Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 06a34505 authored by Marco Martin's avatar Marco Martin

a menu with main actions

parent 5010ef13
......@@ -108,7 +108,6 @@ void SettingsBase::initApplication()
for( int pluginsDone = 0; pluginsDone < nbPlugins ; ++pluginsDone ) {
KService::Ptr activeService = pluginObjects.at( pluginsDone );
QString error;
qWarning()<<"AAA"<<error<<activeService->library();
BaseMode * controller = activeService->createInstance<BaseMode>(this, QVariantList(), &error);
if( error.isEmpty() ) {
possibleViews.insert( activeService->library(), controller );
......@@ -133,7 +132,7 @@ void SettingsBase::initToolBar()
// Exit is the very last action
quitAction = actionCollection()->addAction( KStandardAction::Quit, "quit_action", this, SLOT(close()) );
// Configure goes at the end
configureAction = actionCollection()->addAction( KStandardAction::Preferences, this, SLOT(configShow()) );
configureAction = actionCollection()->addAction( KStandardAction::Preferences, "configure", this, SLOT(configShow()) );
actionCollection()->setDefaultShortcut(configureAction, QKeySequence(Qt::CTRL + Qt::Key_M));
configureAction->setText( i18n("Configure") );
// Help after it
......
......@@ -13,6 +13,7 @@ target_link_libraries(systemsettings_sidebar_mode systemsettingsview
KF5::I18n
KF5::KIOWidgets
KF5::Service
KF5::XmlGui
)
install( TARGETS systemsettings_sidebar_mode DESTINATION ${PLUGIN_INSTALL_DIR} )
......
......@@ -37,6 +37,9 @@
#include <KIconLoader>
#include <KLineEdit>
#include <KServiceTypeTrader>
#include <KXmlGuiWindow>
#include <KActionCollection>
#include <QMenu>
#include <QDebug>
K_PLUGIN_FACTORY( SidebarModeFactory, registerPlugin<SidebarMode>(); )
......@@ -52,6 +55,7 @@ public:
KCategoryDrawer * categoryDrawer;
KCategorizedView * categoryView;
QWidget * mainWidget;
QToolButton * menuButton;
QHBoxLayout * mainLayout;
MenuProxyModel * proxyModel;
KAboutData * aboutIcon;
......@@ -166,7 +170,27 @@ void SidebarMode::initWidget()
d->searchText->setClearButtonShown( true );
d->searchText->setPlaceholderText( i18nc( "Search through a list of control modules", "Search" ) );
d->searchText->setCompletionMode( KCompletion::CompletionPopup );
sidebarLayout->addWidget( d->searchText );
QHBoxLayout *topLayout = new QHBoxLayout(sidebar);
topLayout->setContentsMargins(0, 4, 4, 4);
d->menuButton = new QToolButton(sidebar);
d->menuButton->setAutoRaise(true);
d->menuButton->setIcon( QIcon::fromTheme("application-menu") );
if (!KMainWindow::memberList().isEmpty()) {
KXmlGuiWindow *mainWindow = qobject_cast<KXmlGuiWindow *>(KMainWindow::memberList().first());
if (mainWindow) {
KActionCollection *collection = mainWindow->actionCollection();
QMenu *menu = new QMenu(d->menuButton);
d->menuButton->setPopupMode(QToolButton::InstantPopup);
d->menuButton->setMenu(menu);
menu->addAction( collection->action("configure") );
menu->addAction( collection->action("help_contents") );
menu->addAction( collection->action("help_about_app") );
menu->addAction( collection->action("help_about_kde") );
}
}
topLayout->addWidget( d->menuButton );
topLayout->addWidget( d->searchText );
sidebarLayout->addItem( topLayout );
// Prepare the Base Data
MenuItem *rootModule = new MenuItem( true, 0 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment