diff --git a/krusader/UserMenu/usermenu.cpp b/krusader/UserMenu/usermenu.cpp index 896cdc21..758d1d14 100644 --- a/krusader/UserMenu/usermenu.cpp +++ b/krusader/UserMenu/usermenu.cpp @@ -1,98 +1,99 @@ /***************************************************************************** * Copyright (C) 2003 Shie Erlich * * Copyright (C) 2003 Rafi Yanai * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This package is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this package; if not, write to the Free Software * * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ #include "usermenu.h" -#include +// QtCore +#include #include #include "../krglobal.h" #include "../Konfigurator/konfigurator.h" #include "../UserAction/kraction.h" #include "../UserAction/useraction.h" void UserMenu::exec() { _popup->run(); } UserMenu::UserMenu(QWidget * parent) : QWidget(parent) { _popup = new UserMenuGui(this); } void UserMenu::update() { _popup->createMenu(); } ////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////// UserMenuGui::UserMenuGui(QWidget * parent) : QMenu(parent) { createMenu(); } void UserMenuGui::createMenu() { // qDebug() << "UserMenuGui::createMenu called" << endl; clear(); setTitle(i18n("User Menu")); // read entries from config file. readEntries(); // add the "add new entry" command addSeparator(); _manageAction = addAction(i18n("Manage user actions")); } void UserMenuGui::readEntries() { // Note: entries are marked 1..n, so that entry 0 is always // available. It is used by the "add new entry" command. //FIXME: don't plug ALL useractions into the usermenu. TODO: read the usermenu-strukture from an other file (krusaderrc ?) UserAction::KrActionList list = krUserAction->actionList(); QListIterator it(list); while (it.hasNext()) addAction(it.next()); } void UserMenuGui::run() { //disable unwanted actions: // disabled due to conflicts with the toolbar // (a check on each file-cursor-movement would be necessary; // hit the performance) // krApp->userAction->setAvailability(); QAction * act = exec(); if (act == 0) // nothing was selected return; if (act == _manageAction) { Konfigurator konfigurator(false, 7); // page 7 are the UserActions return; } } diff --git a/krusader/UserMenu/usermenu.h b/krusader/UserMenu/usermenu.h index 3c94cfd6..b7ef3273 100644 --- a/krusader/UserMenu/usermenu.h +++ b/krusader/UserMenu/usermenu.h @@ -1,54 +1,55 @@ /***************************************************************************** * Copyright (C) 2003 Shie Erlich * * Copyright (C) 2003 Rafi Yanai * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This package is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this package; if not, write to the Free Software * * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ #ifndef USERMENU_H #define USERMENU_H -#include +// QtWidgets +#include class QWidget; class UserMenu; class QAction; class UserMenuGui: public QMenu { public: UserMenuGui(QWidget *parent = 0); void run(); void createMenu(); protected: void readEntries(); private: QAction* _manageAction; }; class UserMenu : public QWidget { public: UserMenu(QWidget *parent = 0); void exec(); void update(); private: UserMenuGui* _popup; }; #endif