Author: gs
Date: Wed Aug 29 15:22:18 2007
New Revision: 40584
URL: http://svn.opensuse.org/viewcvs/yast?rev=40584&view=rev
Log:
remove YCPTerm, add preferredW/H, setFunctionKey
Modified:
branches/tmp/sh/mod-ui/ncurses/src/NCAskForFile.cc
branches/tmp/sh/mod-ui/ncurses/src/NCAskForFile.h
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCAskForFile.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCAskForFile.cc?rev=40584&r1=40583&r2=40584&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCAskForFile.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCAskForFile.cc Wed Aug 29 15:22:18 2007
@@ -20,7 +20,6 @@
#include "NCAskForFile.h"
-#include
#include "YDialog.h"
#include "YWidgetID.h"
@@ -41,12 +40,12 @@
namespace
{
- const YCPTerm idOk( "ok" );
- const YCPTerm idCancel( "cancel" );
- const YCPTerm idDirList( "dirlist" );
- const YCPTerm idFileList( "filelist" );
- const YCPTerm idDirName( "dirname" );
- const YCPTerm idDetails( "details" );
+ const string idOk( "ok" );
+ const string idCancel( "cancel" );
+ const string idDirList( "dirlist" );
+ const string idFileList( "filelist" );
+ const string idDirName( "dirname" );
+ const string idDetails( "details" );
}
///////////////////////////////////////////////////////////////////
@@ -165,7 +164,7 @@
dirName = new NCComboBox( frame, _( "Selected Directory:" ), false ); // editable = false;
dirName->setNotify( true );
- YStringWidgetID * dirID = new YStringWidgetID( idDirName->name() );
+ YStringWidgetID * dirID = new YStringWidgetID( idDirName );
dirName->setId( dirID );
//new NCSpacing( vSplit, YD_VERT, false, 0.6 );
@@ -175,7 +174,7 @@
// label for checkbox
detailed = new NCCheckBox( hSplit, _( "&Detailed View" ), false );
- YStringWidgetID * detailsID = new YStringWidgetID( idDetails->name() );
+ YStringWidgetID * detailsID = new YStringWidgetID( idDetails );
detailed->setId( detailsID );
new NCSpacing( hSplit, YD_HORIZ, true, 0.1 ); // stretchable = true
@@ -185,12 +184,12 @@
// add the list of directories
opt.keyEvents.setValue( true );
dirList = new NCDirectoryTable( hSplit1, opt, NCFileSelection::T_Overview, YCPString(startDir) );
- YStringWidgetID * dirListID = new YStringWidgetID( idDirList->name() );
+ YStringWidgetID * dirListID = new YStringWidgetID( idDirList );
dirList->setId( dirListID );
// add the list of files
fileList = new NCFileTable( hSplit1, opt, NCFileSelection::T_Overview, filter, YCPString(startDir) );
- YStringWidgetID * dirFileID = new YStringWidgetID( idFileList->name() );
+ YStringWidgetID * dirFileID = new YStringWidgetID( idFileList );
fileList->setId( dirFileID );
opt.notifyMode.setValue( false );
@@ -225,20 +224,24 @@
//hSplit3->addChild( new NCSpacing( hSplit3, opt, 0.2, true, false ) );
new NCSpacing( hSplit3, YD_HORIZ, true, 0.2 );
+ opt.key_Fxx.setValue( 10 ); // see okButton
+
// add the OK button
- opt.key_Fxx.setValue( 10 ); // FIXME
- // the label of the OK button
okButton = new NCPushButton( hSplit3, _( "&OK" ) );
- YStringWidgetID * okID = new YStringWidgetID(idOk->name() );
+ okButton->setFunctionKey( 10 );
+
+ YStringWidgetID * okID = new YStringWidgetID( idOk );
okButton->setId( okID );
new NCSpacing( hSplit3, YD_HORIZ, true, 0.4 );
+ opt.key_Fxx.setValue( 9 ); // see cancelButton
+
// add the Cancel button
- opt.key_Fxx.setValue( 9 ); // FIXME
- // the label of the Cancel button
cancelButton = new NCPushButton( hSplit3, _( "&Cancel" ) );
- YStringWidgetID * cancelID = new YStringWidgetID( idCancel->name() );
+ cancelButton->setFunctionKey( 9 );
+
+ YStringWidgetID * cancelID = new YStringWidgetID( idCancel );
cancelButton->setId( cancelID );
new NCSpacing( hSplit3, YD_HORIZ, true, 0.2 );
@@ -274,17 +277,14 @@
return postevent;
}
-///////////////////////////////////////////////////////////////////
-//
-//
-// METHOD NAME : NCAskForFile::niceSize
-// METHOD TYPE : void
-//
-// DESCRIPTION :
-//
-long NCAskForFile::nicesize(YUIDimension dim)
+int NCAskForFile::preferredWidth()
+{
+ return NCurses::cols()-10;
+}
+
+int NCAskForFile::preferredHeight()
{
- return ( dim == YD_HORIZ ? NCurses::cols()-10 : NCurses::lines()-4 );
+ return NCurses::lines()-4;
}
///////////////////////////////////////////////////////////////////
@@ -352,14 +352,14 @@
if ( currentId )
{
- if ( currentId->toString() == idOk->name() )
+ if ( currentId->toString() == idOk )
{
postevent.result = YCPString( dirList->getCurrentDir() + "/"
+ getFileName() );
// return false means: close the popup
return false;
}
- else if ( currentId->toString() == idDirList->name()
+ else if ( currentId->toString() == idDirList
&& !postevent.result.isNull() )
{
unsigned int i = dirName->getListSize();
@@ -381,14 +381,14 @@
updateFileList();
}
}
- else if ( currentId->toString() == idDirName->name() )
+ else if ( currentId->toString() == idDirName )
{
dirList->setStartDir( dirName->text() );
dirList->fillList();
updateFileList();
}
- else if ( currentId->toString() == idDetails->name() )
+ else if ( currentId->toString() == idDetails )
{
bool details = getCheckBoxValue( detailed );
if ( details )
@@ -404,7 +404,7 @@
fileList->fillList();
dirList->fillList();
}
- else if ( currentId->toString() == idFileList->name() )
+ else if ( currentId->toString() == idFileList )
{
if ( !postevent.result.isNull() )
{
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCAskForFile.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCAskForFile.h?rev=40584&r1=40583&r2=40584&view=diff
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCAskForFile.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCAskForFile.h Wed Aug 29 15:22:18 2007
@@ -81,8 +81,9 @@
/**
* Set the default size
*/
- virtual long nicesize(YUIDimension dim);
-
+ virtual int preferredWidth();
+ virtual int preferredHeight();
+
/**
* Create layout of file selection popup
* @param YCPString The initial start directory
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org