Author: sh-sh-sh
Date: Mon Dec 10 18:42:59 2007
New Revision: 42919
URL: http://svn.opensuse.org/viewcvs/yast?rev=42919&view=rev
Log:
Moved file and directory dialogs from YUI to YApplication:
- askForExistingDirectory()
- askForExistingFile()
- askForSaveFile()
Added:
trunk/core/libyui/doc/examples/TextEntry-layout.ycp
Modified:
trunk/core/VERSION
trunk/core/libyui/doc/examples/InputField-layout.ycp
trunk/core/libyui/src/ChangeLog
trunk/core/libyui/src/YApplication.h
trunk/core/libyui/src/YUI.h
trunk/core/libyui/src/YUI_builtins.cc
trunk/core/package/yast2-core.changes
trunk/ncurses/VERSION
trunk/ncurses/package/yast2-ncurses.changes
trunk/ncurses/src/NCApplication.cc
trunk/ncurses/src/NCApplication.h
trunk/ncurses/src/NCAskForDirectory.cc
trunk/ncurses/src/NCAskForDirectory.h
trunk/ncurses/src/NCAskForFile.cc
trunk/ncurses/src/NCAskForFile.h
trunk/ncurses/src/NCFileSelection.cc
trunk/ncurses/src/NCFileSelection.h
trunk/ncurses/src/README_mod-ui
trunk/ncurses/src/YNCursesUI.cc
trunk/ncurses/src/YNCursesUI.h
trunk/ncurses/src/pkg/NCPackageSelector.cc
trunk/ncurses/yast2-ncurses.spec.in
trunk/qt/VERSION
trunk/qt/package/yast2-qt.changes
trunk/qt/src/YQApplication.cc
trunk/qt/src/YQApplication.h
trunk/qt/src/YQUI.h
trunk/qt/src/YQUI_builtins.cc
trunk/qt/src/pkg/YQPackageSelector.cc
trunk/qt/src/pkg/YQPkgConflictList.cc
trunk/qt/src/pkg/YQPkgList.cc
trunk/qt/yast2-qt.spec.in
Modified: trunk/core/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/VERSION?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/core/VERSION (original)
+++ trunk/core/VERSION Mon Dec 10 18:42:59 2007
@@ -1 +1 @@
-2.16.14
+2.16.15
Modified: trunk/core/libyui/doc/examples/InputField-layout.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/doc/examples/InputField-layout.ycp?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/core/libyui/doc/examples/InputField-layout.ycp (original)
+++ trunk/core/libyui/doc/examples/InputField-layout.ycp Mon Dec 10 18:42:59 2007
@@ -2,22 +2,22 @@
{
UI::OpenDialog(
`VBox(
- `TextEntry( "Normal", "normal width" ),
- `TextEntry(`opt(`shrinkable), "Sml", "shrinkable" ),
+ `InputField( "Normal", "normal width" ),
+ `InputField(`opt(`shrinkable), "Sml", "shrinkable" ),
`VBox(
`MarginBox( 1, 0.2,
`Frame( "Useless Frame",
`VBox(
`Heading( "Very Wide and Very Useless Heading" ),
- `TextEntry( "Normal 1" ),
- `TextEntry( "Normal 2" ),
- `TextEntry( "Normal 3" ),
- `TextEntry( "Unusually &wide field caption to make it wider" ),
- `TextEntry( "Normal 4" ),
- `TextEntry(`opt(`hstretch ), "Stretch", "stretchable" ),
- `TextEntry(`opt(`shrinkable), "Sml", "shrinkable" ),
- `Left(`TextEntry( "Left", "left aligned" ) ),
- `HSquash(`TextEntry( "HSquashed", "hquashed" ) )
+ `InputField( "Normal 1" ),
+ `InputField( "Normal 2" ),
+ `InputField( "Normal 3" ),
+ `InputField( "Unusually &wide field caption to make it wider" ),
+ `InputField( "Normal 4" ),
+ `InputField(`opt(`hstretch ), "Stretch", "stretchable" ),
+ `InputField(`opt(`shrinkable), "Sml", "shrinkable" ),
+ `Left(`InputField( "Left", "left aligned" ) ),
+ `HSquash(`InputField( "HSquashed", "hquashed" ) )
)
)
)
Added: trunk/core/libyui/doc/examples/TextEntry-layout.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/doc/examples/TextEntry-layout.ycp?rev=42919&view=auto
==============================================================================
--- trunk/core/libyui/doc/examples/TextEntry-layout.ycp (added)
+++ trunk/core/libyui/doc/examples/TextEntry-layout.ycp Mon Dec 10 18:42:59 2007
@@ -0,0 +1,30 @@
+// Input field width under different layout constraints
+{
+ UI::OpenDialog(
+ `VBox(
+ `TextEntry( "Normal", "normal width" ),
+ `TextEntry(`opt(`shrinkable), "Sml", "shrinkable" ),
+ `VBox(
+ `MarginBox( 1, 0.2,
+ `Frame( "Useless Frame",
+ `VBox(
+ `Heading( "Very Wide and Very Useless Heading" ),
+ `TextEntry( "Normal 1" ),
+ `TextEntry( "Normal 2" ),
+ `TextEntry( "Normal 3" ),
+ `TextEntry( "Unusually &wide field caption to make it wider" ),
+ `TextEntry( "Normal 4" ),
+ `TextEntry(`opt(`hstretch ), "Stretch", "stretchable" ),
+ `TextEntry(`opt(`shrinkable), "Sml", "shrinkable" ),
+ `Left(`TextEntry( "Left", "left aligned" ) ),
+ `HSquash(`TextEntry( "HSquashed", "hquashed" ) )
+ )
+ )
+ )
+ ),
+ `PushButton(`opt(`default), "&OK" )
+ )
+ );
+ UI::UserInput();
+ UI::CloseDialog();
+}
Modified: trunk/core/libyui/src/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/ChangeLog?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/core/libyui/src/ChangeLog (original)
+++ trunk/core/libyui/src/ChangeLog Mon Dec 10 18:42:59 2007
@@ -450,4 +450,16 @@
YWidget::queryWidget() and YWidget::changeWidget() methods
* Dropped support for outdated YWidget( YWidgetOpt ) constructors
* Removed unneeded YWidgetOpt fields
-* Added basic default button handling to YDialog and YPushButton
\ No newline at end of file
+* Added basic default button handling to YDialog and YPushButton
+
+
+2007-12-10 sh@suse.de
+
+* Moved file and directory dialogs from YUI to YApplication:
+ - askForExistingDirectory()
+ - askForExistingFile()
+ - askForSaveFile()
+* Parameters and return values now all std::string
+* Now return empty string upon user cancel
+
+
Modified: trunk/core/libyui/src/YApplication.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YApplication.h?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/core/libyui/src/YApplication.h (original)
+++ trunk/core/libyui/src/YApplication.h Mon Dec 10 18:42:59 2007
@@ -132,6 +132,65 @@
**/
string language( bool stripEncoding = false ) const;
+ /**
+ * Open a directory selection box and prompt the user for an existing
+ * directory.
+ *
+ * 'startDir' is the initial directory that is displayed.
+ *
+ * 'headline' is an explanatory text for the directory selection box.
+ * Graphical UIs may omit that if no window manager is running.
+ *
+ * Returns the selected directory name
+ * or an empty string if the user canceled the operation.
+ *
+ * Derived classes are required to implement this.
+ **/
+ virtual string askForExistingDirectory( const string & startDir,
+ const string & headline ) = 0;
+
+ /**
+ * Open a file selection box and prompt the user for an existing file.
+ *
+ * 'startWith' is the initial directory or file.
+ *
+ * 'filter' is one or more blank-separated file patterns, e.g.
+ * "*.png *.jpg"
+ *
+ * 'headline' is an explanatory text for the file selection box.
+ * Graphical UIs may omit that if no window manager is running.
+ *
+ * Returns the selected file name
+ * or an empty string if the user canceled the operation.
+ *
+ * Derived classes are required to implement this.
+ **/
+ virtual string askForExistingFile( const string & startWith,
+ const string & filter,
+ const string & headline ) = 0;
+
+ /**
+ * Open a file selection box and prompt the user for a file to save data
+ * to. Automatically asks for confirmation if the user selects an existing
+ * file.
+ *
+ * 'startWith' is the initial directory or file.
+ *
+ * 'filter' is one or more blank-separated file patterns, e.g.
+ * "*.png *.jpg"
+ *
+ * 'headline' is an explanatory text for the file selection box.
+ * Graphical UIs may omit that if no window manager is running.
+ *
+ * Returns the selected file name
+ * or an empty string if the user canceled the operation.
+ *
+ * Derived classes are required to implement this.
+ **/
+ virtual string askForSaveFileName( const string & startWith,
+ const string & filter,
+ const string & headline ) = 0;
+
private:
ImplPtr<YApplicationPrivate> priv;
Modified: trunk/core/libyui/src/YUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI.h?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI.h (original)
+++ trunk/core/libyui/src/YUI.h Mon Dec 10 18:42:59 2007
@@ -525,66 +525,6 @@
virtual YCPValue runPkgSelection( YWidget * /*packageSelector*/ ) { return YCPVoid(); }
- /**
- * UI-specific implementation of the AskForExistingDirectory() builtin:
- *
- * Open a directory selection box and prompt the user for an existing
- * directory.
- *
- * 'startDir' is the initial directory that is displayed.
- *
- * 'headline' is an explanatory text for the directory selection box.
- * Graphical UIs may omit that if no window manager is running.
- *
- * Returns the selected directory name
- * or 'nil'( YCPVoid() ) if the user canceled the operation.
- **/
- virtual YCPValue askForExistingDirectory( const YCPString & startDir,
- const YCPString & headline ) = 0;
-
- /**
- * UI-specific implementation of the AskForExistingFile() builtin.
- *
- * Open a file selection box and prompt the user for an existing file.
- *
- * 'startWith' is the initial directory or file.
- *
- * 'filter' is one or more blank-separated file patterns, e.g.
- * "*.png *.jpg"
- *
- * 'headline' is an explanatory text for the file selection box.
- * Graphical UIs may omit that if no window manager is running.
- *
- * Returns the selected file name
- * or 'nil'( YCPVoid() ) if the user canceled the operation.
- **/
- virtual YCPValue askForExistingFile( const YCPString & startWith,
- const YCPString & filter,
- const YCPString & headline ) = 0;
-
- /**
- * UI-specific implementation of the AskForSaveFileName() builtin.
- *
- * Open a file selection box and prompt the user for a file to save data
- * to. Automatically asks for confirmation if the user selects an existing
- * file.
- *
- * 'startWith' is the initial directory or file.
- *
- * 'filter' is one or more blank-separated file patterns, e.g.
- * "*.png *.jpg"
- *
- * 'headline' is an explanatory text for the file selection box.
- * Graphical UIs may omit that if no window manager is running.
- *
- * Returns the selected file name
- * or 'nil'( YCPVoid() ) if the user canceled the operation.
- **/
- virtual YCPValue askForSaveFileName( const YCPString & startWith,
- const YCPString & filter,
- const YCPString & headline ) = 0;
-
-
YCPValue callback( const YCPValue & value );
Modified: trunk/core/libyui/src/YUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/libyui/src/YUI_builtins.cc?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/core/libyui/src/YUI_builtins.cc (original)
+++ trunk/core/libyui/src/YUI_builtins.cc Mon Dec 10 18:42:59 2007
@@ -1670,7 +1670,7 @@
/**
* @builtin AskForExistingDirectory
- * @short Opens a directory selection box and prompt the user for an existing directory.
+ * @short Ask user for existing directory
* @description
* Opens a directory selection box and prompt the user for an existing directory.
*
@@ -1680,16 +1680,22 @@
* @return string Returns the selected directory name or <i>nil</i> if the
* user canceled the operation.
*/
-YCPValue YUI::evaluateAskForExistingDirectory( const YCPString & startDir, const YCPString & headline )
+YCPValue
+YUI::evaluateAskForExistingDirectory( const YCPString & startDir, const YCPString & headline )
{
- return askForExistingDirectory( startDir, headline );
+ string ret = app()->askForExistingDirectory( startDir->value(), headline->value() );
+
+ if ( ret.empty() )
+ return YCPVoid();
+ else
+ return YCPString( ret );
}
/**
* @builtin AskForExistingFile
- * @short Opens a file selection box and prompt the user for an existing file.
+ * @short Ask user for existing file
* @description
* Opens a file selection box and prompt the user for an existing file.
*
@@ -1702,13 +1708,18 @@
*/
YCPValue YUI::evaluateAskForExistingFile( const YCPString & startWith, const YCPString & filter, const YCPString & headline )
{
- return askForExistingFile( startWith, filter, headline );
+ string ret = app()->askForExistingFile( startWith->value(), filter->value(), headline->value() );
+
+ if ( ret.empty() )
+ return YCPVoid();
+ else
+ return YCPString( ret );
}
/**
* @builtin AskForSaveFileName
- * @short Opens a file selection box and prompt the user for a file to save data to.
+ * @short Ask user for a file to save data to.
* @description
* Opens a file selection box and prompt the user for a file to save data to.
* Automatically asks for confirmation if the user selects an existing file.
@@ -1722,7 +1733,12 @@
*/
YCPValue YUI::evaluateAskForSaveFileName( const YCPString & startWith, const YCPString & filter, const YCPString & headline )
{
- return askForSaveFileName( startWith, filter, headline );
+ string ret = app()->askForSaveFileName( startWith->value(), filter->value(), headline->value() );
+
+ if ( ret.empty() )
+ return YCPVoid();
+ else
+ return YCPString( ret );
}
/**
Modified: trunk/core/package/yast2-core.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/core/package/yast2-core.changes?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/core/package/yast2-core.changes (original)
+++ trunk/core/package/yast2-core.changes Mon Dec 10 18:42:59 2007
@@ -1,4 +1,14 @@
-------------------------------------------------------------------
+Mon Dec 10 18:35:12 CET 2007 - sh@suse.de
+
+- Moved file and directory dialogs from YUI to YApplication:
+ - askForExistingDirectory(),
+ - askForExistingFile()
+ - askForSaveFile()
+- V 2.16.15
+
+
+-------------------------------------------------------------------
Thu Dec 6 16:28:04 CET 2007 - sh@suse.de
- Fixed bug #345819 (input fields too small):
Modified: trunk/ncurses/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/VERSION?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/VERSION (original)
+++ trunk/ncurses/VERSION Mon Dec 10 18:42:59 2007
@@ -1 +1 @@
-2.16.5
+2.16.6
Modified: trunk/ncurses/package/yast2-ncurses.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/package/yast2-ncurses.changes?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/package/yast2-ncurses.changes (original)
+++ trunk/ncurses/package/yast2-ncurses.changes Mon Dec 10 18:42:59 2007
@@ -1,4 +1,14 @@
-------------------------------------------------------------------
+Mon Dec 10 18:40:37 CET 2007 - sh@suse.de
+
+Moved file and directory dialogs from NCursesUI to NCApplication:
+ - askForExistingDirectory()
+ - askForExistingFile()
+ - askForSaveFile()
+- Added requires and buildRequires for yast2-core-2.16.15 to .spec
+- 2.16.6
+
+-------------------------------------------------------------------
Tue Dec 4 17:00:16 CET 2007 - kmachalkova@suse.cz
- Removed reference to printing license text (#327542)
Modified: trunk/ncurses/src/NCApplication.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCApplication.cc?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/src/NCApplication.cc (original)
+++ trunk/ncurses/src/NCApplication.cc Mon Dec 10 18:42:59 2007
@@ -20,6 +20,8 @@
#include "Y2Log.h"
#include "NCurses.h"
#include "NCApplication.h"
+#include "NCAskForDirectory.h"
+#include "NCAskForFile.h"
NCApplication::NCApplication()
@@ -46,3 +48,49 @@
}
+string
+NCApplication::askForSaveFileName( const string & startDir,
+ const string & filter,
+ const string & headline )
+{
+ NCAskForSaveFileName * filePopup = new NCAskForSaveFileName( wpos( 1, 1 ), startDir, filter, headline );
+ YUI_CHECK_NEW( filePopup );
+
+ NCursesEvent retEvent = filePopup->showDirPopup( );
+ YDialog::deleteTopmostDialog();
+
+ NCMIL << "Returning: " << retEvent.result << endl;
+ return retEvent.result;
+}
+
+
+string
+NCApplication::askForExistingFile( const string & startDir,
+ const string & filter,
+ const string & headline )
+{
+ NCAskForExistingFile * filePopup = new NCAskForExistingFile( wpos( 1, 1 ), startDir, filter, headline );
+ YUI_CHECK_NEW( filePopup );
+
+ NCursesEvent retEvent = filePopup->showDirPopup( );
+ YDialog::deleteTopmostDialog();
+
+ NCMIL << "Returning: " << retEvent.result << endl;
+ return retEvent.result;
+}
+
+
+string
+NCApplication::askForExistingDirectory( const string & startDir,
+ const string & headline )
+{
+ NCAskForExistingDirectory * dirPopup = new NCAskForExistingDirectory( wpos( 1, 1 ), startDir, headline );
+ YUI_CHECK_NEW( dirPopup );
+
+ NCursesEvent retEvent = dirPopup->showDirPopup( );
+ YDialog::deleteTopmostDialog();
+
+ NCMIL << "Returning: " << retEvent.result << endl;
+ return retEvent.result;
+}
+
Modified: trunk/ncurses/src/NCApplication.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCApplication.h?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/src/NCApplication.h (original)
+++ trunk/ncurses/src/NCApplication.h Mon Dec 10 18:42:59 2007
@@ -57,6 +57,64 @@
virtual void setLanguage( const string & language,
const string & encoding = string() );
+ /**
+ * Open a directory selection box and prompt the user for an existing
+ * directory.
+ *
+ * 'startDir' is the initial directory that is displayed.
+ *
+ * 'headline' is an explanatory text for the directory selection box.
+ * Graphical UIs may omit that if no window manager is running.
+ *
+ * Returns the selected directory name
+ * or an empty string if the user canceled the operation.
+ *
+ * Implemented from YApplication.
+ **/
+ virtual string askForExistingDirectory( const string & startDir,
+ const string & headline );
+
+ /**
+ * Open a file selection box and prompt the user for an existing file.
+ *
+ * 'startWith' is the initial directory or file.
+ *
+ * 'filter' is one or more blank-separated file patterns, e.g.
+ * "*.png *.jpg"
+ *
+ * 'headline' is an explanatory text for the file selection box.
+ * Graphical UIs may omit that if no window manager is running.
+ *
+ * Returns the selected file name
+ * or an empty string if the user canceled the operation.
+ *
+ * Implemented from YApplication.
+ **/
+ virtual string askForExistingFile( const string & startWith,
+ const string & filter,
+ const string & headline );
+
+ /**
+ * Open a file selection box and prompt the user for a file to save data
+ * to. Automatically asks for confirmation if the user selects an existing
+ * file.
+ *
+ * 'startWith' is the initial directory or file.
+ *
+ * 'filter' is one or more blank-separated file patterns, e.g.
+ * "*.png *.jpg"
+ *
+ * 'headline' is an explanatory text for the file selection box.
+ * Graphical UIs may omit that if no window manager is running.
+ *
+ * Returns the selected file name
+ * or an empty string if the user canceled the operation.
+ *
+ * Implemented from YApplication.
+ **/
+ virtual string askForSaveFileName( const string & startWith,
+ const string & filter,
+ const string & headline );
};
Modified: trunk/ncurses/src/NCAskForDirectory.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCAskForDirectory.cc?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/src/NCAskForDirectory.cc (original)
+++ trunk/ncurses/src/NCAskForDirectory.cc Mon Dec 10 18:42:59 2007
@@ -57,8 +57,8 @@
// DESCRIPTION :
//
NCAskForExistingDirectory::NCAskForExistingDirectory( const wpos at,
- const YCPString & iniDir,
- const YCPString & headline )
+ const string & iniDir,
+ const string & headline )
: NCPopup( at, true )
, okButton( 0 )
, cancelButton( 0 )
@@ -91,14 +91,14 @@
//
// DESCRIPTION :
//
-void NCAskForExistingDirectory::createLayout( const YCPString & iniDir,
- const YCPString & headline )
+void NCAskForExistingDirectory::createLayout( const string & iniDir,
+ const string & headline )
{
// the vertical split is the (only) child of the dialog
NCLayoutBox * split = new NCLayoutBox( this, YD_VERT );
// the headline
- new NCLabel( split, headline->value(), true, false ); // isHeading = true
+ new NCLabel( split, headline, true, false ); // isHeading = true
NCFrame * frame = new NCFrame( split, "" );
@@ -107,6 +107,7 @@
dirName->setNotify( true );
dirName->setStretchable( YD_HORIZ, true );
+#warning is this widget ID really needed?
YStringWidgetID * dirID = new YStringWidgetID( idDirName );
dirName->setId( dirID );
@@ -115,6 +116,7 @@
// label for checkbox
detailed = new NCCheckBox( hSplit, _( "&Detailed View" ), false );
+#warning is this widget ID really needed?
YStringWidgetID * detailsID = new YStringWidgetID( idDetails );
detailed->setId( detailsID );
detailed->setNotify( true );
@@ -130,6 +132,7 @@
NCFileTable::T_Overview,
iniDir );
+#warning is this widget ID really needed?
YStringWidgetID * dirListID = new YStringWidgetID( idDirList );
dirList->setId( dirListID );
@@ -145,6 +148,7 @@
okButton->setFunctionKey( 10 );
okButton->setStretchable( YD_HORIZ, true );
+#warning is this widget ID really needed?
YStringWidgetID * okID = new YStringWidgetID ( idOk );
okButton->setId( okID );
@@ -155,6 +159,7 @@
cancelButton->setFunctionKey( 9 );
cancelButton->setStretchable( YD_HORIZ, true);
+#warning is this widget ID really needed?
YStringWidgetID * cancelID = new YStringWidgetID (idCancel );
cancelButton->setId( cancelID );
@@ -233,6 +238,7 @@
postevent.detail = NCursesEvent::NODETAIL;
+#warning compare widget pointers here, not IDs
YWidgetID * currentId = dynamic_cast(postevent.widget)->id();
if ( currentId )
Modified: trunk/ncurses/src/NCAskForDirectory.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCAskForDirectory.h?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/src/NCAskForDirectory.h (original)
+++ trunk/ncurses/src/NCAskForDirectory.h Mon Dec 10 18:42:59 2007
@@ -62,8 +62,8 @@
public:
NCAskForExistingDirectory( const wpos at,
- const YCPString & startDir,
- const YCPString & headline );
+ const string & startDir,
+ const string & headline );
virtual ~NCAskForExistingDirectory();
@@ -76,12 +76,12 @@
/**
* Create layout of file directory selection popup
- * @param YCPString The initial start directory
- * @param YCPString The headline of the popup
+ * @param string The initial start directory
+ * @param string The headline of the popup
* @return void
*/
- void createLayout( const YCPString & iniDir,
- const YCPString & headline );
+ void createLayout( const string & iniDir,
+ const string & headline );
/**
* Shows the popup with the list of directories.
Modified: trunk/ncurses/src/NCAskForFile.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCAskForFile.cc?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/src/NCAskForFile.cc (original)
+++ trunk/ncurses/src/NCAskForFile.cc Mon Dec 10 18:42:59 2007
@@ -57,9 +57,9 @@
// DESCRIPTION :
//
NCAskForFile::NCAskForFile( const wpos at,
- const YCPString & iniDir,
- const YCPString & filter,
- const YCPString & headline )
+ const string & iniDir,
+ const string & filter,
+ const string & headline )
: NCPopup( at, true )
, okButton( 0 )
, cancelButton( 0 )
@@ -172,7 +172,7 @@
dirList = new NCDirectoryTable( hSplit1,
dirHeader,
NCFileSelection::T_Overview,
- YCPString(startDir) );
+ startDir );
dirList->setSendKeyEvents( true );
YStringWidgetID * dirListID = new YStringWidgetID( idDirList );
@@ -188,7 +188,7 @@
fileHeader,
NCFileSelection::T_Overview,
filter,
- YCPString(startDir) );
+ startDir );
fileList->setSendKeyEvents( true );
YStringWidgetID * dirFileID = new YStringWidgetID( idFileList );
@@ -442,14 +442,14 @@
// DESCRIPTION :
//
NCAskForExistingFile::NCAskForExistingFile( const wpos at,
- const YCPString & iniDir,
- const YCPString & filter,
- const YCPString & headline )
+ const string & iniDir,
+ const string & filter,
+ const string & headline )
: NCAskForFile( at, iniDir, filter, headline )
{
- createLayout( iniDir->value(),
- filter->value(),
- headline->value(),
+ createLayout( iniDir,
+ filter,
+ headline,
false ); // file name is not editable
}
@@ -478,14 +478,14 @@
// DESCRIPTION :
//
NCAskForSaveFileName::NCAskForSaveFileName( const wpos at,
- const YCPString & iniDir,
- const YCPString & filter,
- const YCPString & headline )
+ const string & iniDir,
+ const string & filter,
+ const string & headline )
: NCAskForFile( at, iniDir, filter, headline )
{
- createLayout( iniDir->value(),
- filter->value(),
- headline->value(),
+ createLayout( iniDir,
+ filter,
+ headline,
true ); // file name is editable
}
Modified: trunk/ncurses/src/NCAskForFile.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCAskForFile.h?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/src/NCAskForFile.h (original)
+++ trunk/ncurses/src/NCAskForFile.h Mon Dec 10 18:42:59 2007
@@ -72,9 +72,9 @@
public:
NCAskForFile( const wpos at,
- const YCPString & startDir,
- const YCPString & filter,
- const YCPString & headline );
+ const string & startDir,
+ const string & filter,
+ const string & headline );
virtual ~NCAskForFile() = 0;
@@ -86,9 +86,9 @@
/**
* Create layout of file selection popup
- * @param YCPString The initial start directory
- * @param YCPString The filter (show files matching this pattern)
- * @param YCPString The headline of the popup
+ * @param string The initial start directory
+ * @param string The filter (show files matching this pattern)
+ * @param string The headline of the popup
* @param bool File name field editable?
* @return void
*/
@@ -125,9 +125,9 @@
public:
NCAskForExistingFile( const wpos at,
- const YCPString & startDir,
- const YCPString & filter,
- const YCPString & headline );
+ const string & startDir,
+ const string & filter,
+ const string & headline );
virtual ~NCAskForExistingFile() {}
@@ -150,9 +150,9 @@
public:
NCAskForSaveFileName( const wpos at,
- const YCPString & startDir,
- const YCPString & filter,
- const YCPString & headline );
+ const string & startDir,
+ const string & filter,
+ const string & headline );
virtual ~NCAskForSaveFileName() {}
Modified: trunk/ncurses/src/NCFileSelection.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCFileSelection.cc?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/src/NCFileSelection.cc (original)
+++ trunk/ncurses/src/NCFileSelection.cc Mon Dec 10 18:42:59 2007
@@ -184,22 +184,22 @@
NCFileSelection::NCFileSelection( YWidget * parent,
YTableHeader * tableHeader,
NCFileSelectionType type,
- const YCPString & iniDir )
+ const string & iniDir )
: NCTable( parent, tableHeader )
- , startDir( iniDir->value() )
- , currentDir( iniDir->value() )
+ , startDir( iniDir )
+ , currentDir( iniDir )
, tableType( type )
{
SetSepChar( ' ' );
setTextdomain( "packages" );
struct stat64 statInfo;
- if ( !iniDir->value().empty() )
+ if ( !iniDir.empty() )
{
- stat64( iniDir->value().c_str(), &statInfo );
+ stat64( iniDir.c_str(), &statInfo );
}
- if ( iniDir->value().empty()
+ if ( iniDir.empty()
|| !S_ISDIR(statInfo.st_mode) )
{
char wDir[PATH_MAX+1]; //
@@ -460,13 +460,13 @@
NCFileTable::NCFileTable( YWidget * parent,
YTableHeader * tableHeader,
NCFileSelectionType type,
- const YCPString & filter,
- const YCPString & iniDir )
+ const string & filter,
+ const string & iniDir )
: NCFileSelection( parent, tableHeader, type, iniDir )
{
//fillHeader();
- string filterStr = filter->value();
+ string filterStr = filter;
const string delims( " \t" );
string::size_type begin, end;
@@ -720,7 +720,7 @@
NCDirectoryTable::NCDirectoryTable( YWidget * parent,
YTableHeader * tableHeader,
NCFileSelectionType type,
- const YCPString & iniDir )
+ const string & iniDir )
: NCFileSelection( parent, tableHeader, type, iniDir )
{
//fillHeader();
Modified: trunk/ncurses/src/NCFileSelection.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/NCFileSelection.h?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/src/NCFileSelection.h (original)
+++ trunk/ncurses/src/NCFileSelection.h Mon Dec 10 18:42:59 2007
@@ -134,7 +134,7 @@
NCFileSelection( YWidget * parent,
YTableHeader * tableHeader,
NCFileSelectionType type,
- const YCPString & iniDir );
+ const string & iniDir );
virtual ~NCFileSelection();
@@ -205,9 +205,9 @@
/**
* Set the start directory
*/
- void setStartDir( const YCPString & start ) {
- currentDir = start->value();
- startDir = start->value();
+ void setStartDir( const string & start ) {
+ currentDir = start;
+ startDir = start;
}
};
@@ -227,13 +227,13 @@
NCFileTable( YWidget * parent,
YTableHeader * tableHeader,
NCFileSelectionType type,
- const YCPString & filter,
- const YCPString & iniDir );
+ const string & filter,
+ const string & iniDir );
virtual ~NCFileTable(){}
- void setCurrentFile( const YCPString & file ) {
- currentFile = file->value();
+ void setCurrentFile( const string & file ) {
+ currentFile = file;
}
bool filterMatch( const string & fileName );
@@ -263,7 +263,7 @@
NCDirectoryTable( YWidget * parent,
YTableHeader * tableHeader,
NCFileSelectionType type,
- const YCPString & iniDir );
+ const string & iniDir );
virtual ~NCDirectoryTable(){}
Modified: trunk/ncurses/src/README_mod-ui
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/README_mod-ui?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/src/README_mod-ui (original)
+++ trunk/ncurses/src/README_mod-ui Mon Dec 10 18:42:59 2007
@@ -96,7 +96,8 @@
NCAskForDirectory/NCAskForFile
------------------------------
-ComboBox entries are added twice
+- ComboBox entries are added twice
+- Don't use widget IDs; compare widget pointers instead
NCMultiLineEdit
Modified: trunk/ncurses/src/YNCursesUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/YNCursesUI.cc?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/src/YNCursesUI.cc (original)
+++ trunk/ncurses/src/YNCursesUI.cc Mon Dec 10 18:42:59 2007
@@ -35,8 +35,6 @@
#include
#include "NCPackageSelectorStart.h"
-#include "NCAskForDirectory.h"
-#include "NCAskForFile.h"
#include "NCstring.h"
#include "NCWidgetFactory.h"
#include "NCOptionalWidgetFactory.h"
@@ -630,84 +628,4 @@
::beep();
}
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : YNCursesUI::askForSaveFileName()
-// METHOD TYPE : YCPValue()
-//
-// DESCRIPTION :
-//
-YCPValue YNCursesUI::askForSaveFileName( const YCPString & startDir,
- const YCPString & filter,
- const YCPString & headline )
-{
- NCAskForSaveFileName * filePopup = new NCAskForSaveFileName( wpos( 1, 1 ), startDir, filter, headline );
- YUI_CHECK_NEW( filePopup );
-
- NCursesEvent retEvent = filePopup->showDirPopup( );
- YDialog::deleteTopmostDialog();
-
- if ( retEvent.result != "" )
- {
- NCMIL << "Returning: " << retEvent.result << endl;
- return YCPString( retEvent.result );
- }
- else
- return YCPVoid(); // nothing selected -> return 'nil'
-}
-
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : YNCursesUI::askForExistingFile()
-// METHOD TYPE : YCPValue
-//
-// DESCRIPTION :
-//
-YCPValue YNCursesUI::askForExistingFile( const YCPString & startDir,
- const YCPString & filter,
- const YCPString & headline )
-{
- NCAskForExistingFile * filePopup = new NCAskForExistingFile( wpos( 1, 1 ), startDir, filter, headline );
- YUI_CHECK_NEW( filePopup );
-
- NCursesEvent retEvent = filePopup->showDirPopup( );
- YDialog::deleteTopmostDialog();
-
- if ( retEvent.result != "" )
- {
- NCMIL << "Returning: " << retEvent.result << endl;
- return YCPString( retEvent.result );
- }
- else
- return YCPVoid(); // nothing selected -> return 'nil'
-}
-
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : YNCursesUI::askForExistingDirectory()
-// METHOD TYPE : YCPValue
-//
-// DESCRIPTION :
-//
-YCPValue YNCursesUI::askForExistingDirectory( const YCPString & startDir,
- const YCPString & headline )
-{
- NCAskForExistingDirectory * dirPopup = new NCAskForExistingDirectory( wpos( 1, 1 ), startDir, headline );
- YUI_CHECK_NEW( dirPopup );
-
- NCursesEvent retEvent = dirPopup->showDirPopup( );
- YDialog::deleteTopmostDialog();
-
- if ( retEvent.result != "" )
- {
- NCMIL << "Returning: " << retEvent.result << endl;
- return YCPString( retEvent.result );
- }
- else
- return YCPVoid(); // nothing selected -> return 'nil'
-}
-
Modified: trunk/ncurses/src/YNCursesUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/YNCursesUI.h?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/src/YNCursesUI.h (original)
+++ trunk/ncurses/src/YNCursesUI.h Mon Dec 10 18:42:59 2007
@@ -163,60 +163,6 @@
virtual void beep();
/**
- *
- * Open a directory selection box and prompt the user for an existing directory.
- * [Inherited from YUIInterpreter]
- *
- * 'startDir' is the initial directory that is displayed.
- *
- * 'headline' is an explanatory text for the directory selection box.
- * Graphical UIs may omit that if no window manager is running.
- *
- * Returns the selected directory name
- * or 'nil' (YCPVoid()) if the user canceled the operation.
- **/
- virtual YCPValue askForExistingDirectory ( const YCPString & startDir,
- const YCPString & headline );
-
- /**
- * Open a file selection box and prompt the user for an existing file.
- * [Inherited from YUIInterpreter]
- *
- * 'startWith' is the initial directory or file.
- *
- * 'filter' is one or more blank-separated file patterns, e.g. "*.png *.jpg"
- *
- * 'headline' is an explanatory text for the file selection box.
- * Graphical UIs may omit that if no window manager is running.
- *
- * Returns the selected file name
- * or 'nil' (YCPVoid()) if the user canceled the operation.
- **/
- virtual YCPValue askForExistingFile ( const YCPString & startWith,
- const YCPString & filter,
- const YCPString & headline );
-
-
- /**
- * Open a file selection box and prompt the user for a file to save data to.
- * Automatically asks for confirmation if the user selects an existing file.
- * [Inherited from YUIInterpreter]
- *
- * 'startWith' is the initial directory or file.
- *
- * 'filter' is one or more blank-separated file patterns, e.g. "*.png *.jpg"
- *
- * 'headline' is an explanatory text for the file selection box.
- * Graphical UIs may omit that if no window manager is running.
- *
- * Returns the selected file name
- * or 'nil' (YCPVoid()) if the user canceled the operation.
- **/
- virtual YCPValue askForSaveFileName ( const YCPString & startWith,
- const YCPString & filter,
- const YCPString & headline );
-
- /**
* Returns the package selector plugin singleton of this UI or creates it
* (including loading the plugin lib) if it does not exist yet.
**/
Modified: trunk/ncurses/src/pkg/NCPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/src/pkg/NCPackageSelector.cc?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/src/pkg/NCPackageSelector.cc (original)
+++ trunk/ncurses/src/pkg/NCPackageSelector.cc Mon Dec 10 18:42:59 2007
@@ -40,6 +40,7 @@
#include "YSelectionBox.h"
#include "YAlignment.h"
#include "YNCursesUI.h"
+#include "YApplication.h"
#include "NCi18n.h"
#include
@@ -62,7 +63,7 @@
typedef zypp::ui::PatchContents ZyppPatchContents;
typedef zypp::ui::PatchContents::const_iterator ZyppPatchContentsIterator;
typedef zypp::syscontent::Reader::Entry ZyppReaderEntry;
-typedef std::pair importMapPair;
+typedef std::pair importMapPair;
#include
#include
@@ -83,7 +84,7 @@
///////////////////////////////////////////////////////////////////
//
-// CompFunc
+// CompFunc
//
bool sortByName( ZyppSel ptr1, ZyppSel ptr2 )
{
@@ -96,7 +97,7 @@
///////////////////////////////////////////////////////////////////
//
-// ignore case compare
+// ignore case compare
//
bool ic_compare ( char c1, char c2 )
{
@@ -177,12 +178,12 @@
, patchPkgsVersions( 0 )
, okButton( 0 )
, cancelButton( 0 )
- , visibleInfo( 0 )
+ , visibleInfo( 0 )
{
// FIXME - remove this code when everthiong is handled by handleEvent() !
// (the eventHandlerMap is obsolete)
-
+
// Fill the handler map
eventHandlerMap[ NCPkgNames::Search()->toString() ] = &NCPackageSelector::SearchHandler;
eventHandlerMap[ NCPkgNames::Diskinfo()->toString() ] = &NCPackageSelector::DiskinfoHandler;
@@ -195,18 +196,18 @@
eventHandlerMap[ NCPkgNames::Security()->toString() ] = &NCPackageSelector::FilterHandler;
eventHandlerMap[ NCPkgNames::Optional()->toString() ] = &NCPackageSelector::FilterHandler;
eventHandlerMap[ NCPkgNames::InstalledPatches()->toString() ] = &NCPackageSelector::FilterHandler;
- eventHandlerMap[ NCPkgNames::AllPatches()->toString() ] = &NCPackageSelector::FilterHandler;
+ eventHandlerMap[ NCPkgNames::AllPatches()->toString() ] = &NCPackageSelector::FilterHandler;
eventHandlerMap[ NCPkgNames::NewPatches()->toString() ] = &NCPackageSelector::FilterHandler;
eventHandlerMap[ NCPkgNames::InstalledPatches()->toString() ] = &NCPackageSelector::FilterHandler;
- eventHandlerMap[ NCPkgNames::InstallablePatches()->toString() ] = &NCPackageSelector::FilterHandler;
+ eventHandlerMap[ NCPkgNames::InstallablePatches()->toString() ] = &NCPackageSelector::FilterHandler;
eventHandlerMap[ NCPkgNames::YaST2Patches()->toString() ] = &NCPackageSelector::FilterHandler;
// Information menu -> DONE
// Action menu -> DONE
-
+
// Etc. menu -> DONE
-
+
// Help menu
eventHandlerMap[ NCPkgNames::GeneralHelp()->toString() ] = &NCPackageSelector::HelpHandler;
eventHandlerMap[ NCPkgNames::StatusHelp()->toString() ] = &NCPackageSelector::HelpHandler;
@@ -227,7 +228,7 @@
testMode = true;
saveState ();
-
+
_rpmGroupsTree = new YRpmGroupsTree ();
// get the rpm groups
@@ -235,7 +236,7 @@
ZyppPoolIterator e = zyppPkgEnd ();
ZyppPoolIterator i;
- for ( i = b; i != e; ++i )
+ for ( i = b; i != e; ++i )
{
ZyppPkg zyppPkg = tryCastToZyppPkg( (*i)->theObj() );
if ( zyppPkg )
@@ -244,7 +245,7 @@
NCDBG << "Adding group: " << zyppPkg->group() << endl;
}
}
-
+
// The creation of the popups is moved to createPopups()
}
@@ -289,7 +290,7 @@
repoPopup = new NCPkgPopupRepo( wpos( 1,1), this );
// create the filter popup
- filterPopup = new NCPkgPopupTree( wpos( 1, 1 ), this );
+ filterPopup = new NCPkgPopupTree( wpos( 1, 1 ), this );
}
// create the search popup
@@ -297,7 +298,7 @@
// the dependency popup
depsPopup = new NCPkgPopupDeps( wpos( 3, 8 ), this );
-
+
// the disk space popup
diskspacePopup = new NCPkgPopupDiskspace( wpos( (NCurses::lines() - 15)/2, NCurses::cols()/6 ), testMode );
}
@@ -323,8 +324,8 @@
{
bool selections;
bool patterns;
-
- // create the pattern popup
+
+ // create the pattern popup
if ( ! zyppPool().emptyzypp::Pattern() )
{
@@ -344,7 +345,7 @@
{
selections = false;
}
-
+
if ( selections && !patterns )
{
// ReplaceWidget and show menu entry Selections instead of Patterns
@@ -369,7 +370,7 @@
if (parsed_code != NULL)
layout = parsed_code->evaluate();
if ( !layout.isNull() )
- y2ui->evaluateReplaceWidget( YCPSymbol("replacefilter"), layout->asTerm() );
+ y2ui->evaluateReplaceWidget( YCPSymbol("replacefilter"), layout->asTerm() );
}
else if ( patterns && selections )
@@ -398,7 +399,7 @@
if (parsed_code != NULL)
layout = parsed_code->evaluate();
if ( !layout.isNull() )
- y2ui->evaluateReplaceWidget( YCPSymbol("replacefilter"), layout->asTerm() );
+ y2ui->evaluateReplaceWidget( YCPSymbol("replacefilter"), layout->asTerm() );
}
}
@@ -407,14 +408,14 @@
//
// detection whether the user has made any changes
//
-
+
void NCPackageSelector::saveState ()
{
ZyppPool p = zyppPool ();
p.saveStatezypp::Package ();
p.saveStatezypp::SrcPackage ();
-
+
p.saveStatezypp::Patch ();
// some future proofing
p.saveStatezypp::Message ();
@@ -431,12 +432,12 @@
p.restoreStatezypp::Package ();
p.restoreStatezypp::SrcPackage ();
-
+
p.restoreStatezypp::Patch ();
// some future proofing
p.restoreStatezypp::Message ();
p.restoreStatezypp::Script ();
-
+
p.restoreStatezypp::Selection ();
p.restoreStatezypp::Pattern ();
p.restoreStatezypp::Language ();
@@ -454,7 +455,7 @@
log << diff << endl;
diff = diff || p.diffStatezypp::SrcPackage ();
log << diff << endl;
-
+
diff = diff || p.diffStatezypp::Patch ();
log << diff << endl;
// some future proofing
@@ -462,7 +463,7 @@
log << diff << endl;
diff = diff || p.diffStatezypp::Script ();
log << diff << endl;
-
+
diff = diff || p.diffStatezypp::Selection ();
log << diff << endl;
diff = diff || p.diffStatezypp::Pattern ();
@@ -479,7 +480,7 @@
if ( !button )
return id;
-
+
YWidgetID * widgetId = button->id();
if ( widgetId )
{
@@ -496,7 +497,7 @@
{
string id;
YMenuEvent * menuEvent;
-
+
if ( !menuItem )
return id;
@@ -508,7 +509,7 @@
delete menuEvent;
}
-
+
return id;
}
@@ -524,7 +525,7 @@
if ( event == NCursesEvent::handled )
return false;
-
+
// Call the appropriate handler
if ( event == NCursesEvent::button )
{
@@ -532,7 +533,7 @@
retVal = OkButtonHandler( event );
else if ( event.widget == cancelButton )
retVal = CancelHandler( event );
-
+
}
else if ( event == NCursesEvent::menu )
{
@@ -560,7 +561,7 @@
else if ( event.selection->label().substr(0,4) == "pkg:" )
// handle hyper links
retVal = LinkHandler( event.selection->label() );
-
+
}
return retVal;
@@ -582,12 +583,12 @@
//
// fillAvailableList
//
-// Fills the package table (on bottom ) with the list of available packages
+// Fills the package table (on bottom ) with the list of available packages
//
bool NCPackageSelector::fillAvailableList( NCPkgTable * pkgTable, ZyppSel selectable )
{
bool addInstalled = true;
-
+
if ( !pkgTable )
{
NCERR << "No table widget for available packages existing" << endl;
@@ -625,10 +626,10 @@
{
pkgTable->createListEntry( tryCastToZyppPkg (selectable->installedObj()), selectable );
}
-
+
// show the package list
pkgTable->drawList();
-
+
if ( pkgTable->getNumLines() > 0 )
{
pkgTable->setCurrentItem( 0 );
@@ -646,7 +647,7 @@
bool NCPackageSelector::showSelPackages( const YCPString & label, const set<string> & wanted )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
UIERR << "Widget is not a valid NCPkgTable widget" << endl;
@@ -655,7 +656,7 @@
// clear the package table
packageList->itemsCleared ();
-
+
set<string>::iterator not_found = wanted.end ();
std::vector<ZyppSel> sorted;
@@ -697,7 +698,7 @@
// show the package table
packageList->drawList();
-
+
if ( !label.isNull() )
{
NCDBG << "Filter: " << label->toString() << endl;
@@ -708,7 +709,7 @@
filterLabel->setLabel( label->toString() );
}
}
-
+
return true;
}
@@ -728,7 +729,7 @@
bool checkRequires )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
return false;
@@ -752,7 +753,7 @@
string description = "";
string provides = "";
string requires = "";
-
+
while ( listIt != pkgList.end() )
{
if ( (*listIt)->installedObj() )
@@ -765,7 +766,7 @@
if ( checkDescr )
{
zypp::Text value = pkg->description();
- description = createDescrText( value );
+ description = createDescrText( value );
}
if ( checkProvides )
{
@@ -775,7 +776,7 @@
if ( checkRequires )
{
zypp::CapSet value = pkg->dep (zypp::Dep::REQUIRES);
- requires = createRelLine( value );
+ requires = createRelLine( value );
}
if ( ( checkName && match( pkg->name(), expr, ignoreCase )) ||
( checkSummary && match( pkg->summary(), expr, ignoreCase) ) ||
@@ -787,14 +788,14 @@
// search sucessful
packageList->createListEntry( pkg, *listIt );
}
- }
+ }
++listIt;
}
// show the package list
packageList->drawList();
-
+
// set filter label to 'Search'
if ( filterLabel )
{
@@ -813,7 +814,7 @@
bool NCPackageSelector::fillPatchSearchList( const string & expr )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
return false;
@@ -824,7 +825,7 @@
// get the patch list and sort it
list<ZyppSel> patchList( zyppPatchesBegin (), zyppPatchesEnd () );
patchList.sort( sortByName );
- list<ZyppSel>::iterator listIt = patchList.begin();
+ list<ZyppSel>::iterator listIt = patchList.begin();
while ( listIt != patchList.end() )
{
@@ -842,7 +843,7 @@
}
// show the patch list with search result
packageList->drawList();
-
+
// set filter label to 'Search'
if ( filterLabel )
{
@@ -862,20 +863,20 @@
bool NCPackageSelector::fillPatchList( string filter )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
UIERR << "No valid NCPkgTable widget" << endl;
return false;
}
-
+
// clear list of patches
packageList->itemsCleared ();
// get the patch list and sort it
list<ZyppSel> patchList( zyppPatchesBegin (), zyppPatchesEnd () );
patchList.sort( sortByName );
- list<ZyppSel>::iterator listIt = patchList.begin();
+ list<ZyppSel>::iterator listIt = patchList.begin();
while ( listIt != patchList.end() )
{
@@ -885,18 +886,18 @@
{
checkPatch( patchPtr, *listIt, filter );
}
- ++listIt;
+ ++listIt;
}
if ( filter == "installable"
&& packageList->getNumLines() == 0 )
{
- packageList->createInfoEntry( NCPkgNames::NoPatches() );
+ packageList->createInfoEntry( NCPkgNames::NoPatches() );
}
// show the patches
packageList->drawList();
-
+
// show the selected filter label
if ( filterLabel )
{
@@ -907,14 +908,14 @@
}
else if ( filter == "installed" )
{
- filterLabel->setLabel( NCPkgNames::InstPatches() );
+ filterLabel->setLabel( NCPkgNames::InstPatches() );
}
else
{
- filterLabel->setLabel( NCPkgNames::Patches() );
+ filterLabel->setLabel( NCPkgNames::Patches() );
}
}
-
+
return true;
}
@@ -927,7 +928,7 @@
bool NCPackageSelector::fillUpdateList( )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
UIERR << "Widget is not a valid NCPkgTable widget" << endl;
@@ -938,7 +939,7 @@
packageList->itemsCleared ();
listzypp::PoolItem_Ref problemList = zypp::getZYpp()->resolver()->problematicUpdateItems();
-
+
for ( listzypp::PoolItem_Ref::const_iterator it = problemList.begin();
it != problemList.end();
++it )
@@ -956,18 +957,18 @@
packageList->createListEntry( pkg, slb );
}
}
-
+
}
-
+
// show the list
packageList->drawList();
-
+
// show the selected filter label
if ( filterLabel )
{
filterLabel->setLabel( NCPkgNames::UpdateProblem() );
}
-
+
return true;
}
@@ -984,8 +985,8 @@
pkgTable->itemsCleared ();
std::set<ZyppSel> patchSelectables;
- ZyppPatch patchPtr = tryCastToZyppPatch( objPtr );
-
+ ZyppPatch patchPtr = tryCastToZyppPatch( objPtr );
+
if ( !patchPtr )
return false;
@@ -1052,9 +1053,9 @@
pkgLine.push_back( (*it)->name() );
pkgLine.push_back( " " ); // versions empty
- pkgLine.push_back( " " );
+ pkgLine.push_back( " " );
pkgLine.push_back( NCPkgNames::Script() );
-
+
pkgTable->addLine( S_NoInst,
pkgLine,
ZyppObj(),
@@ -1072,7 +1073,7 @@
// show the list
pkgTable->drawList();
-
+
return true;
}
@@ -1085,13 +1086,13 @@
bool NCPackageSelector::fillSummaryList( NCPkgTable::NCPkgTableListType type )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
UIERR << "No valid NCPkgTable widget" << endl;
return false;
}
-
+
// clear the package table
packageList->itemsCleared ();
@@ -1103,32 +1104,32 @@
list<ZyppSel>::iterator listIt;
ZyppPkg pkgPtr;
- // If the dependency check is off, the dependencies will not be solved for
+ // If the dependency check is off, the dependencies will not be solved for
// the installation summary.
// This is not necessary because the dependencies will be solved and the
- // "Automatic Changes" list will be shown if the OK button is pressed.
+ // "Automatic Changes" list will be shown if the OK button is pressed.
if ( !autoCheck )
{
// showPackageDependencies( true );
}
-
+
for ( listIt = pkgList.begin(); listIt != pkgList.end(); ++listIt )
{
ZyppSel selectable = *listIt;
ZyppPkg pkg = tryCastToZyppPkg (selectable->theObj ());
- // show all matching packages
+ // show all matching packages
switch ( type )
{
case NCPkgTable::L_Changes: {
if ( selectable->status() != S_NoInst
- && selectable->status() != S_KeepInstalled )
+ && selectable->status() != S_KeepInstalled )
{
packageList->createListEntry( pkg, selectable );
}
break;
}
case NCPkgTable::L_Installed: {
- if ( selectable->status() == S_KeepInstalled )
+ if ( selectable->status() == S_KeepInstalled )
{
packageList->createListEntry( pkg, selectable );
}
@@ -1141,7 +1142,7 @@
// show the package list
packageList->drawList();
-
+
// show the selected filter label
if ( filterLabel )
{
@@ -1161,13 +1162,13 @@
bool NCPackageSelector::fillPackageList( const YCPString & label, YStringTreeItem * rpmGroup )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
UIERR << "No valid NCPkgTable widget" << endl;
return false;
}
-
+
// clear the package table
packageList->itemsCleared ();
@@ -1183,7 +1184,7 @@
for ( listIt = pkgList.begin(); listIt != pkgList.end(); ++listIt )
{
ZyppSel selectable = *listIt;
-
+
// Multiple instances of this package may or may not be in the same
// RPM group, so let's check both the installed version (if there
// is any) and the candidate version.
@@ -1191,14 +1192,14 @@
// Make sure we emit only one filterMatch() signal if both exist
// and both are in the same RPM group. We don't want multiple list
// entries for the same package!
-
+
bool match =
checkPackage( selectable->candidateObj(), selectable, rpmGroup ) ||
- checkPackage( selectable->installedObj(), selectable, rpmGroup );
+ checkPackage( selectable->installedObj(), selectable, rpmGroup );
// If there is neither an installed nor a candidate package, check
- // any other instance.
-
+ // any other instance.
+
if ( ! match &&
! selectable->installedObj() &&
! selectable->candidateObj() )
@@ -1230,7 +1231,7 @@
// Fills the package table with packages from selected repository
//
-bool NCPackageSelector::fillRepoFilterList( ZyppRepo repo)
+bool NCPackageSelector::fillRepoFilterList( ZyppRepo repo)
{
NCMIL << "Collecting packages in selected repository" << endl;
@@ -1241,7 +1242,7 @@
//sets to store matching packages
set <ZyppSel> exactMatch;
set <ZyppSel> nearMatch;
-
+
//iterate through the package pool
for ( ZyppPoolIterator it = zyppPkgBegin();
it != zyppPkgEnd();
@@ -1257,16 +1258,16 @@
else
{
zypp::ui::Selectable::available_iterator pkg_it = (*it)->availableBegin();
-
+
while ( pkg_it != (*it)->availableEnd() )
{
if ( (*pkg_it)->repository() == repo )
nearMatch.insert( *it );
-
+
++pkg_it;
}
}
-
+
}
//finally create pkg table list entries
@@ -1277,7 +1278,7 @@
pkgList->createListEntry ( pkg, *e_it);
e_it++;
}
-
+
set<ZyppSel>::const_iterator n_it = nearMatch.begin();
while ( n_it != nearMatch.end() )
{
@@ -1294,10 +1295,10 @@
ZyppProduct product = repoPopup->findProductForRepo( repo );
if ( product )
{
- filterLabel->setLabel( product->summary() );
+ filterLabel->setLabel( product->summary() );
}
}
-
+
return true;
}
@@ -1310,7 +1311,7 @@
bool NCPackageSelector::match ( string s1, string s2, bool ignoreCase )
{
string::iterator pos;
-
+
if ( ignoreCase )
{
pos = search( s1.begin(), s1.end(),
@@ -1340,19 +1341,19 @@
return false;
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList )
{
UIERR << "Widget is not a valid NCPkgTable widget" << endl;
return false;
}
-
+
string group_str = _rpmGroupsTree->rpmGroup (rpmGroup);
// is the requested rpm group a prefix of this package's group?
if ( pkg->group ().find (group_str) == 0 )
{
packageList->createListEntry( pkg, slb );
-
+
return true;
}
else
@@ -1372,11 +1373,11 @@
bool NCPackageSelector::checkPatch( ZyppPatch patchPtr,
ZyppSel selectable,
string filter )
-
+
{
NCPkgTable * packageList = getPackageList();
bool displayPatch = false;
-
+
if ( !packageList || !patchPtr
|| !selectable )
{
@@ -1407,13 +1408,13 @@
}
else // patch not installed
- {
- if (selectable->hasCandidateObj() &&
+ {
+ if (selectable->hasCandidateObj() &&
selectable->candidatePoolItem().status().isSatisfied() )
{
//patch not installed, but it is satisfied (updated to the version patch requires)
//all that is missing are patch metadata, so let's display the patch
-
+
displayPatch = true;
NCMIL << "Patch satisfied, but not installed yet: " << patchPtr->name().c_str() << " - "
@@ -1427,7 +1428,7 @@
// isSatisfied(): all packages are installed, therefore the isNeeded() flag
// isn't set. BUT the patch meta data aren't installed and therefore it makes
// sense to install the patch
- if ( selectable->candidatePoolItem().status().isNeeded())
+ if ( selectable->candidatePoolItem().status().isNeeded())
{
displayPatch = true;
}
@@ -1464,7 +1465,7 @@
if ( patchPtr->category() == "yast" )
displayPatch = true;
}
-
+
if ( displayPatch )
packageList->createPatchEntry( patchPtr, selectable );
@@ -1491,13 +1492,13 @@
newStatus = oldStatus;
break;
- //Keep also those marked for deletion
+ //Keep also those marked for deletion
case S_Del:
case S_AutoDel:
newStatus = S_KeepInstalled;
NCDBG << "Keeping " << kind << " " << selectable->name().c_str() << endl;
break;
-
+
//Add not yet installed pkgs (if they have candidate available)
case S_NoInst:
case S_Taboo:
@@ -1508,12 +1509,12 @@
}
else
{
- NCDBG << "Cannot add " << kind << " " << selectable->name().c_str() <<
- " " << " - no candidate." << endl;
+ NCDBG << "Cannot add " << kind << " " << selectable->name().c_str() <<
+ " " << " - no candidate." << endl;
}
- break;
- }
- }
+ break;
+ }
+ }
//Package/Pattern is not on the list
else
{
@@ -1530,7 +1531,7 @@
NCDBG << "Deleting " << kind << " " << selectable->name().c_str() << endl;
break;
- //Keep status for not installed, taboo and to-be-deleted
+ //Keep status for not installed, taboo and to-be-deleted
case S_Del:
case S_AutoDel:
case S_NoInst:
@@ -1539,8 +1540,8 @@
break;
}
}
-
- if (oldStatus != newStatus)
+
+ if (oldStatus != newStatus)
selectable->set_status( newStatus );
}
@@ -1553,12 +1554,12 @@
bool NCPackageSelector::SearchHandler( const NCursesEvent& event)
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList || !searchPopup )
{
return false;
}
-
+
// open the search popup
NCursesEvent retEvent = searchPopup->showSearchPopup();
@@ -1573,7 +1574,7 @@
}
packageList->setKeyboardFocus();
-
+
return true;
}
@@ -1620,19 +1621,19 @@
( visibleInfo == filesItem ) ||
( visibleInfo == pkginfoItem ) )
{
- packageList->showInformation( );
+ packageList->showInformation( );
return true;
}
}
-
+
// delete current child of the ReplacePoint
YWidget * replaceChild = replacePoint->firstChild();
wrect oldSize;
-
+
if ( replaceChild )
{
oldSize = dynamic_cast(replaceChild)->wGetSize();
-
+
delete replaceChild;
// reset all info widgets
infoText = 0;
@@ -1675,7 +1676,7 @@
{
patchPkgs->setSize( patchPkgs->preferredWidth(), patchPkgs->preferredHeight() );
patchPkgs->Redraw();
-
+
// set the connection to the NCPackageSelector !!!!
patchPkgs->setPackager( this );
// set status strategy - don't set extra strategy, use 'normal' package strategy
@@ -1686,7 +1687,7 @@
fillPatchPackages( patchPkgs, packageList->getDataPointer( packageList->getCurrentItem() ) );
}
}
- else if ( visibleInfo == pkgversionsItem )
+ else if ( visibleInfo == pkgversionsItem )
{
// show a package table with versions of the packages beloning to a patch
YTableHeader * tableHeader = new YTableHeader();
@@ -1703,13 +1704,13 @@
patchPkgsVersions->setTableType( NCPkgTable::T_Availables, strategy );
patchPkgsVersions->fillHeader( );
-
+
fillPatchPackages( patchPkgsVersions, packageList->getDataPointer( packageList->getCurrentItem() ), true );
}
- }
+ }
else
{
- // show the rich text widget
+ // show the rich text widget
infoText = new NCRichText( replacePoint, " ");
if ( infoText )
@@ -1762,7 +1763,7 @@
// update the package list and the disk space info
updatePackageList();
- showDiskSpace();
+ showDiskSpace();
}
else if ( event.selection == verifyItem )
{
@@ -1786,7 +1787,7 @@
}
NCPkgTable * packageList = getPackageList();
-
+
if ( packageList )
{
packageList->setKeyboardFocus();
@@ -1806,7 +1807,7 @@
{
NCursesEvent retEvent;
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList
|| !event.selection )
{
@@ -1820,7 +1821,7 @@
if ( filterPopup )
{
NCMIL << "Showing RPM groups" << endl;
- // show the filter popup (fills the package list)
+ // show the filter popup (fills the package list)
retEvent = filterPopup->showFilterPopup( );
}
}
@@ -1842,7 +1843,7 @@
retEvent = languagePopup->showSelectionPopup( );
}
}
- else if ( event.selection == reposItem )
+ else if ( event.selection == reposItem )
{
if ( repoPopup )
{
@@ -1850,7 +1851,7 @@
retEvent = repoPopup->showRepoPopup( );
}
}
- else if ( event.selection == searchItem )
+ else if ( event.selection == searchItem )
{
// start package search
SearchHandler( event );
@@ -1872,7 +1873,7 @@
else if ( selId == NCPkgNames::YaST2Patches()->toString() )
{
fillPatchList( "YaST2" ); // patch kind
- }
+ }
else if ( selId == NCPkgNames::AllPatches()->toString() )
{
fillPatchList( "all" ); // show all patches
@@ -1902,11 +1903,11 @@
{
fillSummaryList( NCPkgTable::L_Installed );
}
-
+
packageList->showInformation();
- packageList->setKeyboardFocus();
+ packageList->setKeyboardFocus();
- // return true means: don't leave the event loop in runPkgSelection
+ // return true means: don't leave the event loop in runPkgSelection
return true;
}
@@ -1925,7 +1926,7 @@
{
return false;
}
-
+
if ( packageList->getNumLines() == 0 )
{
// nothing to do
@@ -1933,7 +1934,7 @@
}
string selId = getMenuId( event.selection );
-
+
// call the corresponding method of NCPkgTable
if ( event.selection == toggleItem )
{
@@ -1962,21 +1963,21 @@
}
else if ( event.selection == tabooItem )
{
- packageList->changeObjStatus( '!' );
+ packageList->changeObjStatus( '!' );
}
else if ( event.selection == notabooItem )
{
- packageList->changeObjStatus( '%' );
+ packageList->changeObjStatus( '%' );
}
#if 0
// no source install available
else if (event.selection == NCPkgNames::SourceYes()->toString() )
{
- packageList->SourceInstall( true );
+ packageList->SourceInstall( true );
}
else if (event.selection == NCPkgNames::SourceNo()->toString() )
{
- packageList->SourceInstall( false );
+ packageList->SourceInstall( false );
}
#endif
else if ( event.selection == selallItem )
@@ -2007,9 +2008,9 @@
{
packageList->changeListObjStatus( NCPkgTable::A_DontUpdate );
}
-
+
packageList->setKeyboardFocus();
-
+
return true;
}
@@ -2018,7 +2019,7 @@
// DiskinfoHandler
//
// Opens a popup with disk space information.
-//
+//
bool NCPackageSelector::DiskinfoHandler( const NCursesEvent& event )
{
NCPkgTable * packageList = getPackageList();
@@ -2031,7 +2032,7 @@
{
packageList->setKeyboardFocus();
}
-
+
return true;
}
@@ -2046,7 +2047,7 @@
bool found = false;
// e.g. link is pkg://hp-officeJet
string pkgName = link.substr(6);
-
+
ZyppPoolIterator
b = zyppPkgBegin(),
e = zyppPkgEnd(),
@@ -2072,15 +2073,15 @@
NCERR << "Package " << pkgName << " NOT found" << endl;
// open error popup
}
-
+
return found;
}
///////////////////////////////////////////////////////////////////
//
// testcase handler
-//
-// generate solver testcase
+//
+// generate solver testcase
//
bool NCPackageSelector::TestcaseHandler ( const NCursesEvent& event )
{
@@ -2108,7 +2109,7 @@
///////////////////////////////////////////////////////////////////
//
// File handler
-//
+//
// export/import all packages and patterns list to/from file
//
bool NCPackageSelector::FileHandler( const NCursesEvent& event )
@@ -2118,16 +2119,16 @@
return false;
}
- //Export package list into file
+ //Export package list into file
if ( event.selection == exportItem )
{
//Ask for file to save into
- YCPValue filename = YNCursesUI::ui()->askForSaveFileName( YCPString(DEFAULT_EXPORT_FILE_NAME),
- YCPString("*.xml"),
- YCPString(_("Export List of All Packages and Patterns to File" )));
-
- if ( filename->isString() && !filename->asString()->value().empty() )
- {
+ string filename = YUI::app()->askForSaveFileName( DEFAULT_EXPORT_FILE_NAME,
+ "*.xml",
+ _("Export List of All Packages and Patterns to File" ));
+
+ if ( ! filename.empty() )
+ {
zypp::syscontent::Writer writer;
const zypp::ResPool & pool = zypp::getZYpp()->pool();
@@ -2137,28 +2138,29 @@
boost::ref(writer),
_1));
- try
+ try
{
//open file for writing and try to dump syscontent into it
- std::ofstream exportFile( filename ->asString()->value_cstr() );
+ std::ofstream exportFile( filename.c_str() );
exportFile.exceptions(std::ios_base::badbit | std::ios_base::failbit );
exportFile << writer;
-
- NCMIL << "Exported list of packages and patterns to " << filename->toString() << endl;
- }
-
+
+ NCMIL << "Exported list of packages and patterns to " << filename << endl;
+ }
+
catch (std::exception & exception)
{
- NCWAR << "Error exporting list of packages and patterns to " << filename->toString() << endl;
+ NCWAR << "Error exporting list of packages and patterns to " << filename << endl;
- //delete partially written file (don't care if it doesn't exist)
- (void) unlink( filename->asString()->value_cstr() );
+ //delete partially written file (don't care if it doesn't exist)
+ (void) unlink( filename.c_str() );
//present error popup to the user
NCPopupInfo * errorMsg = new NCPopupInfo( wpos( (NCurses::lines()-5)/2, (NCurses::cols()-40)/2 ),
NCPkgNames::ErrorLabel(),
_("Error exporting list of packages and patterns to ")
- + filename->toString(),
+ // FIXME: String addition is evil for translators!
+ + filename,
NCPkgNames::OKLabel(),
"");
errorMsg->setNiceSize(40,5);
@@ -2166,27 +2168,27 @@
YDialog::deleteTopmostDialog();
}
-
+
return true;
- }
+ }
}
//Import package list from file
else if ( event.selection == importItem )
{
//ask for file to open
- YCPValue filename = YNCursesUI::ui()->askForExistingFile( YCPString(DEFAULT_EXPORT_FILE_NAME),
- YCPString("*.xml"),
- YCPString(_("Import List of All Packages and Patterns from File")));
+ string filename = YUI::app()->askForExistingFile( DEFAULT_EXPORT_FILE_NAME,
+ "*.xml",
+ _("Import List of All Packages and Patterns from File"));
- if ( filename->isString() && !filename->asString()->value().empty() )
- {
+ if ( ! filename.empty() )
+ {
NCPkgTable * packageList = getPackageList();
- NCMIL << "Importing list of packages and patterns from " << filename->toString() << endl;
+ NCMIL << "Importing list of packages and patterns from " << filename << endl;
try
- {
- std::ifstream importFile ( filename->asString()->value_cstr() );
+ {
+ std::ifstream importFile ( filename.c_str() );
zypp::syscontent::Reader reader (importFile);
//maps to store package/pattern data into
@@ -2199,32 +2201,32 @@
it ++ )
{
string kind = it->kind();
-
+
// importMapPair => std::pair
- if ( kind == "package" )
+ if ( kind == "package" )
importPkgs.insert( importMapPair( it->name(), *it ) );
- else if ( kind == "pattern" )
+ else if ( kind == "pattern" )
importPatterns.insert( importMapPair( it->name(), *it ) );
- }
+ }
- NCMIL << "Found " << importPkgs.size() << " packages and " << importPatterns.size() << " patterns." << endl;
+ NCMIL << "Found " << importPkgs.size() << " packages and " << importPatterns.size() << " patterns." << endl;
//Change status of appropriate packages and patterns
for (ZyppPoolIterator it = zyppPkgBegin();
- it != zyppPkgEnd();
+ it != zyppPkgEnd();
it++ )
{
ZyppSel selectable = *it;
//isWanted => package name found in importPkgs map
- importSelectable ( *it, importPkgs.find( selectable->name() ) != importPkgs.end(), "package" );
+ importSelectable ( *it, importPkgs.find( selectable->name() ) != importPkgs.end(), "package" );
}
for (ZyppPoolIterator it = zyppPatternsBegin();
- it != zyppPatternsEnd();
+ it != zyppPatternsEnd();
it++ )
{
ZyppSel selectable = *it;
- importSelectable ( *it, importPatterns.find( selectable->name() ) != importPatterns.end(), "pattern" );
+ importSelectable ( *it, importPatterns.find( selectable->name() ) != importPatterns.end(), "pattern" );
}
//Switch to installation summary filter
@@ -2238,12 +2240,13 @@
}
catch ( const zypp::Exception & exception )
{
- NCWAR << "Error importing list of packages and patterns from" << filename->toString() << endl;
+ NCWAR << "Error importing list of packages and patterns from" << filename << endl;
NCPopupInfo * errorMsg = new NCPopupInfo( wpos( (NCurses::lines()-5)/2, (NCurses::cols()-40)/2) ,
NCPkgNames::ErrorLabel(),
_("Error importing list of packages and patterns from ")
- + filename->toString(),
+ // FIXME: String addition is evil for translators!
+ + filename,
NCPkgNames::OKLabel(),
"");
errorMsg->setNiceSize(40,5);
@@ -2253,12 +2256,12 @@
}
}
}
- return true;
+ return true;
}
///////////////////////////////////////////////////////////////////
//
// HelpHandler
-//
+//
// Show the help popup
//
bool NCPackageSelector::HelpHandler( const NCursesEvent& event )
@@ -2266,14 +2269,14 @@
NCPkgTable * packageList = getPackageList();
string text = "";
string headline = NCPkgNames::PackageHelp();
-
+
if ( !event.selection )
{
return false;
}
string selId = getMenuId( event.selection );
-
+
if ( selId == NCPkgNames::GeneralHelp()->toString() )
{
text += NCPkgNames::HelpPkgInst1();
@@ -2304,7 +2307,7 @@
headline = NCPkgNames::SearchHeadline();
text += NCPkgNames::HelpOnSearch();
}
-
+
// open the popup with the help text
NCPopupInfo * pkgHelp = new NCPopupInfo( wpos( (NCurses::lines()*8)/100, (NCurses::cols()*18)/100 ),
headline,
@@ -2314,19 +2317,19 @@
pkgHelp->showInfoPopup( );
YDialog::deleteTopmostDialog();
-
+
if ( packageList )
{
packageList->setKeyboardFocus();
}
-
+
return true;
}
///////////////////////////////////////////////////////////////////
//
// YOUHelpHandler
-//
+//
// Show the Online Update Help
//
bool NCPackageSelector::YouHelpHandler( const NCursesEvent& event )
@@ -2347,12 +2350,12 @@
youHelp->showInfoPopup( );
YDialog::deleteTopmostDialog();
-
+
if ( packageList )
{
packageList->setKeyboardFocus();
}
-
+
return true;
}
@@ -2361,7 +2364,7 @@
// CancelHandler
//
// Cancel button handler.
-//
+//
bool NCPackageSelector::CancelHandler( const NCursesEvent& event )
{
bool changes = diffState ();
@@ -2374,11 +2377,11 @@
NCPkgNames::YesLabel(),
NCPkgNames::NoLabel()
);
- cancelMsg->setNiceSize( 45, 8 );
+ cancelMsg->setNiceSize( 45, 8 );
NCursesEvent input = cancelMsg->showInfoPopup( );
YDialog::deleteTopmostDialog();
-
+
if ( input == NCursesEvent::cancel ) {
// don't leave the package installation dialog
return true;
@@ -2389,7 +2392,7 @@
NCMIL << "Cancel button pressed - leaving package selection" << endl;
const_cast(event).result = "cancel";
-
+
// return false, which means stop the event loop (see runPkgSelection)
return false;
}
@@ -2399,7 +2402,7 @@
// OkButtonHandler
//
// OK button handler.
-//
+//
bool NCPackageSelector::OkButtonHandler( const NCursesEvent& event )
{
bool closeDialog = true;
@@ -2417,7 +2420,7 @@
}
confirmedAllLicenses = showPendingLicenseAgreements();
-
+
} while ( !confirmedAllLicenses && closeDialog );
if ( !youMode ) // don't show automatic changes if YOU mode
@@ -2434,7 +2437,7 @@
closeDialog = false;
}
}
-
+
if ( diskspacePopup )
{
string message = "";
@@ -2447,8 +2450,8 @@
NCPkgNames::DiskSpaceError() + "<br>" + message,
NCPkgNames::OKLabel(),
NCPkgNames::CancelLabel() );
-
- spaceMsg->setNiceSize( 50, 10 );
+
+ spaceMsg->setNiceSize( 50, 10 );
NCursesEvent input = spaceMsg->showInfoPopup( );
YDialog::deleteTopmostDialog();
@@ -2467,10 +2470,10 @@
// could free some memory?
// clearSaveState ();
- const_cast(event).result = "accept";
+ const_cast(event).result = "accept";
NCMIL << "OK button pressed - leaving package selection, starting installation" << endl;
- // return false, leave the package selection
+ // return false, leave the package selection
return false;
}
else
@@ -2570,7 +2573,7 @@
case S_AutoInstall:
slbPtr->set_status( S_Taboo );
break;
-
+
case S_Update:
case S_AutoUpdate:
slbPtr->set_status( S_Protected );
@@ -2579,7 +2582,7 @@
default:
break;
}
-
+
ok = false;
} else {
NCMIL << "User confirmed license agreement for " << pkgName << endl;
@@ -2588,7 +2591,7 @@
}
YDialog::deleteTopmostDialog();
-
+
return ok;
}
@@ -2610,10 +2613,10 @@
}
// if ( visibleInfo->compare( NCPkgNames::PatchDescr() ) == YO_EQUAL )
- if ( visibleInfo == patchdescrItem )
+ if ( visibleInfo == patchdescrItem )
{
string descr;
-
+
descr += NCPkgNames::Patch();
descr += selectable->name();
descr += " ";
@@ -2638,12 +2641,12 @@
// get and format the patch description
zypp::Text value = patchPtr->description();
descr += createDescrText( value );
-
- // show the description
+
+ // show the description
if ( infoText )
{
infoText->setValue( descr );
- }
+ }
}
// else if ( visibleInfo->compare( NCPkgNames::PatchPackages() ) == YO_EQUAL )
else if ( visibleInfo == patchpkgsItem )
@@ -2661,7 +2664,7 @@
fillPatchPackages ( patchPkgsVersions, objPtr, true);
}
}
-
+
return true;
}
@@ -2676,7 +2679,7 @@
{
bool ok = false;
bool cancel = false;
-
+
if ( depsPopup
&& (doit || autoCheck) )
{
@@ -2691,14 +2694,14 @@
{
bool ok = false;
bool cancel = false;
-
+
NCPopupInfo * info = new NCPopupInfo( wpos( (NCurses::lines()-5)/2, (NCurses::cols()-30)/2 ),
"",
_( "System dependencies verify OK." ),
NCPkgNames::OKLabel()
);
info->setNiceSize( 30, 5 );
-
+
NCMIL << "Verifying system" << endl;
if ( depsPopup )
@@ -2765,8 +2768,8 @@
zypp::Text value = pkgPtr->description();
string descr = createDescrText( value );
NCDBG << "Description: " << descr << endl;
-
- // show the description
+
+ // show the description
if ( infoText )
{
infoText->setValue( descr );
@@ -2784,22 +2787,22 @@
list<string> fileList = package->filenames();
text += createText( fileList, false ) ;
}
-
- // get the widget id
+
+ // get the widget id
if ( infoText )
{
infoText->setValue( text );
- }
+ }
}
else if ( visibleInfo == pkginfoItem )
{
string instVersion = "";
string version = "";
string text = "";
-
+
text += slbPtr->name();
text += " - ";
-
+
text += pkgPtr->summary();
text += "<br>";
@@ -2818,9 +2821,9 @@
{
version = pkgPtr->edition().version();
version += "-";
- version += pkgPtr->edition().release();
+ version += pkgPtr->edition().release();
}
-
+
text += NCPkgNames::Version();
text += version;
if ( instVersion != "" )
@@ -2830,12 +2833,12 @@
text += instVersion;
}
text += " ";
-
+
// show the size
text += NCPkgNames::Size();
text += pkgPtr->size().asString();
text += " ";
-
+
ZyppPkg package = tryCastToZyppPkg (pkgPtr);
if ( package )
{
@@ -2845,7 +2848,7 @@
int medianr = package->mediaNr ();
sprintf( num, "%d", medianr );
text += num;
- text += "<br>";
+ text += "<br>";
// the license
text += NCPkgNames::License();
@@ -2858,7 +2861,7 @@
text += package->group ();
text += "<br>";
}
-
+
// show Provides:
text += NCPkgNames::Provides();
zypp::CapSet provides = package->dep (zypp::Dep::PROVIDES);
@@ -2869,11 +2872,11 @@
if ( package )
{
text += NCPkgNames::Authors();
- list<string> authors = package->authors(); // zypp::Package
+ list<string> authors = package->authors(); // zypp::Package
text += createText( authors, true );
}
-
- // show the description
+
+ // show the description
if ( infoText )
{
infoText->setValue( text );
@@ -2919,16 +2922,16 @@
+ relline + "<br>";
}
}
-
- // show the package relations
+
+ // show the package relations
if ( infoText )
{
infoText->setValue( text );
}
}
-
+
NCDBG << "Showing package information: " << visibleInfo << endl;
-
+
return true;
}
@@ -2941,7 +2944,7 @@
string NCPackageSelector::createDescrText( zypp::Text value )
{
string html_text = "";
-
+
#ifdef FIXME
bool author_format = false;
bool htmlFormat = false; /* Is the description coming in html? */
@@ -2950,7 +2953,7 @@
* to be formatted in html. The yast (this method here) needs not to
* do further formatting for the text part.
*/
-
+
list<string>::const_iterator it = value.begin();
string line;
@@ -3001,15 +3004,15 @@
else
{
html_text += " ";
- }
+ }
}
-
+
++it;
}
#else
html_text = value;
#endif
-
+
return html_text;
}
@@ -3039,7 +3042,7 @@
e = info.end (),
it;
unsigned int i, n = info.size();
-
+
for ( it = b, i = 0; it != e; ++it, ++i )
{
text = text + (*it).asString();
@@ -3062,7 +3065,7 @@
list<string>::iterator it;
string text = "";
unsigned int i;
-
+
for ( i = 0, it = info.begin(); it != info.end() && i < 1000; ++it, i++ )
{
text += (*it);
@@ -3074,7 +3077,7 @@
}
else
{
- text += "<br>";
+ text += "<br>";
}
}
if ( i == 999 )
@@ -3152,10 +3155,10 @@
{
ZyppPkg pkg = tryCastToZyppPkg( *contents_it );
ZyppSel sel;
-
+
if ( pkg )
sel = selMapper.findZyppSel( pkg );
-
+
if ( sel )
{
@@ -3236,14 +3239,14 @@
YLayoutBox * hSplit = YUI::widgetFactory()->createHBox( split );
YAlignment * left1 = YUI::widgetFactory()->createLeft( hSplit );
-
+
// label of the filter menu ( keep it short ) - filters out a set of packages
filterMenu = new NCMenuButton( left1, _("&Filter") );
YUI_CHECK_NEW( filterMenu );
filterMenu->setFunctionKey( 4 );
// begin: menu items of the filter menu
- // please note: use unique hotkeys until end:
+ // please note: use unique hotkeys until end:
groupsItem = new YMenuItem( _("RPM &Groups") );
patternsItem = new YMenuItem( _("Pa&tterns") );
languagesItem = new YMenuItem( _("&Languages") );
@@ -3305,7 +3308,7 @@
dontupdItem = new YMenuItem( allItem, _( "Do Not Update and &Keep Installed" ) );
actionMenu->addItems( itemCollection2 );
-
+
YAlignment * left3 = YUI::widgetFactory()->createLeft( hSplit );
// label Information menu ( keep it short! )
@@ -3338,13 +3341,13 @@
etcMenu->setFunctionKey( 7 );
// add items to Etc. menu
createEtcMenu();
-
- // add the package table
+
+ // add the package table
YTableHeader * tableHeader = new YTableHeader();
pkgList = new NCPkgTable( split, tableHeader );
YUI_CHECK_NEW( pkgList );
-
+
NCPkgStatusStrategy * strategy;
// set the table type
switch ( type )
@@ -3361,7 +3364,7 @@
}
// set the pointer to the packager object
pkgList->setPackager( this );
-
+
// HBox for Filter and Disk Space (both in additional HBoxes )
YLayoutBox * hSplit2 = YUI::widgetFactory()->createHBox( split );
@@ -3369,7 +3372,7 @@
// label text - keep it short
new NCLabel( hSplit3, _( "Filter: " ) );
filterLabel = YUI::widgetFactory()->createLabel ( hSplit3, "....................................." );
-
+
new NCSpacing( hSplit2, YD_HORIZ, true, 0.5 );
YLayoutBox * hSplit4 = YUI::widgetFactory()->createHBox( hSplit2 );
@@ -3379,12 +3382,12 @@
YLayoutBox * vSplit = YUI::widgetFactory()->createVBox( split );
replacePoint = YUI::widgetFactory()->createReplacePoint( vSplit );
-
+
infoText = new NCRichText( replacePoint, " " );
YUI_CHECK_NEW( infoText );
-
+
YLayoutBox * hSplit5 = YUI::widgetFactory()->createHBox( vSplit );
-
+
// add the Cancel button
cancelButton = new NCPushButton( hSplit5, _( "&Cancel" ) );
YUI_CHECK_NEW( cancelButton );
@@ -3394,7 +3397,7 @@
okButton = new NCPushButton( hSplit5, _( "&Accept" ) );
YUI_CHECK_NEW( okButton );
okButton->setFunctionKey( 10 );
-
+
}
void NCPackageSelector::createEtcMenu( )
@@ -3409,19 +3412,19 @@
else
// menu entry: dependency check on
noautodepsItem = new YMenuItem( depsItem, _( "[ ] &Automatic Dependency Check" ) );
-
+
verifyItem = new YMenuItem( depsItem, _( " &Verify System" ) );
// menu item - list of all packages in the system
allpksItem = new YMenuItem( _("All &Packages List" ) );
exportItem = new YMenuItem( allpksItem, _("&Export to File") );
importItem = new YMenuItem( allpksItem, _("&Import from File") );
testcaseItem = new YMenuItem( _( "Generate Dependency Resolver &Test Case" ) );
-
+
YItemCollection itemCollection4;
itemCollection4.push_back( depsItem );
itemCollection4.push_back( allpksItem );
itemCollection4.push_back( testcaseItem );
- etcMenu->addItems( itemCollection4 );
+ etcMenu->addItems( itemCollection4 );
}
//
@@ -3438,7 +3441,7 @@
case NCPkgTable::T_Patches: {
fillPatchList( "installable" ); // default: installable patches
- // set the visible info to long description
+ // set the visible info to long description
setVisibleInfo ( longdescrItem );
// show the package description of the current item
@@ -3449,7 +3452,7 @@
if ( ! zypp::getZYpp()->resolver()->problematicUpdateItems().empty() )
{
fillUpdateList();
- // set the visible info to package description
+ // set the visible info to package description
setVisibleInfo ( pkginfoItem );
// show the package description of the current item
pkgList->showInformation ();
@@ -3464,8 +3467,8 @@
NCMIL << "default RPM group: " << defaultGroup->value().translation() << endl;
fillPackageList ( YCPString( defaultGroup->value().translation()),
defaultGroup );
-
- // set the visible info to package description
+
+ // set the visible info to package description
setVisibleInfo ( pkginfoItem );
// show the package description of the current item
pkgList->showInformation ();
Modified: trunk/ncurses/yast2-ncurses.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/ncurses/yast2-ncurses.spec.in?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/ncurses/yast2-ncurses.spec.in (original)
+++ trunk/ncurses/yast2-ncurses.spec.in Mon Dec 10 18:42:59 2007
@@ -17,6 +17,8 @@
Provides: y2curses
Obsoletes: y2curses
Requires: glibc-locale
+BuildRequires: yast2-core-devel >= 2.16.15
+Requires: yast2-core >= 2.16.15
#adapted to libzypp 3.11 refactoring
Requires: libzypp >= 3.11.8
#FSize.h and YRpmGroupsTree.h moved to libyui
Modified: trunk/qt/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/VERSION?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/qt/VERSION (original)
+++ trunk/qt/VERSION Mon Dec 10 18:42:59 2007
@@ -1 +1 @@
-2.16.7
+2.16.8
Modified: trunk/qt/package/yast2-qt.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/package/yast2-qt.changes?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/qt/package/yast2-qt.changes (original)
+++ trunk/qt/package/yast2-qt.changes Mon Dec 10 18:42:59 2007
@@ -1,4 +1,13 @@
-------------------------------------------------------------------
+Mon Dec 10 18:39:34 CET 2007 - sh@suse.de
+
+- Moved file and directory dialogs from YQUI to YQApplication:
+ - askForExistingDirectory()
+ - askForExistingFile()
+ - askForSaveFile()
+- V 2.16.8
+
+-------------------------------------------------------------------
Wed Dec 5 20:41:15 CET 2007 - sh@suse.de
- Moved main dialog handling out of YQUI and into a new class
Modified: trunk/qt/src/YQApplication.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQApplication.cc?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/qt/src/YQApplication.cc (original)
+++ trunk/qt/src/YQApplication.cc Mon Dec 10 18:42:59 2007
@@ -10,20 +10,27 @@
| (C) SuSE GmbH |
\----------------------------------------------------------------------/
- File: YQApplication.cc
+ File: YQApplication.cc
- Author: Stefan Hundhammer
+ Author: Stefan Hundhammer
+ Textdomain "packages-qt"
/-*/
+#include // access()
#include
#include
#include
+#include
+#include
#define y2log_component "qt-ui"
#include
+#include "utf8.h"
+#include "YQi18n.h"
+
#include "YQApplication.h"
@@ -40,10 +47,10 @@
, _autoHeadingFontSize( -1 )
{
y2debug( "YQApplication constructor start" );
-
+
setIconBasePath( ICONDIR "/icons/22x22/apps/" );
loadPredefinedQtTranslations();
-
+
y2debug( "YQApplication constructor end" );
}
@@ -78,7 +85,7 @@
QString language = QLocale::system().name();
QString transFile = QString( "qt_%1.qm")
- .arg( language.lower().replace('_','-') );
+ .arg( language.lower().replace('_','-') );
if ( path.isEmpty() )
{
@@ -89,7 +96,7 @@
if ( ! _qtTranslations )
_qtTranslations = new QTranslator();
-
+
_qtTranslations->load( transFile, path );
if ( _qtTranslations->isEmpty() )
@@ -144,17 +151,17 @@
}
QString lang = language.c_str();
-
+
if ( ! encoding.empty() )
lang += QString( "." ) + encoding.c_str();
-
+
QString key;
if ( ! _langFonts->hasKey( fontKey( lang ) ) ) // Try with encoding ("zh_CN.UTF8" etc.)
{
lang = language.c_str(); // Try without encoding ("zh_CN")
- if ( ! _langFonts->hasKey( fontKey( lang ) ) )
+ if ( ! _langFonts->hasKey( fontKey( lang ) ) )
lang.replace( QRegExp( "_.*$" ), "" ); // Cut off trailing country ("_CN")
}
@@ -296,7 +303,7 @@
_currentFont = 0;
_headingFont = 0;
- _boldFont = 0;
+ _boldFont = 0;
}
@@ -320,55 +327,174 @@
#endif
int x = 800;
int y = 600;
-
- int normal = 10;
- int heading = 12;
+
+ int normal = 10;
+ int heading = 12;
if ( x >= 800 && y >= 600 )
{
normal = 10;
- heading = 12;
+ heading = 12;
}
if ( x >= 1024 && y >= 768 )
{
normal = 12;
- heading = 14;
+ heading = 14;
}
if ( x >= 1280 && y >= 1024 )
{
normal = 14;
- heading = 18;
+ heading = 18;
}
if ( x >= 1400 )
{
normal = 16;
- heading = 20;
+ heading = 20;
}
if ( x >= 1600 )
{
normal = 18;
- heading = 24;
+ heading = 24;
}
if ( x >= 2048 ) // Sounds futuristic? Just wait one or two years...
{
normal = 20;
- heading = 28;
+ heading = 28;
}
- _autoNormalFontSize = normal;
+ _autoNormalFontSize = normal;
_autoHeadingFontSize = heading;
y2milestone( "Selecting auto fonts - normal: %d, heading: %d (bold)",
_autoNormalFontSize, _autoHeadingFontSize );
}
-
+
+string
+YQApplication::askForExistingDirectory( const string & startDir,
+ const string & headline )
+{
+#if 0
+ normalCursor();
+#endif
+
+ QString dirName =
+ QFileDialog::getExistingDirectory( fromUTF8( startDir ),
+ 0, // parent
+ "dir_selector", // name
+ fromUTF8( headline ) ); // caption
+#if 0
+ busyCursor();
+#endif
+
+ return toUTF8( dirName );
+}
+
+
+string
+YQApplication::askForExistingFile( const string & startWith,
+ const string & filter,
+ const string & headline )
+{
+#if 0
+ normalCursor();
+#endif
+
+ QString fileName =
+ QFileDialog::getOpenFileName( fromUTF8( startWith ),
+ fromUTF8( filter ),
+ 0, // parent
+ "file_selector", // name
+ fromUTF8( headline ) ); // caption
+
+#if 0
+ busyCursor();
+#endif
+
+ return toUTF8( fileName );
+}
+
+
+string
+YQApplication::askForSaveFileName( const string & startWith,
+ const string & filter,
+ const string & headline )
+{
+#if 0
+ normalCursor();
+#endif
+
+ QString fileName = askForSaveFileName( fromUTF8( startWith ),
+ fromUTF8( filter ),
+ fromUTF8( headline ) );
+#if 0
+ busyCursor();
+#endif
+
+ return toUTF8( fileName );
+}
+
+
+
+QString
+YQApplication::askForSaveFileName( const QString & startWith,
+ const QString & filter,
+ const QString & headline )
+{
+ QString fileName;
+ bool tryAgain = false;
+
+ do
+ {
+ // Leave the mouse cursor alone - this function might be called from
+ // some other widget, not only from UI::AskForSaveFileName().
+
+ fileName = QFileDialog::getSaveFileName( startWith,
+ filter,
+ 0, // parent
+ "file_selector", // name
+ headline ); // caption
+
+ if ( fileName.isEmpty() ) // this includes fileName.isNull()
+ return QString::null;
+
+
+ if ( access( (const char *) fileName, F_OK ) == 0 ) // file exists?
+ {
+ QString msg;
+
+ if ( access( (const char *) fileName, W_OK ) == 0 )
+ {
+ // Confirm if the user wishes to overwrite an existing file
+ msg = ( _( "%1 exists! Really overwrite?" ) ).arg( fileName );
+ }
+ else
+ {
+ // Confirm if the user wishes to overwrite a write-protected file %1
+ msg = ( _( "%1 exists and is write-protected!\nReally overwrite?" ) ).arg( fileName );
+ }
+
+ int buttonNo = QMessageBox::information( 0, // parent widget
+ // Translators: Window title for confirmation dialog
+ _( "Confirm" ),
+ msg,
+ _( "C&ontinue" ),
+ _( "&Cancel" ) );
+ tryAgain = ( buttonNo != 0 );
+ }
+
+ } while ( tryAgain );
+
+ return fileName;
+}
+
+
#include "YQApplication.moc"
Modified: trunk/qt/src/YQApplication.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQApplication.h?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/qt/src/YQApplication.h (original)
+++ trunk/qt/src/YQApplication.h Mon Dec 10 18:42:59 2007
@@ -124,6 +124,72 @@
**/
void setAutoFonts( bool useAutoFonts );
+ /**
+ * Open a directory selection box and prompt the user for an existing
+ * directory.
+ *
+ * 'startDir' is the initial directory that is displayed.
+ *
+ * 'headline' is an explanatory text for the directory selection box.
+ * Graphical UIs may omit that if no window manager is running.
+ *
+ * Returns the selected directory name
+ * or an empty string if the user canceled the operation.
+ *
+ * Implemented from YApplication.
+ **/
+ virtual string askForExistingDirectory( const string & startDir,
+ const string & headline );
+
+ /**
+ * Open a file selection box and prompt the user for an existing file.
+ *
+ * 'startWith' is the initial directory or file.
+ *
+ * 'filter' is one or more blank-separated file patterns, e.g.
+ * "*.png *.jpg"
+ *
+ * 'headline' is an explanatory text for the file selection box.
+ * Graphical UIs may omit that if no window manager is running.
+ *
+ * Returns the selected file name
+ * or an empty string if the user canceled the operation.
+ *
+ * Implemented from YApplication.
+ **/
+ virtual string askForExistingFile( const string & startWith,
+ const string & filter,
+ const string & headline );
+
+ /**
+ * Open a file selection box and prompt the user for a file to save data
+ * to. Automatically asks for confirmation if the user selects an existing
+ * file.
+ *
+ * 'startWith' is the initial directory or file.
+ *
+ * 'filter' is one or more blank-separated file patterns, e.g.
+ * "*.png *.jpg"
+ *
+ * 'headline' is an explanatory text for the file selection box.
+ * Graphical UIs may omit that if no window manager is running.
+ *
+ * Returns the selected file name
+ * or an empty string if the user canceled the operation.
+ *
+ * Implemented from YApplication.
+ **/
+ virtual string askForSaveFileName( const string & startWith,
+ const string & filter,
+ const string & headline );
+ /**
+ * Lower-level version that works with QStrings and does not change
+ * the mouse cursor.
+ **/
+ static QString askForSaveFileName( const QString & startWith,
+ const QString & filter,
+ const QString & headline );
+
protected:
Modified: trunk/qt/src/YQUI.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI.h?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/qt/src/YQUI.h (original)
+++ trunk/qt/src/YQUI.h Mon Dec 10 18:42:59 2007
@@ -315,67 +315,6 @@
public:
/**
- *
- * Open a directory selection box and prompt the user for an existing directory.
- * [Reimplemented from YUI]
- *
- * 'startDir' is the initial directory that is displayed.
- *
- * 'headline' is an explanatory text for the directory selection box.
- * Graphical UIs may omit that if no window manager is running.
- *
- * Returns the selected directory name
- * or 'nil' (YCPVoid() ) if the user canceled the operation.
- **/
- YCPValue askForExistingDirectory ( const YCPString & startDir,
- const YCPString & headline );
-
- /**
- * Open a file selection box and prompt the user for an existing file.
- * [Reimplemented from YUI]
- *
- * 'startWith' is the initial directory or file.
- *
- * 'filter' is one or more blank-separated file patterns, e.g. "*.png *.jpg"
- *
- * 'headline' is an explanatory text for the file selection box.
- * Graphical UIs may omit that if no window manager is running.
- *
- * Returns the selected file name
- * or 'nil' (YCPVoid() ) if the user canceled the operation.
- **/
- YCPValue askForExistingFile ( const YCPString & startWith,
- const YCPString & filter,
- const YCPString & headline );
-
- /**
- * Open a file selection box and prompt the user for a file to save data to.
- * Automatically asks for confirmation if the user selects an existing file.
- * [Reimplemented from YUI]
- *
- * 'startWith' is the initial directory or file.
- *
- * 'filter' is one or more blank-separated file patterns, e.g. "*.png *.jpg"
- *
- * 'headline' is an explanatory text for the file selection box.
- * Graphical UIs may omit that if no window manager is running.
- *
- * Returns the selected file name
- * or 'nil' (YCPVoid() ) if the user canceled the operation.
- **/
- YCPValue askForSaveFileName ( const YCPString & startWith,
- const YCPString & filter,
- const YCPString & headline );
-
- /**
- * Lower-level version that works with QStrings and does not change
- * the mouse cursor.
- **/
- QString askForSaveFileName( const QString & startWith,
- const QString & filter,
- const QString & headline );
-
- /**
* Initialize and set a textdomain for gettext()
**/
static void setTextdomain( const char * domain );
Modified: trunk/qt/src/YQUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQUI_builtins.cc?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/qt/src/YQUI_builtins.cc (original)
+++ trunk/qt/src/YQUI_builtins.cc Mon Dec 10 18:42:59 2007
@@ -25,11 +25,12 @@
#include
#include
-#include
-#include
#include
#include
+#include
+#include
#include
+#include
#define y2log_component "qt-ui"
#include
@@ -40,6 +41,7 @@
#include "YUISymbols.h"
#include "YQDialog.h"
#include "YQSignalBlocker.h"
+#include "YQApplication.h"
#include "utf8.h"
#include "YQi18n.h"
@@ -172,7 +174,9 @@
{
YQSignalBlocker sigBlocker( &_user_input_timer );
- fileName = askForSaveFileName( fileName, QString( "*.png" ) , _( "Save screen shot to..." ) );
+ fileName = YQApplication::askForSaveFileName( fileName,
+ QString( "*.png" ) ,
+ _( "Save screen shot to..." ) );
}
if ( fileName.isEmpty() )
@@ -220,9 +224,9 @@
void YQUI::askSaveLogs()
{
- QString fileName = askForSaveFileName( "/tmp/y2logs.tgz", // startWith
- "*.tgz *.tar.gz", // filter
- "Save y2logs to..." ); // headline
+ QString fileName = YQApplication::askForSaveFileName( QString( "/tmp/y2logs.tgz" ), // startWith
+ QString( "*.tgz *.tar.gz" ), // filter
+ QString( "Save y2logs to..." ) ); // headline
if ( ! fileName.isEmpty() )
{
@@ -356,115 +360,4 @@
-YCPValue YQUI::askForExistingDirectory( const YCPString & startDir,
- const YCPString & headline )
-{
- normalCursor();
-
- QString dir_name =
- QFileDialog::getExistingDirectory( fromUTF8( startDir->value() ),
- _main_win, // parent
- "dir_selector", // name
- fromUTF8( headline->value() ) ); // caption
- busyCursor();
-
- if ( dir_name.isEmpty() ) // this includes dir_name.isNull()
- return YCPVoid(); // nothing selected -> return 'nil'
-
- return YCPString( toUTF8( dir_name ) );
-}
-
-
-YCPValue YQUI::askForExistingFile( const YCPString & startWith,
- const YCPString & filter,
- const YCPString & headline )
-{
- normalCursor();
-
- QString file_name =
- QFileDialog::getOpenFileName( fromUTF8( startWith->value() ),
- fromUTF8( filter->value() ),
- _main_win, // parent
- "file_selector", // name
- fromUTF8( headline->value() ) ); // caption
- busyCursor();
-
- if ( file_name.isEmpty() ) // this includes file_name.isNull()
- return YCPVoid(); // nothing selected -> return 'nil'
-
- return YCPString( toUTF8( file_name ) );
-}
-
-
-YCPValue YQUI::askForSaveFileName( const YCPString & startWith,
- const YCPString & filter,
- const YCPString & headline )
-{
- normalCursor();
-
- QString file_name = askForSaveFileName( fromUTF8( startWith->value() ),
- fromUTF8( filter->value() ),
- fromUTF8( headline->value() ) );
- busyCursor();
-
- if ( file_name.isEmpty() ) // this includes file_name.isNull()
- return YCPVoid(); // nothing selected -> return 'nil'
-
- return YCPString( toUTF8( file_name ) );
-}
-
-
-
-QString YQUI::askForSaveFileName( const QString & startWith,
- const QString & filter,
- const QString & headline )
-{
- QString file_name;
- bool try_again = false;
-
- do
- {
- // Leave the mouse cursor alone - this function might be called from
- // some other widget, not only from UI::AskForSaveFileName().
-
- file_name = QFileDialog::getSaveFileName( startWith,
- filter,
- _main_win, // parent
- "file_selector", // name
- headline ); // caption
-
- if ( file_name.isEmpty() ) // this includes file_name.isNull()
- return QString::null;
-
-
- if ( access( (const char *) file_name, F_OK ) == 0 ) // file exists?
- {
- QString msg;
-
- if ( access( (const char *) file_name, W_OK ) == 0 )
- {
- // Confirm if the user wishes to overwrite an existing file
- msg = ( _( "%1 exists! Really overwrite?" ) ).arg( file_name );
- }
- else
- {
- // Confirm if the user wishes to overwrite a write-protected file %1
- msg = ( _( "%1 exists and is write-protected!\nReally overwrite?" ) ).arg( file_name );
- }
-
- int button_no = QMessageBox::information( _main_win,
- // Window title for confirmation dialog
- _( "Confirm" ),
- msg,
- _( "C&ontinue" ),
- _( "&Cancel" ) );
- try_again = ( button_no != 0 );
- }
-
- } while ( try_again );
-
- return file_name;
-}
-
-
// EOF
Modified: trunk/qt/src/pkg/YQPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPackageSelector.cc?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPackageSelector.cc (original)
+++ trunk/qt/src/pkg/YQPackageSelector.cc Mon Dec 10 18:42:59 2007
@@ -79,6 +79,7 @@
#include "QY2ComboTabWidget.h"
#include "YQDialog.h"
+#include "YQApplication.h"
#include "utf8.h"
#include "YQUI.h"
#include "YEvent.h"
@@ -1057,9 +1058,9 @@
void
YQPackageSelector::pkgExport()
{
- QString filename = YQUI::ui()->askForSaveFileName( QString( DEFAULT_EXPORT_FILE_NAME ), // startsWith
- QString( "*.xml;;*" ), // filter
- _( "Save Package List" ) );
+ QString filename = YQApplication::askForSaveFileName( QString( DEFAULT_EXPORT_FILE_NAME ), // startsWith
+ QString( "*.xml;;*" ), // filter
+ _( "Save Package List" ) );
if ( ! filename.isEmpty() )
{
Modified: trunk/qt/src/pkg/YQPkgConflictList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPkgConflictList.cc?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPkgConflictList.cc (original)
+++ trunk/qt/src/pkg/YQPkgConflictList.cc Mon Dec 10 18:42:59 2007
@@ -120,9 +120,9 @@
void
YQPkgConflictList::askSaveToFile() const
{
- QString filename = YQUI::ui()->askForSaveFileName( "conflicts.txt", // startsWith
- "*.txt", // filter
- _( "Save Conflicts List" ) );
+ QString filename = YQApplication::askForSaveFileName( "conflicts.txt", // startsWith
+ "*.txt", // filter
+ _( "Save Conflicts List" ) );
if ( ! filename.isEmpty() )
saveToFile( filename, true );
}
Modified: trunk/qt/src/pkg/YQPkgList.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/pkg/YQPkgList.cc?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/qt/src/pkg/YQPkgList.cc (original)
+++ trunk/qt/src/pkg/YQPkgList.cc Mon Dec 10 18:42:59 2007
@@ -33,6 +33,7 @@
#include "YQUI.h"
#include "YQi18n.h"
#include "YQIconPool.h"
+#include "YQApplication.h"
YQPkgList::YQPkgList( QWidget * parent )
@@ -350,9 +351,9 @@
void
YQPkgList::askExportList() const
{
- QString filename = YQUI::ui()->askForSaveFileName( "pkglist.txt", // startsWith
- "*.txt", // filter
- _( "Export Package List" ) );
+ QString filename = YQApplication::askForSaveFileName( "pkglist.txt", // startsWith
+ "*.txt", // filter
+ _( "Export Package List" ) );
if ( ! filename.isEmpty() )
exportList( filename, true );
}
Modified: trunk/qt/yast2-qt.spec.in
URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/yast2-qt.spec.in?rev=42919&r1=42918&r2=42919&view=diff
==============================================================================
--- trunk/qt/yast2-qt.spec.in (original)
+++ trunk/qt/yast2-qt.spec.in Mon Dec 10 18:42:59 2007
@@ -5,8 +5,8 @@
BuildRequires: dbus-1-devel boost-devel libzypp-devel curl-devel docbook-xsl-stylesheets doxygen libdrm-devel libjpeg-devel libxcrypt-devel libxslt perl-XML-Writer qt3-devel rpm-devel sgml-skel update-desktop-files yast2-devtools yast2-core-devel hal-devel
Summary: -
-BuildRequires: yast2-core-devel >= 2.16.11
-Requires: yast2-core >= 2.16.11
+BuildRequires: yast2-core-devel >= 2.16.15
+Requires: yast2-core >= 2.16.15
Requires: libzypp >= 3.11.8
Provides: yast2_ui
Provides: y2base:/var/lib/YaST2/servers/qt
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org