YaST Commits
Threads by month
- ----- 2024 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
November 2007
- 24 participants
- 864 discussions
[yast-commit] r41956 - /branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc
by gs@svn.opensuse.org 10 Nov '07
by gs@svn.opensuse.org 10 Nov '07
10 Nov '07
Author: gs
Date: Sat Nov 10 09:12:56 2007
New Revision: 41956
URL: http://svn.opensuse.org/viewcvs/yast?rev=41956&view=rev
Log:
create YMenuItem for hyper links
Modified:
branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCR…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc Sat Nov 10 09:12:56 2007
@@ -23,6 +23,8 @@
#include "stringutil.h"
#include <sstream>
+#include "YMenuItem.h"
+
#include "YWidgetID.h"
#if 0
@@ -315,9 +317,7 @@
string ycpstr;
NCstring::RecodeFromWchar( anchors[armed].target, "UTF-8", &ycpstr );
NCMIL << "LINK: " << ycpstr << endl;
- YStringWidgetID * selectionID = new YStringWidgetID( ycpstr );
- //ret.selection = YCPString( ycpstr );
- //ret.selection = selectionID;
+ ret.selection = new YMenuItem( ycpstr );
}
break;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r41955 - /branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc
by gs@svn.opensuse.org 10 Nov '07
by gs@svn.opensuse.org 10 Nov '07
10 Nov '07
Author: gs
Date: Sat Nov 10 09:12:21 2007
New Revision: 41955
URL: http://svn.opensuse.org/viewcvs/yast?rev=41955&view=rev
Log:
activate creation of search popup
Modified:
branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc
Modified: branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/pkg…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc Sat Nov 10 09:12:21 2007
@@ -260,10 +260,10 @@
// create the filter popup
filterPopup = new NCPkgPopupTree( wpos( 1, 1 ), this );
}
-#if 0
+
// create the search popup
searchPopup = new NCPkgPopupSearch( wpos( 1, 1 ), this );
-
+#if 0
// the dependency popup
depsPopup = new NCPkgPopupDeps( wpos( 3, 8 ), this );
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r41954 - /branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupSearch.cc
by gs@svn.opensuse.org 10 Nov '07
by gs@svn.opensuse.org 10 Nov '07
10 Nov '07
Author: gs
Date: Sat Nov 10 09:12:00 2007
New Revision: 41954
URL: http://svn.opensuse.org/viewcvs/yast?rev=41954&view=rev
Log:
remove superfluous creation of layoutbox
Modified:
branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupSearch.cc
Modified: branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupSearch.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/pkg…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupSearch.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPkgPopupSearch.cc Sat Nov 10 09:12:00 2007
@@ -107,8 +107,6 @@
//NCFrame * frame0 = new NCFrame( vSplit, opt, YCPString("" ) );
NCFrame * frame0 = new NCFrame( vSplit, "" );
- new NCLayoutBox( frame0, YD_VERT );
-
searchExpr = new NCComboBox( frame0,
NCPkgNames::SearchPhrase(),
true ); // editable = true
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r41953 - /branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc
by gs@svn.opensuse.org 10 Nov '07
by gs@svn.opensuse.org 10 Nov '07
10 Nov '07
Author: gs
Date: Sat Nov 10 08:49:38 2007
New Revision: 41953
URL: http://svn.opensuse.org/viewcvs/yast?rev=41953&view=rev
Log:
delete YMenuEvent in getMenuId()
Modified:
branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc
Modified: branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/pkg…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc Sat Nov 10 08:49:38 2007
@@ -466,7 +466,10 @@
{
YCPValue selectionId = menuEvent->id();
id = selectionId->toString();
+
+ delete menuEvent;
}
+
return id;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r41952 - in /branches/tmp/sh/mod-ui/ncurses/src: NCMenuButton.cc NCRichText.cc NCurses.h YNCursesUI.cc
by gs@svn.opensuse.org 10 Nov '07
by gs@svn.opensuse.org 10 Nov '07
10 Nov '07
Author: gs
Date: Sat Nov 10 08:23:21 2007
New Revision: 41952
URL: http://svn.opensuse.org/viewcvs/yast?rev=41952&view=rev
Log:
use YMenuItem to store menu selection,
create YMeuEvent(YMenuItem) to propagate the menu event
Modified:
branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.cc
branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc
branches/tmp/sh/mod-ui/ncurses/src/NCurses.h
branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCM…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCMenuButton.cc Sat Nov 10 08:23:21 2007
@@ -197,9 +197,11 @@
NCursesEvent ret = NCursesEvent::menu;
// FIXME - check this
- YStringWidgetID * selectionID = new YStringWidgetID( findMenuItem( selection )->label() );
- ret.selection = selectionID;
+ // YStringWidgetID * selectionID = new YStringWidgetID( findMenuItem( selection )->label() );
+ // ret.selection = selectionID;
+ ret.selection = findMenuItem( selection );
+
YDialog::deleteTopmostDialog();
return ret;
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCR…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCRichText.cc Sat Nov 10 08:23:21 2007
@@ -317,7 +317,7 @@
NCMIL << "LINK: " << ycpstr << endl;
YStringWidgetID * selectionID = new YStringWidgetID( ycpstr );
//ret.selection = YCPString( ycpstr );
- ret.selection = selectionID;
+ //ret.selection = selectionID;
}
break;
}
Modified: branches/tmp/sh/mod-ui/ncurses/src/NCurses.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/NCu…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/NCurses.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/NCurses.h Sat Nov 10 08:23:21 2007
@@ -88,7 +88,7 @@
Type type;
NCWidget * widget;
- YWidgetID * selection; // used for MenuEvent (the menu selection)
+ YMenuItem * selection; // used for MenuEvent (the menu selection)
//YCPValue selection;
YCPValue result; // can be used for any result
Modified: branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/YNC…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/YNCursesUI.cc Sat Nov 10 08:23:21 2007
@@ -182,7 +182,8 @@
}
else
{
- STREAM << "(" << OBJ.selection->toString() << ")"; // FIXME valuetype()???
+ // FIXME: check this - was valuetype() see above
+ STREAM << "(" << OBJ.selection->label() << ")";
}
return STREAM << " for " << OBJ.widget;
}
@@ -213,7 +214,7 @@
case menu:
if ( selection )
- return new YMenuEvent( selection->toString() );
+ return new YMenuEvent( selection );
else
return 0;
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r41951 - in /branches/tmp/sh/mod-ui/ncurses/src/pkg: NCPackageSelector.cc NCPackageSelector.h
by gs@svn.opensuse.org 10 Nov '07
by gs@svn.opensuse.org 10 Nov '07
10 Nov '07
Author: gs
Date: Sat Nov 10 08:17:28 2007
New Revision: 41951
URL: http://svn.opensuse.org/viewcvs/yast?rev=41951&view=rev
Log:
get correct widget ids
Modified:
branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc
branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.h
Modified: branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/pkg…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.cc Sat Nov 10 08:17:28 2007
@@ -50,6 +50,7 @@
#include "YWidgetID.h"
#include "YCPDialogParser.h"
+#include "YCPValueWidgetID.h"
#include "YPackageSelector.h"
typedef zypp::ui::PatchContents ZyppPatchContents;
@@ -60,6 +61,7 @@
#include <ycp/YCPString.h>
#include <ycp/YCPVoid.h>
#include <ycp/Parser.h>
+#include "YEvent.h"
#define DEFAULT_EXPORT_FILE_NAME "user-packages.xml"
@@ -215,6 +217,7 @@
// call YDialog::deleteTopmostDialog() instead at the end of
// NCPackageSelectorPlugin::runPkgSelection
}
+
///////////////////////////////////////////////////////////////////
//
// createPopups
@@ -271,8 +274,6 @@
YStringTreeItem * NCPackageSelector::getDefaultRpmGroup()
{
- NCMIL << "Calling getDefaultRpmGroup()" << endl;
-
if ( filterPopup )
return filterPopup->getDefaultGroup();
else
@@ -432,6 +433,43 @@
return diff;
}
+string NCPackageSelector::getButtonId( YWidget * button )
+{
+ YCPValueWidgetID * ycpId;
+ string id;
+
+ if ( !button )
+ return id;
+
+ YWidgetID * widgetId = button->id();
+ if ( widgetId )
+ {
+ ycpId = dynamic_cast<YCPValueWidgetID *>(widgetId);
+ if ( ycpId )
+ {
+ id = ycpId->toString();
+ }
+ }
+ return id;
+}
+
+string NCPackageSelector::getMenuId( YMenuItem *menuItem )
+{
+ string id;
+ YMenuEvent * menuEvent;
+
+ if ( !menuItem )
+ return id;
+
+ menuEvent = new YMenuEvent( menuItem );
+ if ( menuEvent )
+ {
+ YCPValue selectionId = menuEvent->id();
+ id = selectionId->toString();
+ }
+ return id;
+}
+
///////////////////////////////////////////////////////////////////
//
// handleEvent
@@ -441,7 +479,7 @@
bool NCPackageSelector::handleEvent ( const NCursesEvent& event )
{
bool retVal = false;
- YWidgetID * currentId = 0;
+ string currentId = "";
//YCPValue currentId = YCPNull();
if ( event == NCursesEvent::handled )
@@ -450,28 +488,32 @@
// Get the id of the widget which is affected
if ( event == NCursesEvent::button )
{
- currentId = dynamic_cast<YWidget *>(event.widget)->id();
+ YWidget * widget = dynamic_cast<YWidget *>(event.widget);
+ if ( widget )
+ currentId = getButtonId( widget );
}
else if ( event == NCursesEvent::menu )
{
- currentId = event.selection;
+ currentId = getMenuId(event.selection);
}
// Find the handler-function for the given widget-nameId
- if ( currentId )
+ if ( currentId != "" )
{
- UIMIL << "Selected widget id: " << currentId->toString() << endl;
+ UIMIL << "Selected widget id: " << currentId << endl;
+ // remove '"' at begin and end of cuurentId
+ string linkId = currentId.substr(1,currentId.substr().length()-2);
// hyperlink
//if ( currentId->isString()
// && currentId->asString()->value().substr(0, 4) == "pkg:" )
- if ( currentId->toString().substr(0,4) == "pkg:" )
+ if ( linkId.substr(0,4) == "pkg:" )
{
//LinkHandler( currentId->asString()->value() );
- LinkHandler( currentId->toString() );
+ LinkHandler( linkId );
return true;
}
- tHandlerMap::iterator it = eventHandlerMap.find ( currentId->toString() );
+ tHandlerMap::iterator it = eventHandlerMap.find ( currentId );
if (it != eventHandlerMap.end()) // if currentId found in map
{
@@ -480,7 +522,7 @@
}
else
{
- UIERR << "Unhandled event for widget-Id: " << currentId->toString() << endl;
+ UIERR << "Unhandled event for widget-Id: " << currentId << endl;
// return true means: don't leave the event loop in runPkgSelection
retVal = true;
@@ -1460,7 +1502,7 @@
NCERR << "*** InformationHandler RETURN false ***" << endl;
return false;
}
-
+#if 0
if ( visibleInfo->isEqual( event.selection ) )
{
// information selection has not changed
@@ -1568,7 +1610,7 @@
}
packageList->setKeyboardFocus();
-
+#endif
UIMIL << "Change package info to: " << visibleInfo->toString() << endl;
return true;
}
@@ -1590,8 +1632,9 @@
NCPkgNames::OKLabel() );
info->setNiceSize( 35, 5 );
+ string selId = getMenuId( event.selection );
// ( event.selection->compare( NCPkgNames::ShowDeps() ) == YO_EQUAL )
- if ( event.selection->toString() == "showdeps" )
+ if ( selId == NCPkgNames::ShowDeps()->toString() )
{
bool ok = false;
@@ -1609,14 +1652,14 @@
showDiskSpace();
}
// else if ( event.selection->compare( NCPkgNames::VerifySystem() ) == YO_EQUAL )
- else if ( event.selection->toString() == "verifysystem" )
+ else if ( selId == NCPkgNames::VerifySystem()->toString() )
{
verifyPackageDependencies();
updatePackageList();
showDiskSpace();
}
// else if ( event.selection->compare( NCPkgNames::AutoDeps() ) == YO_EQUAL )
- else if ( event.selection->toString() == "autodeps" )
+ else if ( selId == NCPkgNames::AutoDeps()->toString() )
{
char menu[2000];
@@ -1717,18 +1760,20 @@
{
return false;
}
-
+ string selId = getMenuId( event.selection );
+
// if ( event.selection->compare( NCPkgNames::RpmGroups() ) == YO_EQUAL )
- if ( event.selection->toString() == "groups" )
+ if ( selId == NCPkgNames::RpmGroups()->toString() )
{
if ( filterPopup )
{
+ NCMIL << "Showing RPM groups" << endl;
// show the filter popup (fills the package list)
retEvent = filterPopup->showFilterPopup( );
}
}
// else if ( event.selection->compare( NCPkgNames::Selections() ) == YO_EQUAL )
- else if ( event.selection->toString() == "selections" )
+ else if ( selId == NCPkgNames::Selections()->toString() )
{
if ( selectionPopup )
{
@@ -1737,7 +1782,7 @@
}
}
// else if ( event.selection->compare( NCPkgNames::Patterns() ) == YO_EQUAL )
- else if ( event.selection->toString() == "patterns" )
+ else if ( selId == NCPkgNames::Patterns()->toString() )
{
if ( patternPopup )
{
@@ -1746,7 +1791,7 @@
}
}
// else if ( event.selection->compare( NCPkgNames::Languages() ) == YO_EQUAL )
- else if ( event.selection->toString() == "languages" )
+ else if ( selId == NCPkgNames::Languages()->toString() )
{
if ( languagePopup )
{
@@ -1756,57 +1801,57 @@
}
// patches
// else if ( event.selection->compare( NCPkgNames::Recommended() ) == YO_EQUAL )
- else if ( event.selection->toString() == "recommended" )
+ else if ( selId == NCPkgNames::Recommended()->toString() )
{
fillPatchList( "recommended" ); // patch kind
}
// else if ( event.selection->compare( NCPkgNames::Security() ) == YO_EQUAL )
- else if ( event.selection->toString() == "security" )
+ else if ( selId == NCPkgNames::Security()->toString() )
{
fillPatchList( "security" ); // patch kind
}
// else if ( event.selection->compare( NCPkgNames::Optional() ) == YO_EQUAL )
- else if ( event.selection->toString() == "optional" )
+ else if ( selId == NCPkgNames::Optional()->toString() )
{
fillPatchList( "optional" ); // patch kind
}
// else if ( event.selection->compare( NCPkgNames::YaST2Patches() ) == YO_EQUAL )
- else if ( event.selection->toString() == "yast2" )
+ else if ( selId == NCPkgNames::YaST2Patches()->toString() )
{
fillPatchList( "YaST2" ); // patch kind
}
// else if ( event.selection->compare( NCPkgNames::AllPatches() ) == YO_EQUAL )
- else if ( event.selection->toString() == "allpatches" )
+ else if ( selId == NCPkgNames::AllPatches()->toString() )
{
fillPatchList( "all" ); // show all patches
}
// else if ( event.selection->compare( NCPkgNames::InstalledPatches() ) == YO_EQUAL )
- else if ( event.selection->toString() == "instpatches" )
+ else if ( selId == NCPkgNames::InstalledPatches()->toString() )
{
fillPatchList( "installed" ); // show installed patches
}
// else if ( event.selection->compare( NCPkgNames::InstallablePatches() ) == YO_EQUAL )
- else if ( event.selection->toString() == "installablepatches" )
+ else if ( selId == NCPkgNames::InstallablePatches()->toString() )
{
fillPatchList( "installable" ); // show installed patches
}
// else if ( event.selection->compare( NCPkgNames::NewPatches() ) == YO_EQUAL )
- else if ( event.selection->toString() == "newpatches" )
+ else if ( selId == NCPkgNames::NewPatches()->toString() )
{
fillPatchList( "new" ); // show new patches
}
// else if ( event.selection->compare( NCPkgNames::UpdateList() ) == YO_EQUAL )
- else if ( event.selection->toString() == "updatelist" )
+ else if ( selId == NCPkgNames::UpdateList()->toString() )
{
fillUpdateList();
}
// else if ( event.selection->compare( NCPkgNames::Whatif() ) == YO_EQUAL )
- else if ( event.selection->toString() == "whatif" )
+ else if ( selId == NCPkgNames::Whatif()->toString() )
{
fillSummaryList( NCPkgTable::L_Changes );
}
// else if ( event.selection->compare( NCPkgNames::Installed() ) == YO_EQUAL )
- else if ( event.selection->toString() == "installed" )
+ else if ( selId == NCPkgNames::Installed()->toString() )
{
fillSummaryList( NCPkgTable::L_Installed );
}
@@ -1829,7 +1874,7 @@
bool NCPackageSelector::StatusHandler( const NCursesEvent& event )
{
NCPkgTable * packageList = getPackageList();
-
+
if ( !packageList
|| !event.selection )
{
@@ -1842,14 +1887,16 @@
return true;
}
+ string selId = getMenuId( event.selection );
+
// call the corresponding method of NCPkgTable
// if ( event.selection->compare( NCPkgNames::Toggle() ) == YO_EQUAL )
- if ( event.selection->toString() == "toggle" )
+ if ( selId == NCPkgNames::Toggle()->toString() )
{
packageList->toggleObjStatus( );
}
// else if ( event.selection->compare( NCPkgNames::Select() ) == YO_EQUAL )
- else if ( event.selection->toString() =="select" )
+ else if ( selId == NCPkgNames::Select()->toString() )
{
if ( testMode )
diskspacePopup->setDiskSpace( '+' );
@@ -1857,7 +1904,7 @@
packageList->changeObjStatus( '+' );
}
// else if ( event.selection->compare( NCPkgNames::Delete() ) == YO_EQUAL )
- else if (event.selection->toString() == "delete" )
+ else if (selId == NCPkgNames::Delete()->toString() )
{
if ( testMode )
diskspacePopup->setDiskSpace( '-' );
@@ -1865,7 +1912,7 @@
packageList->changeObjStatus( '-' );
}
// else if ( event.selection->compare( NCPkgNames::Update() ) == YO_EQUAL )
- else if (event.selection->toString() == "update" )
+ else if ( selId == NCPkgNames::Update()->toString() )
{
if ( testMode )
diskspacePopup->checkDiskSpaceRange();
@@ -1873,61 +1920,61 @@
packageList->changeObjStatus( '>' );
}
// else if ( event.selection->compare( NCPkgNames::TabooOn() ) == YO_EQUAL )
- else if (event.selection->toString() == "tabooOn" )
+ else if (selId == NCPkgNames::TabooOn()->toString() )
{
packageList->changeObjStatus( '!' );
}
// else if ( event.selection->compare( NCPkgNames::TabooOff() ) == YO_EQUAL )
- else if (event.selection->toString() == "tabooOff" )
+ else if (selId == NCPkgNames::TabooOff()->toString() )
{
packageList->changeObjStatus( '%' );
}
// else if ( event.selection->compare( NCPkgNames::SourceYes() ) == YO_EQUAL )
- else if (event.selection->toString() == "sourceYes" )
+ else if (selId == NCPkgNames::SourceYes()->toString() )
{
#ifdef FIXME
packageList->SourceInstall( true );
#endif
}
// else if ( event.selection->compare( NCPkgNames::SourceNo() ) == YO_EQUAL )
- else if (event.selection->toString() == "sourceNo" )
+ else if (selId == NCPkgNames::SourceNo()->toString() )
{
#ifdef FIXME
packageList->SourceInstall( false );
#endif
}
// else if ( event.selection->compare( NCPkgNames::InstallAll() ) == YO_EQUAL )
- else if (event.selection->toString() == "selall" )
+ else if (selId == NCPkgNames::InstallAll()->toString() )
{
packageList->changeListObjStatus( NCPkgTable::A_Install );
}
// else if ( event.selection->compare( NCPkgNames::DontInstall() ) == YO_EQUAL )
- else if (event.selection->toString() == "deselall" )
+ else if (selId == "deselall" )
{
packageList->changeListObjStatus( NCPkgTable::A_DontInstall );
}
// else if ( event.selection->compare( NCPkgNames::DeleteAll() ) == YO_EQUAL )
- else if (event.selection->toString() == "delall" )
+ else if (selId == NCPkgNames::DeleteAll()->toString() )
{
packageList->changeListObjStatus( NCPkgTable::A_Delete );
}
// else if ( event.selection->compare( NCPkgNames::DontDelete() ) == YO_EQUAL )
- else if (event.selection->toString() == "dontdel" )
+ else if (selId == NCPkgNames::DontDelete()->toString() )
{
packageList->changeListObjStatus( NCPkgTable::A_DontDelete );
}
// else if ( event.selection->compare( NCPkgNames::UpdateNewer() ) == YO_EQUAL )
- else if (event.selection->toString() == "updnewer" )
+ else if (selId == NCPkgNames::UpdateNewer()->toString() )
{
packageList->changeListObjStatus( NCPkgTable::A_UpdateNewer );
}
// else if ( event.selection->compare( NCPkgNames::UpdateAll() ) == YO_EQUAL )
- else if (event.selection->toString() == "updall" )
+ else if (selId == NCPkgNames::UpdateAll()->toString() )
{
packageList->changeListObjStatus( NCPkgTable::A_Update );
}
// else if ( event.selection->compare( NCPkgNames::DontUpdate() ) == YO_EQUAL )
- else if (event.selection->toString() == "dontupd" )
+ else if (selId == NCPkgNames::DontUpdate()->toString() )
{
packageList->changeListObjStatus( NCPkgTable::A_DontUpdate );
}
@@ -2053,9 +2100,11 @@
return false;
}
+ string selId = getMenuId( event.selection );
+
//Export package list into file
// if ( event.selection->compare( NCPkgNames::ExportToFile() ) == YO_EQUAL )
- if ( event.selection->toString() =="export" )
+ if ( selId == NCPkgNames::ExportToFile()->toString() )
{
//Ask for file to save into
YCPValue filename = YNCursesUI::ui()->askForSaveFileName( YCPString(DEFAULT_EXPORT_FILE_NAME),
@@ -2109,7 +2158,7 @@
//Import package list from file
// else if ( event.selection->compare( NCPkgNames::ImportFromFile() ) == YO_EQUAL )
- else if ( event.selection->toString() =="import" )
+ else if ( selId == NCPkgNames::ImportFromFile()->toString() )
{
//ask for file to open
YCPValue filename = YNCursesUI::ui()->askForExistingFile( YCPString(DEFAULT_EXPORT_FILE_NAME),
@@ -2208,9 +2257,11 @@
{
return false;
}
+
+ string selId = getMenuId( event.selection );
// if ( event.selection->compare( NCPkgNames::GeneralHelp() ) == YO_EQUAL )
- if ( event.selection->toString() == "help_general" )
+ if ( selId == NCPkgNames::GeneralHelp()->toString() )
{
text += NCPkgNames::HelpPkgInst1();
text += NCPkgNames::HelpPkgInst12();
@@ -2222,7 +2273,7 @@
text += NCPkgNames::HelpPkgInst6();
}
// else if ( event.selection->compare( NCPkgNames::StatusHelp() ) == YO_EQUAL )
- else if ( event.selection->toString() == "help_status" )
+ else if ( selId == NCPkgNames::StatusHelp()->toString() )
{
text += NCPkgNames::HelpOnStatus1();
text += NCPkgNames::HelpOnStatus2();
@@ -2233,12 +2284,12 @@
text += NCPkgNames::HelpOnStatus7();
}
// else if ( event.selection->compare( NCPkgNames::UpdateHelp() ) == YO_EQUAL )
- else if ( event.selection->toString() == "help_update" )
+ else if ( selId == NCPkgNames::UpdateHelp()->toString() )
{
text += NCPkgNames::HelpOnUpdate();
}
// else if ( event.selection->compare( NCPkgNames::SearchHelp() ) == YO_EQUAL )
- else if ( event.selection->toString() == "help_search" )
+ else if ( selId == NCPkgNames::SearchHelp()->toString() )
{
headline = YCPString(NCPkgNames::SearchHeadline());
text += NCPkgNames::HelpOnSearch();
Modified: branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/ncurses/src/pkg…
==============================================================================
--- branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.h (original)
+++ branches/tmp/sh/mod-ui/ncurses/src/pkg/NCPackageSelector.h Sat Nov 10 08:17:28 2007
@@ -114,6 +114,8 @@
protected:
+ string getButtonId( YWidget *button );
+ string getMenuId( YMenuItem *menu );
public:
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r41950 - in /branches/tmp/sh/mod-ui/core/libyui/src: UIBuiltinCalls.h UIBuiltinTable.h Y2UINamespace.h
by sh-sh-sh@svn.opensuse.org 09 Nov '07
by sh-sh-sh@svn.opensuse.org 09 Nov '07
09 Nov '07
Author: sh-sh-sh
Date: Fri Nov 9 19:44:23 2007
New Revision: 41950
URL: http://svn.opensuse.org/viewcvs/yast?rev=41950&view=rev
Log:
merged mvidner's latest changes from trunk
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/UIBuiltinCalls.h
branches/tmp/sh/mod-ui/core/libyui/src/UIBuiltinTable.h
branches/tmp/sh/mod-ui/core/libyui/src/Y2UINamespace.h
Modified: branches/tmp/sh/mod-ui/core/libyui/src/UIBuiltinCalls.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/UIBuiltinCalls.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/UIBuiltinCalls.h Fri Nov 9 19:44:23 2007
@@ -1,55 +1,193 @@
- case 0: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, String is required"); return YCPVoid();} return m_instance->SetLanguage (m_param1->asString());
- case 1: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, String is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, String is required"); return YCPVoid();} return m_instance->SetLanguage (m_param1->asString(), m_param2->asString());
- case 2: return m_instance->GetProductName ();
- case 3: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, String is required"); return YCPVoid();} return m_instance->SetProductName (m_param1->asString());
- case 4: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, String is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, String is required"); return YCPVoid();} if (m_param3->isVoid()) {y2error("ERROR: Parameter 3 is nil, String is required"); return YCPVoid();} if (m_param4->isVoid()) {y2error("ERROR: Parameter 4 is nil, String is required"); return YCPVoid();} if (m_param5->isVoid()) {y2error("ERROR: Parameter 5 is nil, String is required"); return YCPVoid();} return m_instance->SetConsoleFont (m_param1->asString(), m_param2->asString(), m_param3->asString(), m_param4->asString(), m_param5->asString());
- case 5: return m_instance->SetKeyboard ();
- case 6: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Boolean is required"); return YCPVoid();} return m_instance->GetLanguage (m_param1->asBoolean());
- case 7: return m_instance->UserInput ();
- case 8: return m_instance->PollInput ();
- case 9: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Integer is required"); return YCPVoid();} return m_instance->TimeoutUserInput (m_param1->asInteger());
- case 10: return m_instance->WaitForEvent ();
- case 11: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Integer is required"); return YCPVoid();} return m_instance->WaitForEvent (m_param1->asInteger());
- case 12: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Term is required"); return YCPVoid();} return m_instance->OpenDialog (m_param1->asTerm());
- case 13: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Term is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, Term is required"); return YCPVoid();} return m_instance->OpenDialog (m_param1->asTerm(), m_param2->asTerm());
- case 14: return m_instance->CloseDialog ();
- case 15: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Symbol is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, Symbol is required"); return YCPVoid();} if (m_param3->isVoid()) {y2error("ERROR: Parameter 3 is nil, Value is required"); return YCPVoid();} return m_instance->ChangeWidget (m_param1->asSymbol(), m_param2->asSymbol(), m_param3->asValue());
- case 16: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Term is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, Symbol is required"); return YCPVoid();} if (m_param3->isVoid()) {y2error("ERROR: Parameter 3 is nil, Value is required"); return YCPVoid();} return m_instance->ChangeWidget (m_param1->asTerm(), m_param2->asSymbol(), m_param3->asValue());
- case 17: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Term is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, Term is required"); return YCPVoid();} if (m_param3->isVoid()) {y2error("ERROR: Parameter 3 is nil, Value is required"); return YCPVoid();} return m_instance->ChangeWidget (m_param1->asTerm(), m_param2->asTerm(), m_param3->asValue());
- case 18: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Symbol is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, Symbol is required"); return YCPVoid();} return m_instance->QueryWidget (m_param1->asSymbol(), m_param2->asSymbol());
- case 19: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Symbol is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, Term is required"); return YCPVoid();} return m_instance->QueryWidget (m_param1->asSymbol(), m_param2->asTerm());
- case 20: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Term is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, Symbol is required"); return YCPVoid();} return m_instance->QueryWidget (m_param1->asTerm(), m_param2->asSymbol());
- case 21: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Term is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, Term is required"); return YCPVoid();} return m_instance->QueryWidget (m_param1->asTerm(), m_param2->asTerm());
- case 22: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Symbol is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, Term is required"); return YCPVoid();} return m_instance->ReplaceWidget (m_param1->asSymbol(), m_param2->asTerm());
- case 23: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Term is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, Term is required"); return YCPVoid();} return m_instance->ReplaceWidget (m_param1->asTerm(), m_param2->asTerm());
- case 24: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Symbol is required"); return YCPVoid();} return m_instance->SetFocus (m_param1->asSymbol());
- case 25: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Term is required"); return YCPVoid();} return m_instance->SetFocus (m_param1->asTerm());
- case 26: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, String is required"); return YCPVoid();} return m_instance->RunInTerminal (m_param1->asString());
- case 27: return m_instance->BusyCursor ();
- case 28: return m_instance->RedrawScreen ();
- case 29: return m_instance->NormalCursor ();
- case 30: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, String is required"); return YCPVoid();} return m_instance->MakeScreenShot (m_param1->asString());
- case 31: return m_instance->MakeScreenShot ();
- case 32: return m_instance->DumpWidgetTree ();
- case 33: return m_instance->Beep ();
- case 34: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, String is required"); return YCPVoid();} return m_instance->RecordMacro (m_param1->asString());
- case 35: return m_instance->StopRecordMacro ();
- case 36: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, String is required"); return YCPVoid();} return m_instance->PlayMacro (m_param1->asString());
- case 37: return m_instance->FakeUserInput ();
- case 38: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Value is required"); return YCPVoid();} return m_instance->FakeUserInput (m_param1->asValue());
- case 39: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Symbol is required"); return YCPVoid();} return m_instance->Glyph (m_param1->asSymbol());
- case 40: return m_instance->GetDisplayInfo ();
- case 41: return m_instance->RecalcLayout ();
- case 42: return m_instance->PostponeShortcutCheck ();
- case 43: return m_instance->CheckShortcuts ();
- case 44: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Symbol is required"); return YCPVoid();} return m_instance->WidgetExists (m_param1->asSymbol());
- case 45: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Term is required"); return YCPVoid();} return m_instance->WidgetExists (m_param1->asTerm());
- case 46: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Value is required"); return YCPVoid();} return m_instance->RunPkgSelection (m_param1->asValue());
- case 47: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, String is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, String is required"); return YCPVoid();} return m_instance->AskForExistingDirectory (m_param1->asString(), m_param2->asString());
- case 48: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, String is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, String is required"); return YCPVoid();} if (m_param3->isVoid()) {y2error("ERROR: Parameter 3 is nil, String is required"); return YCPVoid();} return m_instance->AskForExistingFile (m_param1->asString(), m_param2->asString(), m_param3->asString());
- case 49: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, String is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, String is required"); return YCPVoid();} if (m_param3->isVoid()) {y2error("ERROR: Parameter 3 is nil, String is required"); return YCPVoid();} return m_instance->AskForSaveFileName (m_param1->asString(), m_param2->asString(), m_param3->asString());
- case 50: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Map is required"); return YCPVoid();} return m_instance->SetFunctionKeys (m_param1->asMap());
- case 51: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, String is required"); return YCPVoid();} if (m_param2->isVoid()) {y2error("ERROR: Parameter 2 is nil, String is required"); return YCPVoid();} if (m_param3->isVoid()) {y2error("ERROR: Parameter 3 is nil, String is required"); return YCPVoid();} return m_instance->Recode (m_param1->asString(), m_param2->asString(), m_param3->asString());
- case 52: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, String is required"); return YCPVoid();} return m_instance->SetModulename (m_param1->asString());
- case 53: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Symbol is required"); return YCPVoid();} return m_instance->HasSpecialWidget (m_param1->asSymbol());
- case 54: if (m_param1->isVoid()) {y2error("ERROR: Parameter 1 is nil, Term is required"); return YCPVoid();} return m_instance->WizardCommand (m_param1->asTerm());
+ // This file is generated by generateYCPwrappers from Y2UINamespace.h
+
+ static const char * err_fmt = "Parameter %d is nil, %s is required";
+ case 0: // SetLanguage
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "String"); return YCPVoid();}
+ return m_instance->SetLanguage (m_param1->asString());
+ case 1: // SetLanguage
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "String"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "String"); return YCPVoid();}
+ return m_instance->SetLanguage (m_param1->asString(), m_param2->asString());
+ case 2: // GetProductName
+
+ return m_instance->GetProductName ();
+ case 3: // SetProductName
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "String"); return YCPVoid();}
+ return m_instance->SetProductName (m_param1->asString());
+ case 4: // SetConsoleFont
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "String"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "String"); return YCPVoid();}
+ if (m_param3->isVoid()) {ycp2error(err_fmt, 3, "String"); return YCPVoid();}
+ if (m_param4->isVoid()) {ycp2error(err_fmt, 4, "String"); return YCPVoid();}
+ if (m_param5->isVoid()) {ycp2error(err_fmt, 5, "String"); return YCPVoid();}
+ return m_instance->SetConsoleFont (m_param1->asString(), m_param2->asString(), m_param3->asString(), m_param4->asString(), m_param5->asString());
+ case 5: // SetKeyboard
+
+ return m_instance->SetKeyboard ();
+ case 6: // GetLanguage
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Boolean"); return YCPVoid();}
+ return m_instance->GetLanguage (m_param1->asBoolean());
+ case 7: // UserInput
+
+ return m_instance->UserInput ();
+ case 8: // PollInput
+
+ return m_instance->PollInput ();
+ case 9: // TimeoutUserInput
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Integer"); return YCPVoid();}
+ return m_instance->TimeoutUserInput (m_param1->asInteger());
+ case 10: // WaitForEvent
+
+ return m_instance->WaitForEvent ();
+ case 11: // WaitForEvent
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Integer"); return YCPVoid();}
+ return m_instance->WaitForEvent (m_param1->asInteger());
+ case 12: // OpenDialog
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Term"); return YCPVoid();}
+ return m_instance->OpenDialog (m_param1->asTerm());
+ case 13: // OpenDialog
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Term"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "Term"); return YCPVoid();}
+ return m_instance->OpenDialog (m_param1->asTerm(), m_param2->asTerm());
+ case 14: // CloseDialog
+
+ return m_instance->CloseDialog ();
+ case 15: // ChangeWidget
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Symbol"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "Symbol"); return YCPVoid();}
+ // m_param3 may be nil
+ return m_instance->ChangeWidget (m_param1->asSymbol(), m_param2->asSymbol(), m_param3->asValue());
+ case 16: // ChangeWidget
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Term"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "Symbol"); return YCPVoid();}
+ // m_param3 may be nil
+ return m_instance->ChangeWidget (m_param1->asTerm(), m_param2->asSymbol(), m_param3->asValue());
+ case 17: // ChangeWidget
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Term"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "Term"); return YCPVoid();}
+ if (m_param3->isVoid()) {ycp2error(err_fmt, 3, "Value"); return YCPVoid();}
+ return m_instance->ChangeWidget (m_param1->asTerm(), m_param2->asTerm(), m_param3->asValue());
+ case 18: // QueryWidget
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Symbol"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "Symbol"); return YCPVoid();}
+ return m_instance->QueryWidget (m_param1->asSymbol(), m_param2->asSymbol());
+ case 19: // QueryWidget
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Symbol"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "Term"); return YCPVoid();}
+ return m_instance->QueryWidget (m_param1->asSymbol(), m_param2->asTerm());
+ case 20: // QueryWidget
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Term"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "Symbol"); return YCPVoid();}
+ return m_instance->QueryWidget (m_param1->asTerm(), m_param2->asSymbol());
+ case 21: // QueryWidget
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Term"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "Term"); return YCPVoid();}
+ return m_instance->QueryWidget (m_param1->asTerm(), m_param2->asTerm());
+ case 22: // ReplaceWidget
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Symbol"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "Term"); return YCPVoid();}
+ return m_instance->ReplaceWidget (m_param1->asSymbol(), m_param2->asTerm());
+ case 23: // ReplaceWidget
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Term"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "Term"); return YCPVoid();}
+ return m_instance->ReplaceWidget (m_param1->asTerm(), m_param2->asTerm());
+ case 24: // SetFocus
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Symbol"); return YCPVoid();}
+ return m_instance->SetFocus (m_param1->asSymbol());
+ case 25: // SetFocus
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Term"); return YCPVoid();}
+ return m_instance->SetFocus (m_param1->asTerm());
+ case 26: // RunInTerminal
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "String"); return YCPVoid();}
+ return m_instance->RunInTerminal (m_param1->asString());
+ case 27: // BusyCursor
+
+ return m_instance->BusyCursor ();
+ case 28: // RedrawScreen
+
+ return m_instance->RedrawScreen ();
+ case 29: // NormalCursor
+
+ return m_instance->NormalCursor ();
+ case 30: // MakeScreenShot
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "String"); return YCPVoid();}
+ return m_instance->MakeScreenShot (m_param1->asString());
+ case 31: // MakeScreenShot
+
+ return m_instance->MakeScreenShot ();
+ case 32: // DumpWidgetTree
+
+ return m_instance->DumpWidgetTree ();
+ case 33: // Beep
+
+ return m_instance->Beep ();
+ case 34: // RecordMacro
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "String"); return YCPVoid();}
+ return m_instance->RecordMacro (m_param1->asString());
+ case 35: // StopRecordMacro
+
+ return m_instance->StopRecordMacro ();
+ case 36: // PlayMacro
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "String"); return YCPVoid();}
+ return m_instance->PlayMacro (m_param1->asString());
+ case 37: // FakeUserInput
+
+ return m_instance->FakeUserInput ();
+ case 38: // FakeUserInput
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Value"); return YCPVoid();}
+ return m_instance->FakeUserInput (m_param1->asValue());
+ case 39: // Glyph
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Symbol"); return YCPVoid();}
+ return m_instance->Glyph (m_param1->asSymbol());
+ case 40: // GetDisplayInfo
+
+ return m_instance->GetDisplayInfo ();
+ case 41: // RecalcLayout
+
+ return m_instance->RecalcLayout ();
+ case 42: // PostponeShortcutCheck
+
+ return m_instance->PostponeShortcutCheck ();
+ case 43: // CheckShortcuts
+
+ return m_instance->CheckShortcuts ();
+ case 44: // WidgetExists
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Symbol"); return YCPVoid();}
+ return m_instance->WidgetExists (m_param1->asSymbol());
+ case 45: // WidgetExists
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Term"); return YCPVoid();}
+ return m_instance->WidgetExists (m_param1->asTerm());
+ case 46: // RunPkgSelection
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Value"); return YCPVoid();}
+ return m_instance->RunPkgSelection (m_param1->asValue());
+ case 47: // AskForExistingDirectory
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "String"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "String"); return YCPVoid();}
+ return m_instance->AskForExistingDirectory (m_param1->asString(), m_param2->asString());
+ case 48: // AskForExistingFile
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "String"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "String"); return YCPVoid();}
+ if (m_param3->isVoid()) {ycp2error(err_fmt, 3, "String"); return YCPVoid();}
+ return m_instance->AskForExistingFile (m_param1->asString(), m_param2->asString(), m_param3->asString());
+ case 49: // AskForSaveFileName
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "String"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "String"); return YCPVoid();}
+ if (m_param3->isVoid()) {ycp2error(err_fmt, 3, "String"); return YCPVoid();}
+ return m_instance->AskForSaveFileName (m_param1->asString(), m_param2->asString(), m_param3->asString());
+ case 50: // SetFunctionKeys
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Map"); return YCPVoid();}
+ return m_instance->SetFunctionKeys (m_param1->asMap());
+ case 51: // Recode
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "String"); return YCPVoid();}
+ if (m_param2->isVoid()) {ycp2error(err_fmt, 2, "String"); return YCPVoid();}
+ if (m_param3->isVoid()) {ycp2error(err_fmt, 3, "String"); return YCPVoid();}
+ return m_instance->Recode (m_param1->asString(), m_param2->asString(), m_param3->asString());
+ case 52: // SetModulename
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "String"); return YCPVoid();}
+ return m_instance->SetModulename (m_param1->asString());
+ case 53: // HasSpecialWidget
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Symbol"); return YCPVoid();}
+ return m_instance->HasSpecialWidget (m_param1->asSymbol());
+ case 54: // WizardCommand
+ if (m_param1->isVoid()) {ycp2error(err_fmt, 1, "Term"); return YCPVoid();}
+ return m_instance->WizardCommand (m_param1->asTerm());
Modified: branches/tmp/sh/mod-ui/core/libyui/src/UIBuiltinTable.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/UIBuiltinTable.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/UIBuiltinTable.h Fri Nov 9 19:44:23 2007
@@ -1,3 +1,5 @@
+ // This file is generated by generateYCPwrappers from Y2UINamespace.h
+
enterSymbol (new SymbolEntry (this, 0, "SetLanguage", SymbolEntry::c_function, Type::fromSignature ("void (string)") ) );
_registered_functions.push_back ("SetLanguage");
enterSymbol (new SymbolEntry (this, 1, "SetLanguage", SymbolEntry::c_function, Type::fromSignature ("void (string, string)") ) );
Modified: branches/tmp/sh/mod-ui/core/libyui/src/Y2UINamespace.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/Y2UINamespace.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/Y2UINamespace.h Fri Nov 9 19:44:23 2007
@@ -182,15 +182,11 @@
/* TYPEINFO: boolean() */
YCPValue CloseDialog();
- // TODO DECL_NIL?
- // 'nil' is a valid new_value! (CheckBox tristate value -> nil)
/* TYPEINFO: boolean (symbol, symbol, any) */
- YCPValue ChangeWidget( const YCPSymbol & widget_id, const YCPSymbol & property, const YCPValue & new_value );
+ YCPValue ChangeWidget( const YCPSymbol & widget_id, const YCPSymbol & property, const YCPValue & /*nil*/ new_value );
- // TODO DECL_NIL?
- // 'nil' is a valid new_value! (CheckBox tristate value -> nil)
/* TYPEINFO: boolean (term, symbol, any) */
- YCPValue ChangeWidget( const YCPTerm & widget_id, const YCPSymbol & property, const YCPValue & new_value );
+ YCPValue ChangeWidget( const YCPTerm & widget_id, const YCPSymbol & property, const YCPValue & /*nil*/ new_value );
// No 'nil' permitted for new_value here
/* TYPEINFO: boolean (term, term, any) */
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r41949 - /branches/tmp/sh/mod-ui/core/base/tools/devtools/generateYCPWrappers
by sh-sh-sh@svn.opensuse.org 09 Nov '07
by sh-sh-sh@svn.opensuse.org 09 Nov '07
09 Nov '07
Author: sh-sh-sh
Date: Fri Nov 9 19:44:03 2007
New Revision: 41949
URL: http://svn.opensuse.org/viewcvs/yast?rev=41949&view=rev
Log:
merged from trunk
Modified:
branches/tmp/sh/mod-ui/core/base/tools/devtools/generateYCPWrappers
Modified: branches/tmp/sh/mod-ui/core/base/tools/devtools/generateYCPWrappers
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/base/tools…
==============================================================================
--- branches/tmp/sh/mod-ui/core/base/tools/devtools/generateYCPWrappers (original)
+++ branches/tmp/sh/mod-ui/core/base/tools/devtools/generateYCPWrappers Fri Nov 9 19:44:03 2007
@@ -1,5 +1,10 @@
#!/usr/bin/perl -w
+# example:
+# /* TYPEINFO: boolean (symbol, symbol, any) */
+# YCPValue ChangeWidget ( const YCPSymbol & widget_id, const YCPSymbol & property, const YCPValue & /*nil*/ new_value );
+
+
my $header_file = shift;
my $call_file = shift;
my $register_file = shift;
@@ -50,6 +55,11 @@
open ( CALL, "> $call_file" ) or die "Cannot open output file";
open ( REGISTER, "> $register_file" ) or die "Cannot open output file";
+my $generated = "\t// This file is generated by generateYCPwrappers from $header_file\n\n";
+print CALL $generated;
+print REGISTER $generated;
+
+print CALL "\t\tstatic const char * err_fmt = \"Parameter %d is nil, %s is required\";\n";
my $position = 0;
while (@exports)
@@ -66,21 +76,23 @@
while (@params)
{
- my @par = split (" ", shift (@params) );
- my $type = $par [0];
- if ( $type =~ /const/ )
- {
- $type = $par [1];
- }
- $type =~ s/^YCP(\w+)&?/$1/;
-
- push (@tests, "if (m_param$paramcount->isVoid()) {y2error(\"ERROR: Parameter $paramcount is nil, ".$type." is required\"); return YCPVoid();}");
-
- $type = "m_param" . $paramcount . "->as" . $type . "()" ;
- push @cppparams, $type;
- $paramcount++;
+ my $par = shift (@params);
+ $par =~ m{(const\s*)?YCP(\w+)\s*(&\s*)?(/\*nil\*/)?};
+ my $type = $2;
+ if (defined $4) { # #340523
+ push (@tests, "// m_param$paramcount may be nil");
+ }
+ else {
+ push (@tests, "if (m_param$paramcount->isVoid()) {ycp2error(err_fmt, $paramcount, \"$type\"); return YCPVoid();}");
+
+ }
+ $type = "m_param" . $paramcount . "->as" . $type . "()" ;
+ push @cppparams, $type;
+ $paramcount++;
}
- print CALL "\t\tcase $position: ". join (" ", @tests) . " return m_instance->$func_name (" . join (", ", @cppparams) . "); \n" ;
+ print CALL "\t\tcase $position: // $func_name\n" .
+ "\t\t\t". join ("\n\t\t\t", @tests) . "\n" .
+ "\t\t\treturn m_instance->$func_name (" . join (", ", @cppparams) . "); \n" ;
print REGISTER "\tenterSymbol (new SymbolEntry (this, $position, " ;
print REGISTER "\"$func_name\", SymbolEntry::c_function, Type::fromSignature (\"$signature\") ) );\n";
@@ -91,7 +103,3 @@
close ( CALL );
close ( REGISTER );
-
-
-0
-
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r41948 - in /branches/tmp/jdsn/edu-users/src: EduUsers.ycp dialogs.ycp
by jdsn@svn.opensuse.org 09 Nov '07
by jdsn@svn.opensuse.org 09 Nov '07
09 Nov '07
Author: jdsn
Date: Fri Nov 9 19:10:34 2007
New Revision: 41948
URL: http://svn.opensuse.org/viewcvs/yast?rev=41948&view=rev
Log:
more stuff
Modified:
branches/tmp/jdsn/edu-users/src/EduUsers.ycp
branches/tmp/jdsn/edu-users/src/dialogs.ycp
Modified: branches/tmp/jdsn/edu-users/src/EduUsers.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/edu-users/src/EduUse…
==============================================================================
--- branches/tmp/jdsn/edu-users/src/EduUsers.ycp (original)
+++ branches/tmp/jdsn/edu-users/src/EduUsers.ycp Fri Nov 9 19:10:34 2007
@@ -19,10 +19,10 @@
*/
/**
- * File: modules/EduUsers.ycp
- * Package: Configuration of edu-users
- * Summary: EduUsers settings, input and output functions
- * Authors: J. Daniel Schmidt <jdsn(a)suse.de>
+ * File: modules/EduUsers.ycp
+ * Package: Configuration of edu-users
+ * Summary: EduUsers settings, input and output functions
+ * Authors: J. Daniel Schmidt <jdsn(a)suse.de>
*
* $Id: EduUsers.ycp 27914 2006-02-13 14:32:08Z locilka $
*
@@ -79,7 +79,7 @@
global define boolean Abort() ``{
if(AbortFunction != nil)
{
- return AbortFunction () == true;
+ return AbortFunction () == true;
}
return false;
}
@@ -96,19 +96,34 @@
// ------------------------------------
/**
- * List of the configured cards.
- */
+ * list of terms to hold the users
+ */
+//global list<term> table_users = []; // `item(`id("login"), "Name", "Surname", "Login", "Age", "Password")
+global map<symbol, string> allusers = $[];
+
+/**
+ * list of terms to hold the groups
+ */
+//global list<term> table_groups = []; // `item(`id("groupname"), "group name", "template name")
+global list<string> allgroups = [];
+
+/**
+ * list of terms to hold the templates
+ */
+//global list<term> table_templates = []; // `item(`id(0), "template name")
+global list<string> alltemplates = [];
-// list of terms to hold the users to be created
-global list<term> table_users = []; // `item(`id("login"), "Name", "Surname", "Login", "Age", "Password")
-global list<term> table_users_show = []; // `item(`id("login"), "Name", "Surname", "Login", "Age")
-global list<term> table_groups = []; // `item(`id("groupname"), "group name", "template name")
-global list<term> table_templates = []; // `item(`id(0), "template name")
+// global list<term> table_users_show = []; // `item(`id("login"), "Name", "Surname", "Login", "Age")
-global string autologin = "";
+
+global string autologin = ""; // FIXME - how did I want to use this
// TODO FIXME function to return the show table dynamically - do not store twice!
+
+
+// only these characters are allowed in template or group names
+string validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
/**
@@ -118,114 +133,45 @@
global boolean Read() {
/* EduUsers read dialog caption */
- string caption = _("Initializing edu-users Configuration");
-
- integer steps = 5;
- // FIXME: read sysconfig, read users, read groups, read templates
-
+ string caption = _("Initializing Edu Users Configuration");
- integer sl = 50;
- sleep(sl);
+ integer steps = 2;
- // We do not set help text here, because it was set outside
Progress::New( caption, " ", steps, [
- /* Progress stage 1/4 */
- _("Read the database"),
- /* Progress stage 2/4 */
- _("Read Edu users"),
- /* Progress stage 3/4 */
- _("Read Edu groups"),
- /* Progress stage 4/4 */
- _("Read Edu templates")
- ], [
- /* Progress step 1/4 */
- _("Reading the database..."),
- /* Progress step 2/4 */
- _("Reading Edu users..."),
- /* Progress step 2/4 */
- _("Reading Edu groups..."),
- /* Progress step 3/4 */
- _("Reading Edu templates..."),
- /* Progress finished */
- _("Finished")
- ],
- ""
+ /* Progress stage 1 */
+ _("Read the settings")
+ ], [
+ /* Progress step 1 */
+ _("Reading the settings..."),
+ /* Progress finished */
+ _("Finished")
+ ],
+ ""
);
- // read sysconfig
+ // --- READ PROCESS
+
+ /* read sysconfig */
if(Abort()) return false;
Progress::NextStage();
-/*
- string gettemplates = (string) SCR::Read(.sysconfig.educlient.TEMPLATES);
- list<string> alltemplates = splitstring(gettemplates, ", ");
-
- // only these characters are allowed in template or group names
- string validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
-
- integer count=0;
- foreach (string str, alltemplates,
- {
- string strmod = filterchars ( str, validChars );
- if ( strmod != nil && size(strmod) > 0 )
- {
- table_templates = add(table_templates, (term)`item(`id(strmod), strmod ) );
- //count = count+1; // needed in case the id changes back to integer
- }
- });
-
- string getgroups = (string) SCR::Read(.sysconfig.educlient.GROUPS);
- list<string> allgroups = splitstring(getgroups, ", ");
-
- count=0;
- foreach (string str, allgroups,
- {
- list<string> grp_tmpl = splitstring(str, ":");
- if ( ! contains( [1 , 2], size(grp_tmpl) ) ) { continue; }
- // add one element, so that we have two in any case
- grp_tmpl = add(grp_tmpl, "");
-
- grp_tmpl[0] = filterchars ( grp_tmpl[0]:"err", validChars );
- grp_tmpl[1] = filterchars ( grp_tmpl[1]:"err", validChars );
- if ( grp_tmpl[1]:"err"==nil ) { grp_tmpl[1]=""; }
-
- table_groups = add(table_groups, (term)`item(`id(count), grp_tmpl[0]:"err", grp_tmpl[1]:"err" ) );
- count=count+1;
- });
+ string gettemplates = (string) SCR::Read(.sysconfig.educlient.TEMPLATES);
+ alltemplates = splitstring(gettemplates, ", ");
+ string getgroups = (string) SCR::Read(.sysconfig.educlient.GROUPS);
+ allgroups = splitstring(getgroups, ", ");
-*/
-
+ // TODO read user data
+ // addusers = something
/* Error message */
- if(false) Report::Error(_("Cannot read database1."));
- sleep(sl);
+ if(false) Report::Error(_("Cannot read settings."));
- // read another database
- if(Abort()) return false;
- Progress::NextStep();
- /* Error message */
- if(false) Report::Error(_("Cannot read database2."));
- sleep(sl);
-
- // read current settings
- if(Abort()) return false;
- Progress::NextStage();
- /* Error message */
- if(false) Report::Error(Message::CannotReadCurrentSettings());
- sleep(sl);
-
- // detect devices
- if(Abort()) return false;
- Progress::NextStage();
- /* Error message */
- if(false) Report::Warning(_("Cannot detect devices."));
- sleep(sl);
+ sleep(1000);
if(Abort()) return false;
/* Progress finished */
Progress::NextStage();
- sleep(sl);
if(Abort()) return false;
modified = false;
@@ -233,6 +179,64 @@
}
/**
+ * get table of templates
+ * @return table of templates
+ */
+global list<term> getTemplateItems()
+{
+ //integer count=0;
+ list<term> table_templates = [];
+
+ foreach (string str, alltemplates,
+ {
+ string strmod = filterchars ( str, validChars );
+ if ( strmod != nil && size(strmod) > 0 )
+ {
+ table_templates = add(table_templates, (term)`item(`id(strmod), strmod ) );
+ //count = count+1; // needed in case the id changes back to integer
+ }
+ });
+
+ return table_templates;
+}
+
+/**
+ * get table of groups
+ * @return table of groups
+ */
+global list<term> getGroupItems()
+{
+ integer count=0;
+ list<term> table_groups = [];
+ foreach (string str, allgroups,
+ {
+ list<string> grp_tmpl = splitstring(str, ":");
+ if ( ! contains( [1 , 2], size(grp_tmpl) ) ) { continue; }
+ // add one element, so that we have two in any case
+ grp_tmpl = add(grp_tmpl, "");
+
+ grp_tmpl[0] = filterchars ( grp_tmpl[0]:"err", validChars );
+ grp_tmpl[1] = filterchars ( grp_tmpl[1]:"err", validChars );
+ if ( grp_tmpl[1]:"err"==nil ) { grp_tmpl[1]=""; }
+
+ table_groups = add(table_groups, (term)`item(`id(count), grp_tmpl[0]:"err", grp_tmpl[1]:"err" ) );
+ count=count+1;
+ });
+
+ return table_groups;
+}
+
+/**
+ * get table of users
+ * @return table of users
+ */
+global list<term> getUserItems() {
+ return [];
+ // return table_users;
+ // `item(`id("login"), "Name", "Surname", "Login", "Age", "Password")
+}
+
+/**
* Write all edu-users settings
* @return true on success
*/
@@ -250,19 +254,19 @@
// TODO FIXME Names of real stages
// We do not set help text here, because it was set outside
Progress::New(caption, " ", steps, [
- /* Progress stage 1/2 */
- _("Write the settings"),
- /* Progress stage 2/2 */
- _("Run SuSEconfig")
- ], [
- /* Progress step 1/2 */
- _("Writing the settings..."),
- /* Progress step 2/2 */
- _("Running SuSEconfig..."),
- /* Progress finished */
- _("Finished")
- ],
- ""
+ /* Progress stage 1/2 */
+ _("Write the settings"),
+ /* Progress stage 2/2 */
+ _("Run SuSEconfig")
+ ], [
+ /* Progress step 1/2 */
+ _("Writing the settings..."),
+ /* Progress step 2/2 */
+ _("Running SuSEconfig..."),
+ /* Progress finished */
+ _("Finished")
+ ],
+ ""
);
// write settings
Modified: branches/tmp/jdsn/edu-users/src/dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/jdsn/edu-users/src/dialog…
==============================================================================
--- branches/tmp/jdsn/edu-users/src/dialogs.ycp (original)
+++ branches/tmp/jdsn/edu-users/src/dialogs.ycp Fri Nov 9 19:10:34 2007
@@ -35,6 +35,8 @@
import "Wizard";
import "EduUsers";
import "Autologin";
+import "Users";
+import "UsersCache";
include "edu-users/helps.ycp";
@@ -48,10 +50,12 @@
string caption = _("Add New Edu User");
term fields = `VBox(
+ // text entry
+ `TextEntry (`id(`cn), _("User's &Full Name"), ""),
`VSquash(
`HBox(
// input field for login name
- `Bottom(`TextEntry(`id(`username), _("&Username"), "bla")),
+ `Bottom(`TextEntry(`id(`username), _("&Username"), "")),
("add_user" != "add_user")
? `HSpacing (0)
// push button to generate login from first and last name
@@ -80,7 +84,7 @@
/* EduUsers configure1 dialog contents */
- term contents = `VBox(`Label (_("First part of configuration of edu-users")), `PushButton(`id(`groups), "bla"));
+ term contents = `VBox(`Label (_("First part of configuration of edu-users")), `PushButton(`id(`groups), ""));
contents = `VBox (
`VSpacing(),
@@ -103,19 +107,35 @@
Wizard::SetContentsButtons(caption, contents, HELPS["c1"]:"",
Label::BackButton(), Label::NextButton());
+ string cn = (string) UI::QueryWidget(`id(`cn), `Value);
+ // for proposing username
+ string tmp_cn = cn;
+ UsersCache::ResetProposing ();
+
any ret = nil;
while(true) {
- ret = UI::UserInput();
+ ret = UI::UserInput();
- /* abort? */
- if(ret == `abort || ret == `cancel) {
- if(ReallyAbort()) break;
- else continue;
- }
+ /* abort? */
+ if(ret == `abort || ret == `cancel) {
+ if(ReallyAbort()) break;
+ else continue;
+ }
else if(ret == `next || ret == `back) {
break;
}
+ if (ret == `propose)
+ { // propose a username - sometimes lxuser is the first proposal, no idea why, should be last one
+ cn = (string) UI::QueryWidget(`id(`cn), `Value);
+ if (tmp_cn != cn)
+ {
+ UsersCache::ResetProposing();
+ tmp_cn = cn;
+ }
+ string username = UsersCache::ProposeUsername ( filterchars (cn, Users::ValidLognameChars() + " "));
+ UI::ChangeWidget(`id(`username), `Value, username);
+ }
else {
y2error("unexpected retcode: %1", ret);
continue;
@@ -128,6 +148,7 @@
any UsersDialog() {
+ SetTabDialog();
// fill table with data
Popup::Notify(_("Users"));
@@ -166,10 +187,14 @@
any GroupsDialog() {
-
+
// fill table with data
Popup::Notify(_("Groups"));
+ list<term> groups = EduUsers::getGroupItems();
+
+ UI::ReplaceWidget(`id(`tabContent), `Table( `id(`edutable), `opt(`notify, `vstretch) , `header( _("Groups") ), groups ) );
+
any ret = nil;
while(true) {
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0
[yast-commit] r41947 - in /branches/tmp/sh/mod-ui: core/libyui/src/ qt/src/
by sh-sh-sh@svn.opensuse.org 09 Nov '07
by sh-sh-sh@svn.opensuse.org 09 Nov '07
09 Nov '07
Author: sh-sh-sh
Date: Fri Nov 9 19:03:46 2007
New Revision: 41947
URL: http://svn.opensuse.org/viewcvs/yast?rev=41947&view=rev
Log:
ported PartitionSplitter
Removed:
branches/tmp/sh/mod-ui/qt/src/QY2BarGraph.cc
branches/tmp/sh/mod-ui/qt/src/QY2BarGraph.h
Modified:
branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc
branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h
branches/tmp/sh/mod-ui/core/libyui/src/YPartitionSplitter.cc
branches/tmp/sh/mod-ui/core/libyui/src/YPartitionSplitter.h
branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
branches/tmp/sh/mod-ui/core/libyui/src/YUISymbols.h
branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc
branches/tmp/sh/mod-ui/qt/src/Makefile.am
branches/tmp/sh/mod-ui/qt/src/YQIntField.cc
branches/tmp/sh/mod-ui/qt/src/YQIntField.h
branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc
branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.h
branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.cc
branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h
branches/tmp/sh/mod-ui/qt/src/YQSlider.cc
branches/tmp/sh/mod-ui/qt/src/YQSlider.h
branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc
Modified: branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/ChangeLog Fri Nov 9 19:03:46 2007
@@ -417,4 +417,5 @@
2007-11-09 sh(a)suse.de
* Ported YBarGraph
+* Ported YPartitionSplitter
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YCPDialogParser.cc Fri Nov 9 19:03:46 2007
@@ -63,6 +63,7 @@
#include "YMultiProgressMeter.h"
#include "YMultiSelectionBox.h"
#include "YPackageSelector.h"
+#include "YPartitionSplitter.h"
#include "YProgressBar.h"
#include "YPushButton.h"
#include "YRadioButton.h"
@@ -3005,7 +3006,6 @@
}
rejectAllOptions( term,optList );
- YWidget *slider;
string label = term->value( argnr )->asString()->value();
int minValue = term->value( argnr+1 )->asInteger()->value();
@@ -3081,41 +3081,30 @@
return 0;
}
- for ( int o=0; o < optList->size(); o++ )
- {
- if ( optList->value(o)->isSymbol() && optList->value(o)->asSymbol()->symbol() == YUIOpt_countShowDelta ) opt.countShowDelta.setValue( true );
- else logUnknownOption( term, optList->value(o) );
- }
-
- YWidget *splitter;
-
- if ( YUI::ui()->hasPartitionSplitter() )
- {
- int usedSize = term->value( argnr )->asInteger()->value();
- int totalFreeSize = term->value( argnr+1 )->asInteger()->value();
- int newPartSize = term->value( argnr+2 )->asInteger()->value();
- int minNewPartSize = term->value( argnr+3 )->asInteger()->value();
- int minFreeSize = term->value( argnr+4 )->asInteger()->value();
- YCPString usedLabel = term->value( argnr+5 )->asString();
- YCPString freeLabel = term->value( argnr+6 )->asString();
- YCPString newPartLabel = term->value( argnr+7 )->asString();
- YCPString freeFieldLabel = term->value( argnr+8 )->asString();
- YCPString newPartFieldLabel = term->value( argnr+9 )->asString();
-
- splitter = YUI::ui()->createPartitionSplitter( parent, opt,
- usedSize, totalFreeSize,
- newPartSize, minNewPartSize, minFreeSize,
- usedLabel, freeLabel, newPartLabel,
- freeFieldLabel, newPartFieldLabel );
-
- }
- else
- {
- y2error( "This UI does not support the PartitionSplitter widget." );
- return 0;
- }
+ rejectAllOptions( term, optList );
- return splitter;
+ int usedSize = term->value( argnr )->asInteger()->value();
+ int totalFreeSize = term->value( argnr+1 )->asInteger()->value();
+ int newPartSize = term->value( argnr+2 )->asInteger()->value();
+ int minNewPartSize = term->value( argnr+3 )->asInteger()->value();
+ int minFreeSize = term->value( argnr+4 )->asInteger()->value();
+ string usedLabel = term->value( argnr+5 )->asString()->value();
+ string freeLabel = term->value( argnr+6 )->asString()->value();
+ string newPartLabel = term->value( argnr+7 )->asString()->value();
+ string freeFieldLabel = term->value( argnr+8 )->asString()->value();
+ string newPartFieldLabel = term->value( argnr+9 )->asString()->value();
+
+ return YUI::optionalWidgetFactory()->createPartitionSplitter( parent,
+ usedSize,
+ totalFreeSize,
+ newPartSize,
+ minNewPartSize,
+ minFreeSize,
+ usedLabel,
+ freeLabel,
+ newPartLabel,
+ freeFieldLabel,
+ newPartFieldLabel );
}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.cc Fri Nov 9 19:03:46 2007
@@ -199,7 +199,17 @@
}
YPartitionSplitter *
-YOptionalWidgetFactory::createPartitionSplitter( YWidget * parent )
+YOptionalWidgetFactory::createPartitionSplitter( YWidget * parent,
+ int usedSize,
+ int totalFreeSize,
+ int newPartSize,
+ int minNewPartSize,
+ int minFreeSize,
+ const string & usedLabel,
+ const string & freeLabel,
+ const string & newPartLabel,
+ const string & freeFieldLabel,
+ const string & newPartFieldLabel )
{
THROW_UNSUPPORTED( "YPartitionSplitter" );
}
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YOptionalWidgetFactory.h Fri Nov 9 19:03:46 2007
@@ -99,7 +99,18 @@
virtual YMultiProgressMeter * createMultiProgressMeter ( YWidget * parent, YUIDimension dim, const vector<float> & maxValues );
virtual bool hasPartitionSplitter();
- virtual YPartitionSplitter * createPartitionSplitter ( YWidget * parent );
+ virtual YPartitionSplitter * createPartitionSplitter ( YWidget * parent,
+ int usedSize,
+ int totalFreeSize,
+ int newPartSize,
+ int minNewPartSize,
+ int minFreeSize,
+ const string & usedLabel,
+ const string & freeLabel,
+ const string & newPartLabel,
+ const string & freeFieldLabel,
+ const string & newPartFieldLabel );
+
virtual bool hasDownloadProgress();
virtual YDownloadProgress * createDownloadProgress ( YWidget * parent,
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YPartitionSplitter.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YPartitionSplitter.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YPartitionSplitter.cc Fri Nov 9 19:03:46 2007
@@ -17,8 +17,6 @@
/-*/
-#include <ycp/YCPSymbol.h>
-#include <ycp/YCPBoolean.h>
#define y2log_component "ui"
#include <ycp/y2log.h>
@@ -27,97 +25,177 @@
#include "YPartitionSplitter.h"
-YPartitionSplitter::YPartitionSplitter( const YWidgetOpt & opt,
- int usedSize,
- int totalFreeSize,
- int newPartSize,
- int minNewPartSize,
- int minFreeSize,
- const YCPString & usedLabel,
- const YCPString & freeLabel,
- const YCPString & newPartLabel,
- const YCPString & freeFieldLabel,
- const YCPString & newPartFieldLabel )
- : YWidget ( opt )
- , _usedSize ( usedSize )
- , _totalFreeSize ( totalFreeSize )
- , _newPartSize ( newPartSize )
- , _minNewPartSize ( minNewPartSize )
- , _minFreeSize ( minFreeSize )
- , _usedLabel ( usedLabel )
- , _freeLabel ( freeLabel )
- , _newPartLabel ( newPartLabel )
- , _freeFieldLabel ( freeFieldLabel )
- , _newPartFieldLabel ( newPartFieldLabel )
+struct YPartitionSplitterPrivate
{
+ YPartitionSplitterPrivate( int usedSize,
+ int totalFreeSize,
+ int minNewPartSize,
+ int minFreeSize,
+ const string & usedLabel,
+ const string & freeLabel,
+ const string & newPartLabel,
+ const string & freeFieldLabel,
+ const string & newPartFieldLabel )
+ : usedSize ( usedSize )
+ , totalFreeSize ( totalFreeSize )
+ , minNewPartSize ( minNewPartSize )
+ , minFreeSize ( minFreeSize )
+ , usedLabel ( usedLabel )
+ , freeLabel ( freeLabel )
+ , newPartLabel ( newPartLabel )
+ , freeFieldLabel ( freeFieldLabel )
+ , newPartFieldLabel ( newPartFieldLabel )
+ {}
+
+ int usedSize;
+ int totalFreeSize;
+ int minNewPartSize;
+ int minFreeSize;
+ string usedLabel;
+ string freeLabel;
+ string newPartLabel;
+ string freeFieldLabel;
+ string newPartFieldLabel;
+};
+
+
+
+
+YPartitionSplitter::YPartitionSplitter( YWidget * parent,
+ int usedSize,
+ int totalFreeSize,
+ int newPartSize,
+ int minNewPartSize,
+ int minFreeSize,
+ const string & usedLabel,
+ const string & freeLabel,
+ const string & newPartLabel,
+ const string & freeFieldLabel,
+ const string & newPartFieldLabel )
+ : YWidget( parent )
+ , priv( new YPartitionSplitterPrivate( usedSize,
+ totalFreeSize,
+ minNewPartSize,
+ minFreeSize,
+ usedLabel,
+ freeLabel,
+ newPartLabel,
+ freeFieldLabel,
+ newPartFieldLabel )
+ )
+{
+ YUI_CHECK_NEW( priv );
+
setDefaultStretchable( YD_HORIZ, true );
setStretchable( YD_VERT, false );
}
-void YPartitionSplitter::setValue( int newValue )
+YPartitionSplitter::~YPartitionSplitter()
+{
+ // NOP
+}
+
+
+int YPartitionSplitter::usedSize() const
{
- _newPartSize = newValue;
+ return priv->usedSize;
}
-YCPValue YPartitionSplitter::changeWidget( const YCPSymbol & property,
- const YCPValue & newValue )
+int YPartitionSplitter::totalFreeSize() const
{
- string sym = property->symbol();
+ return priv->totalFreeSize;
+}
- /**
- * @property integer Value the numerical value
- */
- if ( sym == YUIProperty_Value )
- {
- if ( newValue->isInteger() )
- {
- int val = newValue->asInteger()->value();
-
- if ( val < minNewPartSize() )
- {
- y2warning( "YPartitionSplitter::changeWidget( `Value ): "
- "Warning: New value %d below minNewPartSize ( %d )",
- val, minNewPartSize() );
- setValue( minNewPartSize() );
- }
- else if ( val > maxNewPartSize() )
- {
- y2warning( "YPartitionSplitter::changeWidget( `Value ): "
- "Warning: New value %d above maxNewPartSize ( %d )",
- val, maxNewPartSize() );
- setValue( maxNewPartSize() );
- }
- else
- {
- setValue( val );
- }
-
- return YCPBoolean( true );
- }
- else
- {
- y2error( "YPartitionSplitter::changeWidget( `Value ): "
- "Error: Expecting integer value, not %s",
- newValue->toString().c_str() );
- return YCPBoolean( false );
- }
- }
- else return YWidget::changeWidget( property, newValue );
+int YPartitionSplitter::minNewPartSize() const
+{
+ return priv->minNewPartSize;
}
+int YPartitionSplitter::minFreeSize() const
+{
+ return priv->minFreeSize;
+}
+
+
+string YPartitionSplitter::usedLabel() const
+{
+ return priv->usedLabel;
+}
+
-YCPValue YPartitionSplitter::queryWidget( const YCPSymbol & property )
+string YPartitionSplitter::freeLabel() const
{
- string s = property->symbol();
- if ( s == YUIProperty_Value ) return YCPInteger( newPartSize() );
- else return YWidget::queryWidget( property );
+ return priv->freeLabel;
}
+string YPartitionSplitter::newPartLabel() const
+{
+ return priv->newPartLabel;
+}
+
+
+string YPartitionSplitter::freeFieldLabel() const
+{
+ return priv->freeFieldLabel;
+}
+
+
+string YPartitionSplitter::newPartFieldLabel() const
+{
+ return priv->newPartFieldLabel;
+}
+
+
+const YPropertySet &
+YPartitionSplitter::propertySet()
+{
+ static YPropertySet propSet;
+
+ if ( propSet.isEmpty() )
+ {
+ /*
+ * @property string Value the value (the size of the new partition)
+ */
+ propSet.add( YProperty( YUIProperty_Value, YStringProperty ) );
+ propSet.add( YWidget::propertySet() );
+ }
+
+ return propSet;
+}
+
+
+bool
+YPartitionSplitter::setProperty( const string & propertyName, const YPropertyValue & val )
+{
+ propertySet().check( propertyName, val.type() ); // throws exceptions if not found or type mismatch
+
+ if ( propertyName == YUIProperty_Value ) setValue( val.integerVal() );
+ else
+ {
+ return YWidget::setProperty( propertyName, val );
+ }
+
+ return true; // success -- no special processing necessary
+}
+
+
+YPropertyValue
+YPartitionSplitter::getProperty( const string & propertyName )
+{
+ propertySet().check( propertyName ); // throws exceptions if not found
+
+ if ( propertyName == YUIProperty_Value ) return YPropertyValue( value() );
+ else
+ {
+ return YWidget::getProperty( propertyName );
+ }
+}
+
void
YPartitionSplitter::saveUserInput( YMacroRecorder *macroRecorder )
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YPartitionSplitter.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YPartitionSplitter.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YPartitionSplitter.h Fri Nov 9 19:03:46 2007
@@ -20,32 +20,87 @@
#define YPartitionSplitter_h
#include "YWidget.h"
-#include <ycp/YCPString.h>
-#include <ycp/YCPInteger.h>
class YMacroRecorder;
+class YPartitionSplitterPrivate;
+/**
+ * PartitionSplitter: A (very custom) widget for easily splitting one existing
+ * partition into two.
+ *
+ * Layout:
+ *
+ * +--------------------+---------------+--------------------------+
+ * | Old Partition | Old Partition | New Partition |
+ * | used | free | |
+ * +--------------------+---------------+--------------------------+
+ *
+ * Old Partition free New Partition
+ * [ 123 ] ================O================================ [ 123 ]
+ *
+ *
+ * At the top, there is a BarGraph that dynamicylla displays the sizes in
+ * graphical form. Below are an IntField to the left and an IntField to the
+ * right, each with its respective label. Between the two IntFields there is a
+ * Slider.
+ *
+ * The user can enter a value in either IntField or drag the slider. The other
+ * sub-widgets (including the BarGraph) will automatically be
+ * adjusted. Visually (in the BarGraph), the border between "old partition
+ * free" and "new partition" will move left and right. The border between "old
+ * partition used" and "old partition free" is static.
+ *
+ * There are built-in (configurable) limits for the minimum sizes of "old
+ * partition free" and "new partition".
+ **/
class YPartitionSplitter : public YWidget
{
protected:
/**
- * Constructor
+ * Constructor.
+ *
+ * usedSize: Used size of the old partition (constant)
+ *
+ * totalFreeSize: Total free size of the old partition before the split:
+ * OldPartitionFree + NewPartition
+ *
+ * newPartSize': Initial size of the new partition
+ *
+ * minNewPartSize: Miminum size of the new partition
+ *
+ * minFreeSize: Minimum free size of the old partition
+ *
+ * usedLabel: BarGraph label for the used part of the old partition
+ *
+ * freeLabel: BarGraph label for the free part of the old partition
+ *
+ * newPartLabel: BarGraph label for the new partition
+ *
+ * freeFieldLabel: IntField label for the free part of the old partition
+ *
+ * newPartFieldLabel: IntField label for the size of the new partition
**/
- YPartitionSplitter( const YWidgetOpt & opt,
- int usedSize,
- int totalFreeSize,
- int newPartSize,
- int minNewPartSize,
- int minFreeSize,
- const YCPString & usedLabel,
- const YCPString & freeLabel,
- const YCPString & newPartLabel,
- const YCPString & freeFieldLabel,
- const YCPString & newPartFieldLabel );
+ YPartitionSplitter( YWidget * parent,
+ int usedSize,
+ int totalFreeSize,
+ int newPartSize,
+ int minNewPartSize,
+ int minFreeSize,
+ const string & usedLabel,
+ const string & freeLabel,
+ const string & newPartLabel,
+ const string & freeFieldLabel,
+ const string & newPartFieldLabel );
public:
+
+ /**
+ * Destructor.
+ **/
+ virtual ~YPartitionSplitter();
+
/**
* Returns a descriptive name of this widget class for logging,
* debugging etc.
@@ -53,41 +108,65 @@
virtual const char * widgetClass() const { return "YPartitionSplitter"; }
/**
- * Implements the ChangeWidget() UI command.
+ * The value of this PartitionSplitter: The size of the new partition.
+ *
+ * Derived classes are required to implement this.
**/
- YCPValue changeWidget( const YCPSymbol & property,
- const YCPValue & newValue );
+ virtual int value() = 0;
/**
- * Implements the QueryWidget() UI command.
+ * Set the value (the size of the new partition).
+ *
+ * Derived classes are required to implement this.
**/
- YCPValue queryWidget( const YCPSymbol & property );
+ virtual void setValue( int newValue ) = 0;
+
+
+ // Access methods
+ int usedSize() const;
+ int totalFreeSize() const;
+ int minFreeSize() const;
+ int maxFreeSize() const { return totalFreeSize() - minNewPartSize(); }
+ int freeSize() { return totalFreeSize() - newPartSize(); }
+ int newPartSize() { return value(); }
+ int minNewPartSize() const;
+ int maxNewPartSize() const { return totalFreeSize() - minFreeSize(); }
+
+ string usedLabel() const;
+ string freeLabel() const;
+ string newPartLabel() const;
+ string freeFieldLabel() const;
+ string newPartFieldLabel() const;
/**
- * Change the slider value.
+ * Set a property.
+ * Reimplemented from YWidget.
*
- * Overload this, but call YPartitionSplitter::setValue()
- * at the end of your own method.
+ * This function may throw YUIPropertyExceptions.
+ *
+ * This function returns 'true' if the value was successfully set and
+ * 'false' if that value requires special handling (not in error cases:
+ * those are covered by exceptions).
**/
- virtual void setValue( int newValue );
-
+ virtual bool setProperty( const string & propertyName,
+ const YPropertyValue & val );
- // Access methods
+ /**
+ * Get a property.
+ * Reimplemented from YWidget.
+ *
+ * This method may throw YUIPropertyExceptions.
+ **/
+ virtual YPropertyValue getProperty( const string & propertyName );
- int usedSize() { return _usedSize; }
- int totalFreeSize() { return _totalFreeSize; }
- int newPartSize() { return _newPartSize; }
- int minNewPartSize() { return _minNewPartSize; }
- int maxNewPartSize() { return _totalFreeSize - _minFreeSize; }
- int minFreeSize() { return _minFreeSize; }
- int maxFreeSize() { return _totalFreeSize - _minNewPartSize; }
- int remainingFreeSize() { return _totalFreeSize - _newPartSize; }
- const YCPString usedLabel() { return _usedLabel; }
- const YCPString freeLabel() { return _freeLabel; }
- const YCPString newPartLabel() { return _newPartLabel; }
- const YCPString freeFieldLabel() { return _freeFieldLabel; }
- const YCPString newPartFieldLabel() { return _newPartFieldLabel; }
+ /**
+ * Return this class's property set.
+ * This also initializes the property upon the first call.
+ *
+ * Reimplemented from YWidget.
+ **/
+ virtual const YPropertySet & propertySet();
/**
@@ -101,22 +180,12 @@
/**
* Save the widget's user input to a macro recorder.
- * Intentionally declared as "private" so all macro recording internals are
- * handled by the abstract libyui level, not by a specific UI.
**/
virtual void saveUserInput( YMacroRecorder *macroRecorder );
+ ImplPtr<YPartitionSplitterPrivate> priv;
+
- int _usedSize;
- int _totalFreeSize;
- int _newPartSize;
- int _minNewPartSize;
- int _minFreeSize;
- YCPString _usedLabel;
- YCPString _freeLabel;
- YCPString _newPartLabel;
- YCPString _freeFieldLabel;
- YCPString _newPartFieldLabel;
};
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI.h Fri Nov 9 19:03:46 2007
@@ -482,43 +482,6 @@
virtual YWidget * createDumbTab( YWidget *parent, YWidgetOpt & opt );
virtual bool hasDumbTab() { return false; }
- /**
- * Creates a PartitionSplitter widget.
- *
- * This is a special widget that the UI may or may not support.
- * Overwrite this method at your own discretion.
- * If you do, remember to overwrite the has...() method as well!
- *
- * @param parent the parent widget
- * @param opt the widget options
- * @param usedSize size of the used part of the partition
- * @param totalFreeSize total size of the free part of the partition ( before the split )
- * @param newPartSize suggested size of the new partition
- * @param minNewPartSize minimum size of the new partition
- * @param minFreeSize minimum remaining free size of the old partition
- * @param usedLabel BarGraph label for the used part of the old partition
- * @param freeLabel BarGraph label for the free part of the old partition
- * @param newPartLabel BarGraph label for the new partition
- * @param freeFieldLabel label for the remaining free space field
- * @param newPartFieldLabel label for the new partition size field
- **/
-
- virtual YWidget *createPartitionSplitter( YWidget * parent,
- YWidgetOpt & opt,
- int usedSize,
- int totalFreeSize,
- int newPartSize,
- int minNewPartSize,
- int minFreeSize,
- const YCPString & usedLabel,
- const YCPString & freeLabel,
- const YCPString & newPartLabel,
- const YCPString & freeFieldLabel,
- const YCPString & newPartFieldLabel );
-
- virtual bool hasPartitionSplitter() { return false; }
-
-
protected:
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUISymbols.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUISymbols.h (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUISymbols.h Fri Nov 9 19:03:46 2007
@@ -185,7 +185,6 @@
#define YUIOpt_autoShortcut "autoShortcut"
#define YUIOpt_boldFont "boldFont"
#define YUIOpt_centered "centered"
-#define YUIOpt_countShowDelta "countShowDelta"
#define YUIOpt_debugLayout "debugLayout"
#define YUIOpt_decorated "decorated"
#define YUIOpt_default "default"
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI_builtins.cc Fri Nov 9 19:03:46 2007
@@ -92,7 +92,7 @@
else if ( symbol == YUISpecialWidget_VMultiProgressMeter ) hasWidget = fact->hasMultiProgressMeter();
else if ( symbol == YUISpecialWidget_Slider ) hasWidget = fact->hasSlider();
else if ( symbol == YUISpecialWidget_PatternSelector ) hasWidget = fact->hasPatternSelector();
- else if ( symbol == YUISpecialWidget_PartitionSplitter ) hasWidget = hasPartitionSplitter();
+ else if ( symbol == YUISpecialWidget_PartitionSplitter ) hasWidget = fact->hasPartitionSplitter();
else if ( symbol == YUISpecialWidget_SimplePatchSelector ) hasWidget = fact->hasSimplePatchSelector();
else if ( symbol == YUISpecialWidget_Wizard ) hasWidget = fact->hasWizard();
else if ( symbol == YUISpecialWidget_Date ) hasWidget = fact->hasDateField();
Modified: branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/core/libyui/src…
==============================================================================
--- branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc (original)
+++ branches/tmp/sh/mod-ui/core/libyui/src/YUI_special_widgets.cc Fri Nov 9 19:03:46 2007
@@ -65,24 +65,5 @@
}
-YWidget * YUI::createPartitionSplitter( YWidget * parent,
- YWidgetOpt & opt,
- int usedSize,
- int totalFreeSize,
- int newPartSize,
- int minNewPartSize,
- int minFreeSize,
- const YCPString & usedLabel,
- const YCPString & freeLabel,
- const YCPString & newPartLabel,
- const YCPString & freeFieldLabel,
- const YCPString & newPartFieldLabel )
-{
- y2error( "Default createPartitionSplitter() method called - "
- "forgot to call HasSpecialWidget()?" );
-
- return 0;
-}
-
// EOF
Modified: branches/tmp/sh/mod-ui/qt/src/Makefile.am
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/Makefile…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/Makefile.am (original)
+++ branches/tmp/sh/mod-ui/qt/src/Makefile.am Fri Nov 9 19:03:46 2007
@@ -103,7 +103,6 @@
YQWizardButton.cc \
\
YFrameBuffer.cc \
- QY2BarGraph.cc \
QY2ComboTabWidget.cc \
QY2DiskUsageList.cc \
QY2CharValidator.cc \
@@ -166,7 +165,6 @@
YQWizard.moc \
YQWizardButton.moc \
\
- QY2BarGraph.moc \
QY2ComboTabWidget.moc \
QY2DiskUsageList.moc \
QY2CharValidator.moc \
@@ -219,7 +217,6 @@
YQWizard.o YQWizard.lo: YQWizard.moc
YQWizardButton.o YQWizardButton.lo: YQWizardButton.moc
-QY2BarGraph.o QY2BarGraph.lo: QY2BarGraph.moc
QY2ComboTabWidget.o QY2ComboTabWidget.lo: QY2ComboTabWidget.cc
QY2DiskUsageList.o QY2DiskUsageList.lo: QY2DiskUsageList.cc
QY2CharValidator.o QY2CharValidator.lo: QY2CharValidator.moc
@@ -268,7 +265,6 @@
YQWizard.moc: YQWizard.h
YQWizardButton.moc: YQWizardButton.h
-QY2BarGraph.moc: QY2BarGraph.h
QY2ComboTabWidget.moc: QY2ComboTabWidget.h
QY2DiskUsageList.moc: QY2DiskUsageList.h
QY2CharValidator.moc: QY2CharValidator.h
Modified: branches/tmp/sh/mod-ui/qt/src/YQIntField.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQIntFie…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQIntField.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQIntField.cc Fri Nov 9 19:03:46 2007
@@ -56,8 +56,8 @@
setValue( initialValue );
- connect( _qt_spinBox, SIGNAL( valueChanged( int ) ),
- this, SLOT ( valueChanged( int ) ) );
+ connect( _qt_spinBox, SIGNAL( valueChanged ( int ) ),
+ this, SLOT ( valueChangedSlot( int ) ) );
}
@@ -83,10 +83,11 @@
void
-YQIntField::valueChanged( int newValue )
+YQIntField::valueChangedSlot( int newValue )
{
if ( notify() )
YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::ValueChanged ) );
+ emit valueChanged( newValue );
}
Modified: branches/tmp/sh/mod-ui/qt/src/YQIntField.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQIntFie…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQIntField.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQIntField.h Fri Nov 9 19:03:46 2007
@@ -113,6 +113,14 @@
**/
virtual bool setKeyboardFocus();
+
+signals:
+
+ /**
+ * Emitted when the value changes (regardless of the notify flag).
+ **/
+ void valueChanged( int newValue );
+
protected slots:
@@ -120,7 +128,7 @@
* Slot for "value changed". This will send a ValueChanged event if
* 'notify' is set.
**/
- void valueChanged( int newValue );
+ void valueChangedSlot( int newValue );
protected:
Modified: branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQOption…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.cc Fri Nov 9 19:03:46 2007
@@ -200,13 +200,36 @@
bool YQOptionalWidgetFactory::hasPartitionSplitter()
{
- return false;
+ return true;
}
YQPartitionSplitter *
-YQOptionalWidgetFactory::createPartitionSplitter( YWidget * parent )
+YQOptionalWidgetFactory::createPartitionSplitter( YWidget * parent,
+ int usedSize,
+ int totalFreeSize,
+ int newPartSize,
+ int minNewPartSize,
+ int minFreeSize,
+ const string & usedLabel,
+ const string & freeLabel,
+ const string & newPartLabel,
+ const string & freeFieldLabel,
+ const string & newPartFieldLabel )
{
- THROW_UNSUPPORTED( "YQPartitionSplitter" );
+ YQPartitionSplitter * partitionSplitter = new YQPartitionSplitter( parent,
+ usedSize,
+ totalFreeSize,
+ newPartSize,
+ minNewPartSize,
+ minFreeSize,
+ usedLabel,
+ freeLabel,
+ newPartLabel,
+ freeFieldLabel,
+ newPartFieldLabel );
+ YUI_CHECK_NEW( partitionSplitter );
+
+ return partitionSplitter;
}
Modified: branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQOption…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQOptionalWidgetFactory.h Fri Nov 9 19:03:46 2007
@@ -91,7 +91,17 @@
virtual YQMultiProgressMeter * createMultiProgressMeter( YWidget * parent, YUIDimension dim, const vector<float> & maxValues );
virtual bool hasPartitionSplitter();
- virtual YQPartitionSplitter * createPartitionSplitter ( YWidget * parent );
+ virtual YQPartitionSplitter * createPartitionSplitter ( YWidget * parent,
+ int usedSize,
+ int totalFreeSize,
+ int newPartSize,
+ int minNewPartSize,
+ int minFreeSize,
+ const string & usedLabel,
+ const string & freeLabel,
+ const string & newPartLabel,
+ const string & freeFieldLabel,
+ const string & newPartFieldLabel );
virtual bool hasDownloadProgress();
virtual YQDownloadProgress * createDownloadProgress ( YWidget * parent,
Modified: branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQPartit…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.cc Fri Nov 9 19:03:46 2007
@@ -23,179 +23,161 @@
#include "utf8.h"
#include "YQUI.h"
#include "YEvent.h"
+#include "YQWidgetFactory.h"
+#include "YQOptionalWidgetFactory.h"
#include "YQPartitionSplitter.h"
+#include "YQLayoutBox.h"
+#include "YQBarGraph.h"
+#include "YQIntField.h"
+#include "YQSlider.h"
#include "YQSignalBlocker.h"
-YQPartitionSplitter::YQPartitionSplitter( QWidget * parent,
- const YWidgetOpt & opt,
- int arg_usedSize,
- int arg_totalFreeSize,
- int arg_newPartSize,
- int arg_minNewSize,
- int arg_minFreeSize,
- const YCPString & arg_usedLabel,
- const YCPString & arg_freeLabel,
- const YCPString & arg_newPartLabel,
- const YCPString & arg_freeFieldLabel,
- const YCPString & arg_newPartFieldLabel )
- : QVBox( parent )
- , YPartitionSplitter( opt,
- arg_usedSize,
- arg_totalFreeSize,
- arg_newPartSize,
- arg_minNewSize,
- arg_minFreeSize,
- arg_usedLabel,
- arg_freeLabel,
- arg_newPartLabel,
- arg_freeFieldLabel,
- arg_newPartFieldLabel )
+YQPartitionSplitter::YQPartitionSplitter( YWidget * parent,
+ int usedSize,
+ int totalFreeSize,
+ int newPartSize,
+ int minNewSize,
+ int minFreeSize,
+ const string & usedLabel,
+ const string & freeLabel,
+ const string & newPartLabel,
+ const string & freeFieldLabel,
+ const string & newPartFieldLabel )
+ : QWidget( (QWidget *) parent->widgetRep() )
+ , YPartitionSplitter( parent,
+ usedSize,
+ totalFreeSize,
+ newPartSize,
+ minNewSize,
+ minFreeSize,
+ usedLabel,
+ freeLabel,
+ newPartLabel,
+ freeFieldLabel,
+ newPartFieldLabel )
+ , _vbox( 0 )
+ , _barGraph( 0 )
+ , _hbox( 0 )
+ , _freeSizeField( 0 )
+ , _newPartSlider( 0 )
{
setWidgetRep( this );
- _countShowDelta = opt.countShowDelta.value();
+ // Replace children manager so it will accept one single direct child (the outer vbox)
+ setChildrenManager( new YSingleWidgetChildManager( this ) );
- setSpacing( YQWidgetSpacing );
- setMargin( YQWidgetMargin );
-
-
- // BarGraph
-
- _barGraph = new QY2BarGraph( this );
- _barGraph->setSegments(3);
- _barGraph->setLabel( 0, fromUTF8( usedLabel()->value() ) );
- _barGraph->setLabel( 1, fromUTF8( freeLabel()->value() ) );
- _barGraph->setLabel( 2, fromUTF8( newPartLabel()->value() ) );
-
-
- // upper inner HBox for the labels
-
- _labels_hbox = new QHBox( this );
- _labels_hbox->setSpacing( YQWidgetMargin );
-
-
- // Label for the free size
-
- _qt_freeFieldLabel = new QLabel( fromUTF8( freeFieldLabel()->value() ),
- _labels_hbox );
- _qt_freeFieldLabel->setTextFormat( QLabel::PlainText );
- _qt_freeFieldLabel->setAlignment( Qt::AlignLeft );
-
-
- // Label for the new partition size
-
- _qt_newPartFieldLabel = new QLabel( fromUTF8( newPartFieldLabel()->value() ),
- _labels_hbox );
- _qt_newPartFieldLabel->setTextFormat( QLabel::PlainText );
- _qt_newPartFieldLabel->setAlignment( Qt::AlignRight );
-
-
- // lower inner HBox for the fields and the slider
-
- _fields_hbox = new QHBox( this );
- _fields_hbox->setSpacing( YQWidgetMargin );
-
-
- // SpinBox for the free size
-
- _qt_freeSizeField = new QSpinBox( minFreeSize(), maxFreeSize(),
- 1, // step
- _fields_hbox );
- _qt_freeFieldLabel->setBuddy( _qt_freeSizeField );
-
-
- // Slider for the free size
-
- _qt_freeSizeSlider = new QSlider( minFreeSize(), maxFreeSize(),
- 1, // pageStep
- remainingFreeSize(), // initial value
- QSlider::Horizontal, _fields_hbox );
-
-
- // SpinBox for the new partition size
-
- _qt_newPartSizeField = new QSpinBox( minNewPartSize(), maxNewPartSize(),
- 1, // step
- _fields_hbox );
- _qt_newPartFieldLabel->setBuddy( _qt_newPartSizeField );
+ //
+ // Create internal widgets
+ //
+
+ _vbox = YUI::widgetFactory()->createVBox( this );
+ _barGraph = dynamic_cast<YQBarGraph *> ( YUI::optionalWidgetFactory()->createBarGraph( _vbox ) );
+ YUI_CHECK_PTR( _barGraph );
- // Initialize all fields and the bar graph
+ int freeSize = totalFreeSize - newPartSize;
+
+ {
+ YBarGraphMultiUpdate multiUpdate( _barGraph );
- setValue( newPartSize() );
+ _barGraph->addSegment( YBarGraphSegment( usedSize, usedLabel ) );
+ _barGraph->addSegment( YBarGraphSegment( freeSize, freeLabel ) );
+ _barGraph->addSegment( YBarGraphSegment( newPartSize, newPartLabel) );
+ }
+
+ _hbox = YUI::widgetFactory()->createHBox( _vbox );
+
+ _freeSizeField = dynamic_cast<YQIntField *>
+ ( YUI::widgetFactory()->createIntField( _hbox, freeFieldLabel,
+ minFreeSize, maxFreeSize(), freeSize) );
+ YUI_CHECK_PTR( _freeSizeField );
+ _freeSizeField->setStretchable( YD_HORIZ, false );
+
+ _newPartSlider = dynamic_cast<YQSlider *>
+ ( YUI::optionalWidgetFactory()->createSlider( _hbox, newPartFieldLabel,
+ minNewSize, maxNewPartSize(), newPartSize ) );
+ YUI_CHECK_PTR( _newPartSlider );
+ _newPartSlider->setStretchable( YD_HORIZ, true );
// Connect signals
- connect( _qt_freeSizeSlider, SIGNAL( valueChanged (int) ),
- this, SLOT ( setFreeSizeSlot(int) ) );
+ connect( _newPartSlider, SIGNAL( valueChanged (int) ),
+ this, SLOT ( setNewPartSizeSlot(int) ) );
- connect( _qt_freeSizeField, SIGNAL( valueChanged (int) ),
+ connect( _freeSizeField, SIGNAL( valueChanged (int) ),
this, SLOT ( setFreeSizeSlot(int) ) );
+}
- connect( _qt_newPartSizeField,SIGNAL( valueChanged (int) ),
- this, SLOT ( setNewPartSizeSlot(int) ) );
+
+YQPartitionSplitter::~YQPartitionSplitter()
+{
+ // NOP
}
void YQPartitionSplitter::setEnabled( bool enabled )
{
- _qt_freeFieldLabel->setEnabled ( enabled );
- _qt_newPartFieldLabel->setEnabled ( enabled );
- _qt_freeSizeSlider->setEnabled ( enabled );
- _qt_freeSizeField->setEnabled ( enabled );
- _qt_freeSizeField->setEnabled ( enabled );
- _qt_newPartSizeField->setEnabled ( enabled );
+ _freeSizeField->setEnabled ( enabled );
+ _newPartSlider->setEnabled ( enabled );
+
YWidget::setEnabled( enabled );
}
int YQPartitionSplitter::preferredWidth()
{
- return sizeHint().width();
+ return _vbox->preferredWidth();
}
int YQPartitionSplitter::preferredHeight()
{
- return sizeHint().height();
+ return _vbox->preferredHeight();
}
void YQPartitionSplitter::setSize( int newWidth, int newHeight )
{
- resize( newWidth, newHeight );
+ QWidget::resize( newWidth, newHeight );
+ _vbox->setSize ( newWidth, newHeight );
}
-void YQPartitionSplitter::setValue( int new_newPartSize )
+int YQPartitionSplitter::value()
{
- YPartitionSplitter::setValue( new_newPartSize );
+ YUI_CHECK_PTR( _newPartSlider );
+
+ return _newPartSlider->value();
+}
- if ( ! _barGraph )
- return;
- YQSignalBlocker sigBlocker1( _barGraph );
- YQSignalBlocker sigBlocker2( _qt_freeSizeField );
- YQSignalBlocker sigBlocker3( _qt_freeSizeSlider );
- YQSignalBlocker sigBlocker4( _qt_newPartSizeField );
-
- _barGraph->setValue( 0, usedSize() );
- _barGraph->setValue( 1, remainingFreeSize() );
- _barGraph->setValue( 2, newPartSize() );
- _barGraph->update();
-
- _qt_freeSizeField->setValue ( remainingFreeSize() );
- _qt_freeSizeSlider->setValue( remainingFreeSize() );
- _qt_newPartSizeField->setValue( newPartSize() );
+void YQPartitionSplitter::setValue( int newValue )
+{
+ YUI_CHECK_PTR( _barGraph );
+ YUI_CHECK_PTR( _freeSizeField );
+ YUI_CHECK_PTR( _newPartSlider );
+
+ YQSignalBlocker sigBlocker1( _barGraph );
+ YQSignalBlocker sigBlocker2( _freeSizeField );
+ YQSignalBlocker sigBlocker3( _newPartSlider );
+
+ _newPartSlider->setValue( newValue );
+
+ int freeSize = totalFreeSize() - newValue;
+ _freeSizeField->setValue ( freeSize );
+
+ YBarGraphMultiUpdate multiUpdate( _barGraph );
+ {
+ _barGraph->setValue( freeSegment, freeSize );
+ _barGraph->setValue( newPartSegment, newValue );
+ }
}
void YQPartitionSplitter::setFreeSizeSlot( int newFreeSize )
{
int newPartSize = totalFreeSize() - newFreeSize;
- if( _countShowDelta )
- newPartSize += usedSize();
setValue( newPartSize );
@@ -206,12 +188,8 @@
void YQPartitionSplitter::setNewPartSizeSlot( int newPartSize )
{
+ setValue( newPartSize );
- if( _countShowDelta )
- setValue( remainingFreeSize() - totalFreeSize() );
- else
- setValue( newPartSize );
-
if ( notify() )
YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::ValueChanged ) );
}
@@ -219,7 +197,7 @@
bool YQPartitionSplitter::setKeyboardFocus()
{
- _qt_newPartSizeField->setFocus();
+ _newPartSlider->setKeyboardFocus();
return true;
}
Modified: branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQPartit…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQPartitionSplitter.h Fri Nov 9 19:03:46 2007
@@ -20,18 +20,16 @@
#ifndef YQPartitionSplitter_h
#define YQPartitionSplitter_h
-#include <qslider.h>
-#include <qspinbox.h>
-#include <qlabel.h>
-#include <qvbox.h>
-#include <qhbox.h>
-#include <ycp/YCPString.h>
-
-#include "QY2BarGraph.h"
+#include "qwidget.h"
#include "YPartitionSplitter.h"
+class YLayoutBox;
+class YQBarGraph;
+class YQIntField;
+class YQSlider;
+
-class YQPartitionSplitter : public QVBox, public YPartitionSplitter
+class YQPartitionSplitter : public QWidget, public YPartitionSplitter
{
Q_OBJECT
@@ -40,20 +38,38 @@
/**
* Constructor.
**/
- YQPartitionSplitter( QWidget * parent,
- const YWidgetOpt & opt,
- int usedSize,
- int freeSize,
- int newPartSize,
- int minNewPartSize,
- int minFreeSize,
- const YCPString & usedLabel,
- const YCPString & freeLabel,
- const YCPString & newPartLabel,
- const YCPString & freeFieldLabel,
- const YCPString & newPartFieldLabel );
+ YQPartitionSplitter( YWidget * parent,
+ int usedSize,
+ int freeSize,
+ int newPartSize,
+ int minNewPartSize,
+ int minFreeSize,
+ const string & usedLabel,
+ const string & freeLabel,
+ const string & newPartLabel,
+ const string & freeFieldLabel,
+ const string & newPartFieldLabel );
+
+ /**
+ * Destructor.
+ **/
+ ~YQPartitionSplitter();
/**
+ * Return the value (the size of the new partition).
+ *
+ * Implemented from YPartitionSplitter.
+ **/
+ virtual int value();
+
+ /**
+ * Set the value (the size of the new partition).
+ *
+ * Implemented from YPartitionSplitter.
+ **/
+ virtual void setValue( int newValue );
+
+ /**
* Set enabled/disabled state.
*
* Reimplemented from YWidget.
@@ -86,12 +102,6 @@
**/
virtual bool setKeyboardFocus();
- /**
- * Change the value.
- * Calls YPartitionSplitter::setProgress() internally.
- * Inherited from YPartitionSplitter.
- **/
- void setValue( int newValue );
public slots:
/**
@@ -107,22 +117,24 @@
protected:
- /*
- * Widgets
- *
- * Indentation indicates widget hierarchy
- **/
+ enum
+ {
+ usedSegment = 0,
+ freeSegment = 1,
+ newPartSegment = 2
+ };
- QY2BarGraph * _barGraph;
- QHBox * _labels_hbox;
- QLabel * _qt_freeFieldLabel;
- QLabel * _qt_newPartFieldLabel;
- QHBox * _fields_hbox;
- QSpinBox * _qt_freeSizeField;
- QSlider * _qt_freeSizeSlider;
- QSpinBox * _qt_newPartSizeField;
+
+ //
+ // Widgets
+ //
+
+ YLayoutBox * _vbox;
+ YQBarGraph * _barGraph;
+ YLayoutBox * _hbox;
+ YQIntField * _freeSizeField;
+ YQSlider * _newPartSlider;
- bool _countShowDelta;
};
Modified: branches/tmp/sh/mod-ui/qt/src/YQSlider.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQSlider…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQSlider.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQSlider.cc Fri Nov 9 19:03:46 2007
@@ -79,8 +79,8 @@
connect( _qt_slider, SIGNAL( valueChanged(int) ),
_qt_spinBox, SLOT ( setValue (int) ) );
- connect( _qt_spinBox, SIGNAL( valueChanged(int) ),
- this, SLOT ( valueChanged(int) ) );
+ connect( _qt_spinBox, SIGNAL( valueChanged (int) ),
+ this, SLOT ( valueChangedSlot(int) ) );
}
@@ -108,10 +108,12 @@
void
-YQSlider::valueChanged( int newValue )
+YQSlider::valueChangedSlot( int newValue )
{
if ( notify() )
YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::ValueChanged ) );
+
+ emit valueChanged( newValue );
}
Modified: branches/tmp/sh/mod-ui/qt/src/YQSlider.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQSlider…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQSlider.h (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQSlider.h Fri Nov 9 19:03:46 2007
@@ -116,7 +116,7 @@
* Slot for "value changed". This will send a ValueChanged event if
* 'notify' is set.
**/
- void valueChanged( int newValue );
+ void valueChangedSlot( int newValue );
/**
* Slot for setting the value.
@@ -125,6 +125,14 @@
**/
void setValueSlot( int newValue );
+
+signals:
+
+ /**
+ * Emitted when the value changes (regardless of the notify flag).
+ **/
+ void valueChanged( int newValue );
+
protected:
Modified: branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQUI_wid…
==============================================================================
--- branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc (original)
+++ branches/tmp/sh/mod-ui/qt/src/YQUI_widgets.cc Fri Nov 9 19:03:46 2007
@@ -83,38 +83,5 @@
}
-bool YQUI::hasPartitionSplitter()
-{
- return true;
-}
-
-YWidget * YQUI::createPartitionSplitter( YWidget * parent,
- YWidgetOpt & opt,
- int usedSize,
- int totalFreeSize,
- int newPartSize,
- int minNewPartSize,
- int minFreeSize,
- const YCPString & usedLabel,
- const YCPString & freeLabel,
- const YCPString & newPartLabel,
- const YCPString & freeFieldLabel,
- const YCPString & newPartFieldLabel )
-{
- return new YQPartitionSplitter( (QWidget *) ( parent->widgetRep() ),
- opt,
- usedSize,
- totalFreeSize,
- newPartSize,
- minNewPartSize,
- minFreeSize,
- usedLabel,
- freeLabel,
- newPartLabel,
- freeFieldLabel,
- newPartFieldLabel );
-}
-
-
// EOF
--
To unsubscribe, e-mail: yast-commit+unsubscribe(a)opensuse.org
For additional commands, e-mail: yast-commit+help(a)opensuse.org
1
0