Author: dmacvicar
Date: Mon Dec 3 16:59:28 2007
New Revision: 42618
URL: http://svn.opensuse.org/viewcvs/yast?rev=42618&view=rev
Log:
YQUI_builtins
Modified:
branches/tmp/coolo/qt4-port/src/YQUI_builtins.cc
Modified: branches/tmp/coolo/qt4-port/src/YQUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/coolo/qt4-port/src/YQUI_builtins.cc?rev=42618&r1=42617&r2=42618&view=diff
==============================================================================
--- branches/tmp/coolo/qt4-port/src/YQUI_builtins.cc (original)
+++ branches/tmp/coolo/qt4-port/src/YQUI_builtins.cc Mon Dec 3 16:59:28 2007
@@ -17,7 +17,6 @@
Textdomain "packages-qt"
/-*/
-#define QT3_SUPPORT
#define USE_QT_CURSORS 1
#define FORCE_UNICODE_FONT 0
@@ -25,12 +24,11 @@
#include
#include
-#include
-#include
-#include
-#include
-#include
-#include
+#include <QCursor>
+#include <QFileDialog>
+#include <QMessageBox>
+#include <QPixmap>
+#include <QInputDialog>
#include
#define y2log_component "qt-ui"
@@ -117,7 +115,7 @@
QWidget * dialog = (QWidget *) YDialog::currentDialog()->widgetRep();
QPixmap screenShot = QPixmap::grabWindow( dialog->winId() );
- XSync( dialog->x11Display(), false );
+ //FIXME XSync( dialog->x11Display(), false );
QString fileName ( stl_filename.c_str() );
bool interactive = false;
@@ -134,7 +132,7 @@
// Initialize screen shot directory
//
- QString home = QDir::homeDirPath();
+ QString home = QDir::homePath();
char * ssdir = getenv("Y2SCREENSHOTS");
QString dir = ssdir ? ssdir : "yast2-screen-shots";
@@ -149,7 +147,7 @@
dir = "/tmp/" + dir;
- if ( mkdir( dir, 0700 ) == -1 )
+ if ( mkdir( qPrintable(dir), 0700 ) == -1 )
dir = "";
}
else
@@ -159,7 +157,7 @@
// chance to create symlinks to a better location if he wishes so.
dir = home + "/" + dir;
- (void) mkdir( dir, 0750 );
+ (void) mkdir( qPrintable(dir), 0750 );
}
screenShotNameTemplate = dir + "/%s-%03d.png";
@@ -173,8 +171,8 @@
const char * baseName = moduleName();
if ( ! baseName ) baseName = "scr";
int no = screenShotNo[ baseName ];
- fileName.sprintf( screenShotNameTemplate, baseName, no );
- y2debug( "screenshot: %s", (const char *) fileName );
+ fileName.sprintf( qPrintable(screenShotNameTemplate), baseName, no );
+ y2debug( "screenshot: %s", qPrintable(fileName) );
{
YQSignalBlocker sigBlocker( &_user_input_timer );
@@ -196,12 +194,12 @@
// Actually save the screen shot
//
- y2debug( "Saving screen shot to %s", (const char *) fileName );
+ y2debug( "Saving screen shot to %s", qPrintable(fileName) );
bool success = screenShot.save( fileName, "PNG" );
if ( ! success )
{
- y2error( "Couldn't save screen shot %s", (const char *) fileName );
+ y2error( "Couldn't save screen shot %s", qPrintable(fileName) );
if ( interactive )
{
@@ -218,7 +216,7 @@
{
macroRecorder->beginBlock();
YDialog::currentDialog()->saveUserInput( macroRecorder );
- macroRecorder->recordMakeScreenShot( true, (const char *) fileName );
+ macroRecorder->recordMakeScreenShot( true, qPrintable(fileName) );
macroRecorder->recordUserInput( YCPVoid() );
macroRecorder->endBlock();
}
@@ -235,16 +233,16 @@
{
QString saveLogsCommand = "/sbin/save_y2logs";
- if ( access( saveLogsCommand.ascii(), X_OK ) == 0 )
+ if ( access( saveLogsCommand.toAscii(), X_OK ) == 0 )
{
saveLogsCommand += " '" + fileName + "'";
- y2milestone( "Saving y2logs: %s", saveLogsCommand.ascii() );
- int result = system( saveLogsCommand.ascii() );
+ y2milestone( "Saving y2logs: %s", qPrintable(saveLogsCommand) );
+ int result = system( qPrintable(saveLogsCommand) );
if ( result != 0 )
{
y2error( "Error saving y2logs: \"%s\" exited with %d",
- (const char *) saveLogsCommand, result );
+ qPrintable(saveLogsCommand), result );
QMessageBox::warning( 0, // parent
"Error", // caption
QString( "Couldn't save y2logs to %1 - "
@@ -255,13 +253,13 @@
}
else
{
- y2milestone( "y2logs saved to %s", (const char *) fileName );
+ y2milestone( "y2logs saved to %s", qPrintable(fileName) );
}
}
else
{
y2error( "Error saving y2logs: Command %s not found",
- saveLogsCommand.ascii() );
+ qPrintable(saveLogsCommand) );
QMessageBox::warning( 0, // parent
"Error", // caption
@@ -282,18 +280,14 @@
items << "Debug logging off"
<< "Debug logging on";
- QString result = QInputDialog::getItem( "YaST2 Logging", // caption
- "Configure YaST2 Logging:", // label
- items,
- get_log_debug() ? 1 : 0,
- false, // editable
- &okButtonPressed,
- _main_win ); // parent
-
+ QString result = QInputDialog::getItem( _main_win,
+ tr("YaST2 Logging"),
+ tr("Configure YaST2 Logging:"),
+ items, 0, get_log_debug() ? 1 : 0, &okButtonPressed);
if ( okButtonPressed )
{
set_log_debug( result.endsWith( "on" ) );
- y2milestone( "Changing logging: %s - %s", (const char *) result,
+ y2milestone( "Changing logging: %s - %s", qPrintable(result),
get_log_debug() ? "y2debug on" : "y2debug off" );
}
}
@@ -318,15 +312,15 @@
normalCursor();
QString filename =
- Q3FileDialog::getSaveFileName( DEFAULT_MACRO_FILE_NAME, // startWith
- "*.ycp", // filter
- 0, // parent
- 0, // (widget) name
- "Select Macro File to Record to" ); // caption
+ QFileDialog::getSaveFileName( 0,
+ "Select Macro File to Record to",
+ DEFAULT_MACRO_FILE_NAME, // startWith
+ "*.ycp" // filter
+ );
if ( ! filename.isEmpty() ) // file selection dialog has been cancelled
{
- recordMacro( (const char *) filename );
+ recordMacro( qPrintable(filename) );
}
}
}
@@ -337,16 +331,15 @@
normalCursor();
QString filename =
- Q3FileDialog::getOpenFileName( DEFAULT_MACRO_FILE_NAME, // startWith
- "*.ycp", // filter
- 0, // parent
- 0, // (widget) name
- "Select Macro File to Play" ); // caption
+ QFileDialog::getOpenFileName( 0,
+ "Select Macro File to Play",
+ DEFAULT_MACRO_FILE_NAME, // startWith
+ "*.ycp" );
busyCursor();
if ( ! filename.isEmpty() ) // file selection dialog has been cancelled
{
- playMacro( (const char *) filename );
+ playMacro( qPrintable(filename) );
// Do special magic to get out of any UserInput() loop right now
// without doing any harm - otherwise this would hang until the next
@@ -356,7 +349,7 @@
if ( _do_exit_loop )
{
- qApp->exit_loop();
+ _eventLoop->exit();
}
}
}
@@ -369,10 +362,9 @@
normalCursor();
QString dir_name =
- Q3FileDialog::getExistingDirectory( fromUTF8( startDir->value() ),
- _main_win, // parent
- "dir_selector", // name
- fromUTF8( headline->value() ) ); // caption
+ QFileDialog::getExistingDirectory( _main_win,
+ fromUTF8( headline->value() ),
+ fromUTF8( startDir->value() ) );
busyCursor();
if ( dir_name.isEmpty() ) // this includes dir_name.isNull()
@@ -389,11 +381,10 @@
normalCursor();
QString file_name =
- Q3FileDialog::getOpenFileName( fromUTF8( startWith->value() ),
- fromUTF8( filter->value() ),
- _main_win, // parent
- "file_selector", // name
- fromUTF8( headline->value() ) ); // caption
+ QFileDialog::getOpenFileName( _main_win, // parent
+ fromUTF8( headline->value() ),
+ fromUTF8( startWith->value() ),
+ fromUTF8( filter->value() ) );
busyCursor();
if ( file_name.isEmpty() ) // this includes file_name.isNull()
@@ -434,21 +425,20 @@
// Leave the mouse cursor alone - this function might be called from
// some other widget, not only from UI::AskForSaveFileName().
- file_name = Q3FileDialog::getSaveFileName( startWith,
- filter,
- _main_win, // parent
- "file_selector", // name
- headline ); // caption
+ file_name = QFileDialog::getSaveFileName( _main_win,
+ headline,
+ startWith,
+ filter );
if ( file_name.isEmpty() ) // this includes file_name.isNull()
return QString::null;
- if ( access( (const char *) file_name, F_OK ) == 0 ) // file exists?
+ if ( access( qPrintable(file_name), F_OK ) == 0 ) // file exists?
{
QString msg;
- if ( access( (const char *) file_name, W_OK ) == 0 )
+ if ( access( qPrintable(file_name), W_OK ) == 0 )
{
// Confirm if the user wishes to overwrite an existing file
msg = ( _( "%1 exists! Really overwrite?" ) ).arg( file_name );
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org