diff options
Diffstat (limited to 'kicker/menuext')
50 files changed, 5174 insertions, 0 deletions
diff --git a/kicker/menuext/Makefile.am b/kicker/menuext/Makefile.am new file mode 100644 index 000000000..6d672d29a --- /dev/null +++ b/kicker/menuext/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = find kdeprint prefmenu recentdocs konsole konq-profiles remote system kate + diff --git a/kicker/menuext/find/Makefile.am b/kicker/menuext/find/Makefile.am new file mode 100644 index 000000000..223781dcf --- /dev/null +++ b/kicker/menuext/find/Makefile.am @@ -0,0 +1,18 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = kickermenu_find.la + +kickermenu_find_la_SOURCES = findmenu.cpp +kickermenu_find_la_LDFLAGS = $(all_libraries) -module -avoid-version +kickermenu_find_la_LIBADD = $(LIB_KDEUI) + +kickermenu_find_la_METASOURCES = AUTO + +desktopmenu_DATA = find.desktop +desktopmenudir = $(kde_datadir)/kicker/menuext + +findmenu_data_DATA = kfind.desktop websearch.desktop +findmenu_datadir = $(kde_datadir)/kicker/menuext/find + +messages: + $(XGETTEXT) *.cpp -o $(podir)/libkickermenu_find.pot diff --git a/kicker/menuext/find/find.desktop b/kicker/menuext/find/find.desktop new file mode 100644 index 000000000..c4dd2258e --- /dev/null +++ b/kicker/menuext/find/find.desktop @@ -0,0 +1,133 @@ +[Desktop Entry] +Name=Find +Name[af]=Soek +Name[ar]=إبحث +Name[az]=Tap +Name[be]=Шукаць +Name[bg]=Търсене +Name[bn]=অনুসন্ধান +Name[br]=Klask +Name[bs]=Traži +Name[ca]=Cerca +Name[cs]=Najít +Name[csb]=Szëkba +Name[cy]=Canfod +Name[de]=Suchen +Name[el]=Αναζήτηση +Name[eo]=Trovi +Name[es]=Buscar +Name[et]=Otsing +Name[eu]=Bilatu +Name[fa]=یافتن +Name[fi]=Etsi +Name[fr]=Recherche +Name[fy]=Sykje +Name[ga]=Aimsigh +Name[gl]=Procurar +Name[he]=מצא +Name[hi]=ढूंढें +Name[hr]=Traži +Name[hu]=Keresés +Name[is]=Leita +Name[it]=Trova +Name[ja]=検索 +Name[ka]=ძიება +Name[kk]=Іздеп табу +Name[km]=រក +Name[lt]=Rasti +Name[lv]=Meklēt +Name[mk]=Најди +Name[mn]=Олох +Name[ms]=Cari +Name[mt]=Fittex +Name[nb]=Finn +Name[nds]=Söken +Name[ne]=फेला पार्नुहोस् +Name[nl]=Zoeken +Name[nn]=Finn +Name[pa]=ਖੋਜ +Name[pl]=Wyszukiwanie +Name[pt]=Procurar +Name[pt_BR]=Procurar +Name[ro]=Caută +Name[ru]=Поиск +Name[rw]=Gushaka +Name[se]=Oza +Name[sk]=Nájsť +Name[sl]=Najdi +Name[sr]=Нађи +Name[sr@Latn]=Nađi +Name[sv]=Sök +Name[ta]=தேடு +Name[te]=వెతుకు +Name[tg]=Кофтан +Name[th]=ค้นหา +Name[tr]=Bul +Name[tt]=Ezläw +Name[uk]=Пошук +Name[uz]=Qidirish +Name[uz@cyrillic]=Қидириш +Name[vi]=Tìm kiếm +Name[wa]=Trover +Name[zh_CN]=查找 +Name[zh_TW]=尋找 +Comment=Menu for starting a file or web search +Comment[af]=Kieslys om 'n lêer of web bladsy te soek +Comment[ar]=قائمة لتشغيل ملف أو للبحث في الشبكة +Comment[be]=Меню для запуску пошуку файлаў ці ў Сеціве +Comment[bg]=Меню за стартиране на файл или търсене в Интернет +Comment[bn]=ফাইল বা ওয়েব অনুসন্ধান করার জন্য মেনু +Comment[bs]=Meni za pokretanje datoteke ili pretrage weba +Comment[ca]=Menú per iniciar una cerca de fitxers o web +Comment[cs]=Nabídka pro spuštění souboru nebo hledání na webu +Comment[csb]=Menu naczãca szëkbë w sécë abò lopków +Comment[da]=Menu for hurtigt at starte en fil- eller netsøgning +Comment[de]=Menü zur Datei- oder Websuche +Comment[el]=Μενού για την εκκίνηση ενός αρχείου ή αναζήτηση στον ιστό +Comment[eo]=Menuo por lanĉi dosier- aŭ TTT-serĉadon +Comment[es]=Menú para comenzar la búsqueda de un archivo o página web +Comment[et]=Menüü faili- või veebiotsingu käivitamiseks +Comment[eu]=Fitxategiak edo interneten bilaketak abiarazteko menua +Comment[fa]=گزینگان برای آغاز جستجوی پرونده یا وب +Comment[fi]=Valikko tiedoston käynnistämiseen tai verkkohakuun +Comment[fr]=Menu permettant d'effectuer une recherche de fichiers ou sur Internet +Comment[fy]=Menu foar it sykjen nei triemmen of op't ynternet +Comment[gl]=Menú para abrir un ficheiro ou buscar na web +Comment[he]=תפריט לחיפוש קובץ, או ביצוע חיפוש ברשת +Comment[hr]=Izbornik za pokretanje pretraživanja datoteka ili Interneta +Comment[hu]=Menü webes vagy fájlkereséshez +Comment[is]=Einföld leið til að ræsa skrár eða hefja vefleit +Comment[it]=Menu per avviare una ricerca web o di file +Comment[ja]=ファイルまたはウェブ検索を開始するためのメニュー +Comment[ka]=ფაილში ან ვებში ძიების დაწყების მენიუ +Comment[kk]=Файңлды жегу не вебте іздеу мәзірі +Comment[km]=ម៉ឺនុយសម្រាប់ចាប់ផ្តើមស្វែងរកឯកសារ ឬ ទំព័របណ្តាញ +Comment[lt]=Bylų ar žiniatinklio paieškos meniu +Comment[mk]=Мени за пребарување на датотека или пребарување на мрежа +Comment[nb]=Meny for å starte en fil eller et nettsøk +Comment[nds]=Menü för dat Söken na Dateien oder binnen dat Nett +Comment[ne]=फाइल सुरुआत गर्ने वा वेब खोज्नका लागि मेनु +Comment[nl]=Menu voor het zoeken naar bestanden of op internet +Comment[nn]=Meny for å starta ei fil eller eit nettsøk +Comment[pa]=ਇੱਕ ਫਾਇਲ ਜਾਂ ਵੈੱਬ ਖੋਜ ਸ਼ੁਰੂ ਕਰਨ ਲਈ ਮੇਨੂ +Comment[pl]=Menu rozpoczęcia przeszukiwania sieci lub plików +Comment[pt]=Um menu para iniciar uma pesquisa de ficheiros ou na Web +Comment[pt_BR]=Menu para iniciar um arquivo ou uma busca web +Comment[ro]=Meniu pentru pornirea unei căutări de fișiere sau pe web +Comment[ru]=Быстрый доступ к поиску файлов и страниц в Интернете +Comment[se]=Fállu mas álggahat fiila- dahje fierpmádatohcama +Comment[sk]=Menu pre vyhľadávanie súborov alebo webu +Comment[sl]=Meni za začetek iskanja datotek in iskanja po spletu +Comment[sr]=Мени за започињање претраге фајлова или Веба +Comment[sr@Latn]=Meni za započinjanje pretrage fajlova ili Veba +Comment[sv]=Meny för att snabbt starta en fil- eller webbsökning +Comment[th]=เมนูสำหรับเริ่มการค้นหาแฟ้ม หรือเว็บ +Comment[tr]=Bir dosya ya da web araması başlatmak için menü +Comment[uk]=Меню для пошуку файлів або пошуку в Тенетах +Comment[vi]=Thực đơn giúp tìm tập tin hay tìm trên mạng +Comment[wa]=Menu po-z enonder on cweraedje d' on fitchî ou sol daegntoele +Comment[zh_CN]=启动文件或 Web 搜索的菜单 +Comment[zh_TW]=開始檔案或網頁搜尋的選單 +Icon=kfind + +X-KDE-Library=kickermenu_find diff --git a/kicker/menuext/find/findmenu.cpp b/kicker/menuext/find/findmenu.cpp new file mode 100644 index 000000000..fc3ae12a6 --- /dev/null +++ b/kicker/menuext/find/findmenu.cpp @@ -0,0 +1,84 @@ +/* + This file is part of Kicker. + Copyright (c) 2003 Tobias Koenig <[email protected]> + + 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 program 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 program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#include <kapplication.h> +#include <kiconloader.h> +#include <ksimpleconfig.h> +#include <kstandarddirs.h> + +#include "findmenu.h" + +K_EXPORT_KICKER_MENUEXT( find, FindMenu ) + + +FindMenu::FindMenu( QWidget *parent, const char *name, + const QStringList &/*args*/) + : KPanelMenu( "", parent, name ) +{ +} + +FindMenu::~FindMenu() +{ + mConfigList.clear(); +} + +void FindMenu::initialize() +{ + QStringList list = KGlobal::dirs()->findAllResources( "data", "kicker/menuext/find/*.desktop", false, true ); + + list.sort(); + + int id = 0; + + mConfigList.clear(); + for ( QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) { + KSimpleConfig config( *it, true ); + config.setDesktopGroup(); + + mConfigList.append( *it ); + QString text = config.readEntry( "Name" ); + + insertItem( SmallIconSet( config.readEntry( "Icon" ) ), text, id ); + id++; + } +} + +void FindMenu::slotExec( int pos ) +{ + QString app = mConfigList[ pos ]; + + kapp->propagateSessionManager(); + + KSimpleConfig config(app, true); + config.setDesktopGroup(); + if (kapp && config.readEntry("Type") == "Link") + { + kapp->invokeBrowser(config.readEntry("URL")); + } + else + { + KApplication::startServiceByDesktopPath( app ); + } +} + +#include "findmenu.moc" diff --git a/kicker/menuext/find/findmenu.h b/kicker/menuext/find/findmenu.h new file mode 100644 index 000000000..2297c4dff --- /dev/null +++ b/kicker/menuext/find/findmenu.h @@ -0,0 +1,47 @@ +/* + This file is part of Kicker. + Copyright (c) 2003 Tobias Koenig <[email protected]> + + 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 program 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 program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + As a special exception, permission is given to link this program + with any edition of Qt, and distribute the resulting executable, + without including the source code for Qt in the source distribution. +*/ + +#ifndef FINDMENU_H +#define FINDMENU_H + +#include <kpanelmenu.h> + +class QStringList; + +class FindMenu : public KPanelMenu +{ + Q_OBJECT + + public: + FindMenu( QWidget* parent, const char* name, const QStringList &/*args*/ ); + ~FindMenu(); + + protected slots: + void initialize(); + void slotExec( int ); + + private: + QStringList mConfigList; +}; + +#endif diff --git a/kicker/menuext/find/kfind.desktop b/kicker/menuext/find/kfind.desktop new file mode 100644 index 000000000..fff29f223 --- /dev/null +++ b/kicker/menuext/find/kfind.desktop @@ -0,0 +1,89 @@ +[Desktop Entry] +Exec=kfind %f +Icon=kfind +DocPath=kfind/index.html +Path= +Type=Application +Terminal=false +Name=Find Files +Name[af]=Soek Lêers +Name[ar]=ابحث عن ملفات +Name[be]=Шукаць файлы +Name[bg]=Търсене на файлове +Name[bn]=ফাইল অনুসন্ধান +Name[br]=Klask restroù +Name[bs]=Pronađi datoteke +Name[ca]=Cerca fitxers +Name[cs]=Najít soubory +Name[csb]=Nalezë lopczi +Name[cy]=Canfod Ffeiliau +Name[da]=Find filer +Name[de]=Dateien suchen +Name[el]=Αναζήτηση αρχείων +Name[eo]=Trovi dosierojn +Name[es]=KFind +Name[et]=Failide otsimine +Name[eu]=Bilatu fitxategiak +Name[fa]=یافتن پروندهها +Name[fi]=Etsi tiedostoja +Name[fr]=Recherche de fichiers +Name[fy]=Triemmen sykje +Name[ga]=Aimsigh Comhaid +Name[gl]=Buscar Ficheiros +Name[he]=חפש קבצים +Name[hi]=फ़ाइलें ढूंढें +Name[hr]=Traži datoteke +Name[hu]=Fájlkereső +Name[id]=Cari Berkas +Name[is]=Finna skrár +Name[it]=Trova file +Name[ja]=ファイルを検索 +Name[ka]=ფაილთა ძიება +Name[kk]=Файлдарды табу +Name[km]=រកឯកសារ +Name[ko]=글꼴 파일 +Name[lo]=ຄົ້ນຫາແຟ້ມ +Name[lt]=Rasti bylas +Name[lv]=Meklēt Failus +Name[mk]=Пронајди датотеки +Name[mn]=Файл хайх +Name[ms]=Cari Fail +Name[mt]=Sib Fajls +Name[nb]=Finn filer +Name[nds]=Dateien söken +Name[ne]=फाइल फेला पार्नुहोस् +Name[nl]=Bestanden zoeken +Name[nn]=Finn filer +Name[nso]=Hwetsa Difaele +Name[oc]=Cerca fiquièrs +Name[pa]=ਫਾਇਲ ਖੋਜ +Name[pl]=Znajdź pliki +Name[pt]=Procurar Ficheiros +Name[pt_BR]=Procurar arquivos +Name[ro]=Caută fișiere +Name[ru]=Поиск файлов +Name[rw]=Gushaka Amadosiye +Name[se]=Oza fiillaid +Name[sk]=Hľadať súbory +Name[sl]=Najdi datoteke +Name[sr]=Претрага фајлова +Name[sr@Latn]=Pretraga fajlova +Name[sv]=Hitta filer +Name[ta]=கோப்புகளைக் கண்டுபிடி +Name[te]=దస్త్రాలను వెతుకు +Name[tg]=Ёфтани файлҳо +Name[th]=ค้นหาแฟ้ม +Name[tr]=Dosyalarda Bul +Name[tt]=Birem Ezläw +Name[uk]=Пошук файлів +Name[uz]=Fayllarni qidirish +Name[uz@cyrillic]=Файлларни қидириш +Name[ven]=Todani faela +Name[vi]=Tìm Tập tin +Name[wa]=Trover des fitchîs +Name[xh]=Fumana Iifayile +Name[zh_CN]=查找文件 +Name[zh_TW]=尋找檔案 +Name[zu]=Thola Amafayela +X-KDE-StartupNotify=true +Categories=Qt;KDE;Find; diff --git a/kicker/menuext/find/websearch.desktop b/kicker/menuext/find/websearch.desktop new file mode 100644 index 000000000..b3d2a0254 --- /dev/null +++ b/kicker/menuext/find/websearch.desktop @@ -0,0 +1,80 @@ +# KDE Config File +[Desktop Entry] +Type=Link +URL=http://www.google.com +Icon=enhanced_browsing +Terminal=false +Name=Web Search +Name[af]=Web Soektog +Name[ar]=بحث في الشبكة +Name[az]=Vebdə Axtrarış +Name[be]=Шукаць у Сеціве +Name[bg]=Търсене в Интернет +Name[bn]=ওয়েব অনুসন্ধান +Name[br]=Klask ar gwiad +Name[bs]=Web pretraga +Name[ca]=Recerca web +Name[cs]=Vyhledávání na webu +Name[csb]=Szëkba w sécë WWW +Name[cy]=Chwiliad Gwê +Name[da]=Internetsøgning +Name[de]=Web-Suche +Name[el]=Αναζήτηση στο διαδίκτυο +Name[eo]=TTT-serĉo +Name[es]=Búsqueda web +Name[et]=Veebiotsing +Name[eu]=Web arakaketa +Name[fa]=جستجوی وب +Name[fi]=Verkkohaku +Name[fr]=Recherche web +Name[fy]=Web-sykje-opdracht +Name[ga]=Cuardach Lín +Name[gl]=Procura na Web +Name[he]=חיפוש ברשת +Name[hi]=वेब खोज +Name[hr]=Web pretraživanje +Name[hu]=Keresés a weben +Name[is]=Vefleit +Name[it]=Ricerca sul web +Name[ja]=ウェブ検索 +Name[ka]=ვებ ძიება +Name[kk]=Вебте табу +Name[km]=ស្វែងរកតាមបណ្ដាញ +Name[lt]=Žiniatinklio paieška +Name[lv]=Meklēt tīklā +Name[mk]=Веб-пребарување +Name[mn]=Вэб хайлт +Name[ms]=Carian Web +Name[mt]=Fittex fuq il-web +Name[nb]=Søk på nettsteder +Name[nds]=In't Nett söken +Name[ne]=वेब खोजी +Name[nl]=Web-zoekopdracht +Name[nn]=Søk på nettstader +Name[pa]=ਵੈੱਬ ਖੋਜ +Name[pl]=Wyszukiwanie w sieci WWW +Name[pt]=Pesquisa na Web +Name[pt_BR]=Busca na Web +Name[ro]=Căutare Web +Name[ru]=Поиск в Интернете +Name[rw]=Ishakisha ry'Urubugamakuru +Name[se]=Web-ohcan +Name[sk]=Hľadanie na WWW +Name[sl]=Spletno iskanje +Name[sr]=Претраживање Веба +Name[sr@Latn]=Pretraživanje Veba +Name[sv]=Webbsökning +Name[ta]=வலை தேடு +Name[te]=వెబ్ అన్వెషణ +Name[tg]=Ҷустуҷӯи Вэб +Name[th]=ค้นหาจากเว็บ +Name[tr]=Web Arama +Name[tt]=Web-Ezläw +Name[uk]=Пошук в Тенетах +Name[uz]=Internetda qidirish +Name[uz@cyrillic]=Интернетда қидириш +Name[vi]=Tìm kiếm trên mạng +Name[wa]=Cweraedje sol daegntoele +Name[zh_CN]=Web 搜索 +Name[zh_TW]=網頁搜尋 +Categories=Qt;KDE;Find; diff --git a/kicker/menuext/kate/Makefile.am b/kicker/menuext/kate/Makefile.am new file mode 100644 index 000000000..bc629e0f9 --- /dev/null +++ b/kicker/menuext/kate/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = kickermenu_kate.la + +kickermenu_kate_la_SOURCES = katesessionmenu.cpp +kickermenu_kate_la_LDFLAGS = $(all_libraries) -module -avoid-version +kickermenu_kate_la_LIBADD = $(LIB_KDEUI) + +kickermenu_kate_la_METASOURCES = AUTO + +desktopmenu_DATA = katesessionmenu.desktop +desktopmenudir = $(kde_datadir)/kicker/menuext + +messages: + $(XGETTEXT) *.cpp -o $(podir)/kickermenu_kate.pot
\ No newline at end of file diff --git a/kicker/menuext/kate/katesessionmenu.cpp b/kicker/menuext/kate/katesessionmenu.cpp new file mode 100644 index 000000000..63cee8106 --- /dev/null +++ b/kicker/menuext/kate/katesessionmenu.cpp @@ -0,0 +1,150 @@ +/* + 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 program 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 program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + + --- + Copyright (C) 2005, Anders Lund <[email protected]> + */ + +#include "katesessionmenu.h" +#include "katesessionmenu.moc" + +#include <kapplication.h> +#include <kconfig.h> +#include <kglobal.h> +#include <kiconloader.h> +#include <kinputdialog.h> +#include <klibloader.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <ksimpleconfig.h> +#include <kstandarddirs.h> + +#include <qvalidator.h> + +class Validator : public QValidator { + public: + Validator( QObject *parent ) : QValidator( parent, 0 ) {} + ~Validator() {} + virtual QValidator::State validate( QString &, int & ) const { return QValidator::Acceptable; } +}; + +K_EXPORT_KICKER_MENUEXT(kate, KateSessionMenu) + +KateSessionMenu::KateSessionMenu( QWidget *parent, const char *name, const QStringList& ) + : KPanelMenu( parent, name ), + m_parent( parent ) +{ +} + +KateSessionMenu::~KateSessionMenu() +{ +} + +// update the session list and rebuild the menu +void KateSessionMenu::initialize() +{ + if ( initialized() ) + { + return; + } + + m_sessions.clear(); + + int id = 0; + + // no session - exec 'kate' + insertItem( SmallIconSet("kate"), i18n("Start Kate (no arguments)"), id++ ); + + // new session - prompt for a name and exec 'kate --start NAME' + insertItem( SmallIconSet("new"), i18n("New Kate Session"), id++ ); + + // new anonymous session, 'kate --start ""' + insertItem( SmallIconSet("new"), i18n("New Anonymous Session"), id++ ); + + insertSeparator(); + + QStringList list = KGlobal::dirs()->findAllResources( "data", "kate/sessions/*.katesession", false, true); + for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) + { + KSimpleConfig config( *it, true ); + config.setGroup( "General" ); + m_sessions.append( config.readEntry( "Name" ) ); + } + + m_sessions.sort(); + + for ( QStringList::ConstIterator it1 = m_sessions.begin(); it1 != m_sessions.end(); ++it1 ) + { + insertItem( *it1, id++ ); + } + + // means for updating, to let the user manually update if he/she added new sessions. + insertSeparator(); + insertItem( SmallIconSet("reload"), i18n("Reload Session List"), this, SLOT(reinitialize()) ); +} + +void KateSessionMenu::slotExec( int id ) +{ + if ( id < 0 ) + return; + + QStringList args; + if ( id > 0 ) + args << "--start"; + + // If a new session is requested we try to ask for a name. + if ( id == 1 ) + { + bool ok (false); + QString name = KInputDialog::getText( i18n("Session Name"), + i18n("Please enter a name for the new session"), + QString::null, + &ok, 0, 0, new Validator( m_parent ) ); + if ( ! ok ) + return; + + if ( name.isEmpty() && KMessageBox::questionYesNo( 0, + i18n("An unnamed session will not be saved automatically. " + "Do you want to create such a session?"), + i18n("Create anonymous session?"), + KStdGuiItem::yes(), KStdGuiItem::cancel(), + "kate_session_button_create_anonymous" ) == KMessageBox::No ) + return; + + if ( m_sessions.contains( name ) && + KMessageBox::warningYesNo( 0, + i18n("You allready have a session named %1. Do you want to open that session?").arg( name ), + i18n("Session exists") ) == KMessageBox::No ) + return; + else + // mark the menu as dirty so that it gets rebuild at next display + // to show the new session + setInitialized( false ); + + args << name; + } + + else if ( id == 2 ) + args << ""; + + else if ( id > 2 ) + args << m_sessions[ id-3 ]; + + kapp->kdeinitExec("kate", args); +} + + +// kate: space-indent: on; indent-width 2; replace-tabs on; diff --git a/kicker/menuext/kate/katesessionmenu.desktop b/kicker/menuext/kate/katesessionmenu.desktop new file mode 100644 index 000000000..24eea8be4 --- /dev/null +++ b/kicker/menuext/kate/katesessionmenu.desktop @@ -0,0 +1,98 @@ +[Desktop Entry] +Name=Kate Session Menu +Name[bg]=Меню сесии на Kate +Name[bn]=কেট সেশন মেনু +Name[ca]=Menú de la sessió Kate +Name[cs]=Nabídka relace Kate +Name[csb]=Menu sesëji Kate +Name[da]=Kate Sessionsmenu +Name[de]=Kate Sitzungsmenü +Name[el]=Μενού συνεδρίας του Kate +Name[eo]=Kate Seanco Menuo +Name[es]=Menú de la sesión de Kate +Name[et]=Kate seansimenüü +Name[fa]=گزینگان نشست Kate +Name[fi]=Katen istuntojenhallinta +Name[fr]=Menu de sessions de Kate +Name[fy]=Kate Sesjemenu +Name[gl]=Menú de Sesións de Kate +Name[he]=תפריט ההפעלה של Kate +Name[hr]=Kate izbornik sesija +Name[hu]=Kate munkafolyamat-menü +Name[is]=Kate setuvalmynd +Name[it]=Menu delle sessioni di Kate +Name[ja]=Kate セッションメニュー +Name[kk]=Kate сеанс мәзірі +Name[km]=ម៉ឺនុយសម័យរបស់ Kate +Name[lt]=Kate sesijų meniu +Name[nb]=Meny for Kate-økter +Name[nds]=Kate-Törnmenü +Name[ne]=केट सत्र मेनु +Name[nl]=Kate sessiemenu +Name[pa]=ਕੇਟ ਸ਼ੈਸ਼ਨ ਮੇਨੂ +Name[pl]=Menu sesji Kate +Name[pt]=Menu de Sessões do Kate +Name[pt_BR]=Menu de Sessões do Kate +Name[ro]=Meniu sesiune Kate +Name[ru]=Сеанс Kate +Name[sk]=Kate menu sedenia +Name[sl]=Meni s sejami za Kate +Name[sr]=Kate-ин мени сесија +Name[sr@Latn]=Kate-in meni sesija +Name[sv]=Kate sessionsmeny +Name[te]=కేట్ సెషన్ పట్టీ +Name[th]=เมนูเซสชั่นของ Kate +Name[tr]=Kate Oturum Menüsü +Name[uk]=Меню сеансів Kate +Name[uz]=Kate seans menyusi +Name[uz@cyrillic]=Kate сеанс менюси +Name[wa]=Dressêye di sessions Kate +Name[zh_CN]=Kate 会话菜单 +Name[zh_TW]=Kate 工作階段選單 +Comment=Allows you to open Kate with a specified session, or create a new one +Comment[bg]=Позволя отварянето на определена сесия на Kate или създаването на нова +Comment[ca]=Us permet obrir Kate amb una sessió específica o bé crear-ne una de nova +Comment[cs]=Umožňuje otevřít Kate s určitou relací nebo si vytvořit novou +Comment[csb]=Pòzwôlô òtemknąc apartną sesëjã Kate abò ùsôdzëc nową +Comment[da]=Tillader dig at åbne Kate med en bestemt session, eller at oprette en ny +Comment[de]=Lässt Sie Kate mit einer vorhandenen oder neuen Sitzung starten +Comment[el]=Σας επιτρέπει να ανοίξετε το Kate μα μια καθορισμένη συνεδρία, ή να δημιουργήσετε μία νέα +Comment[eo]=Ebligas vin malfermi Kate-n kun aparta seanco, aŭ krei novan +Comment[es]=Le permite abrir Kate con una sesión específica, o crear una nueva +Comment[et]=Võimaldab avada Kate määratud seansiga või luua uue seansi +Comment[fa]=به شما اجازه میدهد Kate را توسط نشست مشخصشده باز کنید، یا مورد جدیدی را ایجاد نمایید +Comment[fi]=Voit avata Katesta määritellyn istunnon, tai luoda uuden +Comment[fr]=Vous permet d'ouvrir Kate avec une session spécifiée, ou d'en créer une nouvelle +Comment[fy]=Stiet jo ta om Kate mei in oantsjutte sesje te iepenjen, of in nije oan te meitsjen +Comment[gl]=Permítelle abrir Kate cunha sesión especificada, ou crear unha nova. +Comment[hr]=Dopušta otvaranje Kate uz određenu sesiju ili izradu nove sesije +Comment[hu]=Lehetővé teszi a Kate megnyitását egy megadott munkafolyamattal vagy egy újonnan létrehozottal +Comment[is]=Gerir þér kleyft að opna Kate með ákveðinni setu, eða búa til nýja +Comment[it]=Ti permette di aprire Kate con una particolare sessione, o di crearne una nuova +Comment[ja]=新規または既存のセッションで Kate を起動します +Comment[kk]=Kate-тің керек сеансын ашады, немесе жаңасын бастайды +Comment[km]= អនុញ្ញាតឲ្យអ្នកបើក Kate ជាមួយនឹងសម័យដែលបានបញ្ជាក់ ឬបង្កើតថ្មីមួយ +Comment[lt]=Leidžia atverti Kate su nurodyta sesija arba sukurti naują +Comment[nb]=Brukes til å åpne Kate med en bestemt økt, eller opprette en ny +Comment[nds]=Lett Di Kate mit en angeven oder niegen Törn opmaken +Comment[ne]=निर्दिष्ट गरिएको सत्रसँग केट खोल्न,वा एउटा नयाँ सिर्जना गर्न अनुमति दिन्छ +Comment[nl]=Stelt u in staat om Kate te openen met een opgegeven sessie, of u kunt een nieuwe sessie aanmaken +Comment[pl]=Pozwala otworzyć określoną sesję Kate albo utworzyć nową +Comment[pt]=Permite-lhe abrir o Kate com uma determinada sessão ou criar uma nova +Comment[pt_BR]=Permite que você abra o Kate com uma sessão específica, ou criar uma nova +Comment[ro]=Vă permite să deschideți Kate cu o sesiune specificată, sau să creați una nouă +Comment[ru]=Позволяет открыть заданный сеанс Kate +Comment[sk]=Umožní otvoriť Kate so špecifickým sedením alebo vytvoriť nové sedenie +Comment[sl]=Omogoča vam, da Kate odprete z izbrano sejo, ali pa ustvarite novo sejo +Comment[sr]=Омогућава вам да отворите Kate са задатом сесијом, или да направите нову +Comment[sr@Latn]=Omogućava vam da otvorite Kate sa zadatom sesijom, ili da napravite novu +Comment[sv]=Gör det möjligt att öppna Kate med en angiven session, eller skapa en ny +Comment[te]=కెట్ ను ఇవ్వబడిన సెషన్ తొ తెరువబడును, లేక కొత్తది సృష్టించబడును +Comment[th]=ให้คุณเปิด Kate ด้วยเซสชั่นที่ระบุ หรือสร้างเซสชั่นใหม่ +Comment[tr]=Kate'i belirli bir oturumla açmanızı sağlar +Comment[uk]=Надає можливість відкривати Kate з певним сеансом або створювати новий +Comment[wa]=Vos permete di drovi Kate avou ene sipecifieye session oudonbén nd ahiver ene novele +Comment[zh_CN]=允许您用指定会话打开 Kate,或创建新会话 +Comment[zh_TW]=讓您可以用指定的工作階段來開啟 Kate,或是建立新的工作階段 +Icon=kate +X-KDE-Library=kickermenu_kate diff --git a/kicker/menuext/kate/katesessionmenu.h b/kicker/menuext/kate/katesessionmenu.h new file mode 100644 index 000000000..ea78bf6ba --- /dev/null +++ b/kicker/menuext/kate/katesessionmenu.h @@ -0,0 +1,45 @@ +/* + 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 program 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 program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + + --- + Copyright (C) 2005, Anders Lund <[email protected]> + */ + +#ifndef _KateSessionMenu_h_ +#define _KateSessionMenu_h_ + +#include <kpanelmenu.h> + +class KateSessionMenu : public KPanelMenu { + Q_OBJECT + public: + KateSessionMenu( QWidget *parent=0, const char *name=0, const QStringList& /*args*/=QStringList() ); + ~KateSessionMenu(); + + public slots: + virtual void initialize(); + + protected slots: + virtual void slotExec( int id ); + + private: + QStringList m_sessions; + QWidget *m_parent; +}; + +#endif // _KateSessionMenu_h_ + +// kate: space-indent on; indent-width 2; replace-tabs on; diff --git a/kicker/menuext/kdeprint/Makefile.am b/kicker/menuext/kdeprint/Makefile.am new file mode 100644 index 000000000..051c087fb --- /dev/null +++ b/kicker/menuext/kdeprint/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = kickermenu_kdeprint.la + +kickermenu_kdeprint_la_SOURCES = print_mnu.cpp +kickermenu_kdeprint_la_LDFLAGS = $(all_libraries) -module -avoid-version +kickermenu_kdeprint_la_LIBADD = $(LIB_KDEUI) $(LIB_KIO) -lkdeprint + +kickermenu_kdeprint_la_METASOURCES = AUTO + +desktopmenu_DATA = printmenu.desktop +desktopmenudir = $(kde_datadir)/kicker/menuext + +messages: + $(XGETTEXT) *.cpp -o $(podir)/libkickermenu_kdeprint.pot diff --git a/kicker/menuext/kdeprint/print_mnu.cpp b/kicker/menuext/kdeprint/print_mnu.cpp new file mode 100644 index 000000000..8b2679432 --- /dev/null +++ b/kicker/menuext/kdeprint/print_mnu.cpp @@ -0,0 +1,139 @@ +/***************************************************************** + +Copyright (c) 1996-2001 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#include "print_mnu.h" +#include <kiconloader.h> +#include <klocale.h> +#include <kglobal.h> +#include <kapplication.h> +#include <krun.h> +#include <kdeprint/kmmanager.h> +#include <qregexp.h> + +K_EXPORT_KICKER_MENUEXT(kdeprint, PrintMenu) + +#define ADD_PRINTER_ID 0 +#define KDEPRINT_SETTINGS_ID 1 +#define CONFIG_SERVER_ID 2 +#define PRINT_MANAGER_ID 3 +#define PRINT_BROWSER_ID 4 +#define KPRINTER_ID 5 +#define PRINTER_LIST_ID 10 + +PrintMenu::PrintMenu(QWidget *parent, const char *name, const QStringList & /*args*/) +: KPanelMenu("", parent, name) +{ + static bool kdeprintIconsInitialized = false; + if ( !kdeprintIconsInitialized ) { + KGlobal::iconLoader()->addAppDir("kdeprint"); + kdeprintIconsInitialized = true; + } +} + +PrintMenu::~PrintMenu() +{ +} + +void PrintMenu::initialize() +{ + if (initialized()) clear(); + setInitialized(true); + + int ID = PRINTER_LIST_ID; + // just to be sure the plugin is loaded -> icons are available + KMManager::self(); + + if ((KMManager::self()->printerOperationMask() & KMManager::PrinterCreation) && KMManager::self()->hasManagement()) + insertItem(SmallIconSet("wizard"), i18n("Add Printer..."), ADD_PRINTER_ID); + insertItem(SmallIconSet("kdeprint_configmgr"), i18n("KDE Print Settings"), KDEPRINT_SETTINGS_ID); + if (KMManager::self()->serverOperationMask() & KMManager::ServerConfigure) + insertItem(SmallIconSet("kdeprint_configsrv"), i18n("Configure Server"), CONFIG_SERVER_ID); + insertSeparator(); + insertItem(SmallIconSet("kcontrol"), i18n("Print Manager"), PRINT_MANAGER_ID); + insertItem(SmallIconSet("konqueror"), i18n("Print Browser (Konqueror)"), PRINT_BROWSER_ID); + insertSeparator(); + insertItem(SmallIconSet("fileprint"), i18n("Print File..."), KPRINTER_ID); + + // printer list + QPtrList<KMPrinter> *l = KMManager::self()->printerList(); + if (l && !l->isEmpty()) + { + bool separatorInserted = false; + QPtrListIterator<KMPrinter> it(*l); + for (; it.current(); ++it) + { + // no special, implicit or pure instances + if (it.current()->isSpecial() || it.current()->isVirtual()) + continue; + if (!separatorInserted) + { + // we insert a separator only when we find the first + // printer + insertSeparator(); + separatorInserted = true; + } + insertItem(SmallIconSet(it.current()->pixmap()), + it.current()->printerName(), ID++); + } + } +} + +void PrintMenu::slotExec(int ID) +{ + switch (ID) + { + case ADD_PRINTER_ID: + kapp->kdeinitExec("kaddprinterwizard"); + break; + case KDEPRINT_SETTINGS_ID: + kapp->kdeinitExec("kaddprinterwizard", QStringList("--kdeconfig")); + break; + case CONFIG_SERVER_ID: + kapp->kdeinitExec("kaddprinterwizard", QStringList("--serverconfig")); + break; + case PRINT_MANAGER_ID: + KRun::runCommand("kcmshell kde-printers.desktop"); + break; + case PRINT_BROWSER_ID: + KRun::runCommand("kfmclient openProfile filemanagement print:/", "kfmclient", "konqueror"); + break; + case KPRINTER_ID: + kapp->kdeinitExec("kprinter"); + break; + default: + { + // start kjobviewer + QStringList args; + args << "--show" << "-d" << text(ID).remove('&'); + kapp->kdeinitExec("kjobviewer", args); + } + break; + } +} + +void PrintMenu::reload() +{ + initialize(); +} + +#include "print_mnu.moc" diff --git a/kicker/menuext/kdeprint/print_mnu.h b/kicker/menuext/kdeprint/print_mnu.h new file mode 100644 index 000000000..a80da4be2 --- /dev/null +++ b/kicker/menuext/kdeprint/print_mnu.h @@ -0,0 +1,46 @@ +/***************************************************************** + +Copyright (c) 1996-2001 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#ifndef _print_mnu_h_ +#define _print_mnu_h_ + +#include <kpanelmenu.h> +#include <kdeprint/kpreloadobject.h> + +class PrintMenu : public KPanelMenu, public KPReloadObject +{ + Q_OBJECT + +public: + PrintMenu(QWidget *parent, const char *name, const QStringList & /*args*/); + ~PrintMenu(); + +protected slots: + void slotExec(int id); + void initialize(); + +protected: + void reload(); +}; + +#endif diff --git a/kicker/menuext/kdeprint/printmenu.desktop b/kicker/menuext/kdeprint/printmenu.desktop new file mode 100644 index 000000000..2bc90f1b8 --- /dev/null +++ b/kicker/menuext/kdeprint/printmenu.desktop @@ -0,0 +1,144 @@ +[Desktop Entry] +Name=Print System +Name[af]=Drukker Stelsel +Name[ar]=نظام الطباعة +Name[az]=Çap Sistemi +Name[be]=Сістэма друку +Name[bg]=Система за печат +Name[bn]=মুদ্রণ ব্যবস্থা +Name[br]=Reizhiad moulañ +Name[bs]=Sistem štampe +Name[ca]=Sistema d'impressió +Name[cs]=Tiskový systém +Name[csb]=Systema drëkù +Name[cy]=Cysawd Argraffu +Name[da]=Udskriftssystem +Name[de]=Drucksystem +Name[el]=Σύστημα εκτύπωσης +Name[eo]=Printosistemo +Name[es]=Sistema de impresión +Name[et]=Trükkimissüsteem +Name[eu]=Inprimaketa sistema +Name[fa]=سیستم چاپ +Name[fi]=Tulostusjärjestelmä +Name[fr]=Système d'impression +Name[fy]=Printsysteem +Name[ga]=Córas Priontála +Name[gl]=Sistema de Impresión +Name[he]=מערכת הדפסה +Name[hi]=छापा तंत्र +Name[hr]=Sustav za ispisivanje +Name[hu]=Nyomtatási rendszer +Name[is]=Prentkerfi +Name[it]=Sistema di stampa +Name[ja]=印刷システム +Name[ka]=ბეჭდვის სისტემა +Name[kk]=Басып шығару +Name[km]=ប្រព័ន្ធបោះពុម្ព +Name[ko]=모던 시스템 +Name[ku]=Pergala Çapkirinê +Name[lo]=ລະບົບການພິມ +Name[lt]=Spausdinimo sistema +Name[lv]=Drukas Sistēma +Name[mk]=Печатарски систем +Name[mn]=Хэвлэх систем +Name[ms]=Cetak Sistem +Name[mt]=Sistema tal-ipprintjar +Name[nb]=Utskriftsystem +Name[nds]=Drucksysteem +Name[ne]=मुद्रण प्रणाली +Name[nl]=Afdruksysteem +Name[nn]=Utskriftssystem +Name[nso]=System ya Kgatiso +Name[pa]=ਪਰਿੰਟ ਸਿਸਟਮ +Name[pl]=System drukowania +Name[pt]=Sistema de Impressão +Name[pt_BR]=Sistema de Impressão +Name[ro]=Sistem de tipărire +Name[ru]=Система печати +Name[rw]=Sisitemu Gucapa +Name[se]=Čálihanvuogádat +Name[sk]=Tlačový systém +Name[sl]=Tiskalniški sistem +Name[sr]=Систем за штампу +Name[sr@Latn]=Sistem za štampu +Name[sv]=Skrivarsystem +Name[ta]=அச்சு அமைப்பு +Name[te]=ప్రచురణ వ్యవస్థ +Name[tg]=Системаи Чоп +Name[th]=ระบบการพิมพ์ +Name[tr]=Yazıcı Sistemi +Name[tt]=Bastıru Sisteme +Name[uk]=Система друку +Name[uz]=Bosib chiqarish tizimi +Name[uz@cyrillic]=Босиб чиқариш тизими +Name[ven]=Maitele au phirintha +Name[vi]=Hệ thống In ấn +Name[wa]=Sistinme d' imprimaedje +Name[xh]=Indlela Yoshicilelo +Name[zh_CN]=打印系统 +Name[zh_TW]=列印系統 +Name[zu]=Isistimu yokushicilela +Comment=Menu for the print system +Comment[af]=Kieslys vir die drukker stelsel +Comment[ar]=قائمة لنظام الطباعة +Comment[be]=Меню для сістэмы друку +Comment[bg]=Меню на системата за печат +Comment[bn]=মুদ্রণ ব্যবস্থার জন্য মেনু +Comment[bs]=Meni za sistem štampe +Comment[ca]=Menú per al sistema d'impressió +Comment[cs]=Nabídka tiskového systému +Comment[csb]=Menu systemë drëkù +Comment[da]=Menu for udskriftssystemet +Comment[de]=Einfacher Zugriff auf das Drucksystem +Comment[el]=Μενού για το σύστημα εκτύπωσης +Comment[eo]=Menuo por printosistemo +Comment[es]=Menú para el sistema de impresión +Comment[et]=Trükkimissüsteemi menüü +Comment[eu]=Inprimaketa sistemarako menua +Comment[fa]=گزینگان برای سیستم چاپ +Comment[fi]=Tulostusjärjestelmävalikko +Comment[fr]=Menu du système d'impression +Comment[fy]=Menu foar it printsysteem +Comment[gl]=Menu para o sistema de impresión +Comment[he]=תפריט למערכת ההדפסה +Comment[hr]=Izbornik sustava ispisivanja +Comment[hu]=Menü a nyomtatási rendszer eléréséhez +Comment[is]=Fljótleg leið að prentkerfinu +Comment[it]=Menu del sistema di stampa +Comment[ja]=印刷システム用メニュー +Comment[ka]=ბეჭდვის სისტემის მენიუ +Comment[kk]=Басып шығару жүйесінің мәзірі +Comment[km]=ម៉ឺនុយសម្រាប់ប្រព័ន្ធបោះពុម្ព +Comment[lt]=Spausdinimo sistemos meniu +Comment[mk]=Мени за системот за печатење +Comment[nb]=Meny for utskriftssystemet +Comment[nds]=Menü för dat Drucksysteem +Comment[ne]=मुद्रण प्रणालीका लागि मेनु +Comment[nl]=Menu voor het afdruksysteem +Comment[nn]=Meny for utskriftssystemet +Comment[pa]=ਪਰਿੰਟ ਸਿਸਟਮ ਲਈ ਮੇਨੂ +Comment[pl]=Menu systemu drukowania +Comment[pt]=Um menu para o sistema de impressão +Comment[pt_BR]=Menu para o sistema de impressão +Comment[ro]=Meniu pentru sistemul de tipărire +Comment[ru]=Быстрый доступ к системе печати +Comment[se]=Čálihanvuogádaga fállu +Comment[sk]=Menu pre tlačový systém +Comment[sl]=Meni za tiskalniški sistem +Comment[sr]=Мени за систем штампања +Comment[sr@Latn]=Meni za sistem štampanja +Comment[sv]=Meny för skrivarsystemet +Comment[te]=ప్రచురణ వ్యవస్థ కొరకు పట్టి +Comment[th]=เมนูสำหรับระบบการพิมพ์ +Comment[tr]=Yazıcı sistemi menüsü +Comment[uk]=Меню для системи друку +Comment[uz]=Bosib chiqarish tizimining menyusi +Comment[uz@cyrillic]=Босиб чиқариш тизимининг менюси +Comment[vi]=Thực đơn cho hệ thống in ấn +Comment[wa]=Dresseŷe pol sistinme d' imprimaedje +Comment[zh_CN]=打印系统菜单 +Comment[zh_TW]=用於列印系統的選單 +Icon=fileprint + +X-KDE-Library=kickermenu_kdeprint diff --git a/kicker/menuext/konq-profiles/Makefile.am b/kicker/menuext/konq-profiles/Makefile.am new file mode 100644 index 000000000..07df8f9ab --- /dev/null +++ b/kicker/menuext/konq-profiles/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = kickermenu_konqueror.la + +kickermenu_konqueror_la_SOURCES = konqy_menu.cpp +kickermenu_konqueror_la_LDFLAGS = $(all_libraries) -module -avoid-version +kickermenu_konqueror_la_LIBADD = $(LIB_KDEUI) $(LIB_KIO) + +kickermenu_konqueror_la_METASOURCES = AUTO + +desktopmenu_DATA = konquerormenu.desktop +desktopmenudir = $(kde_datadir)/kicker/menuext + +messages: + $(XGETTEXT) *.cpp -o $(podir)/libkickermenu_konqueror.pot diff --git a/kicker/menuext/konq-profiles/konquerormenu.desktop b/kicker/menuext/konq-profiles/konquerormenu.desktop new file mode 100644 index 000000000..e051239b5 --- /dev/null +++ b/kicker/menuext/konq-profiles/konquerormenu.desktop @@ -0,0 +1,136 @@ +[Desktop Entry] +Name=Konqueror Profiles +Name[af]=Konqueror Profiele +Name[ar]=مواصفات في Konqueror +Name[az]=Konqueror Profilləri +Name[be]=Профілі Konqueror +Name[bg]=Профили на браузъра +Name[bn]=কংকরার প্রোফাইল +Name[br]=Profiloù Konqueror +Name[bs]=Konqueror profili +Name[ca]=Perfils de Konqueror +Name[cs]=Profily Konqueroru +Name[csb]=Profile Konquerora +Name[cy]=Proffilau Konqueror +Name[da]=Konqueror-profiler +Name[de]=Konqueror-Profile +Name[el]=Προφίλ του Konqueror +Name[eo]=Konkerantaj Profiloj +Name[es]=Perfiles de Konqueror +Name[et]=Konquerori profiilid +Name[eu]=Konquerorren profilak +Name[fa]=Profileهای Konqueror +Name[fi]=Konquerorin profiilit +Name[fr]=Profils de Konqueror +Name[fy]=Konqueror-profielen +Name[ga]=Próifílí Konqueror +Name[gl]=Perfis de Konqueror +Name[he]=פרופילים של Konqueror +Name[hi]=कॉन्करर प्रोफ़ाइल्स +Name[hr]=Konqueror profili +Name[hu]=Konqueror-profilok +Name[is]=Konqueror sniðmát +Name[it]=Profili di Konqueror +Name[ja]=Konqueror プロファイル +Name[ka]=Konqueror-ის პროფილები +Name[kk]=Konqueror профильдер +Name[km]=ទម្រង់ Konqueror +Name[ko]=Konqueror 제스처 +Name[lt]=Konqueror profiliai +Name[lv]=Iekarotāja profili +Name[mk]=Профили за Konqueror +Name[ms]=Profil Konqueror +Name[mt]=Profili ta' Konqueror +Name[nb]=Profiler for Konqueror +Name[nds]=Konqueror-Profilen +Name[ne]=कन्क्वेरर प्रोफाइल +Name[nl]=Konqueror-profielen +Name[nn]=Profilar for Konqueror +Name[pa]=ਕੋਨਕਿਉਰੋਰ ਪਰੋਫਾਇਲ +Name[pl]=Profile Konquerora +Name[pt]=Perfis do Konqueror +Name[pt_BR]=Perfis do Konqueror +Name[ro]=Profile Konqueror +Name[ru]=Профили Konqueror +Name[rw]=Ibijyana na Konqueror +Name[se]=Konqueror-profiillat +Name[sk]=Profily pre Konqueror +Name[sl]=Profili Konquerorja +Name[sr]=Konqueror-ови профили +Name[sr@Latn]=Konqueror-ovi profili +Name[sv]=Konqueror-profiler +Name[ta]=Konqueror விவரக்குறிப்புகள் +Name[te]=కాంకెరర్ ప్రొఫైల్లు +Name[th]=โปรไฟล์ของคอนเควอร์เรอร์ +Name[tr]=Konqueror Profilleri +Name[tt]=Konqueror Caybireme +Name[uk]=Профілі Konqueror +Name[uz]=Konqueror profillari +Name[uz@cyrillic]=Konqueror профиллари +Name[vi]=Thông số Konqueror +Name[wa]=Profils Konqueror +Name[zh_CN]=Konqueror 配置文件 +Name[zh_TW]=Konqueror 設定組合 +Comment=Menu for accessing the Konqueror profiles +Comment[af]=Kieslys om toegang tot die Konqueror profiele te verkry +Comment[ar]=قائمة للوصول إلى مواصفات في Konqueror +Comment[be]=Меню для доступу да профіляў Konqueror +Comment[bg]=Меню за достъп до профилите на браузъра +Comment[bn]=সহজে বিভিন্ন কংকরার প্রোফাইল খোলার জন্য মেনু +Comment[bs]=Meni za pristup do profila Konquerora +Comment[ca]=Menú per accedir als perfils Konqueror +Comment[cs]=Přístup k profilům Konqueroru +Comment[csb]=Menu przistãpù do profilów Konquerora +Comment[da]=Menu for adgang til Konquerors profiler +Comment[de]=Vereinfachter Zugang zu den Konqueror-Profilen +Comment[el]=Μενού πρόσβασης στα προφίλ του Konqueror +Comment[eo]=Menuo por atingi Konkerantajn profilojn +Comment[es]=Menú para acceder a los perfiles de Konqueror +Comment[et]=Menüü Konquerori profiilide kasutamiseks +Comment[eu]=Konqueror profilak atzitzeko menua +Comment[fa]=گزینگان برای دستیابی به profileهای Konqueror +Comment[fi]=Valikko Konquerorin profiileille +Comment[fr]=Menu d'accès aux profils de Konqueror +Comment[fy]=Menu foar tagong ta de Konqueror-profielen +Comment[gl]=Aceso doado aos perfis de Konqueror +Comment[he]=תפריט גישה לפרופילים של Konqueror +Comment[hr]=Izbornik za pristupanje Konqueror profilima +Comment[hu]=Menü a Konqueror profiljainak eléréséhez +Comment[is]=Einföld leið að sniðmátum Konqueror +Comment[it]=Menu per accedere ai profili di Konqueror +Comment[ja]=Konqueror プロファイルにアクセスするためのメニュー +Comment[ka]=Konqueror-ის პროფილების წვდომის მენიუ +Comment[kk]=Konqueror профильдеріне қатынау мәзірі +Comment[km]=ម៉ឺនុយសម្រាប់ចូលដំណើរការទម្រង់របស់ Konqueror +Comment[lt]=Konqueror profilių pasiekimo meniu +Comment[mk]=Мени за пристапување до профилите на Konqueror +Comment[nb]=Meny for Konquerors profiler +Comment[nds]=Menü för Konqueror sien Profilen +Comment[ne]=कन्क्वेरर प्रोफाइल पहुँचका लागि मेनु +Comment[nl]=Menu voor toegang tot de Konqueror-profielen +Comment[nn]=Meny for Konqueror-profilane +Comment[pa]=ਕੋਨਕਿਉਰੋਰ ਪਰੋਫਾਇਲ ਲਈ ਸੌਖੀ ਪਹੁੰਚ ਲਈ ਮੇਨੂ +Comment[pl]=Menu dostępu do profili Konquerora +Comment[pt]=Um menu para aceder aos perfis do Konqueror +Comment[pt_BR]=Acesso fácil aos perfis do Konqueror +Comment[ro]=Meniu pentru accesul profilelor Konqueror +Comment[ru]=Быстрый доступ к профилям Konqueror +Comment[se]=Fállu mii čájeha Konqueror-profiillaid +Comment[sk]=Menu pre prístup k profilom pre Konqueror +Comment[sl]=Meni za dostop do profilov Konquerorja +Comment[sr]=Мени за приступ Konqueror-овим профилима +Comment[sr@Latn]=Meni za pristup Konqueror-ovim profilima +Comment[sv]=Meny för att komma åt Konquerors profiler +Comment[te]=కాంకెరర్ ప్రొఫైల్లు చూసెందుకు కొరకు పట్టి +Comment[th]=เมนูสำหรับเข้าใช้โปรไฟล์ของคอนเควอร์เรอร์วดเร็ว +Comment[tr]=Konqueror profillerine kolay erişim menüsü +Comment[uk]=Меню для доступу до профілів Konqueror +Comment[uz]=Konqueror profillarining menyusi +Comment[uz@cyrillic]=Konqueror профилларининг менюси +Comment[vi]=Thực đơn truy cập đến các thông số của Konqueror +Comment[wa]=Dressêye poz aveur accès ås profils di Konqueror +Comment[zh_CN]=访问 Konqueror 配置文件的菜单 +Comment[zh_TW]=方便存取 Konqueror 設定組合的選單 +Icon=konqueror + +X-KDE-Library=kickermenu_konqueror diff --git a/kicker/menuext/konq-profiles/konqy_menu.cpp b/kicker/menuext/konq-profiles/konqy_menu.cpp new file mode 100644 index 000000000..3ac09e050 --- /dev/null +++ b/kicker/menuext/konq-profiles/konqy_menu.cpp @@ -0,0 +1,102 @@ +/***************************************************************** + +Copyright (c) 1996-2001 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#include "konqy_menu.h" +#include <kiconloader.h> +#include <klocale.h> +#include <kglobal.h> +#include <kapplication.h> +#include <krun.h> +#include <kstandarddirs.h> +#include <kio/global.h> +#include <ksimpleconfig.h> + +#include <qregexp.h> +#include <qfileinfo.h> + +K_EXPORT_KICKER_MENUEXT(konqueror, KonquerorProfilesMenu) + +KonquerorProfilesMenu::KonquerorProfilesMenu(QWidget *parent, const char *name, const QStringList & /*args*/) +: KPanelMenu("", parent, name) +{ + static bool kdeprintIconsInitialized = false; + if ( !kdeprintIconsInitialized ) { + KGlobal::iconLoader()->addAppDir("kdeprint"); + kdeprintIconsInitialized = true; + } +} + +KonquerorProfilesMenu::~KonquerorProfilesMenu() +{ +} + +void KonquerorProfilesMenu::initialize() +{ + if (initialized()) clear(); + setInitialized(true); + + QStringList profiles = KGlobal::dirs()->findAllResources( "data", "konqueror/profiles/*", false, true ); + + m_profiles.resize(profiles.count()); + int id=1; + QStringList::ConstIterator pEnd = profiles.end(); + for (QStringList::ConstIterator pIt = profiles.begin(); pIt != pEnd; ++pIt ) + { + QFileInfo info( *pIt ); + QString profileName = KIO::decodeFileName( info.baseName() ); + QString niceName=profileName; + KSimpleConfig cfg( *pIt, true ); + if ( cfg.hasGroup( "Profile" ) ) + { + cfg.setGroup( "Profile" ); + if ( cfg.hasKey( "Name" ) ) + niceName = cfg.readEntry( "Name" ); + + insertItem(niceName, id); + m_profiles[id-1]=profileName; + id++; + } + } +} + +void KonquerorProfilesMenu::slotExec(int id) +{ + QStringList args; + args<<"--profile"<<m_profiles[id-1]; + kapp->kdeinitExec("konqueror", args); +} + +void KonquerorProfilesMenu::reload() +{ + initialize(); +} + +void KonquerorProfilesMenu::slotAboutToShow() +{ + reinitialize(); + KPanelMenu::slotAboutToShow(); +} + + +#include "konqy_menu.moc" + diff --git a/kicker/menuext/konq-profiles/konqy_menu.h b/kicker/menuext/konq-profiles/konqy_menu.h new file mode 100644 index 000000000..f47b026ee --- /dev/null +++ b/kicker/menuext/konq-profiles/konqy_menu.h @@ -0,0 +1,50 @@ +/***************************************************************** + +Copyright (c) 1996-2001 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#ifndef _konqy_menu_h_ +#define _konqy_menu_h_ + +#include <kpanelmenu.h> + +#include <qvaluevector.h> + +class KonquerorProfilesMenu : public KPanelMenu +{ + Q_OBJECT + + public: + KonquerorProfilesMenu(QWidget *parent, const char *name, const QStringList & /*args*/); + ~KonquerorProfilesMenu(); + + protected slots: + void slotExec(int id); + void initialize(); + void slotAboutToShow(); + + protected: + void reload(); + QValueVector<QString> m_profiles; + +}; + +#endif diff --git a/kicker/menuext/konsole/Makefile.am b/kicker/menuext/konsole/Makefile.am new file mode 100644 index 000000000..907e79769 --- /dev/null +++ b/kicker/menuext/konsole/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = kickermenu_konsole.la + +kickermenu_konsole_la_SOURCES = konsole_mnu.cpp konsolebookmarkhandler.cpp konsolebookmarkmenu.cpp +kickermenu_konsole_la_LDFLAGS = $(all_libraries) -module -avoid-version +kickermenu_konsole_la_LIBADD = $(LIB_KDEUI) $(LIB_KIO) + +kickermenu_konsole_la_METASOURCES = AUTO + +desktopmenu_DATA = konsolemenu.desktop +desktopmenudir = $(kde_datadir)/kicker/menuext + +messages: + $(XGETTEXT) *.cpp -o $(podir)/libkickermenu_konsole.pot diff --git a/kicker/menuext/konsole/konsole_mnu.cpp b/kicker/menuext/konsole/konsole_mnu.cpp new file mode 100644 index 000000000..87df6f268 --- /dev/null +++ b/kicker/menuext/konsole/konsole_mnu.cpp @@ -0,0 +1,318 @@ +/***************************************************************** + +Copyright (c) 1996-2001 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#include <stdlib.h> +#include <dirent.h> +#include <fcntl.h> +#include <unistd.h> +#include <sys/stat.h> + +#include <qdir.h> +#include <qfileinfo.h> + +#include <kapplication.h> +#include <kglobal.h> +#include <kiconloader.h> +#include <kio/global.h> +#include <klocale.h> +#include <krun.h> +#include <kshell.h> +#include <ksimpleconfig.h> +#include <kstandarddirs.h> + +#include "konsole_mnu.h" + +K_EXPORT_KICKER_MENUEXT(konsole, KonsoleMenu) + +KonsoleMenu::KonsoleMenu(QWidget *parent, const char *name, const QStringList& /* args */) + : KPanelMenu("", parent, name), + m_profileMenu(0), + m_bookmarksSession(0), + m_bookmarkHandlerSession(0) +{ +} + +KonsoleMenu::~KonsoleMenu() +{ + KGlobal::locale()->removeCatalogue("libkickermenu_konsole"); +} + +static void insertItemSorted(KPopupMenu *menu, + const QIconSet &iconSet, + const QString &txt, int id) +{ + const int defaultId = 1; // The id of the 'new' item. + int index = menu->indexOf(defaultId); + int count = menu->count(); + if (index >= 0) + { + index++; // Skip separator + while(true) + { + index++; + if (index >= count) + { + index = -1; // Insert at end + break; + } + if (menu->text(menu->idAt(index)) > txt) + break; // Insert before this item + } + } + menu->insertItem(iconSet, txt, id, index); +} + + +void KonsoleMenu::initialize() +{ + if (initialized()) + { + clear(); + } + else + { + kapp->iconLoader()->addAppDir("konsole"); + } + + setInitialized(true); + + QStringList list = KGlobal::dirs()->findAllResources("data", + "konsole/*.desktop", + false, true); + + QString defaultShell = locate("data", "konsole/shell.desktop"); + list.prepend(defaultShell); + + int id = 1; + + sessionList.clear(); + for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it) + { + if ((*it == defaultShell) && (id != 1)) + { + continue; + } + + KSimpleConfig conf(*it, true /* read only */); + conf.setDesktopGroup(); + QString text = conf.readEntry("Name"); + + // try to locate the binary + QString exec= conf.readPathEntry("Exec"); + if (exec.startsWith("su -c \'")) + { + exec = exec.mid(7,exec.length()-8); + } + + exec = KRun::binaryName(exec, false); + exec = KShell::tildeExpand(exec); + QString pexec = KGlobal::dirs()->findExe(exec); + if (text.isEmpty() || + conf.readEntry("Type") != "KonsoleApplication" || + (!exec.isEmpty() && pexec.isEmpty())) + { + continue; + } + insertItemSorted(this, SmallIconSet(conf.readEntry("Icon", "konsole")), + text, id++); + QFileInfo fi(*it); + sessionList.append(fi.baseName(true)); + + if (id == 2) + { + insertSeparator(); + } + } + + m_bookmarkHandlerSession = new KonsoleBookmarkHandler(this, false); + m_bookmarksSession = m_bookmarkHandlerSession->menu(); + insertSeparator(); + insertItem(SmallIconSet("keditbookmarks"), + i18n("New Session at Bookmark"), m_bookmarksSession); + connect(m_bookmarkHandlerSession, + SIGNAL(openURL(const QString&, const QString&)), + SLOT(newSession(const QString&, const QString&))); + + + screenList.clear(); + QCString screenDir = getenv("SCREENDIR"); + + if (screenDir.isEmpty()) + { + screenDir = QFile::encodeName(QDir::homeDirPath()) + "/.screen/"; + } + + QStringList sessions; + // Can't use QDir as it doesn't support FIFOs :( + DIR *dir = opendir(screenDir); + if (dir) + { + struct dirent *entry; + while ((entry = readdir(dir))) + { + QCString path = screenDir + "/" + entry->d_name; + struct stat st; + if (stat(path, &st) != 0) + { + continue; + } + + int fd; + if (S_ISFIFO(st.st_mode) && !(st.st_mode & 0111) && // xbit == attached + (fd = open(path, O_WRONLY | O_NONBLOCK)) != -1) + { + ::close(fd); + screenList.append(QFile::decodeName(entry->d_name)); + insertItem(SmallIconSet("konsole"), + i18n("Screen is a program controlling screens!", + "Screen at %1").arg(entry->d_name), id); + id++; + } + } + closedir(dir); + } + + // reset id as we are now going to populate the profiles submenu + id = 0; + + delete m_profileMenu; + m_profileMenu = new KPopupMenu(this); + QStringList profiles = KGlobal::dirs()->findAllResources("data", + "konsole/profiles/*", + false, true ); + m_profiles.resize(profiles.count()); + QStringList::ConstIterator pEnd = profiles.end(); + for (QStringList::ConstIterator pIt = profiles.begin(); pIt != pEnd; ++pIt) + { + QFileInfo info(*pIt); + QString profileName = KIO::decodeFileName(info.baseName()); + QString niceName = profileName; + KSimpleConfig cfg(*pIt, true); + if (cfg.hasGroup("Profile")) + { + cfg.setGroup("Profile"); + if (cfg.hasKey("Name")) + { + niceName = cfg.readEntry("Name"); + } + } + + m_profiles[id] = profileName; + ++id; + m_profileMenu->insertItem(niceName, id); + } + + int profileID = insertItem(i18n("New Session Using Profile"), + m_profileMenu); + if (id == 1) + { + // we don't have any profiles, disable the menu + setItemEnabled(profileID, false); + } + connect(m_profileMenu, SIGNAL(activated(int)), SLOT(launchProfile(int))); + + insertSeparator(); + insertItem(SmallIconSet("reload"), + i18n("Reload Sessions"), this, SLOT(reinitialize())); +} + +void KonsoleMenu::slotExec(int id) +{ + if (id < 1) + { + return; + } + + --id; + kapp->propagateSessionManager(); + QStringList args; + if (static_cast<unsigned int>(id) < sessionList.count()) + { + args << "--type"; + args << sessionList[id]; + } + else + { + args << "-e"; + args << "screen"; + args << "-r"; + args << screenList[id - sessionList.count()]; + } + KApplication::kdeinitExec("konsole", args); + return; +} + +void KonsoleMenu::launchProfile(int id) +{ + if (id < 1 || id > m_profiles.count()) + { + return; + } + + --id; + // this is a session, not a bookmark, so execute that instead + QStringList args; + args << "--profile" << m_profiles[id]; + kapp->kdeinitExec("konsole", args); +} + +KURL KonsoleMenu::baseURL() const +{ + KURL url; + /*url.setPath(se->getCwd()+"/");*/ + return url; +} + +void KonsoleMenu::newSession(const QString& sURL, const QString& title) +{ + QStringList args; + + KURL url = KURL(sURL); + if ((url.protocol() == "file") && (url.hasPath())) + { + args << "-T" << title; + args << "--workdir" << url.path(); + KApplication::kdeinitExec("konsole", args); + return; + } + else if ((!url.protocol().isEmpty()) && (url.hasHost())) + { + QString protocol = url.protocol(); + QString host = url.host(); + args << "-T" << title; + args << "-e" << protocol.latin1(); /* argv[0] == command to run. */ + if (url.hasUser()) { + args << "-l" << url.user().latin1(); + } + args << host.latin1(); + KApplication::kdeinitExec("konsole", args); + return; + } + /* + * We can't create a session without a protocol. + * We should ideally popup a warning, about an invalid bookmark. + */ +} + + +#include "konsole_mnu.moc" diff --git a/kicker/menuext/konsole/konsole_mnu.h b/kicker/menuext/konsole/konsole_mnu.h new file mode 100644 index 000000000..988764124 --- /dev/null +++ b/kicker/menuext/konsole/konsole_mnu.h @@ -0,0 +1,64 @@ +/***************************************************************** + +Copyright (c) 1996-2001 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#ifndef _konsole_mnu_h_ +#define _konsole_mnu_h_ + +#include <qvaluevector.h> + +#include <kpanelmenu.h> +#include <klibloader.h> + +#include "konsolebookmarkmenu.h" +#include "konsolebookmarkhandler.h" + + +class KonsoleMenu : public KPanelMenu/*, public KPReloadObject*/ +{ + Q_OBJECT + +public: + KonsoleMenu(QWidget *parent, const char *name, const QStringList& /* args */); + ~KonsoleMenu(); + KURL baseURL() const; + + +protected slots: + void slotExec(int id); + void launchProfile(int id); + void initialize(); + void newSession(const QString& sURL, const QString& title); + + +private: + QStringList sessionList; + QStringList screenList; + QValueVector<QString> m_profiles; + KPopupMenu* m_profileMenu; + KPopupMenu* m_bookmarksSession; + + KonsoleBookmarkHandler *m_bookmarkHandlerSession; +}; + +#endif + diff --git a/kicker/menuext/konsole/konsolebookmarkhandler.cpp b/kicker/menuext/konsole/konsolebookmarkhandler.cpp new file mode 100644 index 000000000..c9f8e2806 --- /dev/null +++ b/kicker/menuext/konsole/konsolebookmarkhandler.cpp @@ -0,0 +1,117 @@ +// Born as kdelibs/kio/kfile/kfilebookmarkhandler.cpp + +#include <stdio.h> +#include <stdlib.h> + +#include <qtextstream.h> + +#include <kbookmarkimporter.h> +#include <kmimetype.h> +#include <kpopupmenu.h> +#include <ksavefile.h> +#include <kstandarddirs.h> + +#include "konsole_mnu.h" +#include "konsolebookmarkmenu.h" +#include "konsolebookmarkhandler.h" + +KonsoleBookmarkHandler::KonsoleBookmarkHandler( KonsoleMenu *konsole, bool ) + : QObject( konsole, "KonsoleBookmarkHandler" ), + KBookmarkOwner(), + m_konsole( konsole ), + m_importStream( 0L ) +{ + m_menu = new KPopupMenu( konsole, "bookmark menu" ); + + QString file = locate( "data", "konsole/bookmarks.xml" ); + if ( file.isEmpty() ) + file = locateLocal( "data", "konsole/bookmarks.xml" ); + + // import old bookmarks + if ( !KStandardDirs::exists( file ) ) { + QString oldFile = locate( "data", "kfile/bookmarks.html" ); + if ( !oldFile.isEmpty() ) + importOldBookmarks( oldFile, file ); + } + + KBookmarkManager *manager = KBookmarkManager::managerForFile( file, false); + manager->setUpdate( true ); + manager->setShowNSBookmarks( false ); + + connect( manager, SIGNAL( changed(const QString &, const QString &) ), + SLOT( slotBookmarksChanged(const QString &, const QString &) ) ); + m_bookmarkMenu = new KonsoleBookmarkMenu( manager, this, m_menu, + NULL, false, /*Not toplevel*/ + false /*No 'Add Bookmark'*/ ); +} + +QString KonsoleBookmarkHandler::currentURL() const +{ + return m_konsole->baseURL().url(); +} + +void KonsoleBookmarkHandler::importOldBookmarks( const QString& path, + const QString& destinationPath ) +{ + KSaveFile file( destinationPath ); + if ( file.status() != 0 ) + return; + + m_importStream = file.textStream(); + *m_importStream << "<!DOCTYPE xbel>\n<xbel>\n"; + + KNSBookmarkImporter importer( path ); + connect( &importer, + SIGNAL( newBookmark( const QString&, const QCString&, const QString& )), + SLOT( slotNewBookmark( const QString&, const QCString&, const QString& ))); + connect( &importer, + SIGNAL( newFolder( const QString&, bool, const QString& )), + SLOT( slotNewFolder( const QString&, bool, const QString& ))); + connect( &importer, SIGNAL( newSeparator() ), SLOT( newSeparator() )); + connect( &importer, SIGNAL( endMenu() ), SLOT( endMenu() )); + + importer.parseNSBookmarks( false ); + + *m_importStream << "</xbel>"; + + file.close(); + m_importStream = 0L; +} + +void KonsoleBookmarkHandler::slotNewBookmark( const QString& /*text*/, + const QCString& url, + const QString& additionalInfo ) +{ + *m_importStream << "<bookmark icon=\"" << KMimeType::iconForURL( KURL( url ) ); + *m_importStream << "\" href=\"" << QString::fromUtf8(url) << "\">\n"; + *m_importStream << "<title>" << (additionalInfo.isEmpty() ? QString::fromUtf8(url) : additionalInfo) << "</title>\n</bookmark>\n"; +} + +void KonsoleBookmarkHandler::slotNewFolder( const QString& text, bool /*open*/, + const QString& /*additionalInfo*/ ) +{ + *m_importStream << "<folder icon=\"bookmark_folder\">\n<title=\""; + *m_importStream << text << "\">\n"; +} + +void KonsoleBookmarkHandler::slotBookmarksChanged( const QString &, + const QString & ) +{ + // This is called when someone changes bookmarks in konsole.... + m_bookmarkMenu->slotBookmarksChanged(""); +} + +void KonsoleBookmarkHandler::newSeparator() +{ + *m_importStream << "<separator/>\n"; +} + +void KonsoleBookmarkHandler::endFolder() +{ + *m_importStream << "</folder>\n"; +} + +void KonsoleBookmarkHandler::virtual_hook( int id, void* data ) +{ KBookmarkOwner::virtual_hook( id, data ); } + +#include "konsolebookmarkhandler.moc" diff --git a/kicker/menuext/konsole/konsolebookmarkhandler.h b/kicker/menuext/konsole/konsolebookmarkhandler.h new file mode 100644 index 000000000..b22f0d03d --- /dev/null +++ b/kicker/menuext/konsole/konsolebookmarkhandler.h @@ -0,0 +1,60 @@ +// Born as kdelibs/kio/kfile/kfilebookmarkhandler.h + +#ifndef KONSOLEBOOKMARKHANDLER_H +#define KONSOLEBOOKMARKHANDLER_H + +#include <kbookmarkmanager.h> +#include "konsolebookmarkmenu.h" + + +class QTextStream; +class KPopupMenu; +class KonsoleBookmarkMenu; +class KonsoleMenu; + +class KonsoleBookmarkHandler : public QObject, public KBookmarkOwner +{ + Q_OBJECT + +public: + KonsoleBookmarkHandler( KonsoleMenu *konsole, bool toplevel ); + + QPopupMenu * popupMenu(); + + // KBookmarkOwner interface: + virtual void openBookmarkURL( const QString& url, const QString& title ) + { emit openURL( url, title ); } + virtual QString currentURL() const; + + KPopupMenu *menu() const { return m_menu; } + +signals: + void openURL( const QString& url, const QString& title ); + +private slots: + // for importing + void slotNewBookmark( const QString& text, const QCString& url, + const QString& additionalInfo ); + void slotNewFolder( const QString& text, bool open, + const QString& additionalInfo ); + void slotBookmarksChanged( const QString &, const QString & caller ); + void newSeparator(); + void endFolder(); + +private: + void importOldBookmarks( const QString& path, const QString& destinationPath ); + + KonsoleMenu *m_konsole; + KPopupMenu *m_menu; + KonsoleBookmarkMenu *m_bookmarkMenu; + QTextStream *m_importStream; + +protected: + virtual void virtual_hook( int id, void* data ); +private: + class KonsoleBookmarkHandlerPrivate; + KonsoleBookmarkHandlerPrivate *d; +}; + + +#endif // KONSOLEBOOKMARKHANDLER_H diff --git a/kicker/menuext/konsole/konsolebookmarkmenu.cpp b/kicker/menuext/konsole/konsolebookmarkmenu.cpp new file mode 100644 index 000000000..b10d26c40 --- /dev/null +++ b/kicker/menuext/konsole/konsolebookmarkmenu.cpp @@ -0,0 +1,187 @@ +#include <stdio.h> +#include <stdlib.h> + +#include <qtextstream.h> + +#include <kbookmarkimporter.h> +#include <kmimetype.h> +#include <kpopupmenu.h> +#include <ksavefile.h> +#include <kstandarddirs.h> +//#include <kbookmarkmenu.h> + +#include "konsole_mnu.h" +#include "konsolebookmarkmenu.h" +#include "konsolebookmarkhandler.h" + +#include <qfile.h> + +#include <kaction.h> +#include <klocale.h> + + +KonsoleBookmarkMenu::KonsoleBookmarkMenu( KBookmarkManager* mgr, + KonsoleBookmarkHandler * _owner, KPopupMenu * _parentMenu, + KActionCollection *collec, bool _isRoot, bool _add, + const QString & parentAddress ) +: KBookmarkMenu( mgr, _owner, _parentMenu, collec, _isRoot, _add, + parentAddress), + m_kOwner(_owner) +{ + /* + * First, we disconnect KBookmarkMenu::slotAboutToShow() + * Then, we connect KonsoleBookmarkMenu::slotAboutToShow(). + * They are named differently because the SLOT() macro thinks we want + * KonsoleBookmarkMenu::KBookmarkMenu::slotAboutToShow() + * Could this be solved if slotAboutToShow() is virtual in KBookmarMenu? + */ + disconnect( _parentMenu, SIGNAL( aboutToShow() ), this, + SLOT( slotAboutToShow() ) ); + connect( _parentMenu, SIGNAL( aboutToShow() ), + SLOT( slotAboutToShow2() ) ); +} + +/* + * Duplicate this exactly because KBookmarkMenu::slotBookmarkSelected can't + * be overrided. I would have preferred to NOT have to do this. + * + * Why did I do this? + * - when KBookmarkMenu::fillbBookmarkMenu() creates sub-KBookmarkMenus. + * - when ... adds KActions, it uses KBookmarkMenu::slotBookmarkSelected() + * instead of KonsoleBookmarkMenu::slotBookmarkSelected(). + */ +void KonsoleBookmarkMenu::slotAboutToShow2() +{ + // Did the bookmarks change since the last time we showed them ? + if ( m_bDirty ) + { + m_bDirty = false; + refill(); + } +} + +void KonsoleBookmarkMenu::refill() +{ + //kdDebug(1203) << "KBookmarkMenu::refill()" << endl; + m_lstSubMenus.clear(); + QPtrListIterator<KAction> it( m_actions ); + for (; it.current(); ++it ) + it.current()->unplug( m_parentMenu ); + m_parentMenu->clear(); + m_actions.clear(); + fillBookmarkMenu(); + m_parentMenu->adjustSize(); +} + +void KonsoleBookmarkMenu::fillBookmarkMenu() +{ + if ( m_bIsRoot ) + { + if ( m_bAddBookmark ) + addAddBookmark(); + + addEditBookmarks(); + + if ( m_bAddBookmark ) + addNewFolder(); + + if ( m_pManager->showNSBookmarks() + && QFile::exists( KNSBookmarkImporter::netscapeBookmarksFile() ) ) + { + m_parentMenu->insertSeparator(); + + KActionMenu * actionMenu = new KActionMenu( i18n("Netscape Bookmarks"), + "netscape", + m_actionCollection, 0L ); + actionMenu->plug( m_parentMenu ); + m_actions.append( actionMenu ); + KonsoleBookmarkMenu *subMenu = new KonsoleBookmarkMenu( m_pManager, + m_kOwner, actionMenu->popupMenu(), + m_actionCollection, false, + m_bAddBookmark, QString::null ); + m_lstSubMenus.append(subMenu); + connect( actionMenu->popupMenu(), SIGNAL(aboutToShow()), subMenu, + SLOT(slotNSLoad())); + } + } + + KBookmarkGroup parentBookmark = m_pManager->findByAddress( m_parentAddress ).toGroup(); + Q_ASSERT(!parentBookmark.isNull()); + bool separatorInserted = false; + for ( KBookmark bm = parentBookmark.first(); !bm.isNull(); + bm = parentBookmark.next(bm) ) + { + QString text = bm.text(); + text.replace( '&', "&&" ); + if ( !separatorInserted && m_bIsRoot) { // inserted before the first konq bookmark, to avoid the separator if no konq bookmark + m_parentMenu->insertSeparator(); + separatorInserted = true; + } + if ( !bm.isGroup() ) + { + if ( bm.isSeparator() ) + { + m_parentMenu->insertSeparator(); + } + else + { + // kdDebug(1203) << "Creating URL bookmark menu item for " << bm.text() << endl; + // create a normal URL item, with ID as a name + KAction * action = new KAction( text, bm.icon(), 0, + this, SLOT( slotBookmarkSelected() ), + m_actionCollection, bm.url().url().utf8() ); + + action->setStatusText( bm.url().prettyURL() ); + + action->plug( m_parentMenu ); + m_actions.append( action ); + } + } + else + { + // kdDebug(1203) << "Creating bookmark submenu named " << bm.text() << endl; + KActionMenu * actionMenu = new KActionMenu( text, bm.icon(), + m_actionCollection, 0L ); + actionMenu->plug( m_parentMenu ); + m_actions.append( actionMenu ); + KonsoleBookmarkMenu *subMenu = new KonsoleBookmarkMenu( m_pManager, + m_kOwner, actionMenu->popupMenu(), + m_actionCollection, false, + m_bAddBookmark, bm.address() ); + m_lstSubMenus.append( subMenu ); + } + } + + if ( !m_bIsRoot && m_bAddBookmark ) + { + m_parentMenu->insertSeparator(); + addAddBookmark(); + addNewFolder(); + } +} + +void KonsoleBookmarkMenu::slotBookmarkSelected() +{ + KAction * a; + QString b; + + if ( !m_pOwner ) return; // this view doesn't handle bookmarks... + a = (KAction*)sender(); + b = a->text(); + m_kOwner->openBookmarkURL( QString::fromUtf8(sender()->name()), /* URL */ + ( (KAction *)sender() )->text() /* Title */ ); +} + +void KonsoleBookmarkMenu::slotNSBookmarkSelected() +{ + KAction *a; + QString b; + + QString link(sender()->name()+8); + a = (KAction*)sender(); + b = a->text(); + m_kOwner->openBookmarkURL( link, /*URL */ + ( (KAction *)sender() )->text() /* Title */ ); +} + +#include "konsolebookmarkmenu.moc" diff --git a/kicker/menuext/konsole/konsolebookmarkmenu.h b/kicker/menuext/konsole/konsolebookmarkmenu.h new file mode 100644 index 000000000..65e87f0f5 --- /dev/null +++ b/kicker/menuext/konsole/konsolebookmarkmenu.h @@ -0,0 +1,58 @@ +#ifndef KONSOLEBOOKMARKMENU_H +#define KONSOLEBOOKMARKMENU_H + +#include <qptrlist.h> +#include <qptrstack.h> +#include <qobject.h> +#include <sys/types.h> +#include <kbookmark.h> +#include <kbookmarkmenu.h> + +#include "konsolebookmarkhandler.h" + + +class QString; +class KBookmark; +class KAction; +class KActionMenu; +class KActionCollection; +class KBookmarkOwner; +class KBookmarkMenu; +class KPopupMenu; +class KonsoleBookmarkMenu; + +class KonsoleBookmarkMenu : public KBookmarkMenu +{ + Q_OBJECT + +public: + KonsoleBookmarkMenu( KBookmarkManager* mgr, + KonsoleBookmarkHandler * _owner, KPopupMenu * _parentMenu, + KActionCollection *collec, bool _isRoot, + bool _add = true, const QString & parentAddress = ""); + + void fillBookmarkMenu(); + +public slots: + +signals: + +private slots: + +private: + KonsoleBookmarkHandler * m_kOwner; + +protected slots: + void slotAboutToShow2(); + void slotBookmarkSelected(); + void slotNSBookmarkSelected(); + +protected: + void refill(); + +private: + class KonsoleBookmarkMenuPrivate; + KonsoleBookmarkMenuPrivate *d; +}; + +#endif // KONSOLEBOOKMARKMENU_H diff --git a/kicker/menuext/konsole/konsolemenu.desktop b/kicker/menuext/konsole/konsolemenu.desktop new file mode 100644 index 000000000..5766d7f03 --- /dev/null +++ b/kicker/menuext/konsole/konsolemenu.desktop @@ -0,0 +1,137 @@ +[Desktop Entry] +Name=Terminal Sessions +Name[af]=Terminaal Sessies +Name[ar]=جلسات مطراف سطر الأوامر +Name[az]=Terminal İclasları +Name[be]=Тэрмінальныя сесіі +Name[bg]=Терминални сесии +Name[bn]=টার্মিনাল সেশন +Name[br]=Dalc'hoù an termenell +Name[bs]=Sesije terminala +Name[ca]=Sessions de terminal +Name[cs]=Terminálové relace +Name[csb]=Sesëje terminala +Name[cy]=Sesiynnau Terfynell +Name[da]=Terminalsessioner +Name[de]=Terminalsitzungen +Name[el]=Συνεδρίες τερματικού +Name[eo]=Terminalaj seancoj +Name[es]=Sesiones de terminal +Name[et]=Terminali seansid +Name[eu]=Terminal saioak +Name[fa]=نشستهای پایانه +Name[fi]=Komentoikkunaistunnot +Name[fr]=Sessions de terminal +Name[fy]=Terminal-sesjes +Name[ga]=Seisiúin Teirminéil +Name[gl]=Sesións de Terminal +Name[he]=משימות מסוף +Name[hi]=टर्मिनल सत्र +Name[hr]=Terminalske sesije +Name[hu]=Terminálablakok +Name[is]=Skjáhermisforrit +Name[it]=Sessioni terminale +Name[ja]=ターミナルセッション +Name[ka]=სერმინალის სეანსები +Name[kk]=Терминал сеанстары +Name[km]=សម័យស្ថានីយ +Name[ko]=터미널 프로그램 +Name[lo]=ໂປຣແກຣມເທີມິເນລ +Name[lt]=Terminalo sesijos +Name[lv]=Termināla sesijas +Name[mk]=Терминалски сесии +Name[mn]=Терминал-Суултууд +Name[ms]=Sesi Terminal +Name[mt]=Sessjonijiet tat-terminal +Name[nb]=Terminaløkter +Name[nds]=Terminal-Törns +Name[ne]=टर्मिनल सत्र +Name[nl]=Terminal-sessies +Name[nn]=Terminaløkter +Name[nso]=Ditiragalo tsa Terminal +Name[pa]=ਟਰਮੀਨਲ ਸ਼ੈਸ਼ਨ +Name[pl]=Sesje terminala +Name[pt]=Sessões de Terminal +Name[pt_BR]=Sessões de Terminal +Name[ro]=Sesiuni de terminal +Name[ru]=Терминальные сеансы +Name[rw]=Imikoro Ihera +Name[se]=Terminálbargovuorut +Name[sk]=Sedenia terminálu +Name[sl]=Terminalske seje +Name[sr]=Сесије терминала +Name[sr@Latn]=Sesije terminala +Name[sv]=Terminalsessioner +Name[ta]=கடைசி அமர்வுகள் +Name[te]=టెర్మినల్ సెషన్లు +Name[tg]=Ҷаласаҳои терминал +Name[th]=เซสชันของเทอร์มินัล +Name[tr]=Uçbirim Oturumları +Name[tt]=Terminal Sessiläre +Name[uk]=Сеанси терміналів +Name[uz]=Terminal seanslari +Name[uz@cyrillic]=Терминал сеанслари +Name[ven]=Zwitenwa zwa theminala +Name[vi]=Phiên chạy đầu cuối +Name[wa]=Sessions do terminå +Name[xh]=Intlanganiso Yesiphelo sendlela +Name[zh_CN]=终端会话 +Name[zh_TW]=終端機工作階段 +Name[zu]=Iziqendu Zangaphandle +Comment=Menu for starting a terminal emulator with a session or bookmark +Comment[af]='n Kieslys wat 'n terminaal emuleerder met 'n sessie of boekmerk kan begin +Comment[ar]=قائمة لبدء تشغيل مضاهِ مطراف مع جلسة أو علامة موقع +Comment[be]=Меню для запуску эмулятара тэрміналу з сесіяй ці закладкай +Comment[bg]=Меню за стартиране на сесия в терминален прозорец +Comment[bs]=Meni za pokretanje simulatora terminala sa sesijom ili zabilješkom +Comment[ca]=Menú per engegar un emulador de terminal amb una sessió o punt +Comment[cs]=Nabídka pro spuštění teminálu s relací nebo záložkou +Comment[csb]=Menu zrëszëniô òkna terminala ze spamiãtóną sesëją abò załóżka +Comment[da]=Menu til at starte en terminalemulator med en session eller bogmærke +Comment[de]=Menü zum Starten des Terminal-Emulators mit einer Sitzung oder Lesezeichen +Comment[el]=Μενού για την εκκίνηση ενός εξομοιωτή τερματικού με μια συνεδρία ή σελιδοδείκτη +Comment[eo]=Menuo por lanĉi terminalsimulilon jam ŝarĝita kun seaco aŭ legosigno +Comment[es]=Menú para iniciar un emulador de terminal con una sesión o marcador +Comment[et]=Menüü seansi või järjehoidja käivitamiseks terminali emulaatoris +Comment[eu]=Terminal emuladorea saio edo laster-markaz abiarazteko menua +Comment[fa]=گزینگانی برای آغاز مقلد پایانه، توسط یک نشست یا چوب الف +Comment[fi]=Valikko pääteikkunan käynnistämiseen istunnon tai kirjanmerkin kanssa +Comment[fr]=Menu permettant de démarrer un émulateur de terminal à partir d'une session ou un signet +Comment[fy]=Menu foar it begjinnen fan in terminalemulaasje mei in sesje of blêdwizer +Comment[gl]=Menu para lanzar un emulador de terminal +Comment[he]=תפריט להפעלת מסוף עם הפעלה או סימנייה +Comment[hr]=Izbornik za pokretanje terminalske emulacije putem sesije ili oznake +Comment[hu]=Menü parancsértelmező indításához (könyvjelzővel is) +Comment[is]=Valmynd til að ræsa skjáhermi með setu eða bókamerki +Comment[it]=Menu per l'emulatore di terminale con una data sessione o segnalibro +Comment[ja]=指定したセッションやブックマーク先でターミナルエミュレータを起動します +Comment[kk]=Терминал сеансын не бетбелгіні ашу мәзірі +Comment[km]=ម៉ឺនុយសម្រាប់ចាប់ផ្ដើមកម្មវិធីត្រាប់តាមកម្មវិធីស្ថានីយជាមួយនឹងសម័យ ឬចំណាំ +Comment[lt]=Meniu terminalo emuliatoriaus paleidimui su tam tikra sesija ar - nuo žymeklio +Comment[mk]=Мени за стартување на терминалски емулатор со сесија или обележувач +Comment[nb]=Meny for å starte en terminalemulator med en økt eller et bokmerke +Comment[nds]=Menü för dat Starten vun en Terminal-Emulator mit Leestekens oder Törns +Comment[ne]=सत्र वा पुस्तकचिनोसँग टर्मिनल इमुलेटर सुरुआत गर्नका लागि मेनु +Comment[nl]=Menu voor het starten van een terminalemulatie met een sessie of bladwijzer +Comment[nn]=Meny for å starta ein terminalemulator med ei økt eller eit bokmerke +Comment[pl]=Menu uruchomienia okna terminala z zapamiętaną sesją lub zakładką +Comment[pt]=Um menu para iniciar um emulador de terminal com uma sessão ou favorito +Comment[pt_BR]=Menu para início de um emulador de terminal, com uma sessão ou favorito +Comment[ro]=Meniu pentru pornirea unui emulator de terminal cu o sesiune sau semn de carte +Comment[ru]=Быстрый доступ к сеансам и закладкам терминала +Comment[sk]=Menu pre spustenie emulátora terminálu so sedením alebo záložkou +Comment[sl]=Meni za zaganjanje terminalskega emulatorja s sejo ali zaznamkom +Comment[sr]=Мени за покретање емулатора терминала са сесијом или маркером +Comment[sr@Latn]=Meni za pokretanje emulatora terminala sa sesijom ili markerom +Comment[sv]=Meny för att starta en terminalemulator med en session eller bokmärke +Comment[th]=เมนูสำหรับเริ่มโปรแกรมจำลองเทอร์มินัล พร้อมกับวาระ หรือที่คั่นหน้า +Comment[tr]=Bir uçbirim düzenleyiciyi oturum ya da yer imi ile açmanızı sağlar +Comment[uk]=Меню для запуску терміналу емулятора через сеанс або закладку +Comment[vi]=Thực đơn chạy một trình đầu cuối với một phiên chạy hay một địa chỉ lưu trong sổ +Comment[wa]=Dressêye po-z enonder on terminå avou ene session ou ene rimåke +Comment[zh_CN]=以会话或书签启动终端模拟器的菜单 +Comment[zh_TW]=用來啟動作業階段和書籤的終端機模擬程式的選單 +Icon=konsole + +X-KDE-Library=kickermenu_konsole +X-KDE-AuthorizeAction=shell_access diff --git a/kicker/menuext/prefmenu/Makefile.am b/kicker/menuext/prefmenu/Makefile.am new file mode 100644 index 000000000..2ccbb4ba2 --- /dev/null +++ b/kicker/menuext/prefmenu/Makefile.am @@ -0,0 +1,17 @@ +INCLUDES = -I../../libkicker -I$(top_srcdir)/kicker/libkicker $(all_includes) + +kde_module_LTLIBRARIES = kickermenu_prefmenu.la + +kickermenu_prefmenu_la_SOURCES = prefmenu.cpp +kickermenu_prefmenu_la_LDFLAGS = $(all_libraries) -module -avoid-version +kickermenu_prefmenu_la_LIBADD = $(LIB_KDEUI) $(top_builddir)/kicker/libkicker/libkickermain.la + +kickermenu_prefmenu_la_METASOURCES = AUTO + +desktopmenu_DATA = prefmenu.desktop +desktopmenudir = $(kde_datadir)/kicker/menuext + +messages: + $(XGETTEXT) *.cpp -o $(podir)/libkickermenu_prefmenu.pot + +prefmenu.lo: ../../libkicker/kickerSettings.h diff --git a/kicker/menuext/prefmenu/prefmenu.cpp b/kicker/menuext/prefmenu/prefmenu.cpp new file mode 100644 index 000000000..dd157d2cb --- /dev/null +++ b/kicker/menuext/prefmenu/prefmenu.cpp @@ -0,0 +1,394 @@ +/***************************************************************** + +Copyright (c) 1996-2002 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#include <qcursor.h> +#include <qtimer.h> + +#include <kapplication.h> +#include <kglobal.h> +#include <kiconloader.h> +#include <klocale.h> +#include <kservice.h> +#include <kservicegroup.h> +#include <kstandarddirs.h> +#include <ksycoca.h> +#include <kurl.h> +#include <kurldrag.h> + +#include "global.h" +#include "kickerSettings.h" +#include "prefmenu.h" + +K_EXPORT_KICKER_MENUEXT(prefmenu, PrefMenu) + +const int idStart = 4242; + +PrefMenu::PrefMenu(QWidget *parent, + const char *name, + const QStringList &/*args*/) + : KPanelMenu(i18n("Settings"), parent, name), + m_clearOnClose(false) +{ +} + +PrefMenu::PrefMenu(const QString& label, + const QString& root, + QWidget *parent) + : KPanelMenu(label, parent), + m_clearOnClose(false), + m_root(root) +{ + m_subMenus.setAutoDelete(true); + + connect(KSycoca::self(), SIGNAL(databaseChanged()), + this, SLOT(clearOnClose())); + + connect(this, SIGNAL(aboutToHide()), + this, SLOT(aboutToClose())); +} + +PrefMenu::~PrefMenu() +{ +} + +void PrefMenu::insertMenuItem(KService::Ptr& s, + int nId, + int nIndex, + const QStringList *suppressGenericNames) +{ + QString serviceName = s->name(); + // add comment + QString comment = s->genericName(); + if (!comment.isEmpty()) + { + if (KickerSettings::menuEntryFormat() == KickerSettings::NameAndDescription) + { + if (!suppressGenericNames || + !suppressGenericNames->contains(s->untranslatedGenericName())) + { + serviceName = QString("%1 (%2)").arg(serviceName).arg(comment); + } + } + else if (KickerSettings::menuEntryFormat() == KickerSettings::DescriptionAndName) + { + serviceName = QString("%1 (%2)").arg(comment).arg(serviceName); + } + else if (KickerSettings::menuEntryFormat() == KickerSettings::DescriptionOnly) + { + serviceName = comment; + } + } + + // restrict menu entries to a sane length + if (serviceName.length() > 60) + { + serviceName.truncate(57); + serviceName += "..."; + } + + // check for NoDisplay + if (s->noDisplay()) + { + return; + } + + // ignore dotfiles. + if ((serviceName.at(0) == '.')) + { + return; + } + + // item names may contain ampersands. To avoid them being converted + // to accelerators, replace them with two ampersands. + serviceName.replace("&", "&&"); + + int newId = insertItem(KickerLib::menuIconSet(s->icon()), serviceName, nId, nIndex); + m_entryMap.insert(newId, static_cast<KSycocaEntry*>(s)); +} + +void PrefMenu::mousePressEvent(QMouseEvent * ev) +{ + m_dragStartPos = ev->pos(); + KPanelMenu::mousePressEvent(ev); +} + +void PrefMenu::mouseMoveEvent(QMouseEvent * ev) +{ + KPanelMenu::mouseMoveEvent(ev); + + if ((ev->state() & LeftButton) != LeftButton) + { + return; + } + + QPoint p = ev->pos() - m_dragStartPos; + if (p.manhattanLength() <= QApplication::startDragDistance()) + { + return; + } + + int id = idAt(m_dragStartPos); + + // Don't drag items we didn't create. + if (id < idStart) + { + return; + } + + if (!m_entryMap.contains(id)) + { + kdDebug(1210) << "Cannot find service with menu id " << id << endl; + return; + } + + KSycocaEntry * e = m_entryMap[id]; + + QPixmap icon; + KURL url; + + switch (e->sycocaType()) + { + case KST_KService: + { + icon = static_cast<KService *>(e)->pixmap(KIcon::Small); + QString filePath = static_cast<KService *>(e)->desktopEntryPath(); + if (filePath[0] != '/') + { + filePath = locate("apps", filePath); + } + url.setPath(filePath); + break; + } + + case KST_KServiceGroup: + { + icon = KGlobal::iconLoader()->loadIcon(static_cast<KServiceGroup*>(e)->icon(), + KIcon::Small); + url = "programs:/" + static_cast<KServiceGroup*>(e)->relPath(); + break; + } + + default: + { + return; + break; + } + } + + // If the path to the desktop file is relative, try to get the full + // path from KStdDirs. + KURLDrag *d = new KURLDrag(KURL::List(url), this); + connect(d, SIGNAL(destroyed()), this, SLOT(dragObjectDestroyed())); + d->setPixmap(icon); + d->dragCopy(); + + // Set the startposition outside the panel, so there is no drag initiated + // when we use drag and click to select items. A drag is only initiated when + // you click to open the menu, and then press and drag an item. + m_dragStartPos = QPoint(-1,-1); +} + +void PrefMenu::dragEnterEvent(QDragEnterEvent *event) +{ + // Set the DragObject's target to this widget. This is needed because the + // widget doesn't accept drops, but we want to determine if the drag object + // is dropped on it. This avoids closing on accidental drags. If this + // widget accepts drops in the future, these lines can be removed. + if (event->source() == this) + { + KURLDrag::setTarget(this); + } + event->ignore(); +} + +void PrefMenu::dragLeaveEvent(QDragLeaveEvent */*event*/) +{ + // see PrefMenu::dragEnterEvent why this is nescessary + if (!frameGeometry().contains(QCursor::pos())) + { + KURLDrag::setTarget(0); + } +} + +void PrefMenu::initialize() +{ + if (initialized()) + { + return; + } + + // Set the startposition outside the panel, so there is no drag initiated + // when we use drag and click to select items. A drag is only initiated when + // you click to open the menu, and then press and drag an item. + m_dragStartPos = QPoint(-1,-1); + + if (m_root.isEmpty()) + { + insertItem(KickerLib::menuIconSet("kcontrol"), + i18n("Control Center"), + this, SLOT(launchControlCenter())); + insertSeparator(); + } + + // We ask KSycoca to give us all services under Settings/ + KServiceGroup::Ptr root = KServiceGroup::group(m_root.isEmpty() ? "Settings/" : m_root); + + if (!root || !root->isValid()) + { + return; + } + + KServiceGroup::List list = root->entries(true, true, true, + KickerSettings::menuEntryFormat() == KickerSettings:: NameAndDescription); + + if (list.isEmpty()) + { + setItemEnabled(insertItem(i18n("No Entries")), false); + return; + } + + int id = idStart; + + QStringList suppressGenericNames = root->suppressGenericNames(); + + KServiceGroup::List::ConstIterator it = list.begin(); + for (; it != list.end(); ++it) + { + KSycocaEntry* e = *it; + + if (e->isType(KST_KServiceGroup)) + { + + KServiceGroup::Ptr g(static_cast<KServiceGroup *>(e)); + QString groupCaption = g->caption(); + + // Avoid adding empty groups. + KServiceGroup::Ptr subMenuRoot = KServiceGroup::group(g->relPath()); + if (subMenuRoot->childCount() == 0) + { + continue; + } + + // Ignore dotfiles. + if ((g->name().at(0) == '.')) + { + continue; + } + + // Item names may contain ampersands. To avoid them being converted + // to accelerators, replace each ampersand with two ampersands. + groupCaption.replace("&", "&&"); + + PrefMenu* m = new PrefMenu(g->name(), g->relPath(), this); + m->setCaption(groupCaption); + + int newId = insertItem(KickerLib::menuIconSet(g->icon()), groupCaption, m, id++); + m_entryMap.insert(newId, static_cast<KSycocaEntry*>(g)); + // We have to delete the sub menu our selves! (See Qt docs.) + m_subMenus.append(m); + } + else if (e->isType(KST_KService)) + { + KService::Ptr s(static_cast<KService *>(e)); + insertMenuItem(s, id++, -1, &suppressGenericNames); + } + else if (e->isType(KST_KServiceSeparator)) + { + insertSeparator(); + } + } + + setInitialized(true); +} + +void PrefMenu::slotExec(int id) +{ + if (!m_entryMap.contains(id)) + { + return; + } + + kapp->propagateSessionManager(); + KSycocaEntry *e = m_entryMap[id]; + KService::Ptr service = static_cast<KService *>(e); + KApplication::startServiceByDesktopPath(service->desktopEntryPath(), + QStringList(), 0, 0, 0, "", true); + m_dragStartPos = QPoint(-1,-1); +} + +void PrefMenu::clearOnClose() +{ + if (!initialized()) + { + return; + } + + m_clearOnClose = isVisible(); + if (!m_clearOnClose) + { + // we aren't visible right now so clear immediately + slotClear(); + } +} + +void PrefMenu::slotClear() +{ + if( isVisible()) + { + // QPopupMenu's aboutToHide() is emitted before the popup is really hidden, + // and also before a click in the menu is handled, so do the clearing + // only after that has been handled + QTimer::singleShot( 100, this, SLOT( slotClear())); + return; + } + + m_entryMap.clear(); + KPanelMenu::slotClear(); + m_subMenus.clear(); +} + +void PrefMenu::aboutToClose() +{ + if (m_clearOnClose) + { + m_clearOnClose = false; + slotClear(); + } +} + +void PrefMenu::launchControlCenter() +{ + KApplication::startServiceByDesktopName("kcontrol", QStringList(), + 0, 0, 0, "", true); +} + + +void PrefMenu::dragObjectDestroyed() +{ + if (KURLDrag::target() != this) + { + close(); + } +} + +#include "prefmenu.moc" diff --git a/kicker/menuext/prefmenu/prefmenu.desktop b/kicker/menuext/prefmenu/prefmenu.desktop new file mode 100644 index 000000000..f3206d4e3 --- /dev/null +++ b/kicker/menuext/prefmenu/prefmenu.desktop @@ -0,0 +1,135 @@ +[Desktop Entry] +Name=Settings +Name[af]=Instellings +Name[ar]=التعيينات +Name[az]=Qurğular +Name[be]=Настаўленні +Name[bg]=Настройки +Name[bn]=সেটিংস +Name[br]=Dibarzhoù +Name[bs]=Postavke +Name[ca]=Preferències +Name[cs]=Nastavení +Name[csb]=Ùstôw +Name[cy]=Gosodiadau +Name[da]=Opsætning +Name[de]=Einstellungen +Name[el]=Ρυθμίσεις +Name[eo]=Agordo +Name[es]=Preferencias +Name[et]=Seadistused +Name[eu]=Ezarpenak +Name[fa]=تنظیمات +Name[fi]=Asetukset +Name[fr]=Configuration +Name[fy]=Ynstellings +Name[ga]=Socruithe +Name[gl]=Opcións +Name[he]=הגדרות +Name[hi]=विन्यास +Name[hr]=Postavke +Name[hsb]=Nastajenja +Name[hu]=Beállítások +Name[is]=Stillingar +Name[it]=Impostazioni +Name[ja]=設定 +Name[ka]=პარამეტრები +Name[kk]=Параметрлері +Name[km]=ការកំណត់ +Name[ko]=설정 +Name[lt]=Parinktys +Name[lv]=Parametri +Name[mk]=Поставувања +Name[mn]=Тохируулга +Name[ms]=Tempatan +Name[nb]=Innstillinger +Name[nds]=Instellen +Name[ne]=सेटिङ +Name[nl]=Instellingen +Name[nn]=Innstillingar +Name[pa]=ਸੈਟਿੰਗ +Name[pl]=Ustawienia +Name[pt]=Configuração +Name[pt_BR]=Configurações +Name[ro]=Setări +Name[ru]=Настройка +Name[rw]=Amagenamiterere +Name[se]=Heivehusat +Name[sk]=Nastavenia +Name[sl]=Nastavitve +Name[sr]=Поставке +Name[sr@Latn]=Postavke +Name[sv]=Inställningar +Name[ta]=அமைப்புகள் +Name[te]=అమరికలు +Name[tg]=Танзимот +Name[th]=ตั้งค่าต่างๆ +Name[tr]=Ayarlar +Name[tt]=Caylaw +Name[uk]=Параметри +Name[uz]=Moslamalar +Name[uz@cyrillic]=Мосламалар +Name[vi]=Thiết lập +Name[wa]=Apontiaedjes +Name[zh_CN]=设置 +Name[zh_TW]=設定 +Comment=Control Center modules menu +Comment[af]=Beheer Sentrum Modules kieslys +Comment[ar]=قائمة وحدات مركز التحكّم +Comment[be]=Меню модуляў Цэнтра кіравання +Comment[bg]=Меню на модулите в контролния център +Comment[bn]=বিভিন্ন নিয়ন্ত্রণ কেন্দ্র মডিউল সম্বলিত মেনু +Comment[ca]=Menú dels mòduls del centre de control +Comment[cs]=Nabídka modulů Ovládacího centra +Comment[csb]=Menu mòdułów Centróm kòntrolë +Comment[da]=Menu med moduler i kontrolcentret +Comment[de]=Das Menü für Kontrollzentrum-Module +Comment[el]=Μενού αρθρωμάτων κέντρου ελέγχου +Comment[en_GB]=Control Centre modules menu +Comment[eo]=Menuo de Stircentraj Moduloj +Comment[es]=Menú de los módulos del Centro de control +Comment[et]=Juhtimiskeskuse moodulite menüü +Comment[eu]=Kontrol gunearen moduluen menua +Comment[fa]=گزینگان پیمانههای مرکز کنترل +Comment[fi]=Ohjauskeskuksen moduulivalikko +Comment[fr]=Menu des modules du Centre de configuration +Comment[fy]=Menu mei Konfiguraasjemodules +Comment[gl]=Menu dos Módulos do Centro de Control +Comment[he]=תפריט מודולי מרכז בקרה +Comment[hr]=Izbornik modula upravljačkog središta +Comment[hu]=Menü a Vezérlőpult moduljaival +Comment[is]=Valmynd stjórnborðseininga +Comment[it]=Menu dei moduli del centro di controllo +Comment[ja]=コントロールセンターモジュールメニュー +Comment[kk]=Басқару орталықтың модульдер мәзірі +Comment[km]=ម៉ឺនុយម៉ូឌុលមជ្ឈមណ្ឌលបញ្ជា +Comment[ko]=제어판 모듈 +Comment[lt]=Valdymo centro modulių meniu +Comment[mk]=Мени со модулите од Контролниот центар +Comment[nb]=Meny for kontrollpanelmoduler +Comment[nds]=Kuntrullzentrum-Modulen +Comment[ne]=नियन्त्रण केन्द्र मोड्युल मेनु +Comment[nl]=Menu met Configuratiemodules +Comment[nn]=Meny for kontrollsentermodular +Comment[pa]=ਕੰਟਰੋਲ ਕੇਂਦਰ ਮੈਡੀਊਲ ਮੇਨੂ +Comment[pl]=Menu modułów Centrum sterowania +Comment[pt]=Menu de módulos do Centro de Controlo +Comment[pt_BR]=Menu dos módulos do Centro de Controle +Comment[ru]=Модули Центра управления +Comment[sk]=Menu pre moduly Ovládacieho centra +Comment[sl]=Meni z moduli Nadzornega središča +Comment[sr]=Мени модула Контролног центра +Comment[sr@Latn]=Meni modula Kontrolnog centra +Comment[sv]=Meny med moduler i Inställningscentralen +Comment[th]=เมนูของโมดูลของศูนย์ควบคุม +Comment[tr]=Kontrol Merkezi modülleri menüsü +Comment[uk]=Меню модулів в Центрі керування +Comment[uz]=Boshqaruv markazining modullari +Comment[uz@cyrillic]=Бошқарув марказининг модуллари +Comment[vi]=Trung tâm điều khiển mô đun thực đơn +Comment[wa]=Dressêye des modules do cinte di contrôle +Comment[zh_CN]=控制中心模块菜单 +Comment[zh_TW]=控制中心模組選單 +Icon=package_settings + +X-KDE-Library=kickermenu_prefmenu diff --git a/kicker/menuext/prefmenu/prefmenu.h b/kicker/menuext/prefmenu/prefmenu.h new file mode 100644 index 000000000..99c3772fc --- /dev/null +++ b/kicker/menuext/prefmenu/prefmenu.h @@ -0,0 +1,74 @@ +/***************************************************************** + +Copyright (c) 1996-2002 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#ifndef _prefmenu_h_ +#define _prefmenu_h_ + +#include <qmap.h> + +#include <kpanelmenu.h> +#include <ksycocaentry.h> + +typedef QMap<int, KSycocaEntry::Ptr> EntryMap; +typedef QPtrList<QPopupMenu> PopupMenuList; + +class PrefMenu : public KPanelMenu +{ + Q_OBJECT + + public: + PrefMenu(QWidget *parent, + const char *name, + const QStringList & /*args*/); + PrefMenu(const QString& label, + const QString& root, + QWidget *parent); + ~PrefMenu(); + + protected: + void insertMenuItem(KService::Ptr & s, + int nId, + int nIndex= -1, + const QStringList *suppressGenericNames = 0); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void dragEnterEvent(QDragEnterEvent *); + virtual void dragLeaveEvent(QDragLeaveEvent *); + + bool m_clearOnClose; + QString m_root; + QPoint m_dragStartPos; + EntryMap m_entryMap; + PopupMenuList m_subMenus; + + protected slots: + void initialize(); + void slotExec(int id); // from KPanelMenu + void slotClear(); // from KPanelMenu + void clearOnClose(); + void aboutToClose(); + void launchControlCenter(); + void dragObjectDestroyed(); +}; + +#endif diff --git a/kicker/menuext/recentdocs/Makefile.am b/kicker/menuext/recentdocs/Makefile.am new file mode 100644 index 000000000..38f95814b --- /dev/null +++ b/kicker/menuext/recentdocs/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = kickermenu_recentdocs.la + +kickermenu_recentdocs_la_SOURCES = recentdocsmenu.cpp +kickermenu_recentdocs_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined +kickermenu_recentdocs_la_LIBADD = $(LIB_KDEUI) $(LIB_KIO) + +kickermenu_recentdocs_la_METASOURCES = AUTO + +desktopmenu_DATA = recentdocs.desktop +desktopmenudir = $(kde_datadir)/kicker/menuext + +messages: + $(XGETTEXT) *.cpp -o $(podir)/libkickermenu_recentdocs.pot diff --git a/kicker/menuext/recentdocs/recentdocs.desktop b/kicker/menuext/recentdocs/recentdocs.desktop new file mode 100644 index 000000000..a2f406079 --- /dev/null +++ b/kicker/menuext/recentdocs/recentdocs.desktop @@ -0,0 +1,140 @@ +[Desktop Entry] +Name=Recent Documents +Name[af]=Onlangse Dokumente +Name[ar]=مستندات حديثة +Name[az]=Son Sənədlər +Name[be]=Ранейшыя дакументы +Name[bg]=Документи +Name[bn]=সম্প্রতি ব্যবহৃত নথী +Name[br]=Teulioù nevez +Name[bs]=Najnoviji dokumenti +Name[ca]=Documents recents +Name[cs]=Nedávné dokumenty +Name[csb]=Slédno òtemkłé dokùmentë +Name[cy]=Dogfenni Diweddar +Name[da]=Nylige dokumenter +Name[de]=Zuletzt geöffnete Dokumente +Name[el]=Πρόσφατα έγγραφα +Name[eo]=Lastaj dokumentoj +Name[es]=Documentos recientes +Name[et]=Viimati kasutatud dokumendid +Name[eu]=Azken dokumentuak +Name[fa]=سندهای اخیر +Name[fi]=Viimeaikaiset asiakirjat +Name[fr]=Documents récents +Name[fy]=Nijste dokuminten +Name[ga]=Cáipéisí is déanaí +Name[gl]=Documentos Recentes +Name[he]=מסמכים אחרונים +Name[hi]=हालिया दस्तावेज़ +Name[hr]=Nedavno pristupljeni dokumenti +Name[hu]=A legutóbbi dokumentumok +Name[is]=Nýleg skjöl +Name[it]=Documenti recenti +Name[ja]=最近開いたドキュメント +Name[ka]=ბოლო დოკუმენტები +Name[kk]=Жуырдағы құжаттар +Name[km]=ឯកសារថ្មីៗនេះ +Name[lo]=ເອກະສານຂໍ້ຄວາມ +Name[lt]=Neseni dokumentai +Name[lv]=Nesenie dokumenti +Name[mk]=Скорешни документи +Name[mn]=Сүүлд нээгдсэн баримтууд +Name[ms]=Dokumen Terkini +Name[mt]=Dokumenti riċenti +Name[nb]=Nylig brukte dokumenter +Name[nds]=Tolest bruukte Dokmenten +Name[ne]=हालको कागजात +Name[nl]=Recente documenten +Name[nn]=Nyleg bruka dokument +Name[nso]=Ditokomane tsa Gabjale +Name[pa]=ਤਾਜ਼ਾ ਦਸਤਾਵੇਜ਼ +Name[pl]=Ostatnio otwarte dokumenty +Name[pt]=Documentos Recentes +Name[pt_BR]=Documentos Recentes +Name[ro]=Documente recente +Name[ru]=Последние документы +Name[rw]=Inyandiko za Vuba +Name[se]=Áiddo geavahuvvon dokumeanttat +Name[sk]=Nedávne dokumenty +Name[sl]=Nedavni dokumenti +Name[sr]=Пређашњи документи +Name[sr@Latn]=Pređašnji dokumenti +Name[sv]=Senaste dokument +Name[ta]=தற்போதைய ஆவணங்கள் +Name[tg]=Ҳуҷҷатҳои охирин +Name[th]=เอกสารที่เคยเรียกใช้ +Name[tr]=Son Kullanılan Belgeler +Name[tt]=Soñğı İstäleklär +Name[uk]=Недавні документи +Name[uz]=Yaqinda ochilgan hujjatlar +Name[uz@cyrillic]=Яқинда очилган ҳужжатлар +Name[ven]=Manwalwa a Zwino +Name[vi]=Tài liệu Gần đây +Name[wa]=Documints d' enawaire +Name[xh]=Uxwebhu Olusandukusebenziswa +Name[zh_CN]=最近文档 +Name[zh_TW]=最近的文件 +Name[zu]=Ushicilelo olusanda kuvulwa +Comment=Menu of documents you have used recently +Comment[af]=Kieslys met dokumente wat onlangs deur jou gebruik is +Comment[ar]=قائمة المستنادات التي إستخدمتها حديثاً +Comment[be]=Меню раней выкарыстаных дакументаў +Comment[bg]=Последно използвани документи +Comment[bn]=আপনি সম্প্রতি ব্যবহার করেছেন এমন নথীর তালিকা +Comment[bs]=Meni sa dokumentima koje ste nedavno koristili +Comment[ca]=Menú dels documents usats fa poc +Comment[cs]=Nabídka nedávno použitých dokumentů +Comment[csb]=Menu slédno òtemkłëch dokùmentów +Comment[da]=Menu med dokumenter du har brugt for nyligt +Comment[de]=Menü mit Dokumenten, die Sie zuletzt geöffnet hatten +Comment[el]=Μενού εγγράφων που χρησιμοποιήθηκαν πρόσφατα +Comment[eo]=Menuo de dokumentoj kiujn vi laste uzis +Comment[es]=Menú de los documentos recientemente usados +Comment[et]=Viimati kasutatud dokumentide menüü +Comment[eu]=Erabili dituzun azken dokumentuen menua +Comment[fa]=گزینگان سندهایی که اخیراً استفاده کردهاید +Comment[fi]=Viimeksi käyttämiesi asiakirjojen valikko +Comment[fr]=Menu des documents récemment utilisés +Comment[fy]=Menu mei dokuminten dy jo koartlyn iepene ha +Comment[gl]=Os documentos que usou recentemente +Comment[he]=תפריט המסמכים שהשתמשת בהם לאחרונה +Comment[hr]=Izbornik s nedavno pristupljenim dokumentima +Comment[hu]=A nemrég használt dokumentumok menüje +Comment[is]=Listi yfir skjöl sem þú hefur nýlega notað +Comment[it]=Menu dei documenti usati recentemente +Comment[ja]=最近使ったドキュメントのメニュー +Comment[ka]=ბოლო დროს გამოყენებული დოკუმენტების მენიუ +Comment[kk]=Жуырда қолданған құжаттар мәзірі +Comment[km]=ម៉ឺនុយឯកសារដែលអ្នកបានប្រើថ្មីៗនេះ +Comment[lt]=Nesenai naudotų dokumentų meniu +Comment[mk]=Мени со последните документи што сте ги користеле +Comment[nb]=Meny over dokumenter du nylig har brukt +Comment[nds]=Menü vun Dokmenten, de Du tolest bruukt hest +Comment[ne]=तपाईँले भरखरै प्रयोग गर्नु भएको कागजातका मेनु +Comment[nl]=Menu met documenten die u recentelijk hebt geopend +Comment[nn]=Meny over dokument du nyleg har bruka +Comment[pa]=ਤਾਜ਼ਾ ਦਸਤਾਵੇਜ਼, ਜੋ ਕਿ ਤੁਸੀਂ ਹੁਣੇ ਵਰਤੇ ਹਨ +Comment[pl]=Menu ostatnio używanych dokumentów +Comment[pt]=Menu com os documentos recentes que você usou +Comment[pt_BR]=Menu de documentos que você usou recentemente +Comment[ro]=Meniu cu lista de documente pe care le-ați utilizat recent +Comment[ru]=Последние документы +Comment[se]=Fállu mii čájeha dokumeanttaid mat áiddo leat geavahuvvon +Comment[sk]=Menu nedávno použitých dokumentov +Comment[sl]=Meni z dokumenti, ki ste jih uporabljali pred kratkim +Comment[sr]=Мени докумената које сте скорије користили +Comment[sr@Latn]=Meni dokumenata koje ste skorije koristili +Comment[sv]=Meny med dokument som du nyligen har använt +Comment[th]=เมนูของเอกสารที่คุณเคยเรียกใช้มาแล้ว +Comment[tr]=Son kullanılan belgelerin menüsü +Comment[uk]=Меню документів, які ви недавно використовували +Comment[uz]=Yaqinda ishlatilgan hujjatlarning menyusi +Comment[uz@cyrillic]=Яқинда ишлатилган ҳужжатларнинг менюси +Comment[vi]=Thực đơn chứa các tài liệu bạn mới truy cập gần đây +Comment[wa]=Dressêye des documints ki vs avoz eployîz enawaire +Comment[zh_CN]=您最近使用过的文档的菜单 +Comment[zh_TW]=您最近使用過的文件選單 +Icon=document + +X-KDE-Library=kickermenu_recentdocs diff --git a/kicker/menuext/recentdocs/recentdocsmenu.cpp b/kicker/menuext/recentdocs/recentdocsmenu.cpp new file mode 100644 index 000000000..98357fe52 --- /dev/null +++ b/kicker/menuext/recentdocs/recentdocsmenu.cpp @@ -0,0 +1,139 @@ +/***************************************************************** + +Copyright (c) 1996-2000 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#include <qdragobject.h> + +#include <kglobal.h> +#include <kiconloader.h> +#include <kmimetype.h> +#include <klocale.h> +#include <kdesktopfile.h> +#include <kglobalsettings.h> +#include <kapplication.h> +#include <kurldrag.h> +#include <krecentdocument.h> + +#include "recentdocsmenu.h" + +K_EXPORT_KICKER_MENUEXT(recentdocs, RecentDocsMenu) + +RecentDocsMenu::RecentDocsMenu(QWidget *parent, const char *name, + const QStringList &/*args*/) + : KPanelMenu(KRecentDocument::recentDocumentDirectory(), parent, name) +{ +} + +RecentDocsMenu::~RecentDocsMenu() +{ +} + +void RecentDocsMenu::initialize() { + if (initialized()) clear(); + + insertItem(SmallIconSet("history_clear"), i18n("Clear History"), + this, SLOT(slotClearHistory())); + insertSeparator(); + + _fileList = KRecentDocument::recentDocuments(); + + if (_fileList.isEmpty()) { + insertItem(i18n("No Entries"), 0); + setItemEnabled(0, false); + return; + } + + int id = 0; + + for (QStringList::ConstIterator it = _fileList.begin(); + it != _fileList.end(); + ++it) + { + KDesktopFile f(*it, true /* read only */); + insertItem(SmallIconSet(f.readIcon()), f.readName().replace('&', QString::fromAscii("&&") ), id++); + } + + setInitialized(true); +} + +void RecentDocsMenu::slotClearHistory() { + KRecentDocument::clear(); + reinitialize(); +} + +void RecentDocsMenu::slotExec(int id) { + if (id >= 0) { + kapp->propagateSessionManager(); + KURL u; + u.setPath(_fileList[id]); + KDEDesktopMimeType::run(u, true); + } +} + +void RecentDocsMenu::mousePressEvent(QMouseEvent* e) { + _mouseDown = e->pos(); + QPopupMenu::mousePressEvent(e); +} + +void RecentDocsMenu::mouseMoveEvent(QMouseEvent* e) { + KPanelMenu::mouseMoveEvent(e); + + if (!(e->state() & LeftButton)) + return; + + if (!rect().contains(_mouseDown)) + return; + + int dragLength = (e->pos() - _mouseDown).manhattanLength(); + + if (dragLength <= KGlobalSettings::dndEventDelay()) + return; // ignore it + + int id = idAt(_mouseDown); + + // Don't drag 'manual' items. + if (id < 0) + return; + + KDesktopFile f(_fileList[id], true /* read only */); + + KURL url ( f.readURL() ); + + if (url.isEmpty()) // What are we to do ? + return; + + KURL::List lst; + lst.append(url); + + KURLDrag* d = new KURLDrag(lst, this); + d->setPixmap(SmallIcon(f.readIcon())); + d->dragCopy(); + close(); +} + +void RecentDocsMenu::slotAboutToShow() +{ + reinitialize(); + KPanelMenu::slotAboutToShow(); +} + +#include "recentdocsmenu.moc" diff --git a/kicker/menuext/recentdocs/recentdocsmenu.h b/kicker/menuext/recentdocs/recentdocsmenu.h new file mode 100644 index 000000000..1e3157495 --- /dev/null +++ b/kicker/menuext/recentdocs/recentdocsmenu.h @@ -0,0 +1,55 @@ +/***************************************************************** + +Copyright (c) 1996-2002 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#ifndef RECENTDOCSMENU_H +#define RECENTDOCSMENU_H + +#include <kpanelmenu.h> + +class QStringList; +class QPoint; + +class RecentDocsMenu : public KPanelMenu +{ + Q_OBJECT + +public: + RecentDocsMenu(QWidget* parent, const char* name, const QStringList &/*args*/); + ~RecentDocsMenu(); + void initialize(); + +protected slots: + void slotClearHistory(); + void slotExec(int id); + void slotAboutToShow(); + +protected: + void mousePressEvent(QMouseEvent* e); + void mouseMoveEvent(QMouseEvent* e); + +private: + QStringList _fileList; + QPoint _mouseDown; +}; + +#endif // RECENTDOCSMENU_H diff --git a/kicker/menuext/remote/Makefile.am b/kicker/menuext/remote/Makefile.am new file mode 100644 index 000000000..85736d0a2 --- /dev/null +++ b/kicker/menuext/remote/Makefile.am @@ -0,0 +1,17 @@ +INCLUDES = -I$(srcdir)/../../ui -I../../libkicker $(all_includes) + +kde_module_LTLIBRARIES = kickermenu_remotemenu.la + +kickermenu_remotemenu_la_SOURCES = remotemenu.cpp remotemenu.skel +kickermenu_remotemenu_la_LDFLAGS = $(all_libraries) -module -avoid-version +kickermenu_remotemenu_la_LIBADD = $(LIB_KDEUI) $(top_builddir)/kicker/libkicker/libkickermain.la + +kickermenu_remotemenu_la_METASOURCES = AUTO + +desktopmenu_DATA = remotemenu.desktop +desktopmenudir = $(kde_datadir)/kicker/menuext + +messages: + $(XGETTEXT) *.cpp -o $(podir)/libkickermenu_remotemenu.pot + +remotemenu.lo: ../../libkicker/kickerSettings.h diff --git a/kicker/menuext/remote/remotemenu.cpp b/kicker/menuext/remote/remotemenu.cpp new file mode 100644 index 000000000..42b3d5339 --- /dev/null +++ b/kicker/menuext/remote/remotemenu.cpp @@ -0,0 +1,164 @@ +/* This file is part of the KDE project + Copyright (c) 2004 Kevin Ottens <ervin ipsquad net> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "remotemenu.h" + +#include <kdebug.h> +#include <kglobal.h> +#include <kstandarddirs.h> +#include <krun.h> +#include <kiconloader.h> +#include <kdesktopfile.h> +#include <kservice.h> + +#include <qpixmap.h> +#include <qdir.h> +#include <qtimer.h> + +#include "kickerSettings.h" + +#define WIZARD_SERVICE "knetattach" + +K_EXPORT_KICKER_MENUEXT(remotemenu, RemoteMenu) + + +RemoteMenu::RemoteMenu(QWidget *parent, const char *name, + const QStringList &/*args*/) + : KPanelMenu(parent, name), KDirNotify() +{ + KGlobal::dirs()->addResourceType("remote_entries", + KStandardDirs::kde_default("data") + "remoteview"); + + QString path = KGlobal::dirs()->saveLocation("remote_entries"); + + QDir dir = path; + if (!dir.exists()) + { + dir.cdUp(); + dir.mkdir("remoteview"); + } +} + +RemoteMenu::~RemoteMenu() +{ +} + +void RemoteMenu::initialize() +{ + int id = 0; + if (KickerSettings::showMenuTitles()) + { + insertTitle(i18n("Network Folders")); + } + + id = insertItem(SmallIcon("wizard"), i18n("Add Network Folder")); + connectItem(id, this, SLOT(startWizard())); + id = insertItem(SmallIcon("kfm"), i18n("Manage Network Folders")); + connectItem(id, this, SLOT(openRemoteDir())); + + insertSeparator(); + + m_desktopMap.clear(); + QStringList names_found; + QStringList dirList = KGlobal::dirs()->resourceDirs("remote_entries"); + + QStringList::ConstIterator dirpath = dirList.begin(); + QStringList::ConstIterator end = dirList.end(); + for(; dirpath!=end; ++dirpath) + { + QDir dir = *dirpath; + if (!dir.exists()) continue; + + QStringList filenames + = dir.entryList( QDir::Files | QDir::Readable ); + + QStringList::ConstIterator name = filenames.begin(); + QStringList::ConstIterator endf = filenames.end(); + + for(; name!=endf; ++name) + { + if (!names_found.contains(*name)) + { + names_found.append(*name); + QString filename = *dirpath+*name; + KDesktopFile desktop(filename); + id = insertItem(SmallIcon(desktop.readIcon()), desktop.readName()); + m_desktopMap[id] = filename; + } + } + } +} + +void RemoteMenu::startWizard() +{ + KURL url; + KService::Ptr service = KService::serviceByDesktopName(WIZARD_SERVICE); + + if (service && service->isValid()) + { + url.setPath(locate("apps", service->desktopEntryPath())); + new KRun(url, 0, true); // will delete itself + } +} + +void RemoteMenu::openRemoteDir() +{ + new KRun(KURL("remote:/")); +} + +void RemoteMenu::slotExec(int id) +{ + if (m_desktopMap.contains(id)) + { + new KRun(m_desktopMap[id]); + } +} + +ASYNC RemoteMenu::FilesAdded(const KURL &directory) +{ + if (directory.protocol()=="remote") reinitialize(); +} + +ASYNC RemoteMenu::FilesRemoved(const KURL::List &fileList) +{ + KURL::List::ConstIterator it = fileList.begin(); + KURL::List::ConstIterator end = fileList.end(); + + for (; it!=end; ++it) + { + if ((*it).protocol()=="remote") + { + reinitialize(); + return; + } + } +} + +ASYNC RemoteMenu::FilesChanged(const KURL::List &fileList) +{ + FilesRemoved(fileList); +} + +ASYNC RemoteMenu::FilesRenamed(const KURL &src, const KURL &dest) +{ + if (src.protocol()=="remote" || dest.protocol()=="remote") + reinitialize(); +} + +#include "remotemenu.moc" diff --git a/kicker/menuext/remote/remotemenu.desktop b/kicker/menuext/remote/remotemenu.desktop new file mode 100644 index 000000000..82f0de72c --- /dev/null +++ b/kicker/menuext/remote/remotemenu.desktop @@ -0,0 +1,133 @@ +[Desktop Entry] +Name=Network Folders +Name[af]=Netwerk Gidse +Name[ar]=مجلّدات الشبكة +Name[be]=Сеткавыя тэчкі +Name[bg]=Мрежови директории +Name[bn]=নেটওয়ার্ক ফোল্ডার +Name[br]=Renkelloù rouedad +Name[bs]=Mrežni folderi +Name[ca]=Carpetes de xarxa +Name[cs]=Síťové složky +Name[csb]=Sécowé katalodżi +Name[da]=Netværksmapper +Name[de]=Netzwerkordner +Name[el]=Δικτυακοί φάκελοι +Name[eo]=Retaj Dosierujoj +Name[es]=Carpetas de red +Name[et]=Võrgukataloogid +Name[eu]=Sareko karpetak +Name[fa]=پوشههای شبکه +Name[fi]=Verkkokansiot +Name[fr]=Dossiers réseau +Name[fy]=Netwurkmappen +Name[ga]=Fillteáin Líonra +Name[gl]=Cartafoles en Rede +Name[he]=תיקיות רשת +Name[hi]=नेटवर्क फोल्डर्स +Name[hr]=Mrežne mape +Name[hu]=Hálózati mappák +Name[is]=Netmöppur +Name[it]=Cartelle di rete +Name[ja]=ネットワークフォルダ +Name[ka]=ქსელური საქაღალდეები +Name[kk]=Желідегі қапшықтар +Name[km]=ថតបណ្ដាញ +Name[ko]=네트워크 폴더 마법사 +Name[lt]=Tinklo aplankai +Name[lv]=Tīkla mape +Name[mk]=Мрежни папки +Name[ms]=Folder Rangkaian +Name[nb]=Nettverksmapper +Name[nds]=Nettwarkorner +Name[ne]=सञ्जाल फोल्डर +Name[nl]=Netwerkmappen +Name[nn]=Nettverksmapper +Name[pa]=ਨੈੱਟਵਰਕ ਫੋਲਡਰ +Name[pl]=Foldery sieciowe +Name[pt]=Pastas de Rede +Name[pt_BR]=Pastas de Rede +Name[ro]=Foldere de rețea +Name[ru]=Сетевые папки +Name[rw]=Ububiko bw'Urusobemiyoboro +Name[se]=Fierpmádatmáhpat +Name[sk]=Sieťové priečinky +Name[sl]=Omrežne mape +Name[sr]=Мрежне фасцикле +Name[sr@Latn]=Mrežne fascikle +Name[sv]=Nätverkskataloger +Name[ta]=வலைப்பின்னல் அடைவுகள் +Name[te]=నెట్వర్క్ ఫొల్డర్లు +Name[tg]=Феҳрастҳои шабака +Name[th]=โฟลเดอร์เครือข่าย +Name[tr]=Ağ Dizinleri +Name[tt]=Çeltärle Törgäklär +Name[uk]=Мережні теки +Name[uz]=Tarmoq jildlari +Name[uz@cyrillic]=Тармоқ жилдлари +Name[vi]=Thư mục Mạng +Name[wa]=Ridants rantoele +Name[zh_CN]=网络文件夹 +Name[zh_TW]=網路資料夾 +Comment=Menu of network folders +Comment[af]=Kieslys vir netwerk gidse +Comment[ar]=قائمة مجلّدات الشبكة +Comment[be]=Меню сеткавых тэчак +Comment[bg]=Меню за достъп до мрежови директории +Comment[bn]=নেটওয়ার্ক ফোল্ডার-এর তালিকা +Comment[bs]=Meni sa mrežnim direktorijima +Comment[ca]=Menú de les carpetes de xarxa +Comment[cs]=Nabídka síťových složek +Comment[csb]=Menu sécowëch katalogów +Comment[da]=Menu med netværksmapper +Comment[de]=Menü für den Zugriff auf Netzwerkordner +Comment[el]=Μενού των δικτυακών φακέλων +Comment[eo]=Menuo de retaj dosierujoj +Comment[es]=Menú de las carpetas de red +Comment[et]=Võrgukataloogide menüü +Comment[eu]=Sareko karpeten menua +Comment[fa]=گزینگان پوشههای شبکه +Comment[fi]=Verkkokansiovalikko +Comment[fr]=Menu des dossiers réseau +Comment[fy]=Menu mei netwurkmappen +Comment[gl]=Aceso doado cartafoles en rede +Comment[he]=תפריט של תיקיות רשת +Comment[hr]=Izbornik mrežnih mapa +Comment[hu]=A hálózati mappák menüje +Comment[is]=Einföld leið að netmöppum +Comment[it]=Menu delle cartelle di rete +Comment[ja]=ネットワークフォルダのメニュー +Comment[ka]=ქსელური დასტების მენიუ +Comment[kk]=Желідегі қапшықтар мәзірі +Comment[km]=ម៉ឺនុយរបស់ថតបណ្តាញ +Comment[lt]=Tinklo aplankų meniu +Comment[mk]=Мени на мрежните папки +Comment[nb]=Meny over nettverksmappene +Comment[nds]=Menü vun Nettwarkornern +Comment[ne]=सञ्जाल फोल्डरको मेनु +Comment[nl]=Menu met netwerkmappen +Comment[nn]=Meny over nettverksmapper +Comment[pa]=ਨੈੱਟਵਰਕ ਫੋਲਡਰ ਲਈ ਮੇਨੂ +Comment[pl]=Menu folderów sieciowych +Comment[pt]=Menu de pastas de rede +Comment[pt_BR]=Acesso fácil às pastas de rede +Comment[ro]=Meniu cu folderele de rețea +Comment[ru]=Быстрый доступ к сетевым папкам +Comment[se]=Fállu mii čájeha fierpmádatmáhpaid +Comment[sk]=Menu sieťových priečinkov +Comment[sl]=Meni z omrežnimi mapami +Comment[sr]=Мени мрежних фасцикли +Comment[sr@Latn]=Meni mrežnih fascikli +Comment[sv]=Meny med nätverkskataloger +Comment[th]=เมนูของโฟลเดอร์บนเครือข่าย +Comment[tr]=Ağ dizinlerinin menüsü +Comment[uk]=Меню мережних тек +Comment[uz]=Tarmoq jildlarining menyusi +Comment[uz@cyrillic]=Тармоқ жилдларининг менюси +Comment[vi]=Thực đơn chứa thư mục mạng +Comment[wa]=Dressêye des ridants rantoele +Comment[zh_CN]=网络文件夹菜单 +Comment[zh_TW]=網路資料夾選單 +Icon=network + +X-KDE-Library=kickermenu_remotemenu diff --git a/kicker/menuext/remote/remotemenu.h b/kicker/menuext/remote/remotemenu.h new file mode 100644 index 000000000..1e46bb4e3 --- /dev/null +++ b/kicker/menuext/remote/remotemenu.h @@ -0,0 +1,53 @@ +/* This file is part of the KDE project + Copyright (c) 2004 Kevin Ottens <ervin ipsquad net> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef REMOTEMENU_H +#define REMOTEMENU_H + +#include <kdirnotify.h> +#include <kpanelmenu.h> +#include <qmap.h> + +class RemoteMenu : public KPanelMenu, public KDirNotify +{ + Q_OBJECT + K_DCOP + + public: + RemoteMenu(QWidget *parent, const char *name, + const QStringList & /*args*/); + ~RemoteMenu(); + + k_dcop: + virtual ASYNC FilesAdded(const KURL &directory); + virtual ASYNC FilesRemoved(const KURL::List &fileList); + virtual ASYNC FilesChanged(const KURL::List &fileList); + virtual ASYNC FilesRenamed(const KURL &src, const KURL &dest); + + protected slots: + void initialize(); + void startWizard(); + void openRemoteDir(); + void slotExec(int id); + + private: + QMap<int, QString> m_desktopMap; +}; + +#endif diff --git a/kicker/menuext/system/Makefile.am b/kicker/menuext/system/Makefile.am new file mode 100644 index 000000000..aa5d3d33f --- /dev/null +++ b/kicker/menuext/system/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = -I$(top_srcdir)/kicker/libkicker $(all_includes) + +kde_module_LTLIBRARIES = kickermenu_systemmenu.la + +kickermenu_systemmenu_la_SOURCES = systemmenu.cpp +kickermenu_systemmenu_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined +kickermenu_systemmenu_la_LIBADD = $(LIB_KDEUI) $(LIB_KIO) $(top_builddir)/kicker/libkicker/libkickermain.la + +kickermenu_systemmenu_la_METASOURCES = AUTO + +desktopmenu_DATA = systemmenu.desktop +desktopmenudir = $(kde_datadir)/kicker/menuext + +messages: + $(XGETTEXT) *.cpp -o $(podir)/libkickermenu_systemmenu.pot diff --git a/kicker/menuext/system/systemmenu.cpp b/kicker/menuext/system/systemmenu.cpp new file mode 100644 index 000000000..68c3f5c66 --- /dev/null +++ b/kicker/menuext/system/systemmenu.cpp @@ -0,0 +1,91 @@ +/* This file is part of the KDE project + Copyright (c) 2004 Kevin Ottens <ervin ipsquad net> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "systemmenu.h" + +#include <krun.h> +#include <kiconloader.h> +#include <qpixmap.h> + +#include "global.h" + +K_EXPORT_KICKER_MENUEXT(systemmenu, SystemMenu) + + +SystemMenu::SystemMenu(QWidget *parent, const char *name, + const QStringList &/*args*/) + : KPanelMenu( parent, name) +{ + connect( &m_dirLister, SIGNAL( completed() ), + this, SLOT( slotCompleted() ) ); + + m_dirLister.openURL(KURL("system:/")); +} + +SystemMenu::~SystemMenu() +{ +} + +void SystemMenu::append(const QString &icon, const KURL &url, + const QString &label) +{ + int id = insertItem(KickerLib::menuIconSet(icon), label); + m_urlMap.insert(id, url); +} + +void SystemMenu::initialize() +{ + if (isVisible()) return; + + clear(); + + if (m_entries.isEmpty()) + { + insertItem(i18n("Empty...")); + return; + } + + m_urlMap.clear(); + + KFileItemList::ConstIterator it = m_entries.begin(); + KFileItemList::ConstIterator end = m_entries.end(); + + for (; it!=end; ++it) + { + QString icon = (*it)->iconName(); + KURL url = (*it)->url(); + QString name = (*it)->name(); + append(icon, url, name); + } +} + +void SystemMenu::slotExec(int id) +{ + if(!m_urlMap.contains(id)) return; + + new KRun(m_urlMap[id]); // will delete itself +} + +void SystemMenu::slotCompleted() +{ + m_entries = m_dirLister.items(KDirLister::AllItems); + setInitialized(false); +} + +#include "systemmenu.moc" diff --git a/kicker/menuext/system/systemmenu.desktop b/kicker/menuext/system/systemmenu.desktop new file mode 100644 index 000000000..29156838c --- /dev/null +++ b/kicker/menuext/system/systemmenu.desktop @@ -0,0 +1,127 @@ +[Desktop Entry] +Name=System Menu +Name[af]=Stelsel Kieslys +Name[ar]=قائمة النظام +Name[be]=Сістэмнае меню +Name[bg]=Системно меню +Name[bn]=সিস্টেম মেনু +Name[br]=Meuziad ar reizhiad +Name[bs]=Sistemski meni +Name[ca]=Menú de sistema +Name[cs]=Systémová nabídka +Name[csb]=Systema +Name[cy]=Dewislen y Cysawd +Name[da]=Systemmenu +Name[de]=System-Menü +Name[el]=Μενού συστήματος +Name[eo]=SistemMenuo +Name[es]=Menú del sistema +Name[et]=Süsteemi menüü +Name[eu]=Sistemaren menua +Name[fa]=گزینگان سیستم +Name[fi]=Järjestelmävalikko +Name[fr]=Menu du système +Name[fy]=Systeemmenu +Name[ga]=Roghchlár an Chórais +Name[gl]=Sistema +Name[he]=תפריט מערכת +Name[hr]=Sistemski izbornik +Name[hu]=Rendszermenü +Name[is]=Kerfisvalmynd +Name[it]=Menu di Sistema +Name[ja]=システムメニュー +Name[ka]=სისტემის მენიუ +Name[kk]=Жүйе мәзірі +Name[km]=ប្រព័ន្ធម៉ឺនុយ +Name[lt]=Sistemos meniu +Name[mk]=Системско мени +Name[nb]=Systemmeny +Name[nds]=Systeem-Menü +Name[ne]=प्रणाली मेनु +Name[nl]=Systeemmenu +Name[nn]=Systemmeny +Name[pa]=ਸਿਸਟਮ ਮੇਨੂ +Name[pl]=System +Name[pt]=Menu do Sistema +Name[pt_BR]=Menu Sistema +Name[ro]=Meniu sistem +Name[ru]=Система +Name[se]=Vuogádatfállu +Name[sk]=Systémové menu +Name[sl]=Sistem +Name[sr]=Системски мени +Name[sr@Latn]=Sistemski meni +Name[sv]=Systemmeny +Name[te]=వ్యవస్థ పట్టి +Name[tg]=Менюи система +Name[th]=เมนูระบบ +Name[tr]=Sistem Menüsü +Name[uk]=Системне меню +Name[uz]=Tizim menyusi +Name[uz@cyrillic]=Тизим менюси +Name[vi]=Thực đơn Hệ thống +Name[wa]=Dressêye sistinme +Name[zh_CN]=系统菜单 +Name[zh_TW]=系統選單 +Comment=Menu of important system places +Comment[af]=Kieslys vir belangrike stelsel plekke +Comment[ar]=قائمة أمكنة النظام الهامة +Comment[be]=Меню важных сістэмных месцаў +Comment[bg]=Меню за достъп до системните директории +Comment[bn]=সিস্টেমের গুরুত্বপূর্ণ অবস্থানগুলির তালিকা +Comment[bs]=Meni sa sistemskim lokacijama +Comment[ca]=Menú de llocs importants del sistema +Comment[cs]=Nabídka důležitých systémových míst +Comment[csb]=Menu z wôżnëma placama systemë +Comment[da]=Menu med vigtige steder på systemet +Comment[de]=Einfacher Zugriff auf Systemordner +Comment[el]=Μενού σημαντικών τοποθεσιών του συστήματος +Comment[eo]=Menuo de gravaj sistemlokoj +Comment[es]=Menú de lugares importantes del sistema +Comment[et]=Olulisemate süsteemi osade menüü +Comment[eu]=Sistemaren leku garrantzitsuen menua +Comment[fa]=گزینگان جاهای مهم سیستم +Comment[fi]=Järjestelmän tärkeiden asetuksien valikko +Comment[fr]=Menu dirigeant vers les endroits importants du système +Comment[fy]=Menu mei wichtige systeemgebieden +Comment[gl]=Aceso doado a lugares de importáncia para o sistema +Comment[he]=תפריט של מקומות מערכת חשובים +Comment[hr]=Izbornik važnih lokacija sustava +Comment[hu]=A rendszerkönyvtárak menüje +Comment[is]=Fljótleg leið að mikilvægum kerfishlutum +Comment[it]=Menu con gli oggetti importanti del sistema +Comment[ja]=システムの重要な場所にアクセスするためのメニュー +Comment[ka]=სისტემის მნიშვნელოვან ადგილთა მენიუ +Comment[kk]=Маңызды жүйелік орындарының мәзірі +Comment[km]=ម៉ឺនុយកន្លែងប្រព័ន្ធសំខាន់ +Comment[lt]=Svarbių sistemos vietų meniu +Comment[mk]=Мени со важни системски ресурси +Comment[nb]=Meny over viktige systemsteder +Comment[nds]=Menü vun wichtig Systeemornern +Comment[ne]=महत्वपूर्ण प्रणाली स्थानको मेनु +Comment[nl]=Menu met belangrijke systeemgebieden +Comment[nn]=Meny over viktige systemstader +Comment[pa]=ਸਿਸਟਮ ਥਾਵਾਂ ਲ਼ਈ ਮੇਨੂ +Comment[pl]=Menu z ważnymi miejscami systemu +Comment[pt]=Um menu com os locais importantes do sistema +Comment[pt_BR]=Acesso fácil a locais importantes do sistema +Comment[ro]=Meniu cu locații importante din sistem +Comment[ru]=Быстрый доступ к системным ресурсам +Comment[se]=Fállu mii čájeha dehálaš báikkiid vuogádagas +Comment[sk]=Menu dôležitých systémových miest +Comment[sl]=Meni s pomembnimi sistemskimi lokacijami +Comment[sr]=Мени важних места на систему +Comment[sr@Latn]=Meni važnih mesta na sistemu +Comment[sv]=Meny med viktiga systemplatser +Comment[th]=เมนูสำหรับที่สำคัญๆ ของระบบ +Comment[tr]=Önemli sistem yerlerinin menüsü +Comment[uk]=Меню важливих місць в системі +Comment[uz]=Tizimda muhim boʻlgan joylarning menyusi +Comment[uz@cyrillic]=Тизимда муҳим бўлган жойларнинг менюси +Comment[vi]=Thực đơn chứa các liên kết hệ thống quan trọng +Comment[wa]=Dressêye des impôrtantès plaeces do sistinmes +Comment[zh_CN]=重要系统位置的菜单 +Comment[zh_TW]=重要系統位置選單 +Icon=system + +X-KDE-Library=kickermenu_systemmenu diff --git a/kicker/menuext/system/systemmenu.h b/kicker/menuext/system/systemmenu.h new file mode 100644 index 000000000..6f118d21c --- /dev/null +++ b/kicker/menuext/system/systemmenu.h @@ -0,0 +1,50 @@ +/* This file is part of the KDE project + Copyright (c) 2004 Kevin Ottens <ervin ipsquad net> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef SYSTEMMENU_H +#define SYSTEMMENU_H + +#include <kpanelmenu.h> +#include <kurl.h> +#include <kdirlister.h> +#include <kfileitem.h> + +class SystemMenu : public KPanelMenu +{ + Q_OBJECT + + public: + SystemMenu(QWidget *parent, const char *name, + const QStringList & /*args*/); + ~SystemMenu(); + + protected slots: + void initialize(); + void slotExec(int id); + + void slotCompleted(); + + private: + void append(const QString &icon, const KURL &url, const QString &label); + KDirLister m_dirLister; + KFileItemList m_entries; + QMap<int, KURL> m_urlMap; +}; + +#endif diff --git a/kicker/menuext/tom/Makefile.am b/kicker/menuext/tom/Makefile.am new file mode 100644 index 000000000..4947ef77b --- /dev/null +++ b/kicker/menuext/tom/Makefile.am @@ -0,0 +1,19 @@ +INCLUDES = -I$(srcdir)/../../libkicker -I$(srcdir)/../../ui -I$(srcdir)/../../core $(all_includes) + +kde_module_LTLIBRARIES = kickermenu_tom.la + +kickermenu_tom_la_SOURCES = tom.cc +kickermenu_tom_la_LDFLAGS = $(all_libraries) -module -avoid-version +kickermenu_tom_la_LIBADD = $(LIB_KDEUI) +#$(top_builddir)/kicker/ui/libkicker_ui.la + +kickermenu_tom_la_METASOURCES = AUTO + +desktopmenu_DATA = tom.desktop +desktopmenudir = $(kde_datadir)/kicker/menuext + +tomdata_DATA = destinations +tomdatadir = $(kde_datadir)/kicker/tom + +messages: + $(XGETTEXT) *.cc -o $(podir)/libkickermenu_tom.pot diff --git a/kicker/menuext/tom/README b/kicker/menuext/tom/README new file mode 100644 index 000000000..2616c76c5 --- /dev/null +++ b/kicker/menuext/tom/README @@ -0,0 +1,65 @@ +What is TOM? +============ +TOM stands for Task Oriented Menu and is a work in progress that will become a +viable alternative to the current KMenu. Its goals include: + + o Be task oriented + o Be simple and clear to use + o Create a smaller but usable menu + o Limited configurability through sensible defaults + o Have all configuration needs built right into the menu, including: + o Editor dialogs that can be called up from entries in the menu + o Context menus accessed by RMB clicking on a task for powerusers + o Allow locking down of menus through immutable settings + o Obeys Kicker and KDE Kiosk settings + o By making the TOM group of kickerrc immutable all config is removed + o By making a task group's rc file immutable, config options are removed + o Not require any modifications to the KDE menu system (applnk, etc) + + +What is a "Task Oriented Menu"? +================================ +A task oriented menu displays it's entries as "things to do" (or tasks) rather +than simply listing all items that are available. Each of these tasks has an +application or command associated with it, and this associated command can be +changed without changing the task name or placement within the menu. The tasks +are grouped by function and may map to programs, documents or actions. + + +Todo list +========= +Editor dialogs +Make the Destination entries work (only Run A Command is done) +Populate and track Recent Applications menu entries + o Application launching should be caught somewhere in the KDE libs, ala + Recent Documents +Writing out of config files to reflect runtime changes (deleted entries, etc) + o This requires keeping track of the config files used in creating the menu +KDEDIR merging + o KDEDIRS are already consulted for taskgroups, but groups of the same name + should be merged +Sane merging of menuext entries + o "Recent" items should go into the recent section + o Replace TOM's builin recent docs with the menuext version? + o Create a Recent Applications menuext? + o Add a way to quickly add/remove menuext items from TOM + (ala "Modify These Tasks") +Check for updates on launch and bring them down/install them if they exist + o this includes new apps installed on the local box showing up in the menu + o "Get cool stuff" integration? +Further refinement of wording / ordering in main menu (a perpetual TODO ;) +Creation of real-world task groups +Support plugins which can add arbitrary functionality to the menu + + +Debate list +=========== +What should be the default task entry format be: + a) Task Name + b) Task Name (App Name) + c) App Name (Task Name) <-- silly option =) +Should "Run A Command..." be replaced by an inline combobox? + Pros: It's more obvious and will work even if kdesktop is gone. The widget + is already written (in tom.cc) + Cons: It makes it stand out too much over other entries, takes up more room + and isn't as powerful as the full minicli diff --git a/kicker/menuext/tom/TASKGROUPS b/kicker/menuext/tom/TASKGROUPS new file mode 100644 index 000000000..c1aa1ed98 --- /dev/null +++ b/kicker/menuext/tom/TASKGROUPS @@ -0,0 +1,49 @@ +Task Groups +=========== +Tasks are grouped into common families of functionality. These groups are then +stored in a standard KDE configuration file. The General category in the +config file defines the icon (Icon), user visible name (Name), the number +of tasks in the group (NumTasks) and optionally whether or not it is hidden +(Hidden). + +For each task there is a numbered section in the file in the form TaskN. Each +section contains the user visible name for the task (Name), the associated +.desktop file and optionally whether or not it is hidden (Hidden). + +An example file can be found below. + +Alternatives +============ +Alternative formats are possible, including making it more like the servicemenu +.desktop format or the new virtual menu freedesktop.org draft standard. Here are +the pros and cons of each of these options: + +servicemenu style: + o CONS: no extra flexibility, still have to do most checking manually + o PROS: familiar format + +virtual menu style: + o CONS: it's XML and that's way more trouble that we need to go through, and it + isn't really designed with this sort of menu in mind + o PROS: it's becoming a standard for desktop menus + + +Example +======= +[General] +Icon=konqueror +Name=Internet +NumTasks=3 +Hidden=true + +[Task0] +Name=Browse the web +DesktopFile=applications/konqbrowser.desktop + +[Task1] +Name=EMail +DesktopFile=Internet/KMail.desktop + +[Task2] +Name=VNC +DesktopFile=Internet/keystone.desktop diff --git a/kicker/menuext/tom/destinations b/kicker/menuext/tom/destinations new file mode 100644 index 000000000..6e075237f --- /dev/null +++ b/kicker/menuext/tom/destinations @@ -0,0 +1,18 @@ +[General] +NumTasks=4 + +[Task0] +Name=Consult Manuals +DesktopFile=Help.desktop + +[Task1] +Name=Find Files +DesktopFile=Kfind.desktop + +[Task2] +Name=Adjust Settings +DesktopFile=KControl.desktop + +[Task3] +Name=Browse My Files +DesktopFile=Home.desktop diff --git a/kicker/menuext/tom/tom.cc b/kicker/menuext/tom/tom.cc new file mode 100644 index 000000000..80ea3e71d --- /dev/null +++ b/kicker/menuext/tom/tom.cc @@ -0,0 +1,855 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Aaron J. Seigo <[email protected]> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License version 2 as published by the Free Software Foundation. + + This program 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 program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <iostream> +using namespace std; + +#include <unistd.h> +#include <pwd.h> +#include <sys/types.h> + +#include <qdir.h> +#include <qimage.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qpainter.h> +#include <qregexp.h> +#include <qsettings.h> +#include <qstyle.h> +#include <qfile.h> + +#include <dcopclient.h> +#include <kapplication.h> +#include <kcombobox.h> +#include <kdialog.h> +#include <kglobal.h> +#include <kiconloader.h> +#include <kiconeffect.h> +#include <klocale.h> +#include <kmessagebox.h> +#include <kmimetype.h> +#include <kpixmap.h> +#include <krecentdocument.h> +#include <kservice.h> +#include <kservicegroup.h> +#include <kstandarddirs.h> +#include <kstdaction.h> +#include <ksycocaentry.h> + +#include "menuinfo.h" +#include "service_mnu.h" +#include "kicker.h" +#include "tom.h" + +const int configureMenuID = 1000; +const int contextMenuTitleID = 10000; +const int destMenuTitleID = 10001; + +extern "C" +{ + KDE_EXPORT void* init_kickermenu_tom() + { + KGlobal::locale()->insertCatalogue("libkickermenu_tom"); + return new TOMFactory; + } +}; + +TOMFactory::TOMFactory(QObject *parent, const char *name) +: KLibFactory(parent, name) +{ +} + +QObject* TOMFactory::createObject(QObject *parent, const char *name, const char*, const QStringList&) +{ + return new TOM((QWidget*)parent, name); +} + +#include <qmenudata.h> +/* + * TODO: switch the backgroundmode when translucency turns on/off + * TODO: catch font changes too? + */ +class runMenuWidget : public QWidget, public QMenuItem +{ + public: + runMenuWidget(KPopupMenu* parent, int index) + : QWidget (parent), + m_menu(parent), + m_index(index) + { + setFocusPolicy(StrongFocus); + + QHBoxLayout* runLayout = new QHBoxLayout(this); + textRect = fontMetrics().boundingRect(i18n("Run:")); + runLayout->setSpacing(KDialog::spacingHint()); + runLayout->addSpacing((KDialog::spacingHint() * 3) + KIcon::SizeMedium + textRect.width()); + icon = DesktopIcon("run", KIcon::SizeMedium); + /*QLabel* l1 = new QLabel(this); + QPixmap foo = DesktopIcon("run", KIcon::SizeMedium); + cout << "foo is: " << foo.width() << " by " << foo.height() << endl; + l1->setPixmap(foo); + runLayout->addWidget(l1);*/ + /*QLabel* l2 = new QLabel(i18n("&Run: "), this); + l2->setBackgroundMode(Qt::X11ParentRelative, Qt::X11ParentRelative); + l2->setBuddy(this); + runLayout->addWidget(l2);*/ + m_runEdit = new KHistoryCombo(this); + m_runEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + runLayout->addWidget(m_runEdit, 10); + runLayout->addSpacing(KDialog::spacingHint()); + + QSettings settings; + if (settings.readEntry("/KStyle/Settings/MenuTransparencyEngine", "Disabled") != "Disabled") + { + setBackgroundMode(Qt::X11ParentRelative, Qt::X11ParentRelative); + //l1->setBackgroundMode(Qt::X11ParentRelative, Qt::X11ParentRelative); + //l2->setBackgroundMode(Qt::X11ParentRelative, Qt::X11ParentRelative); + m_runEdit->setBackgroundMode(Qt::X11ParentRelative, Qt::X11ParentRelative); + } + else + { + /*setBackgroundMode(Qt::NoBackground, Qt::NoBackground); + l1->setBackgroundMode(Qt::NoBackground, Qt::NoBackground); + l2->setBackgroundMode(Qt::NoBackground, Qt::NoBackground); + m_runEdit->setBackgroundMode(Qt::NoBackground, Qt::NoBackground);*/ + //l1->setAutoMask(true); + //l1->setBackgroundMode(Qt::NoBackground, Qt::NoBackground); + //l2->setBackgroundMode(Qt::X11ParentRelative, Qt::X11ParentRelative); + //m_runEdit->setBackgroundMode(Qt::X11ParentRelative, Qt::X11ParentRelative); + } + + setMinimumHeight(KIcon::SizeMedium + 2); + } + ~runMenuWidget() {} + + + void paintEvent(QPaintEvent * /*e*/) + { + QPainter p(this); + QRect r(rect()); + // ew, nasty hack. may result in coredumps due to horrid C-style cast??? + kapp->style().drawControl(QStyle::CE_PopupMenuItem, &p, m_menu, r, palette().active(), QStyle::Style_Enabled, + QStyleOption(static_cast<QMenuItem*>(this), 0, KIcon::SizeMedium )); + p.drawPixmap(KDialog::spacingHint(), 1, icon); + p.drawText((KDialog::spacingHint() * 2) + KIcon::SizeMedium, textRect.height() + ((height() - textRect.height()) / 2), i18n("Run:")); + } + + void focusInEvent (QFocusEvent* e) + { + if (!e || e->gotFocus()) + { + m_menu->setActiveItem(m_index); + m_runEdit->setFocus(); + } + } + + void enterEvent(QEvent*) + { + focusInEvent(0); + } + + private: + KPopupMenu* m_menu; + KHistoryCombo* m_runEdit; + QPixmap icon; + QRect textRect; + int m_index; +}; + +TOM::TOM(QWidget *parent, const char *name) + : KPanelMenu(parent, name), + m_maxIndex(0) +{ + disableAutoClear(); + m_submenus.setAutoDelete(true); + setCaption(i18n("Task-Oriented Menu")); + + // KMenu legacy: support some menu config options + KConfig* config = KGlobal::config(); + config->setGroup("menus"); + m_detailedTaskEntries = config->readBoolEntry("DetailedMenuEntries", false); + if (m_detailedTaskEntries) + { + m_detailedNamesFirst = config->readBoolEntry("DetailedEntriesNamesFirst", false); + } + + m_isImmutable = Kicker::kicker()->isImmutable() || config->groupIsImmutable("TOM"); + config->setGroup("TOM"); + m_largerFont = font(); + m_largerFont = config->readFontEntry("Font", &m_largerFont); +} + +TOM::~TOM() +{ + slotClear(); +} + +void TOM::initializeRecentApps(QPopupMenu* menu) +{ + /* + * TODO: make this real + * add a KDE-wide "commands run" registry + */ + + if (!m_isImmutable) + { + menu->insertSeparator(); + menu->insertItem(i18n("Configure This Menu"), configureMenuID); + } +} + +void TOM::initializeRecentDocs() +{ + m_recentDocsMenu->clear(); + m_recentDocsMenu->insertItem(SmallIconSet("history_clear"), i18n("Clear History"), + this, SLOT(clearRecentDocHistory())); + m_recentDocsMenu->insertSeparator(); + + m_recentDocURLs = KRecentDocument::recentDocuments(); + + if (m_recentDocURLs.isEmpty()) + { + setItemEnabled(m_recentDocsMenu->insertItem(i18n("No Entries")), false); + return; + } + + int id = 0; + for (QStringList::ConstIterator it = m_recentDocURLs.begin(); + it != m_recentDocURLs.end(); + ++it) + { + /* + * TODO: make the number of visible items configurable? + */ + + KDesktopFile f(*it, true /* read only */); + m_recentDocsMenu->insertItem(DesktopIcon(f.readIcon(), KIcon::SizeMedium), + f.readName().replace('&', "&&"), id); + ++id; + } +} + +int TOM::appendTaskGroup(KConfig& config, bool inSubMenu) +{ + if (!config.hasGroup("General")) + { + return 0; + } + + config.setGroup("General"); + + if (config.readBoolEntry("Hidden", false)) + { + return 0; + } + + QString name = config.readEntry("Name", i18n("Unknown")); + QString icon = config.readEntry("Icon"); + int numTasks = config.readNumEntry("NumTasks", 0); + + if (numTasks < 1) + { + return 0; + } + + KPopupMenu* taskGroup; + if( inSubMenu ) + { + taskGroup = new KPopupMenu(this); + + if (icon != QString::null) + { + insertItem(DesktopIcon(icon, KIcon::SizeMedium), name, taskGroup); + } + else + { + insertItem(name, taskGroup); + } + } + else + { + taskGroup = this; + } + + int foundTasks = 0; + for (int i = 0; i < numTasks; ++i) + { + QString groupName = QString("Task%1").arg(i); + + if (config.hasGroup(groupName)) + { + config.setGroup(groupName); + + if (config.readBoolEntry("Hidden", false)) + { + continue; + } + + QString name = config.readEntry("Name"); + // in case the name contains an ampersand, double 'em up + name.replace("&", "&&"); + QString desktopfile = config.readPathEntry("DesktopFile"); + KService::Ptr pService = KService::serviceByDesktopPath(desktopfile); + + if (!pService) + { + pService = KService::serviceByDesktopName(desktopfile); + + if (!pService) + { + continue; + } + } + + QString execName = pService->name(); + QString icon = pService->icon(); + + if (m_detailedTaskEntries && !execName.isEmpty()) + { + QString tmp = i18n("%1 (%2)"); + + if (m_detailedNamesFirst) + { + name = tmp.arg(execName).arg(name); + } + else + { + name = tmp.arg(name).arg(execName); + } + } + + ++m_maxIndex; + if (icon.isEmpty()) + { + taskGroup->insertItem(name, m_maxIndex); + } + else + { + + QIconSet iconset = BarIconSet(icon, 22); + if (iconset.isNull()) + taskGroup->insertItem(name, m_maxIndex); + else + taskGroup->insertItem(iconset, name, m_maxIndex); + + } + + m_tasks.insert(m_maxIndex, pService); + ++foundTasks; + } + } + + // if we end up with an empty task group, get rid of the menu + if (foundTasks == 0) + { + if (inSubMenu) + { + delete taskGroup; + } + + return 0; + } + + connect(taskGroup, SIGNAL(activated(int)), this, SLOT(runTask(int))); + // so we have an actual task group menu with tasks, let's add it + + if (inSubMenu) + { + QObject::connect(taskGroup, SIGNAL(aboutToShowContextMenu(KPopupMenu*, int, QPopupMenu*)), + this, SLOT(contextualizeRMBmenu(KPopupMenu*, int, QPopupMenu*))); + + m_submenus.append(taskGroup); + + taskGroup->setFont(m_largerFont); + taskGroup->setKeyboardShortcutsEnabled(true); + + if (!m_isImmutable && !config.isImmutable()) + { + taskGroup->insertSeparator(); + taskGroup->insertItem("Modify These Tasks", configureMenuID); + QPopupMenu* rmbMenu = taskGroup->contextMenu(); + rmbMenu->setFont(m_largerFont); + KPopupTitle* title = new KPopupTitle(); + title->setText(i18n("%1 Menu Editor").arg(name)); + rmbMenu->insertItem(title, contextMenuTitleID); + rmbMenu->insertItem(i18n("Add This Task to Panel")); + rmbMenu->insertItem(i18n("Modify This Task...")); + rmbMenu->insertItem(i18n("Remove This Task..."), this, SLOT(removeTask())); + rmbMenu->insertItem(i18n("Insert New Task...")); + } + } + + return foundTasks; +} +/* + * TODO: track configuration file changes. +void TOM::configChanged() +{ + KPanelMenu::configChanged(); + setInitialized(false); + initialize(); +} +*/ +void TOM::initialize() +{ + if (initialized()) + { + return; + } + + setInitialized(true); + m_submenus.clear(); + m_tasks.clear(); + clear(); + + /* hack to make items larger. should use something better? + m_largerFont = font(); + if (m_largerFont.pointSize() < 18) + { + m_largerFont.setPointSize(18); + } + setFont(m_largerFont);*/ + + + /*if (!loadSidePixmap()) + { + m_sidePixmap = m_sideTilePixmap = QPixmap(); + } + else + { + connect(kapp, SIGNAL(kdisplayPaletteChanged()), SLOT(paletteChanged())); + }*/ + + // TASKS + insertTitle(i18n("Tasks"), contextMenuTitleID); + + QStringList dirs = KGlobal::dirs()->findDirs("data", "kicker/tom/"); + QStringList::ConstIterator dIt = dirs.begin(); + QStringList::ConstIterator dEnd = dirs.end(); + + for (; dIt != dEnd; ++dIt ) + { + QDir dir(*dIt); + + QStringList entries = dir.entryList("*rc", QDir::Files); + QStringList::ConstIterator eIt = entries.begin(); + QStringList::ConstIterator eEnd = entries.end(); + + for (; eIt != eEnd; ++eIt ) + { + KConfig config(*dIt + *eIt); + appendTaskGroup(config); + } + } + + PanelServiceMenu* moreApps = new PanelServiceMenu(QString::null, QString::null, this, "More Applications"); + moreApps->setFont(m_largerFont); + insertItem(DesktopIcon("misc", KIcon::SizeMedium), i18n("More Applications"), moreApps); + m_submenus.append(moreApps); + + if (!m_isImmutable) + { + insertSeparator(); + // TODO: connect to taskgroup edits + insertItem("Modify The Above Tasks"); + } + + // DESTINATIONS + insertTitle(i18n("Destinations"), destMenuTitleID); + int numDests = 0; + QString destinationsConfig = locate("appdata", "tom/destinations"); + + if (!destinationsConfig.isEmpty() && QFile::exists(destinationsConfig)) + { + KConfig config(destinationsConfig); + numDests = appendTaskGroup(config, false); + } + + if (numDests == 0) + { + removeItem(destMenuTitleID); + } + else if (kapp->authorize("run_command")) + { + insertItem(DesktopIcon("run", KIcon::SizeMedium), i18n("Run Command..."), this, SLOT(runCommand())); + } + + // RECENTLY USED ITEMS + insertTitle(i18n("Recently Used Items"), contextMenuTitleID); + + m_recentDocsMenu = new KPopupMenu(this, "recentDocs"); + m_recentDocsMenu->setFont(m_largerFont); + connect(m_recentDocsMenu, SIGNAL(aboutToShow()), this, SLOT(initializeRecentDocs())); + connect(m_recentDocsMenu, SIGNAL(activated(int)), this, SLOT(openRecentDocument(int))); + insertItem(DesktopIcon("document", KIcon::SizeMedium), i18n("Recent Documents"), m_recentDocsMenu); + m_submenus.append(m_recentDocsMenu); + + KPopupMenu* recentApps = new KPopupMenu(this, "recentApps"); + recentApps->setFont(m_largerFont); + recentApps->setKeyboardShortcutsEnabled(true); + initializeRecentApps(recentApps); + insertItem(i18n("Recent Applications"), recentApps); + m_submenus.append(recentApps); + + // SPECIAL ITEMS + insertTitle(i18n("Special Items"), contextMenuTitleID); + + // if we have no destinations, put the run command here + if (numDests == 0 && kapp->authorize("run_command")) + { + insertItem(DesktopIcon("run", KIcon::SizeMedium), i18n("Run Command..."), this, SLOT(runCommand())); + } + + + KConfig* config = KGlobal::config(); + QStringList menu_ext = config->readListEntry("Extensions"); + if (!menu_ext.isEmpty()) + { + bool needSeparator = false; + for (QStringList::ConstIterator it = menu_ext.begin(); it != menu_ext.end(); ++it) + { + MenuInfo info(*it); + if (!info.isValid()) + { + continue; + } + + KPanelMenu *menu = info.load(); + if (menu) + { + ++m_maxIndex; + insertItem(DesktopIcon(info.icon(), KIcon::SizeMedium), info.name(), menu, m_maxIndex); + m_submenus.append(menu); + needSeparator = true; + } + } + + if (needSeparator) + { + insertSeparator(); + } + } + + + QString username; + struct passwd *userInfo = getpwuid(getuid()); + if (userInfo) + { + username = QString::fromLocal8Bit(userInfo->pw_gecos); + if (username.find(',') != -1) + { + // Remove everything from and including first comma + username.truncate(username.find(',')); + } + + if (username.isEmpty()) + { + username = QString::fromLocal8Bit(userInfo->pw_name); + } + } + + insertItem(DesktopIcon("exit", KIcon::SizeMedium), + i18n("Logout %1").arg(username), this, SLOT(logout())); +} + +void TOM::reload() +{ + setInitialized(false); + initialize(); +} + +void TOM::contextualizeRMBmenu(KPopupMenu* menu, int menuItem, QPopupMenu* ctxMenu) +{ + if (menuItem == configureMenuID) + { + menu->hideContextMenu(); + return; + } + + ctxMenu->removeItem(contextMenuTitleID); + QString text = menu->text(menuItem); + int parens = text.find('(') - 1; + if (parens > 0) + { + text = text.left(parens); + } + KPopupTitle* title = new KPopupTitle(); + title->setText(i18n("The \"%2\" Task").arg(text)); + ctxMenu->insertItem(title, contextMenuTitleID, 0); +} + +void TOM::slotClear() +{ + KPanelMenu::slotClear(); + m_submenus.clear(); + m_tasks.clear(); +} + +void TOM::slotExec(int /* id */) +{ + // Reimplemented because we have to +} + +void TOM::removeTask() +{ + // TODO: write this change out to the appropriate config file + QString task = KPopupMenu::contextMenuFocus()->text(KPopupMenu::contextMenuFocusItem()); + if (KMessageBox::warningContinueCancel(this, + i18n("<qt>Are you sure you want to remove the <strong>%1</strong> task?<p>" + "<em>Tip: You can restore the task after it has been removed by selecting the "Modify These Tasks" entry</em></qt>").arg(task), + i18n("Remove Task?"),KStdGuiItem::del()) == KMessageBox::Continue) + { + m_tasks.remove(KPopupMenu::contextMenuFocusItem()); + KPopupMenu::contextMenuFocus()->removeItem(KPopupMenu::contextMenuFocusItem()); + } +} + +// TODO: should we have a side graphic like the K Menu? personally, i don't +// think it helps usability. it's nice for branding, but that's it. perhaps a +// top image, or something blended with the actual menu background? deffinitely +// a job for a graphic artist. +/* + * if this goes in, it should be shared w/the kmenu + * +bool TOM::loadSidePixmap() +{ + KConfig *config = KGlobal::config(); + QColor color = palette().active().highlight(); + QImage image; + + config->setGroup("WM"); + QColor activeTitle = config->readColorEntry("activeBackground", &color); + QColor inactiveTitle = config->readColorEntry("inactiveBackground", &color); + + config->setGroup("KMenu"); + if (!config->readBoolEntry("Usem_sidePixmap", true)) + return false; + + // figure out which color is most suitable for recoloring to + int h1, s1, v1, h2, s2, v2, h3, s3, v3; + activeTitle.hsv(&h1, &s1, &v1); + inactiveTitle.hsv(&h2, &s2, &v2); + palette().active().background().hsv(&h3, &s3, &v3); + + if ( (abs(h1-h3)+abs(s1-s3)+abs(v1-v3) < abs(h2-h3)+abs(s2-s3)+abs(v2-v3)) && + ((abs(h1-h3)+abs(s1-s3)+abs(v1-v3) < 32) || (s1 < 32)) && (s2 > s1)) + color = inactiveTitle; + else + color = activeTitle; + + // limit max/min brightness + int r, g, b; + color.rgb(&r, &g, &b); + int gray = qGray(r, g, b); + if (gray > 180) { + r = (r - (gray - 180) < 0 ? 0 : r - (gray - 180)); + g = (g - (gray - 180) < 0 ? 0 : g - (gray - 180)); + b = (b - (gray - 180) < 0 ? 0 : b - (gray - 180)); + } else if (gray < 76) { + r = (r + (76 - gray) > 255 ? 255 : r + (76 - gray)); + g = (g + (76 - gray) > 255 ? 255 : g + (76 - gray)); + b = (b + (76 - gray) > 255 ? 255 : b + (76 - gray)); + } + color.setRgb(r, g, b); + + QString sideName = config->readEntry("SideName", "kside.png"); + QString sideTileName = config->readEntry("SideTileName", "kside_tile.png"); + + image.load(locate("data", "kicker/pics/" + sideName)); + + if (image.isNull()) + { + return false; + } + + KIconEffect::colorize(image, color, 1.0); + m_sidePixmap.convertFromImage(image); + + image.load(locate("data", "kicker/pics/" + sideTileName)); + + if (image.isNull()) + { + return false; + } + + KIconEffect::colorize(image, color, 1.0); + m_sideTilePixmap.convertFromImage(image); + + if (m_sidePixmap.width() != m_sideTilePixmap.width()) + { + return false; + } + + // pretile the pixmap to a height of at least 100 pixels + if (m_sideTilePixmap.height() < 100) + { + int tiles = (int)(100 / m_sideTilePixmap.height()) + 1; + QPixmap preTiledPixmap(m_sideTilePixmap.width(), m_sideTilePixmap.height() * tiles); + QPainter p(&preTiledPixmap); + p.drawTiledPixmap(preTiledPixmap.rect(), m_sideTilePixmap); + m_sideTilePixmap = preTiledPixmap; + } + + return true; +} + +void TOM::paletteChanged() +{ + if (!loadSidePixmap()) + m_sidePixmap = m_sideTilePixmap = QPixmap(); +} + +void TOM::setMinimumSize(const QSize & s) +{ + KPanelMenu::setMinimumSize(s.width() + m_sidePixmap.width(), s.height()); +} + +void TOM::setMaximumSize(const QSize & s) +{ + KPanelMenu::setMaximumSize(s.width() + m_sidePixmap.width(), s.height()); +} + +void TOM::setMinimumSize(int w, int h) +{ + KPanelMenu::setMinimumSize(w + m_sidePixmap.width(), h); +} + +void TOM::setMaximumSize(int w, int h) +{ + KPanelMenu::setMaximumSize(w + m_sidePixmap.width(), h); +} + +QRect TOM::sideImageRect() +{ + return QStyle::visualRect( QRect( frameWidth(), frameWidth(), m_sidePixmap.width(), + height() - 2*frameWidth() ), this ); +} + +void TOM::resizeEvent(QResizeEvent * e) +{ + setFrameRect( QStyle::visualRect( QRect( m_sidePixmap.width(), 0, + width() - m_sidePixmap.width(), height() ), this ) ); +} + +void TOM::paintEvent(QPaintEvent * e) +{ + if (m_sidePixmap.isNull()) { + KPanelMenu::paintEvent(e); + return; + } + + QPainter p(this); + + style().drawPrimitive( QStyle::PE_PanelPopup, &p, + QRect( 0, 0, width(), height() ), + colorGroup(), QStyle::Style_Default, + QStyleOption( frameWidth(), 0 ) ); + + QRect r = sideImageRect(); + r.setBottom( r.bottom() - m_sidePixmap.height() ); + p.drawTiledPixmap( r, m_sideTilePixmap ); + + r = sideImageRect(); + r.setTop( r.bottom() - m_sidePixmap.height() ); + p.drawPixmap( r, m_sidePixmap ); + + drawContents( &p ); +} + +QMouseEvent TOM::translateMouseEvent( QMouseEvent* e ) +{ + QRect side = sideImageRect(); + + if ( !side.contains( e->pos() ) ) + return *e; + + QPoint newpos( e->pos() ); + QApplication::reverseLayout() ? + newpos.setX( newpos.x() - side.width() ) : + newpos.setX( newpos.x() + side.width() ); + QPoint newglobal( e->globalPos() ); + QApplication::reverseLayout() ? + newglobal.setX( newpos.x() - side.width() ) : + newglobal.setX( newpos.x() + side.width() ); + + return QMouseEvent( e->type(), newpos, newglobal, e->button(), e->state() ); +} + +void TOM::mousePressEvent(QMouseEvent * e) +{ + QMouseEvent newEvent = translateMouseEvent(e); + KPanelMenu::mousePressEvent( &newEvent ); +} + +void TOM::mouseReleaseEvent(QMouseEvent *e) +{ + QMouseEvent newEvent = translateMouseEvent(e); + KPanelMenu::mouseReleaseEvent( &newEvent ); +} + +void TOM::mouseMoveEvent(QMouseEvent *e) +{ + QMouseEvent newEvent = translateMouseEvent(e); + KPanelMenu::mouseMoveEvent( &newEvent ); +}*/ + +extern int kicker_screen_number; + +void TOM::runCommand() +{ + QByteArray data; + QCString appname( "kdesktop" ); + if ( kicker_screen_number ) + appname.sprintf("kdesktop-screen-%d", kicker_screen_number); + + kapp->updateRemoteUserTimestamp( appname ); + kapp->dcopClient()->send( appname, "KDesktopIface", + "popupExecuteCommand()", data ); +} + +void TOM::runTask(int id) +{ + if (!m_tasks.contains(id)) return; + + kapp->propagateSessionManager(); + KApplication::startServiceByDesktopPath(m_tasks[id]->desktopEntryPath(), + QStringList(), 0, 0, 0, "", true); +} + +void TOM::clearRecentDocHistory() +{ + KRecentDocument::clear(); +} + +void TOM::openRecentDocument(int id) +{ + if (id >= 0) + { + kapp->propagateSessionManager(); + KURL u; + u.setPath(m_recentDocURLs[id]); + KDEDesktopMimeType::run(u, true); + } +} + +void TOM::logout() +{ + kapp->requestShutDown(); +} + +#include "tom.moc" diff --git a/kicker/menuext/tom/tom.desktop b/kicker/menuext/tom/tom.desktop new file mode 100644 index 000000000..f59a4beab --- /dev/null +++ b/kicker/menuext/tom/tom.desktop @@ -0,0 +1,75 @@ +[Desktop Entry] +Name=TOM +Name[bg]=Задачно меню +Name[eo]=PTMS +Name[hi]=टीओएम +Name[te]=టామ్ +Name[zh_CN]=任务菜单 +Comment=A task oriented menu system +Comment[af]='n Taak geörienteerde kieslys stelsel +Comment[ar]=نظام قوائم وظيفيّ المنحى +Comment[be]=Сістэма меню, арыентаваная на выкананне шматлікіх задачаў +Comment[bg]=Меню, ориентирано към изпълнение на задачи +Comment[bn]=টাস্ক ওরিয়েন্টেড মেনু সিস্টেম +Comment[bs]=Sistem menija orjentisan na zadatke +Comment[ca]=Una tasca orientada al menú del sistema +Comment[cs]=Úkolově orientovaný systém nabídek +Comment[csb]=Systema menu skòncentrowónô na dzejaniô +Comment[cy]=Cysawd dewislenni a gyfeirir at dasgau +Comment[da]=Et opgaveorienteret menusystem +Comment[de]=Aufgabenorientiertes Menüsystem +Comment[el]=Ένα σύστημα μενού προσανατολισμένο στην εργασία +Comment[eo]=Pertaska menusistemo +Comment[es]=Sistema de menú orientado a tareas +Comment[et]=Ülesandele orienteeritud menüüsüsteem +Comment[eu]=Atazetara zuzendutako menu sistema +Comment[fa]=یک سیستم گزینگان جهتدار تکلیف +Comment[fi]=Tehtäväpohjainen valikkojärjestelmä +Comment[fr]=Un menu système par tâches +Comment[fy]=In taakoriïntearre menusysteem +Comment[ga]=Córas roghchláir dírithe ar thascanna +Comment[gl]=Un menu do sistema orientado a tarefas +Comment[he]=מערכת תפריטים מונחת משימות +Comment[hi]=कार्य अनुकूल मेन्यू तंत्र +Comment[hr]=Sustav izbornika orijentiran zadacima +Comment[hu]=Feladatorientált menürendszer +Comment[is]=Verkefnabyggt valmyndakerfi +Comment[it]=Un sistema di menu organizzato per funzione +Comment[ja]=作業タスクベースのメニューシステム +Comment[ka]=ამოცანაზე ორიენტირებული მენიუს სისტემა +Comment[kk]=Тапсырмаларға арналған мәзір жүйесі +Comment[km]=ប្រព័ន្ធម៉ឺនុយដែលសម្របតាមភារកិច្ច +Comment[lt]=Į užduotis orientuota meniu sistema +Comment[lv]=Uz darbībām orientēta izvēlņu sistēma +Comment[mk]=Систем од менија ориентиран кон задачи +Comment[mn]=Үйлдэлд чиглэсэн цэсийн систем +Comment[ms]=Sistem menu berorientasikan tugas +Comment[mt]=Menu imqassam skond ix-xogħol li trid tagħmel +Comment[nb]=Et oppgaveorientert menysystem +Comment[nds]=Menüsysteem, dat an Opgaven utricht is +Comment[ne]=कार्य उन्मुख मेनु प्रणाली +Comment[nl]=Een taakgeörienteerd menusysteem +Comment[nn]=Eit oppgåveorientert menysystem +Comment[pa]=ਇੱਕ ਕੰਮ ਆਧਾਰਿਤ ਮੇਨੂ ਸਿਸਟਮ +Comment[pl]=System menu zorientowany na zadania +Comment[pt]=Um sistema de menus orientado por tarefas +Comment[pt_BR]=Um sistema de menu orientado a tarefa +Comment[ro]=Un meniu orientat pe probleme de rezolvat +Comment[ru]=Система меню, ориентированная на задачи +Comment[rw]=Ibikubiyemo Sisitemu bijyanye n'Igikorwa +Comment[sk]=Systém menu podľa činnosti +Comment[sl]=Opravilno narejen menijski sistem +Comment[sr]=Систем менија оријентисан према задацима +Comment[sr@Latn]=Sistem menija orijentisan prema zadacima +Comment[sv]=Uppgiftsrelaterat menysystem +Comment[ta]=பணி சார்ந்த பட்டியல் அமைப்பு +Comment[th]=ระบบเมนูที่ใช้แนวทางของงาน +Comment[tr]=Görev yönelimli bir menü sistemi +Comment[tt]=Yökkä yünälgän saylaq sisteme +Comment[uk]=Система меню орієнтована на завдання +Comment[vi]=Hệ thực đơn hướng tác vụ +Comment[wa]=Ene dressêye sistinme fwaite po les bouyes +Comment[zh_CN]=面向任务的菜单系统 +Comment[zh_TW]=一個工作導向的選單系統 +Icon=kmenu +X-KDE-Library=kickermenu_tom diff --git a/kicker/menuext/tom/tom.h b/kicker/menuext/tom/tom.h new file mode 100644 index 000000000..663cb05d6 --- /dev/null +++ b/kicker/menuext/tom/tom.h @@ -0,0 +1,110 @@ +/* This file is part of the KDE project + Copyright (C) 2003 Aaron J. Seigo <[email protected]> + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License version 2 as published by the Free Software Foundation. + + This program 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 program; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef __tom_h_ +#define __tom_h_ + +#include <qpixmap.h> + +#include <kpanelmenu.h> +#include <klibloader.h> + +class KPopupMenu; +class QPopupMenu; + +typedef QPtrList<QPopupMenu> PopupMenuList; +typedef QMap<int, KService::Ptr> TaskMap; + +class TOM : public KPanelMenu +{ + Q_OBJECT + + public: + TOM(QWidget *parent = 0, const char *name = 0); + ~TOM(); + + // for the side image + /*void setMinimumSize(const QSize &); + void setMaximumSize(const QSize &); + void setMinimumSize(int, int); + void setMaximumSize(int, int); */ + + protected slots: + void slotClear(); + void slotExec(int); + //void configChanged(); + void initialize(); + void contextualizeRMBmenu(KPopupMenu* menu, int menuItem, QPopupMenu* ctxMenu); + //void paletteChanged(); + void clearRecentDocHistory(); + void runCommand(); + void runTask(int id); + void initializeRecentDocs(); + void openRecentDocument(int id); + void logout(); + + /* + * slots for the RMB menu on task group + */ + void removeTask(); + + protected: + void reload(); + + int appendTaskGroup(KConfig& config, bool inSubMenu = true ); + void initializeRecentApps(QPopupMenu* menu); + //int insertTOMTitle(QPopupMenu* menu, const QString &text, int id = -1, int index = -1); + + /* + * this stuff should be shared w/the kmenu + + QRect sideImageRect(); + QMouseEvent translateMouseEvent( QMouseEvent* e ); + void resizeEvent(QResizeEvent *); + void paintEvent(QPaintEvent *); + void mousePressEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + bool loadSidePixmap(); + + QPixmap m_sidePixmap; + QPixmap m_sideTilePixmap;*/ + PopupMenuList m_submenus; + QFont m_largerFont; + int m_maxIndex; + bool m_isImmutable; + bool m_detailedTaskEntries; + bool m_detailedNamesFirst; + TaskMap m_tasks; + KPopupMenu* m_recentDocsMenu; + QStringList m_recentDocURLs; +}; + +class TOMFactory : public KLibFactory +{ + public: + TOMFactory(QObject *parent = 0, const char *name = 0); + + protected: + QObject* createObject(QObject *parent = 0, const char *name = 0, + const char *classname = "QObject", + const QStringList& args = QStringList()); +}; + + +#endif |