diff options
Diffstat (limited to 'src/app/UserMenu')
-rw-r--r-- | src/app/UserMenu/Makefile.am | 7 | ||||
-rw-r--r-- | src/app/UserMenu/usermenu.cpp | 85 | ||||
-rw-r--r-- | src/app/UserMenu/usermenu.h | 46 |
3 files changed, 138 insertions, 0 deletions
diff --git a/src/app/UserMenu/Makefile.am b/src/app/UserMenu/Makefile.am new file mode 100644 index 0000000..1d48899 --- /dev/null +++ b/src/app/UserMenu/Makefile.am @@ -0,0 +1,7 @@ +noinst_LIBRARIES = libUserMenu.a + +INCLUDES = $(all_includes) + +libUserMenu_a_METASOURCES = AUTO + +libUserMenu_a_SOURCES = usermenu.cpp diff --git a/src/app/UserMenu/usermenu.cpp b/src/app/UserMenu/usermenu.cpp new file mode 100644 index 0000000..5f9241a --- /dev/null +++ b/src/app/UserMenu/usermenu.cpp @@ -0,0 +1,85 @@ +/*************************************************************************** + _expressionsu.cpp - description + ------------------- +begin : Sat Dec 6 2003 +copyright : (C) 2003 by Shie Erlich & Rafi Yanai +email : +***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include <kdebug.h> +#include <tdelocale.h> + +#include "../krusader.h" +#include "../Konfigurator/konfigurator.h" +#include "../UserAction/kraction.h" +#include "../UserAction/useraction.h" +#include "usermenu.h" + + +void UserMenu::exec() { + _popup->run(); +} + +UserMenu::UserMenu( TQWidget * parent, const char * name ) : TQWidget( parent, name ) { + _popup = new UserMenuGui(this); +} + +void UserMenu::update() { + _popup->createMenu(); +} + +////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////////////////////////////// + +UserMenuGui::UserMenuGui( UserMenu *, TQWidget * parent ) : TDEPopupMenu( parent ) { + createMenu(); +} + +void UserMenuGui::createMenu() { +// kdDebug() << "UserMenuGui::createMenu called" << endl; + clear(); + insertTitle( i18n("User Menu") ); + + // read entries from config file. + readEntries(); + + // add the "add new entry" command + insertSeparator(); + insertItem( i18n("Manage user actions"), 0 ); +} + +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. + int idx = 1; + + //FIXME: don't plug ALL useractions into the usermenu. TODO: read the usermenu-strukture from an other file (krusaderrc ?) + UserAction::KrActionList list = krUserAction->actionList(); + for ( KrAction* action = list.first(); action; action = list.next() ) + action->plug( this, idx++ ); + +} + +void UserMenuGui::run() { + //disable unwanted actions: + // disabled due to conflicts with the toolbar (a check on each file-cursor-movement would be nessesary; hit the performance) +// krApp->userAction->setAvailability(); + + int idx = exec(); + if ( idx == -1 ) // nothing was selected + return; + if ( idx == 0 ) { + Konfigurator konfigurator( false, 7 ); // page 7 are the UserActions + return; + } +} diff --git a/src/app/UserMenu/usermenu.h b/src/app/UserMenu/usermenu.h new file mode 100644 index 0000000..f987b4d --- /dev/null +++ b/src/app/UserMenu/usermenu.h @@ -0,0 +1,46 @@ +/*************************************************************************** + usermenu.h - description + ------------------- +begin : Sat Dec 6 2003 +copyright : (C) 2003 by Shie Erlich & Rafi Yanai +email : +***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef USERMENU_H +#define USERMENU_H + +#include <tdepopupmenu.h> + +class TQWidget; +class UserMenu; + +class UserMenuGui: public TDEPopupMenu { + public: + UserMenuGui( UserMenu* menu, TQWidget *parent = 0 ); + void run(); + void createMenu(); + + protected: + void readEntries(); +}; + +class UserMenu : public TQWidget { + public: + UserMenu( TQWidget *parent = 0, const char *name = 0 ); + void exec(); + void update(); + + private: + UserMenuGui* _popup; +}; + +#endif |