[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/systemsettings
From: Ben Cooksley <sourtooth () gmail ! com>
Date: 2009-05-04 4:12:11
Message-ID: 1241410331.428460.6018.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 963175 by bcooksley:
Ensure we don't force a toolbar direction.
Coding style fixes ( whitespace + tabs )
Give better proper names to both Icon and Tree views
Remove unused members
Replace about button with Help menu
Fix window title not changing when switching between views
BUG: 164978
BUG: 157725
BUG: 191491
M +72 -69 app/SettingsBase.cpp
M +10 -6 app/SettingsBase.h
M +1 -1 app/systemsettingsui.rc
M +1 -1 classic/ClassicMode.cpp
M +1 -1 core/MenuModel.cpp
M +1 -1 core/ToolTips/KToolTipDelegate.cpp
M +2 -3 icons/IconMode.cpp
--- trunk/KDE/kdebase/workspace/systemsettings/app/SettingsBase.cpp #963174:963175
@@ -38,18 +38,24 @@
SettingsBase::SettingsBase( QWidget * parent ) :
KXmlGuiWindow(parent),
- activeView( NULL ),
categories( KServiceTypeTrader::self()->query("SystemSettingsCategory") ),
modules( KServiceTypeTrader::self()->query("KCModule") )
{
// Ensure delayed loading doesn't cause a crash
+ activeView = 0;
aboutDialog = 0;
configDialog = 0;
- // Initialise the window so we don't flicker
+ // Initialise search
mainConfigGroup = KGlobal::config()->group( "Main" );
- initSearch();
+ searchText = new KLineEdit( this );
+ searchText->setClearButtonShown( true );
+ searchText->setClickMessage( i18nc( "Search through a list of control modules", \
"Search" ) ); +
+ spacerWidget = new QWidget( this );
+ spacerWidget->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Maximum \
); + // Initalise the window so we don't flicker
initToolBar();
- showTooltips = mainConfigGroup.readEntry( "ShowTooltips", true );
+ showTooltips = mainConfigGroup.readEntry( "ShowTooltips", true );
// We can now launch the delayed loading safely
QTimer::singleShot(0, this, SLOT(initApplication()));
}
@@ -83,12 +89,12 @@
if( error.isEmpty() ) {
possibleViews.insert( activeService->library(), controller );
controller->init( activeService );
- connect(controller, SIGNAL(changeToolBarItems(BaseMode::ToolBarItems)), this, \
SLOT(changeToolBar(BaseMode::ToolBarItems))); + connect(controller, \
SIGNAL(changeToolBarItems(BaseMode::ToolBarItems)), this, \
SLOT(changeToolBar(BaseMode::ToolBarItems)));
connect(controller, SIGNAL(actionsChanged()), this, \
SLOT(updateViewActions()));
connect(searchText, SIGNAL(textChanged(const QString&)), controller, \
SLOT(searchChanged(const QString&)));
connect(controller, SIGNAL(viewChanged()), this, SLOT(moduleChanged()));
- connect(controller->moduleView(), SIGNAL(configurationChanged(bool)), \
this, SLOT(toggleDirtyState(bool)));
- } else {
+ connect(controller->moduleView(), SIGNAL(configurationChanged(bool)), \
this, SLOT(toggleDirtyState(bool))); + } else {
kWarning() << "View load error: " + error;
}
}
@@ -103,9 +109,8 @@
// Configure goes at the end
configureAction = actionCollection()->addAction( KStandardAction::Preferences, \
this, SLOT( configShow() ) ); configureAction->setText( i18n("Configure") );
- // About after it
- aboutAction = actionCollection()->addAction( KStandardAction::AboutApp, \
"aboutSystemSettings", this, SLOT( about() ) );
- aboutAction->setText( i18n("About") );
+ // Help after it
+ initHelpMenu();
// Then a spacer so the search line-edit is kept separate
spacerAction = new KAction( this );
spacerAction->setDefaultWidget(spacerWidget);
@@ -123,22 +128,28 @@
// Toolbar & Configuration
setMinimumSize(800,480);
toolBar()->setMovable(false); // We don't allow any changes
- toolBar()->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
changeToolBar( BaseMode::Search | BaseMode::Configure );
}
-void SettingsBase::initSearch()
+void SettingsBase::initHelpMenu()
{
- searchText = new KLineEdit( 0 );
- searchText->setClearButtonShown( true );
- searchText->setClickMessage( i18nc( "Search through a list of control modules", \
"Search" ) );
-
- spacerWidget = new QWidget( this );
- spacerWidget->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Maximum \
); + helpMenuObject = new KHelpMenu( this );
+ helpActionMenu = new KActionMenu( KIcon("system-help"), i18n("Help"), this );
+ helpActionMenu->setMenu( helpMenuObject->menu() );
+ helpActionMenu->setDelayed( false );
+ actionCollection()->addAction( "helpMenu", helpActionMenu );
+ // Add the custom actions
+ aboutModuleAction = actionCollection()->addAction( KStandardAction::AboutApp, \
"aboutModule", this, SLOT( about() ) ); + aboutModuleAction->setText( i18n("About \
current module") ); + aboutModuleAction->setEnabled(false);
+ aboutViewAction = actionCollection()->addAction( KStandardAction::AboutApp, \
"aboutView", this, SLOT( about() ) ); + helpActionMenu->insertAction( \
helpMenuObject->action( KHelpMenu::menuAboutApp ), aboutModuleAction ); + \
helpActionMenu->insertAction( aboutModuleAction, aboutViewAction ); }
void SettingsBase::initConfig()
-{ // Prepare dialog first
+{
+ // Prepare dialog first
configDialog = new KDialog(this);
configDialog->setButtons( KDialog::Ok | KDialog::Cancel );
configWidget.setupUi(configDialog->mainWidget());
@@ -156,16 +167,6 @@
void SettingsBase::initMenuList(MenuItem * parent)
{
// look for any categories inside this level, and recurse into them
- int depth = 0;
- MenuItem * current = parent;
- while ( current && current->parent() ) {
- depth++;
- current = current->parent();
- }
-
- QString space;
- space.fill( ' ', depth * 2 );
- kDebug() << space << "Looking for children in '" << parent->name() << "'";
for (int i = 0; i < categories.size(); ++i) {
KService::Ptr entry = categories.at(i);
QString parentCategory = \
entry->property("X-KDE-System-Settings-Parent-Category").toString(); @@ -181,7 +182,6 \
@@ KService::Ptr entry = modules.at(i);
QString category = \
entry->property("X-KDE-System-Settings-Parent-Category").toString(); \
if(!parent->name().isEmpty() && category == parent->name() ) {
- kDebug() << space << "found module '" << entry->name() << "' " << \
entry->entryPath(); // Add the module info to the menu
MenuItem * infoItem = new MenuItem(false, parent);
infoItem->setService( entry );
@@ -195,7 +195,7 @@
configDialog->saveDialogSize( mainConfigGroup );
int currentIndex = configWidget.CbPlugins->currentIndex();
mainConfigGroup.writeEntry( "ActiveView", possibleViews.keys().at(currentIndex) \
);
- showTooltips = configWidget.ChTooltips->isChecked(); \
+ showTooltips = configWidget.ChTooltips->isChecked();
mainConfigGroup.writeEntry( "ShowTooltips", showTooltips );
changePlugin();
}
@@ -219,7 +219,7 @@
}
bool SettingsBase::queryClose()
-{
+{
bool changes = true;
if( activeView ) {
activeView->saveState();
@@ -231,47 +231,30 @@
void SettingsBase::about()
{
- QList<const KAboutData *> listToAdd;
+ if( aboutDialog ) {
+ delete aboutDialog;
+ aboutDialog = 0;
+ }
- // We initialise if we haven't already
- if( !aboutDialog ) {
- aboutDialog = new KPageDialog(this); // We create it on the first run
- aboutDialog->setPlainCaption( i18n("About System Settings") );
- aboutDialog->setButtons( KDialog::Close );
+ const KAboutData * about = 0;
+ if( sender() == aboutViewAction ) {
+ about = activeView->aboutData();
+ } else if( sender() == aboutModuleAction && activeView->moduleView() ) {
+ about = activeView->moduleView()->aboutData();
}
- // First we cleanup from previous runs
- while (!aboutAppPage.isEmpty()) {
- aboutDialog->removePage(aboutAppPage.takeFirst());
- }
- // Build the list of About Items to add
- if( KGlobal::activeComponent().aboutData() ) {
- listToAdd.append( KGlobal::activeComponent().aboutData() );
+ if( about ) {
+ aboutDialog = new KAboutApplicationDialog(about, 0);
+ aboutDialog->show();
}
- if( activeView && activeView->aboutData() ) {
- listToAdd.append( activeView->aboutData() );
- }
- if( activeView && activeView->moduleView() && \
activeView->moduleView()->aboutData() ) {
- listToAdd.append( activeView->moduleView()->aboutData() );
- }
- foreach( const KAboutData * addingItem, listToAdd ) {
- KAboutApplicationDialog * addingDialog = new \
KAboutApplicationDialog(addingItem, 0);
- KPageWidgetItem * addingPage = new KPageWidgetItem( addingDialog, \
addingItem->programName() );
- addingDialog->setButtons( KDialog::None );
- addingPage->setHeader( "" );
- addingPage->setIcon( KIcon(addingItem->programIconName()) );
- aboutDialog->addPage(addingPage);
- aboutAppPage.append(addingPage);
- }
- aboutDialog->show();
}
void SettingsBase::changePlugin()
{
- if( possibleViews.count() == 0 ) // We should ensure we have a plugin available \
to choose
- { KMessageBox::error(this, i18n("System Settings was unable to find any views, \
and hence has nothing to display."), i18n("No views found")); + if( \
possibleViews.count() == 0 ) { // We should ensure we have a plugin available to \
choose + KMessageBox::error(this, i18n("System Settings was unable to find any \
views, and hence has nothing to display."), i18n("No views found")); return; // Halt \
now!
- }
+ }
if( activeView ) {
activeView->saveState();
@@ -284,11 +267,13 @@
else { // Otherwise we activate the failsafe
activeView = possibleViews.values().first();
}
-
+
if( stackedWidget->indexOf(activeView->mainWidget()) == -1 ) {
stackedWidget->addWidget(activeView->mainWidget());
}
+ changeAboutMenu( activeView->aboutData(), aboutViewAction, i18n("About active \
view") ); + moduleChanged();
activeView->setEnhancedTooltipEnabled( showTooltips );
stackedWidget->setCurrentWidget(activeView->mainWidget());
updateViewActions();
@@ -297,8 +282,8 @@
}
void SettingsBase::toggleDirtyState(bool state)
-{
- KCModuleInfo * moduleProxy = activeView->moduleView()->activeModule();
+{
+ KCModuleInfo * moduleProxy = activeView->moduleView()->activeModule();
configureAction->setDisabled(state);
setCaption( moduleProxy->moduleName(), state );
}
@@ -317,6 +302,7 @@
} else {
setCaption( QString(), false );
}
+ changeAboutMenu( activeView->moduleView()->aboutData(), aboutModuleAction, \
i18n("About active module") ); }
void SettingsBase::changeToolBar( BaseMode::ToolBarItems toolbar )
@@ -328,14 +314,31 @@
guiFactory()->unplugActionList( this, "search" );
if ( BaseMode::Search & toolbar ) {
QList<QAction*> searchBarActions;
- searchBarActions << spacerAction << searchAction;
+ searchBarActions << spacerAction << searchAction;
guiFactory()->plugActionList( this, "search", searchBarActions );
}
if ( BaseMode::Configure & toolbar ) {
QList<QAction*> configureBarActions;
- configureBarActions << configureAction;
+ configureBarActions << configureAction;
guiFactory()->plugActionList( this, "configure", configureBarActions );
}
}
+void SettingsBase::changeAboutMenu( const KAboutData * menuAbout, KAction * \
menuItem, QString fallback ) +{
+ if( !menuItem ) {
+ return;
+ }
+
+ if( menuAbout ) {
+ menuItem->setText( i18n( "About %1", menuAbout->programName() ) );
+ menuItem->setIcon( KIcon( menuAbout->programIconName() ) );
+ menuItem->setEnabled(true);
+ } else {
+ menuItem->setText( fallback );
+ menuItem->setIcon( KIcon( \
KGlobal::activeComponent().aboutData()->programIconName() ) ); + \
menuItem->setEnabled(false); + }
+}
+
#include "SettingsBase.moc"
--- trunk/KDE/kdebase/workspace/systemsettings/app/SettingsBase.h #963174:963175
@@ -28,11 +28,11 @@
#include <QStackedWidget>
#include <KDialog>
-#include <KAction>
#include <KService>
#include <KToolBar>
#include <KLineEdit>
-#include <KPageDialog>
+#include <KHelpMenu>
+#include <KActionMenu>
#include <KConfigGroup>
#include <KXmlGuiWindow>
#include <KAboutApplicationDialog>
@@ -55,7 +55,7 @@
private slots:
void initApplication();
void initToolBar();
- void initSearch();
+ void initHelpMenu();
void initConfig();
void initMenuList(MenuItem * parent);
void configUpdated();
@@ -66,6 +66,7 @@
void updateViewActions();
void moduleChanged();
void changeToolBar( BaseMode::ToolBarItems toolbar );
+ void changeAboutMenu( const KAboutData * menuAbout, KAction * menuItem, QString \
fallback );
private:
// The plugins
@@ -79,7 +80,11 @@
KAction * spacerAction;
KAction * quitAction;
KAction * configureAction;
- KAction * aboutAction;
+ // The help menu
+ KAction * aboutViewAction;
+ KAction * aboutModuleAction;
+ KHelpMenu * helpMenuObject;
+ KActionMenu * helpActionMenu;
// The configuration
KDialog * configDialog;
Ui::ConfigDialog configWidget;
@@ -92,8 +97,7 @@
KService::List categories;
KService::List modules;
// The about dialog
- KPageDialog * aboutDialog;
- QList<KPageWidgetItem *> aboutAppPage;
+ KAboutApplicationDialog * aboutDialog;
// Show enhanced tooltips
bool showTooltips;
--- trunk/KDE/kdebase/workspace/systemsettings/app/systemsettingsui.rc #963174:963175
@@ -12,7 +12,7 @@
<text>About System Settings</text>
<ActionList name="viewActions" />
<Separator />
- <Action name="aboutSystemSettings" />
+ <Action name="helpMenu" />
<ActionList name="configure" />
<ActionList name="search" />
</ToolBar>
--- trunk/KDE/kdebase/workspace/systemsettings/classic/ClassicMode.cpp #963174:963175
@@ -62,7 +62,7 @@
ClassicMode::ClassicMode( QObject * parent, const QVariantList& )
: BaseMode( parent ), d( new Private() )
{
- d->aboutClassic = new KAboutData( "KControl4_TreeView", 0, ki18n("Control Center \
Tree View"), + d->aboutClassic = new KAboutData( "TreeView", 0, ki18n("Tree \
View"),
"1.0", ki18n("Provides a classic tree-based view \
of control modules."),
KAboutData::License_GPL, ki18n("(c) 2009, Ben \
Cooksley"));
d->aboutClassic->addAuthor(ki18n("Ben Cooksley"), ki18n("Author"), \
"ben@eclipse.endoftheinternet.org");
--- trunk/KDE/kdebase/workspace/systemsettings/core/MenuModel.cpp #963174:963175
@@ -103,7 +103,7 @@
theData.setValue( mi );
break;
case MenuModel::UserFilterRole:
- theData.setValue( mi->keywords().join( QString() ) );
+ theData.setValue( mi->keywords().join( QString() ) );
break;
case MenuModel::UserSortRole:
theData.setValue( QString("%1%2").arg( QString::number(mi->weight()), 5, \
'0' ).arg( mi->service()->name() ) );
--- trunk/KDE/kdebase/workspace/systemsettings/core/ToolTips/KToolTipDelegate.cpp \
#963174:963175 @@ -111,7 +111,7 @@
#ifdef Q_WS_X11
return QX11Info::isCompositingManagerRunning();
#else
- return false;
+ return false;
#endif
}
--- trunk/KDE/kdebase/workspace/systemsettings/icons/IconMode.cpp #963174:963175
@@ -51,7 +51,6 @@
QList<QAbstractItemView*> mViews;
QStackedWidget * mainWidget;
KTabWidget * iconWidget;
- QSortFilterProxyModel proxyModel;
QList<MenuProxyModel *> proxyList;
QHash<MenuProxyModel *, QString> proxyMap;
KAboutData * aboutIcon;
@@ -62,7 +61,7 @@
IconMode::IconMode( QObject *parent, const QVariantList& )
: BaseMode( parent ), d( new Private() )
{
- d->aboutIcon = new KAboutData( "KControl4_IconView", 0, ki18n( "Control Center \
Icons View" ), + d->aboutIcon = new KAboutData( "IconView", 0, ki18n( "Icon View" \
),
"1.0", ki18n( "Provides a categorized icons view of \
control modules." ),
KAboutData::License_GPL, ki18n( "(c) 2009, Ben \
Cooksley" ) );
d->aboutIcon->addAuthor( ki18n( "Ben Cooksley" ), ki18n( "Author" ), \
"ben@eclipse.endoftheinternet.org" ); @@ -108,7 +107,7 @@
{
foreach( MenuItem *childItem, rootItem()->children() ) {
MenuModel *model = new MenuModel( childItem, this );
- model->addException( childItem );
+ model->addException( childItem );
MenuProxyModel *proxyModel = new MenuProxyModel( this );
proxyModel->setCategorizedModel( true );
proxyModel->setSourceModel( model );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic