diff options
Diffstat (limited to 'kicker/kicker/buttons')
27 files changed, 2751 insertions, 0 deletions
diff --git a/kicker/kicker/buttons/Makefile.am b/kicker/kicker/buttons/Makefile.am new file mode 100644 index 000000000..2ba4d20c6 --- /dev/null +++ b/kicker/kicker/buttons/Makefile.am @@ -0,0 +1,24 @@ +INCLUDES = -I$(srcdir)/../core -I$(srcdir)/../../libkicker -I../../libkicker \ + -I$(srcdir)/../ui -I$(top_srcdir)/libkonq $(all_includes) + +noinst_LTLIBRARIES = libkicker_buttons.la + +libkicker_buttons_la_SOURCES = servicebutton.cpp bookmarksbutton.cpp \ + browserbutton.cpp \ + desktopbutton.cpp extensionbutton.cpp kbutton.cpp \ + nonkdeappbutton.cpp servicemenubutton.cpp urlbutton.cpp \ + windowlistbutton.cpp + +libkicker_buttons_la_LDFLAGS = $(all_libraries) +libkicker_buttons_la_LIBADD = $(top_builddir)/libkonq/libkonq.la $(LIB_KDEUI) $(XTESTLIB) +libkicker_buttons_la_METASOURCES = AUTO + +desktopmenu_DATA = bookmarks.desktop browser.desktop desktop.desktop \ + exec.desktop kmenu.desktop windowlist.desktop +desktopmenudir = $(kde_datadir)/kicker/builtins + +browserbutton.lo: ../../libkicker/kickerSettings.h +desktopbutton.lo: ../../libkicker/kickerSettings.h +panelbutton.lo: ../../libkicker/kickerSettings.h +servicebutton.lo: ../../libkicker/kickerSettings.h +urlbutton.lo: ../../libkicker/kickerSettings.h diff --git a/kicker/kicker/buttons/bookmarks.desktop b/kicker/kicker/buttons/bookmarks.desktop new file mode 100644 index 000000000..2957099d1 --- /dev/null +++ b/kicker/kicker/buttons/bookmarks.desktop @@ -0,0 +1,133 @@ +[Desktop Entry] +Name=Bookmarks Menu +Name[af]=Boekmerke Kieslys +Name[ar]=قائمة علامات مواقع +Name[be]=Меню закладак +Name[bg]=Отметки +Name[bn]=বুকমার্ক মেনু +Name[br]=Meuziad ar sinedoù +Name[bs]=Meni zabilješki +Name[ca]=Menú de punts +Name[cs]=Nabídka záložek +Name[csb]=Załóżczi +Name[da]=Bogmærkemenu +Name[de]=Lesezeichen +Name[el]=Μενού σελιδοδεικτών +Name[eo]=Legosigna Menuo +Name[es]=Marcadores +Name[et]=Järjehoidjate menüü +Name[eu]=Laster-marken menua +Name[fa]=گزینگان چوب الفها +Name[fi]=Kirjanmerkit +Name[fr]=Menu des signets +Name[fy]=Blêdwizers menu +Name[ga]=Roghchlár na Leabharmharcanna +Name[gl]=Marcadores +Name[he]=תפריט סימניות +Name[hr]=Izbornik oznaka +Name[hu]=Könyvjelzők menü +Name[is]=Bókamerkjavalmynd +Name[it]=Menu dei segnalibri +Name[ja]=ブックマークメニュー +Name[ka]=სანიშნეების მენიუ +Name[kk]=Бетбелгілер мәзірі +Name[km]=ម៉ឺនុយចំណាំ +Name[ko]=책갈피 +Name[lt]=Žymelių meniu +Name[mk]=Мени со обележувачи +Name[nb]=Bokmerkemeny +Name[nds]=Leestekens +Name[ne]=पुस्तकचिनो मेनु +Name[nl]=Bladwijzermenu +Name[nn]=Bokmerkemeny +Name[pa]=ਬੁੱਕਮਾਰਕ ਮੇਨੂ +Name[pl]=Zakładki +Name[pt]=Menu de Favoritos +Name[pt_BR]=Menu favoritos +Name[ro]=Meniu semne de carte +Name[ru]=Закладки +Name[rw]=Ibikubiyemo by'Utumenyetso +Name[se]=Girjemearkafállu +Name[sk]=Menu záložiek +Name[sl]=Meni z zaznamki +Name[sr]=Мени маркера +Name[sr@Latn]=Meni markera +Name[sv]=Bokmärkesmeny +Name[te]=పేజి గుర్తుల పట్టి +Name[tg]=Менюи хатчӯбҳо +Name[th]=ที่คั่นหน้า +Name[tr]=Yer imleri Menüsü +Name[tt]=Bitbilge Saylağı +Name[uk]=Меню закладок +Name[uz]=Xatchoʻplar menyusi +Name[uz@cyrillic]=Хатчўплар менюси +Name[vi]=Thực đơn có Sổ lưu liên kết +Name[wa]=Dressêye des rmåkes +Name[zh_CN]=书签菜单 +Name[zh_TW]=書籤選單 +Comment=Your Konqueror bookmarks +Comment[af]=Jou Konqueror boekmerke +Comment[ar]=علامات مواقعك لِــ Konqueror +Comment[be]=Закладкі Konqueror +Comment[bg]=Отметки на браузъра +Comment[bn]=আপনার কনকরার বুকমার্ক-সমূহ +Comment[bs]=Vaše Konqueror zabilješke +Comment[ca]=Els vostres punts Konqueror +Comment[cs]=Vaše záložky Konqueroru +Comment[csb]=Załóżczi Konquerora +Comment[da]=Dine Konqueror bogmærker +Comment[de]=Ein Menü mit Ihren Konqueror-Lesezeichen +Comment[el]=Οι σελιδοδείκτες σας του Konqueror +Comment[eo]=Viaj Konkeranto-legosignoj +Comment[es]=Sus marcadores de Konqueror +Comment[et]=Konquerori järjehoidjad +Comment[eu]=Zure Konquerorren laster-markak +Comment[fa]=چوب الفهای Konqueror شما +Comment[fi]=Konquerorin kirjanmerkit +Comment[fr]=Vos signets Konqueror +Comment[fy]=Jo blêdwizers yn Konqueror +Comment[ga]=Do Chuid Leabharmharcanna Konqueror +Comment[gl]=Os seus marcadores de Konqueror +Comment[he]=הסימניות Konqueror שלך +Comment[hr]=Vaše Konqueror oznake +Comment[hu]=A Konqueror könyvjelzői +Comment[is]=Konqueror bókamerkin þín +Comment[it]=I tuoi segnalibri di Konqueror +Comment[ja]=Konqueror ブックマーク +Comment[ka]=Konqueror-ის თქვენი სანიშნეები +Comment[kk]=Konqueror шолғыштың бетбелгілері +Comment[km]=ចំណាំ Konqueror របស់អ្នក +Comment[lt]=Konqueror žymelės +Comment[mk]=Вашите обележувачи од Konqueror +Comment[nb]=Dine bokmerker i Konqueror +Comment[nds]=Menü mit Dien Konqueror-Leestekens +Comment[ne]=तपाईँको कन्क्वेररका पुस्तकचिनो +Comment[nl]=Uw bladwijzers in Konqueror +Comment[nn]=Konqueror-bokmerka +Comment[pa]=ਤੁਹਾਡੇ ਕੋਨਕਿਉਰੋਰ ਬੁੱਕਮਾਰਕ +Comment[pl]=Zakładki Konquerora +Comment[pt]=Os seus favoritos do Konqueror +Comment[pt_BR]=Seus favoritos do Konqueror +Comment[ro]=Semnele de carte Konqueror +Comment[ru]=Закладки Konqueror +Comment[rw]=Ibimenyetso bya Konqueror yawe +Comment[se]=Konqueror:a girjemearkkat +Comment[sk]=Konqueror záložky +Comment[sl]=Meni z zaznamki iz Konquerorja +Comment[sr]=Ваши маркери у Konqueror-у +Comment[sr@Latn]=Vaši markeri u Konqueror-u +Comment[sv]=Dina bokmärken i Konqueror +Comment[te]=మీ కాంకెరర్ పేజి గుర్తులు +Comment[tg]=Хатчӯбҳои Konqueror +Comment[th]=ที่คั่นหน้าคอนเควอร์เรอร์ของคุณ +Comment[tr]=Konqueror yer imleriniz +Comment[tt]=Konqueror Bitbilgeläre +Comment[uk]=Закладки з Konqueror +Comment[uz]=Konqueror xatchoʻplari +Comment[uz@cyrillic]=Konqueror хатчўплари +Comment[vi]=Các liên kết đã lưu tại Konqueror của bạn +Comment[wa]=Vos rmåkes Konqueror +Comment[zh_CN]=您的 Konqueror 书签 +Comment[zh_TW]=您的 Konqueror 書籤 +Icon=bookmark +X-KDE-Library=BookmarksButton diff --git a/kicker/kicker/buttons/bookmarksbutton.cpp b/kicker/kicker/buttons/bookmarksbutton.cpp new file mode 100644 index 000000000..b351af263 --- /dev/null +++ b/kicker/kicker/buttons/bookmarksbutton.cpp @@ -0,0 +1,72 @@ +/***************************************************************** + +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 <qtooltip.h> + +#include <kaction.h> +#include <kbookmark.h> +#include <kbookmarkmenu.h> +#include <konqbookmarkmanager.h> +#include <klocale.h> +#include <kpopupmenu.h> + +#include "bookmarksbutton.h" +#include "bookmarksbutton.moc" + +BookmarksButton::BookmarksButton(QWidget* parent) + : PanelPopupButton(parent, "BookmarksButton"), + bookmarkParent(0), + bookmarkMenu(0), + actionCollection(0), + bookmarkOwner(0) +{ + actionCollection = new KActionCollection( this ); + bookmarkParent = new KPopupMenu(this, "bookmarks"); + bookmarkOwner = new KBookmarkOwner; + bookmarkMenu = new KBookmarkMenu(KonqBookmarkManager::self(), + bookmarkOwner, + bookmarkParent, + actionCollection, + true, false); + setPopup(bookmarkParent); + QToolTip::add(this, i18n("Bookmarks")); + setTitle(i18n("Bookmarks")); + setIcon("bookmark"); +} + +BookmarksButton::~BookmarksButton() +{ + delete bookmarkMenu; + delete bookmarkOwner; +} + +void BookmarksButton::initPopup() +{ + bookmarkMenu->ensureUpToDate(); +} + +void BookmarksButton::properties() +{ + KonqBookmarkManager::self()->slotEditBookmarks(); +} + diff --git a/kicker/kicker/buttons/bookmarksbutton.h b/kicker/kicker/buttons/bookmarksbutton.h new file mode 100644 index 000000000..95ffa9609 --- /dev/null +++ b/kicker/kicker/buttons/bookmarksbutton.h @@ -0,0 +1,58 @@ +/***************************************************************** + +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. + +******************************************************************/ + +#ifndef __bookmarksbutton_h__ +#define __bookmarksbutton_h__ + +#include "panelbutton.h" + +class KPopupMenu; +class KBookmarkMenu; +class KActionCollection; +class KBookmarkOwner; + +/** + * Button that contains a bookmark menu + */ +class BookmarksButton : public PanelPopupButton +{ + Q_OBJECT + +public: + BookmarksButton(QWidget* parent); + ~BookmarksButton(); + + void loadConfig(const KConfigGroup& config); + virtual void properties(); + +protected: + virtual QString tileName() { return "WindowList"; } + virtual void initPopup(); + + KPopupMenu* bookmarkParent; + KBookmarkMenu* bookmarkMenu; + KActionCollection* actionCollection; + KBookmarkOwner* bookmarkOwner; +}; + +#endif diff --git a/kicker/kicker/buttons/browser.desktop b/kicker/kicker/buttons/browser.desktop new file mode 100644 index 000000000..f7236786b --- /dev/null +++ b/kicker/kicker/buttons/browser.desktop @@ -0,0 +1,125 @@ +[Desktop Entry] +Name=Quick File Browser +Name[af]=Vinnige Lêer Blaaier +Name[ar]=متصفح ملفات سريع +Name[be]=Хуткі прагляд +Name[bg]=Бърз файлов браузър +Name[bn]=চটপট ফাইল ব্রাউজার +Name[bs]=Brzi preglednik datoteka +Name[ca]=Fullejador de fitxers ràpid +Name[cs]=Rychlý prohlížeč souborů +Name[csb]=Chùtczé przezéranié lopków +Name[da]=Hurtig filsøgning +Name[de]=Schnellanzeiger +Name[el]=Γρήγορος περιηγητής αρχείων +Name[eo]=Rapida Dosiero Legilo +Name[es]=Navegador rápido de archivos +Name[et]=Failide kiirbrauser +Name[eu]=Fitxategi arakatzaile bizkorra +Name[fa]=مرورگر پروندۀ سریع +Name[fi]=Nopea tiedostoselain +Name[fr]=Explorateur de fichiers rapide +Name[fy]=Flugge triem blêder +Name[gl]=Navegador Rápido +Name[he]=דפדפן קבצים מהיר +Name[hr]=Brzi pretraživač datoteka +Name[hu]=Gyors fájlböngésző +Name[is]=Flýti skráarvafri +Name[it]=Browser rapido dei file +Name[ja]=クイックファイルブラウザ +Name[ka]=ფაილების სწრაფი ნუსხა +Name[kk]=Жедел файл шолғышы +Name[km]=កម្មវិធីរុករកឯកសាររហ័ស +Name[lt]=Paprasta bylų naršyklė +Name[mk]=Брз прелистувач на датотеки +Name[nb]=Enkel filbehandler +Name[nds]=Fix-Dateiwieser +Name[ne]=द्रुत फाइल ब्राउजर +Name[nn]=Snøgglesar +Name[pa]=ਤੇਜ਼ ਫਾਇਲ ਝਲਕਾਰਾ +Name[pl]=Szybkie przeglądanie plików +Name[pt]=Navegação Rápida de Ficheiros +Name[pt_BR]=Navegador de Arquivos Rápido +Name[ro]=Navigator de fișiere rapid +Name[ru]=Быстрый выбор файла +Name[rw]=Mucukumbuzi y'Idosiye Yihuta +Name[se]=Jođánis fiilagieđahalli +Name[sk]=Rýchly prehliadač súborov +Name[sl]=Preprost brskalnik +Name[sr]=Брзи прегледач фајлова +Name[sr@Latn]=Brzi pregledač fajlova +Name[sv]=Snabbfilbläddrare +Name[tg]=Интихоби файлҳои тез +Name[th]=โปรแกรมเรียกดูไฟล์อย่างรวดเร็ว +Name[tr]=Hızlı Dosya Tarayıcı +Name[tt]=Tiz Birem-Küzätüçe +Name[uk]=Швидкий навігатор файлів +Name[uz]=Tez koʻruvchi +Name[uz@cyrillic]=Тез кўрувчи +Name[vi]=Duyệt nhanh các tập tin +Name[wa]=Betchteu d' fitchî simpe +Name[zh_CN]=快速文件浏览器 +Name[zh_TW]=快速檔案瀏覽器 +Comment=A menu that lists files in a given folder +Comment[af]='n Kieslys wat die lêers in 'n spesifieke gids vertoon +Comment[ar]=قائمة تعرض الملفات في مجلّد معيين +Comment[be]=Меню, якое паказвае файлы ў вызначанай тэчцы +Comment[bg]=Меню, което показва файловете в зададена директория +Comment[bn]=একটি মেনু যা ফোল্ডার-এর ফাইলসমূহ তালিকাবদ্ধ করে +Comment[bs]=Meni u kojem se nalaze datoteke u datom direktoriju +Comment[ca]=Un menú que llista els fitxers d'una carpeta +Comment[cs]=Nabídka vypisující soubory v dané složce +Comment[csb]=Menu pokazëwôjące lopczi w pòdónym katalogù +Comment[da]=En menu der lister filer i en given mappe +Comment[de]=Ein Menü, das die Dateien eines bestimmten Ordners auflistet +Comment[el]=Ένα μενού που εμφανίζει τα αρχεία ενός δοσμένου φακέλου +Comment[eo]=Menuo kiu listigas dosierojn en la nomita dosierujo +Comment[es]=Un menú que le muestra los archivos de una carpeta +Comment[et]=Menüü, mis näitab valitud kataloogi faile +Comment[eu]=Emandako karpetako fitxategiak zerrendatzen dituen menua +Comment[fa]=گزینگانی که پروندهها را در پوشۀ دادهشده فهرست میکند +Comment[fi]=Valikko, joka listaa annetun kansion tiedostot +Comment[fr]=Un menu affichant les fichiers d'un dossier donné +Comment[fy]=In menu dat de triemmen út de oantsjutte map sjen lit +Comment[ga]=Roghchlár a thaispeánann na comhaid i bhfillteán +Comment[gl]=Un menu que lista os ficheiros dos seus cartafoles +Comment[he]=תפריט שנותן רשימה של קבצים הקיימים בתיקייה מסוימת +Comment[hr]=Izbornik s popisom datoteka unutar dane mape +Comment[hu]=Egy adott könyvtár tartalmát kilistázó menü +Comment[is]=Valmynd sem sýnir skrár í uppgefinni möppu +Comment[it]=Un menu che elenca i file di una data cartella +Comment[ja]=指定したフォルダのファイルのリストを表示するメニュー +Comment[kk]=Каталогтағы файлдар тізім мәзірі +Comment[km]=ម៉ឺនុយដែលរាយឯកសារក្នុងថតដែលបានផ្តល់មួយ +Comment[lt]=Bylų sąrašą nurodytame aplanke pateikiantis meniu +Comment[mk]=Мени што ги листа датотеките во дадена папка +Comment[nb]=En meny som viser filene i en bestemt mappe +Comment[nds]=Menü dat de Dateien ut en angeven Orner wiest +Comment[ne]=दिएको फोल्डरमा फाइलहरू सूचीकृत गर्ने मेनु +Comment[nl]=Een menu dat de bestanden uit de opgegeven map toont +Comment[nn]=Ein meny som viser filene i ei mappe +Comment[pa]=ਇੱਕ ਮੇਨੂ, ਜੋ ਕਿ ਦਿੱਤੇ ਫੋਲਡਰ ਵਿੱਚ ਫਾਇਲਾਂ ਵਿਖਾ ਸਕਦਾ ਹੈ +Comment[pl]=Menu pokazujące pliki w podanym katalogu +Comment[pt]=Um menu que mostra os ficheiros numa dada pasta +Comment[pt_BR]=Um menu que lista arquivos em uma determinada pasta +Comment[ro]=Un meniu care listează fișierele dintr-un folder +Comment[ru]=Меню с быстрым выбором файла из указанной папки +Comment[rw]=Ibikubiyemo bitanga urutonde rw'amadosiye mu bubiko butanzwe +Comment[se]=Fállu mii čájeha fiillaid dihto máhpas +Comment[sk]=Menu, ktoré zobrazí súbory v priečinku +Comment[sl]=Meni, ki prikazuje seznam datotek v dani mapi +Comment[sr]=Мени који листа фајлове у датој фасцикли +Comment[sr@Latn]=Meni koji lista fajlove u datoj fascikli +Comment[sv]=En meny som listar filer i en given katalog +Comment[th]=เมนูที่แสดงรายการแฟ้มของโฟลเดอร์ที่กำหนด +Comment[tr]=Belirlenen bir dizinde dosyaları listeleme menüsü +Comment[tt]=Berär törgäkneñ birem tezmäsen kürsätüçe saylaq +Comment[uk]=Меню, яке дає перелік файлів в даній теці +Comment[uz]=Koʻrsatilgan jilddagi fayllarning roʻyxatini koʻrsatuvchi +Comment[uz@cyrillic]=Кўрсатилган жилддаги файлларнинг рўйхатини кўрсатувчи +Comment[vi]=Một thực đơn liệt kê các tập tin có trong thư mục +Comment[wa]=Ene dressêye ki fwait l' lisse des fitchî dins on ridant d' diné +Comment[zh_CN]=列出给定文件夹中文件的菜单 +Comment[zh_TW]=列出所選資料夾中檔案的選單 +Icon=kdisknav +X-KDE-Library=BrowserButton diff --git a/kicker/kicker/buttons/browserbutton.cpp b/kicker/kicker/buttons/browserbutton.cpp new file mode 100644 index 000000000..9a445d218 --- /dev/null +++ b/kicker/kicker/buttons/browserbutton.cpp @@ -0,0 +1,147 @@ +/***************************************************************** + +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 <qtimer.h> +#include <qtooltip.h> +#include <qdragobject.h> + +#include <kconfig.h> +#include <klocale.h> +#include <konq_operations.h> +#include <kfileitem.h> + +#include "kicker.h" +#include "browser_mnu.h" +#include "browser_dlg.h" +#include "global.h" + +#include "browserbutton.h" +#include "browserbutton.moc" + +BrowserButton::BrowserButton( const QString& icon, const QString& startDir, QWidget* parent ) + : PanelPopupButton( parent, "BrowserButton" ) + , topMenu( 0 ) +{ + initialize( icon, startDir ); +} + +BrowserButton::BrowserButton( const KConfigGroup& config, QWidget* parent ) + : PanelPopupButton( parent, "BrowserButton" ) + , topMenu( 0 ) +{ + initialize( config.readEntry("Icon", "kdisknav"), config.readPathEntry("Path") ); +} + +BrowserButton::~BrowserButton() +{ + delete topMenu; +} + +void BrowserButton::initialize( const QString& icon, const QString& path ) +{ + _icon = icon; + + // Don't parent to this, so that the tear of menu is not always-on-top. + topMenu = new PanelBrowserMenu( path ); + setPopup(topMenu); + + _menuTimer = new QTimer( this ); + connect( _menuTimer, SIGNAL(timeout()), SLOT(slotDelayedPopup()) ); + + QToolTip::add(this, i18n("Browse: %1").arg(path)); + setTitle( path ); + setIcon ( _icon ); +} + +void BrowserButton::saveConfig( KConfigGroup& config ) const +{ + config.writeEntry("Icon", _icon); + config.writePathEntry("Path", topMenu->path()); +} + +void BrowserButton::dragEnterEvent( QDragEnterEvent *ev ) +{ + if ((ev->source() != this) && KURLDrag::canDecode(ev)) + { + _menuTimer->start(500, true); + ev->accept(); + } + else + { + ev->ignore(); + } + PanelButton::dragEnterEvent(ev); +} + +void BrowserButton::dragLeaveEvent( QDragLeaveEvent *ev ) +{ + _menuTimer->stop(); + PanelButton::dragLeaveEvent(ev); +} + +void BrowserButton::dropEvent( QDropEvent *ev ) +{ + KURL path ( topMenu->path() ); + _menuTimer->stop(); + KFileItem item( path, QString::fromLatin1( "inode/directory" ), KFileItem::Unknown ); + KonqOperations::doDrop( &item, path, ev, this ); + PanelButton::dropEvent(ev); +} + +void BrowserButton::initPopup() +{ + topMenu->initialize(); +} + +void BrowserButton::slotDelayedPopup() +{ + topMenu->initialize(); + topMenu->popup(KickerLib::popupPosition(popupDirection(), topMenu, this)); + setDown(false); +} + +void BrowserButton::properties() +{ + PanelBrowserDialog dlg( topMenu->path(), _icon, this ); + + if( dlg.exec() == QDialog::Accepted ){ + _icon = dlg.icon(); + QString path = dlg.path(); + + if ( path != topMenu->path() ) { + delete topMenu; + topMenu = new PanelBrowserMenu( path, this ); + setPopup( topMenu ); + setTitle( path ); + } + setIcon( _icon ); + emit requestSave(); + } +} + +void BrowserButton::startDrag() +{ + KURL url(topMenu->path()); + emit dragme(KURL::List(url), labelIcon()); +} + diff --git a/kicker/kicker/buttons/browserbutton.h b/kicker/kicker/buttons/browserbutton.h new file mode 100644 index 000000000..00ff0abea --- /dev/null +++ b/kicker/kicker/buttons/browserbutton.h @@ -0,0 +1,66 @@ +/***************************************************************** + +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. + +******************************************************************/ + +#ifndef __browserbutton_h__ +#define __browserbutton_h__ + +#include "panelbutton.h" + +class PanelBrowserMenu; + +/** + * Button that contains a Browser directory menu + */ +class BrowserButton : public PanelPopupButton +{ + Q_OBJECT + +public: + BrowserButton( const QString& icon, const QString& startDir, QWidget* parent ); + BrowserButton( const KConfigGroup& config, QWidget* parent ); + virtual ~BrowserButton(); + + void saveConfig( KConfigGroup& config ) const; + + virtual void properties(); + +protected slots: + virtual void slotDelayedPopup(); + virtual void startDrag(); + +protected: + void initialize( const QString& icon, const QString& startDir ); + virtual QString tileName() { return "Browser"; } + virtual void initPopup(); + virtual void dropEvent(QDropEvent *ev); + virtual void dragEnterEvent(QDragEnterEvent *ev); + virtual void dragLeaveEvent(QDragLeaveEvent *ev); + virtual QString defaultIcon() const { return "kdisknav"; }; + + PanelBrowserMenu* topMenu; + QString _icon; + QTimer *_menuTimer; +}; + +#endif + diff --git a/kicker/kicker/buttons/desktop.desktop b/kicker/kicker/buttons/desktop.desktop new file mode 100644 index 000000000..f9ccbc81d --- /dev/null +++ b/kicker/kicker/buttons/desktop.desktop @@ -0,0 +1,129 @@ +[Desktop Entry] +Name=Show Desktop +Name[af]=Vertoon Werkskerm +Name[ar]=أعرض سطح المكتب +Name[be]=Паказаць працоўны стол +Name[bg]=Показване на работния плот +Name[bn]=ডেস্কটপ দেখাও +Name[br]=Diskouez ar burev +Name[bs]=Prikaži desktop +Name[ca]=Mostra l'escriptori +Name[cs]=Zobrazit plochu +Name[csb]=Pòkôże pùlt +Name[da]=Vis desktop +Name[de]=Zugriff auf Arbeitsfläche +Name[el]=Εμφάνιση επιφάνειας εργασίας +Name[eo]=Montri Tabulon +Name[es]=Mostrar escritorio +Name[et]=Näita töölauda +Name[eu]=Erakutsi mahaigaina +Name[fa]=نمایش رومیزی +Name[fi]=Näytä työpöytä +Name[fr]=Afficher le bureau +Name[fy]=Buroblêd sjen litte +Name[ga]=Taispeáin an Deasc +Name[gl]=Escritório +Name[he]=הצג שולחן עבודה +Name[hr]=Prikaži radnu površinu +Name[hu]=A munkaasztal megjelenítése +Name[is]=Sýna skjáborð +Name[it]=Mostra il desktop +Name[ja]=デスクトップを表示 +Name[ka]=სამუშაო დაფის ჩვენება +Name[kk]=Үстелге ауысу +Name[km]=បង្ហាញផ្ទៃតុ +Name[ko]=데스크톱 1로 바꾸기 +Name[lt]=Rodyti darbastalį +Name[mk]=Прикажи работна површина +Name[nb]=Vis skrivebord +Name[nds]=Schriefdischwieser +Name[ne]=डेस्कटप देखाउनुहोस् +Name[nl]=Bureaublad tonen +Name[nn]=Vis skrivebord +Name[pa]=ਵੇਹੜਾ ਵੇਖਾਓ +Name[pl]=Pokaż pulpit +Name[pt]=Mostrar o Ecrã +Name[pt_BR]=Mostrar Área de Trabalho +Name[ro]=Arată desktop +Name[ru]=Свернуть все окна +Name[rw]=Kwerekana Ibiro +Name[se]=Čájet čállinbeavddi +Name[sk]=Ukáže pracovnú plochu +Name[sl]=Prikaži namizje +Name[sr]=Прикажи радну површину +Name[sr@Latn]=Prikaži radnu površinu +Name[sv]=Visa skrivbord +Name[te]=రంగస్థలాన్ని చూపు +Name[tg]=Намоиши мизи корӣ +Name[th]=แสดงพื้นที่หน้าจอ +Name[tr]=Masaüstünü Göster +Name[tt]=Östäl Kürsätü +Name[uk]=Показати стільницю +Name[uz]=Ish stoli +Name[uz@cyrillic]=Иш столи +Name[vi]=Hiển thị Màn hình nền +Name[wa]=Mostrer l' sicribanne +Name[zh_CN]=显示桌面 +Name[zh_TW]=顯示桌面 +Comment=A button that gives quick access to the desktop when pressed +Comment[af]='n Knoppie wat vinnige toegang tot die werkskerm gee wanneer dit gedruk word +Comment[ar]=زرّ يسمح بالوصول السريع إلى سطح المكتب عند ضغطه +Comment[be]=Кнопка, якая дае хуткі доступ да працоўнага стала +Comment[bg]=Бутон за бърз достъп до работния плот +Comment[bn]=একটা বাটন যেটি চাপলে ডেস্কটপ ফাঁকা করে দেখানো হবে +Comment[bs]=Dugme koje sklanja sve prozore sa ekrana i prikazuje desktop +Comment[ca]=Un botó que dóna accés ràpid a l'escriptori en prémer-hi +Comment[cs]=Tlačítko s rychlým přístupem k pracovní ploše +Comment[csb]=Knąpa chùtczégò przistãpù do pùltu +Comment[da]=En knap der giver hurtig adgang til desktoppen når den trykkes ned +Comment[de]=Dieser Knopf ermöglicht den schnellen Zugriff auf die Arbeitsfläche +Comment[el]=Ένα κουμπί που όταν πατηθεί δίνει γρήγορη πρόσβαση στην επιφάνεια εργασίας +Comment[eo]=Butono kiu ebligas rapid aliron al labortabulo kiam premita +Comment[es]=Muestra rápidamente el escritorio al pulsarlo +Comment[et]=Nupp, mis võimaldab ühe klõpsuga kiiresti pääseda otse töölauale +Comment[eu]=Zapatzean mahagainera sarbide bizkorra ematen duen botoia +Comment[fa]=دکمهای که وقتی فشار داده شد، امکان دستیابی سریع به رومیزی را میدهد. +Comment[fi]=Painike, jota painamalla pääsee nopeasti työpöydälle +Comment[fr]=Un bouton, qui, en étant cliqué, donne un accès rapide au bureau +Comment[fy]=In knop hokker flugge tagong ta it buroblêd jout +Comment[gl]=Un botón que dá aceso rápido ao escritório cando se preme +Comment[he]=כפתור הנותן גישה מהירה לשולחן העבודה כאשר נלחץ +Comment[hr]=Gumb koji omogućuje brz pristup radnoj površini +Comment[hu]=Ezzel a gombbal gyorsan elérhető a munkaasztal +Comment[is]=Hnappur sem veitir hraðan aðgang að skjáborðinu +Comment[it]=Un pulsante che da accesso rapido al desktop quando viene premuto +Comment[ja]=デスクトップに素早くアクセスするためのボタン +Comment[kk]=Бір басып үстелге қатынау батырмасы +Comment[km]=ប៊ូតុងដែលផ្តល់ការចូលដំណើរការរហ័សទៅផ្ទៃតុ ពេលចុច +Comment[lt]=Mygtukas, kurį nuspaudus suteikiama greita prieiga prie darbastalio +Comment[mk]=Копче што дава брз пристап кон работната површина кога е притиснато +Comment[nb]=En knapp som gir deg rask tilgang til skrivebordet +Comment[nds]=Disse Knoop laat Een direktemang op den Schriefdisch togriepen +Comment[ne]=थिचेको बेलामा डेस्कटपमा द्रुत पहुँच प्रदान गर्ने बटन +Comment[nl]=Een knop die snelle toegang tot het bureaublad geeft +Comment[nn]=Ein knapp som gir deg rask tilgang til skrivebordet +Comment[pa]=ਇੱਕ ਬਟਨ, ਜੋ ਕਿ ਦਬਾਉਣ ਉਪਰੰਤ ਤੁਹਾਨੂ ਵੇਹੜਾ ਉਪਲੱਬਧ ਕਰਵਾਉਦਾ ਹੈ +Comment[pl]=Przycisk szybkiego dostępu do pulpitu +Comment[pt]=Um botão que dá acesso rápido ao ecrã, quando for carregado +Comment[pt_BR]=Um botão que fornece acesso rápido para a área de trabalho, quando pressionado +Comment[ro]=Un buton care permite acces rapid la desktop la apăsare +Comment[ru]=Кнопка перехода на заданный рабочий стол +Comment[rw]=Buto itanga ukugera vuba ku biro igihe ikanzwe +Comment[se]=Boallu mii čiehká buot lásiid mat leat čállinbeavddis go dan coahkkala +Comment[sk]=Tlačidlo pre rýchly prístup na pracovnú plochu +Comment[sl]=Klik tega gumba omogoča hiter dostop do namizja +Comment[sr]=Дугме које по притиску даје брз приступ радној површини +Comment[sr@Latn]=Dugme koje po pritisku daje brz pristup radnoj površini +Comment[sv]=En knapp som ger snabb åtkomst till skrivbordet när den klickas +Comment[th]=ปุ่มที่กดแล้วจะแสดงพื้นที่หน้าจออย่างรวดเร็ว +Comment[tr]=Tıklandığı zaman masaüstüne hızlı erişim sağlar +Comment[tt]=Östäl eçtälegenä tiz ireşergä birüçe töymä +Comment[uk]=Кнопка, яка при натисканні надає швидкий доступ до стільниці +Comment[uz]=Ish stoliga qisqa yoʻl +Comment[uz@cyrillic]=Иш столига қисқа йўл +Comment[vi]=Một nút cho phép bạn truy cập ngay đến màn hình nền mỗi khi ấn vào +Comment[wa]=On boton ki dene raddimint accès å scribanne cwand il est tchôkî +Comment[zh_CN]=按下可快速访问桌面的按钮 +Comment[zh_TW]=按下去能快速顯示桌面的按鈕 +Icon=desktop +X-KDE-Library=DesktopButton diff --git a/kicker/kicker/buttons/desktopbutton.cpp b/kicker/kicker/buttons/desktopbutton.cpp new file mode 100644 index 000000000..3831303d7 --- /dev/null +++ b/kicker/kicker/buttons/desktopbutton.cpp @@ -0,0 +1,84 @@ +/***************************************************************** + +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 <qtooltip.h> +#include <qdragobject.h> + +#include <klocale.h> +#include <kglobalsettings.h> +#include <konq_operations.h> +#include <kfileitem.h> + +#include "showdesktop.h" +#include "kicker.h" +#include "kickerSettings.h" + +#include "desktopbutton.h" +#include "desktopbutton.moc" + +DesktopButton::DesktopButton( QWidget* parent ) + : PanelButton( parent, "DesktopButton" ) +{ + setToggleButton(true); + + QToolTip::add(this, i18n("Show desktop")); + setTitle(i18n("Desktop Access")); + setIcon("desktop"); + + connect( this, SIGNAL(toggled(bool)), this, SLOT(showDesktop(bool)) ); + connect( ShowDesktop::the(), SIGNAL(desktopShown(bool)), this, SLOT(toggle(bool)) ); + + setOn( ShowDesktop::the()->desktopShowing() ); +} + +void DesktopButton::toggle(bool showDesktop) +{ + KickerTip::enableTipping(false); + setOn(showDesktop); + KickerTip::enableTipping(true); +} + +void DesktopButton::showDesktop(bool showDesktop) +{ + KickerTip::enableTipping(false); + ShowDesktop::the()->showDesktop(showDesktop); + KickerTip::enableTipping(true); +} + +void DesktopButton::dragEnterEvent( QDragEnterEvent *ev ) +{ + if ((ev->source() != this) && KURLDrag::canDecode(ev)) + ev->accept(rect()); + else + ev->ignore(rect()); + PanelButton::dragEnterEvent(ev); +} + +void DesktopButton::dropEvent( QDropEvent *ev ) +{ + KURL dPath ( KGlobalSettings::desktopPath() ); + KFileItem item( dPath, QString::fromLatin1( "inode/directory" ), KFileItem::Unknown ); + KonqOperations::doDrop( &item, dPath, ev, this ); + PanelButton::dropEvent(ev); +} + diff --git a/kicker/kicker/buttons/desktopbutton.h b/kicker/kicker/buttons/desktopbutton.h new file mode 100644 index 000000000..62de4c342 --- /dev/null +++ b/kicker/kicker/buttons/desktopbutton.h @@ -0,0 +1,49 @@ +/***************************************************************** + +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. + +******************************************************************/ + +#ifndef __desktopbutton_h__ +#define __desktopbutton_h__ + +#include "panelbutton.h" + +/** + * Button that shows the deskop + */ +class DesktopButton : public PanelButton +{ + Q_OBJECT + +public: + DesktopButton( QWidget* parent ); + +protected: + virtual QString tileName() { return "DesktopButton"; } + virtual void dragEnterEvent(QDragEnterEvent *ev); + virtual void dropEvent(QDropEvent *ev); + +protected slots: + void toggle(bool); + void showDesktop(bool); +}; + +#endif diff --git a/kicker/kicker/buttons/exec.desktop b/kicker/kicker/buttons/exec.desktop new file mode 100644 index 000000000..ab30698f3 --- /dev/null +++ b/kicker/kicker/buttons/exec.desktop @@ -0,0 +1,125 @@ +[Desktop Entry] +Name=Non-KDE Application Launcher +Name[af]=Nie-KDE Program Lanseerder +Name[ar]=مُطلِق التطبيقات اغير KDE +Name[be]=Запускальнік праграмы не-KDE +Name[bg]=Стартиране на програми +Name[bn]=নন-কে.ডি.ই অ্যাপলিকেশন লঞ্চার +Name[bs]=Pokretač ne-KDE programa +Name[ca]=Engegador d'aplicacions no KDE +Name[cs]=Spouštěč aplikací nepatřících do KDE +Name[csb]=Zrëszanié programów z bùtna KDE +Name[da]=Starter ikke-KDE-programmer +Name[de]=Nicht-KDE-Programm +Name[el]=Εκτελεστής μη-KDE εφαρμογών +Name[eo]=neKDE-a Aplikaĵolanĉilo +Name[es]=Aplicaciones No-KDE +Name[et]=KDE-väliste rakenduste käivitaja +Name[eu]=KDEren ez diren aplikazio abiarazlea +Name[fa]=راهانداز کاربرد غیر KDE +Name[fi]=Ei-KDE:n sovellusten käynnistäjä +Name[fr]=Lancement des applications non KDE +Name[fy]=Net-KDE-programma's útfierder +Name[ga]=Tosaitheoir Feidhmchlár Neamh-KDE +Name[gl]=Lanzador de Aplicacións Non-KDE +Name[he]=מפעיל תוכניות שלא שייכות למשפחת KDE +Name[hr]=Pokretač vanjskih KDE aplikacija +Name[hu]=Programindító nem KDE-s alkalmazásokhoz +Name[is]=Ræsir fyrir ekki-KDE forrit +Name[it]=Lancio di applicazioni non-KDE +Name[ja]=KDE 以外のアプリケーションランチャー +Name[ka]=არა KDE-ს პროგრამების +Name[kk]=KDE-ге тиесілі емес қолданбаларды жегу +Name[km]=ឧបករណ៍បើកកម្មវិធីមិនមែន KDE +Name[ko]=프로그램 실행기 +Name[lt]=Ne-KDE programų startavimo priedas +Name[mk]=Стартувач на не-KDE апликации +Name[nb]=Last ikke-KDE-programmer +Name[nds]=Starter för Nich-KDE-Programmen +Name[ne]=KDE बाहेकको अनुप्रयोग सुरुआतकर्ता +Name[nl]=Niet-KDE-programma's starten +Name[nn]=Start av ikkje-KDE-program +Name[pa]=ਨਾ-KDE ਕਾਰਜ ਸ਼ੁਰੂਆਤੀ +Name[pl]=Uruchamianie programów spoza KDE +Name[pt]=Lançador de Aplicações não-KDE +Name[pt_BR]=Lançador de aplicativos que não são do KDE +Name[ro]=Lansator de aplicații Non-KDE +Name[ru]=Запуск приложения не из KDE +Name[rw]=Bitari-KDE Porogaramu Mutangiza +Name[se]=Ii-KDE prográmmaid álggaheaddji +Name[sk]=Spúšťač non-KDE aplikácií +Name[sl]=Zaganjalnik ne-KDE programov +Name[sr]=Покретач не-KDE програма +Name[sr@Latn]=Pokretač ne-KDE programa +Name[sv]=Start av program som inte hör till KDE +Name[th]=ตัวเรียกใช้งานแอพพลิเคชันที่ไม่ใช่ของ KDE +Name[tr]=KDE Dışı Uygulama Başlatıcısı +Name[tt]=KDE-bulmağan Yazılım Cibärgeç +Name[uk]=Запуск не-KDE програм +Name[uz]=No-KDE dasturlarni ishga tushuruvchi +Name[uz@cyrillic]=Но-KDE дастурларни ишга тушурувчи +Name[vi]=Trình khởi động Chương trình không của KDE +Name[wa]=Enondeu di programes nén KDE +Name[zh_CN]=非 KDE 应用程序启动器 +Name[zh_TW]=非-KDE 應用程式啟動器 +Comment=A launcher for programs not in the K Menu +Comment[af]='n Lanseerder vir programme wat nie in die K-Kieslys voorkom nie +Comment[ar]=مُطلِق البرامج غير التابعة لِلقائمة K +Comment[be]=Запускальнік для праграмы, якой няма ў меню KDE +Comment[bg]=Стартиране на програми, които са извън главното меню (К) +Comment[bn]=কে-মেনু-তে নেই এমন প্রোগ্রাম-এর চালু করার জন্য একটি লঞ্চার +Comment[bs]=Pokretač programa koji nisu u K meniju +Comment[ca]=Un engegador de programes que no hi són al menú K +Comment[cs]=Spouštěč pro programy nenacházející se v hlavní nabídce KDE +Comment[csb]=Zrëszanié programów, jaczich nie dô w K menu +Comment[da]=En starter af programmer der ikke er i K-Menuen +Comment[de]=Startet Programme, die sich nicht im K-Menü befinden +Comment[el]=Ένας εκτελεστής εφαρμογών που δε βρίσκονται στο Μενού K +Comment[eo]=Lanĉilo por programoj ne en la K Menuo +Comment[es]=Le permite ejecutar aplicaciones que no están en el Menu K +Comment[et]=K menüüst puuduvate rakenduste käivitaja +Comment[eu]=K Menuan ez dauden aplikazio abiarazlea +Comment[fa]=یک راهانداز برای برای برنامههایی که در گزینگان K نیست +Comment[fi]=Käynnistäjä ohjelmille, jotka eivät ole K-valikossa +Comment[fr]=Lancement des programmes n'étant pas dans le menu K +Comment[fy]=In útfierder foar programma's hokker net yn it K-menu stean +Comment[gl]=Un lanzador para aplicacións que non estexan no Menu de KDE +Comment[he]=מפעיל עבור יישומים שלא בתפריט המערכת +Comment[hr]=Pokretač programa koji se ne nalaze na KDE izborniku +Comment[hu]=Programindító +Comment[is]=Ræsir fyrir forrit sem eru ekki í K valmyndinni +Comment[it]=Per lanciare programmi che non sono nel menu K +Comment[ja]=K メニューにないプログラムを起動 +Comment[kk]=KDE мәзрінде жоқ бағдарламаларды жегу +Comment[km]=ឧបករណ៍បើកកម្មវិធីដែលមិននៅក្នុងម៉ឺនុយ K +Comment[lt]=K meniu nesančių programų startavimo meniu +Comment[mk]=Стартување на програми што не се во К-менито +Comment[nb]=Mulighet til å starte programmer som ikke er i KDE-menyen +Comment[nds]=En Starter för Programmen, de nich in't K-Menü staht +Comment[ne]=के मेनुमा नभएका कार्यक्रमका लागि सुरुआतकर्ता +Comment[nl]=Een starter voor het uitvoeren van programma's die niet in het K-menu staan +Comment[nn]=Start av program som ikkje ligg i K-menyen +Comment[pa]= ਕੇ(K) ਮੇਨੂ ਵਿੱਚ ਨਾ-ਮੌਜੂਦ ਕਾਰਜ ਲਈ ਸ਼ੁਰੂਆਤੀ ਹੈ +Comment[pl]=Uruchamianie programów, które nie znajdują się w menu K +Comment[pt]=Um lançador de programas que não estejam no Menu K +Comment[pt_BR]=Um lançador para programas que não estão no Menu K +Comment[ro]=Lansator de programe ce nu se află în meniul K +Comment[ru]=Запуск приложений, не входящих в меню KDE +Comment[rw]=Mutangiza w'amaporogaramu atari muri K Ibikubiyemo +Comment[sk]=Spúštač programov, ktoré nie sú v KDE Menu +Comment[sl]=Zaganjalnik programov, ki se ne nahajajo v meniju KDE-ja +Comment[sr]=Покретач за програме којих нема у K-менију +Comment[sr@Latn]=Pokretač za programe kojih nema u K-meniju +Comment[sv]=Start av program som inte finns i K-menyn +Comment[th]=ตัวเรียกใช้งานโปรแกรมที่ไม่ได้อยู่ใน K menu +Comment[tr]=KDE menüsünde bulunmayan programlar için bir başlatıcı +Comment[tt]=K-Saylaqta bulmağan yazılımnar cibärgeçe +Comment[uk]=Запуск програм, яких немає в K Меню +Comment[uz]=K-menyuga qoʻshilmagan dasturlarni ishga tushirish +Comment[uz@cyrillic]=К-менюга қўшилмаган дастурларни ишга тушириш +Comment[vi]=Trình khởi động các chương trình không có trong thực đơn của KDE +Comment[wa]=On enondeu po les programes ki n' sont nén dins l' dressêye K +Comment[zh_CN]=启动不在 K 菜单中的程序 +Comment[zh_TW]=用於不在 K 選單中的程式啟動器 +Icon=exec +X-KDE-Library=ExecButton diff --git a/kicker/kicker/buttons/extensionbutton.cpp b/kicker/kicker/buttons/extensionbutton.cpp new file mode 100644 index 000000000..004e0d47b --- /dev/null +++ b/kicker/kicker/buttons/extensionbutton.cpp @@ -0,0 +1,79 @@ +/***************************************************************** + +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 <qtooltip.h> + +#include <kconfig.h> +#include <kpanelmenu.h> + +#include "menuinfo.h" + +#include "extensionbutton.h" +#include "extensionbutton.moc" + +ExtensionButton::ExtensionButton( const QString& desktopFile, QWidget* parent ) + : PanelPopupButton( parent, "ExtensionButton" ) + , info( 0 ) + , menu( 0 ) +{ + initialize( desktopFile ); +} + +ExtensionButton::ExtensionButton( const KConfigGroup& config, QWidget* parent ) + : PanelPopupButton( parent, "extensionbuttton" ) +{ + initialize( config.readPathEntry("DesktopFile") ); +} + +void ExtensionButton::initialize( const QString& desktopFile ) +{ + info = new MenuInfo(desktopFile); + if (!info->isValid()) + { + m_valid = false; + return; + } + menu = info->load(this); + setPopup(menu); + + QToolTip::add(this, info->comment()); + setTitle(info->name()); + setIcon(info->icon()); +} + +ExtensionButton::~ExtensionButton() +{ + delete info; +} + +void ExtensionButton::saveConfig( KConfigGroup& config ) const +{ + config.writePathEntry("DesktopFile", info->desktopFile()); +} + +void ExtensionButton::initPopup() +{ + if( !menu->initialized() ) { + menu->reinitialize(); + } +} diff --git a/kicker/kicker/buttons/extensionbutton.h b/kicker/kicker/buttons/extensionbutton.h new file mode 100644 index 000000000..0d489f706 --- /dev/null +++ b/kicker/kicker/buttons/extensionbutton.h @@ -0,0 +1,52 @@ +/***************************************************************** + +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. + +******************************************************************/ + +#ifndef __extensionbutton_h__ +#define __extensionbutton_h__ + +#include "panelbutton.h" + +class MenuInfo; +class KPanelMenu; + +class ExtensionButton : public PanelPopupButton +{ + Q_OBJECT + +public: + ExtensionButton( const QString& desktopFile, QWidget* parent ); + ExtensionButton( const KConfigGroup& config, QWidget* parent ); + ~ExtensionButton(); + + void saveConfig( KConfigGroup& config ) const; + +protected: + void initialize( const QString& desktopFile ); + virtual QString tileName() { return "URL"; } + virtual void initPopup(); + + MenuInfo* info; + KPanelMenu* menu; +}; + +#endif diff --git a/kicker/kicker/buttons/kbutton.cpp b/kicker/kicker/buttons/kbutton.cpp new file mode 100644 index 000000000..071d15981 --- /dev/null +++ b/kicker/kicker/buttons/kbutton.cpp @@ -0,0 +1,78 @@ +/***************************************************************** + +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 <qtooltip.h> + +#include <klocale.h> +#include <kapplication.h> +#include <kdebug.h> + +#include "kickerSettings.h" + +#include "config.h" + +#include "menumanager.h" +#include "k_mnu.h" + +#include "kbutton.h" +#include "kbutton.moc" + +KButton::KButton( QWidget* parent ) + : PanelPopupButton( parent, "KButton" ) +{ + QToolTip::add(this, i18n("Applications, tasks and desktop sessions")); + setTitle(i18n("K Menu")); + + setPopup(MenuManager::the()->kmenu()); + MenuManager::the()->registerKButton(this); + setIcon("kmenu"); + + if (KickerSettings::showKMenuText()) + { + setButtonText(KickerSettings::kMenuText()); + setFont(KickerSettings::buttonFont()); + setTextColor(KickerSettings::buttonTextColor()); + } +} + +KButton::~KButton() +{ + MenuManager::the()->unregisterKButton(this); +} + +void KButton::properties() +{ + KApplication::startServiceByDesktopName("kmenuedit", QStringList(), + 0, 0, 0, "", true); +} + +void KButton::initPopup() +{ +// kdDebug(1210) << "KButton::initPopup()" << endl; + + // this hack is required to ensure the correct popup position + // when the size of the recent application part of the menu changes + // please don't remove this _again_ + MenuManager::the()->kmenu()->initialize(); +} + diff --git a/kicker/kicker/buttons/kbutton.h b/kicker/kicker/buttons/kbutton.h new file mode 100644 index 000000000..6de61181f --- /dev/null +++ b/kicker/kicker/buttons/kbutton.h @@ -0,0 +1,50 @@ +/***************************************************************** + +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. + +******************************************************************/ + +#ifndef __kbutton_h__ +#define __kbutton_h__ + +#include "panelbutton.h" + +/** + * Button that contains the PanelKMenu and client menu manager. + */ +class KButton : public PanelPopupButton +{ + Q_OBJECT + +public: + KButton( QWidget *parent ); + ~KButton(); + + void loadConfig( const KConfigGroup& config ); + + virtual void properties(); + +protected: + virtual QString tileName() { return "KMenu"; } + virtual void initPopup(); + virtual QString defaultIcon() const { return "go"; } +}; + +#endif diff --git a/kicker/kicker/buttons/kmenu.desktop b/kicker/kicker/buttons/kmenu.desktop new file mode 100644 index 000000000..be9a0aa68 --- /dev/null +++ b/kicker/kicker/buttons/kmenu.desktop @@ -0,0 +1,132 @@ +[Desktop Entry] +Name=K Menu +Name[af]=K-Kieslys +Name[ar]=قائمة K +Name[be]=Меню KDE +Name[bg]=Главно меню +Name[bn]=কে মেনু +Name[br]=Meuziad K +Name[bs]=K meni +Name[ca]=Menú K +Name[cs]=Nabídka KDE +Name[cy]=Y Ddewislen K +Name[da]=K-Menu +Name[de]=K-Menü +Name[el]=Μενού K +Name[eo]=KDEa Menuo +Name[es]=Menú de KDE +Name[et]=K menüü +Name[eu]=K menua +Name[fa]=گزینگان K +Name[fi]=K-valikko +Name[fr]=Menu K +Name[fy]=K-menu +Name[ga]=Roghchlár K +Name[gl]=Menu de KDE +Name[he]=תפריט K +Name[hr]=KDE izbornik +Name[hu]=KDE menü +Name[is]=K valmynd +Name[it]=Menu K +Name[ja]=K メニュー +Name[ka]=K მენიუ +Name[kk]=K мәзірі +Name[km]=ម៉ឺនុយ K +Name[ko]=KDE 메뉴 +Name[lt]=K meniu +Name[mk]=К-мени +Name[nb]=KDE-meny +Name[nds]=K-Menü +Name[ne]=के मेनु +Name[nl]=K-menu +Name[nn]=K-meny +Name[pa]=K ਮੇਨੂ +Name[pl]=Menu K +Name[pt]=Menu K +Name[pt_BR]=Menu K +Name[ro]=Meniu K +Name[ru]=Меню KDE +Name[rw]=K Ibikubiyemo +Name[se]=K-fállu +Name[sk]=Menu KDE +Name[sl]=Meni KDE-ja +Name[sr]=K-мени +Name[sr@Latn]=K-meni +Name[sv]=K-meny +Name[te]=కె పట్టి +Name[tg]=Менюи KDE +Name[th]=เมนู KDE +Name[tr]=KDE Menüsü +Name[tt]=K-Saylaq +Name[uk]=K Меню +Name[uz]=K-menyu +Name[uz@cyrillic]=К-меню +Name[vi]=Thực đơn KDE +Name[wa]=Dressêye K +Name[zh_CN]=K 菜单 +Name[zh_TW]=K 選單 +Comment=Applications and common actions +Comment[af]=Programme en algemene aksies +Comment[ar]=تطبيقات و أعمال شائعة +Comment[be]=Праграмы і асноўныя дзеянні +Comment[bg]=Главното меню с програмите, системните настройки и всичко останало +Comment[bn]=অ্যাপলিকেশন এবং সাধারণ ক্রিয়াসমূহ +Comment[bs]=Programi i standardne akcije +Comment[ca]=Aplicacions i accions comunes +Comment[cs]=Aplikace a časté činnosti +Comment[csb]=Programë ë pòpùlarné dzejania +Comment[da]=Programmer og sædvanlige handlinger +Comment[de]=Enthält Programme und häufig verwendete Aktionen +Comment[el]=Εφαρμογές και τυπικές ενέργειες +Comment[eo]=Aplikaĵoj kaj komunaj agoj +Comment[es]=Aplicaciones y acciones comunes +Comment[et]=Rakendused ja levinumad toimingud +Comment[eu]=Aplikazioak eta ohiko ekintzak +Comment[fa]=کاربردها و کنشهای مشترک +Comment[fi]=Sovellukset ja yleiset toiminnot +Comment[fr]=Applications et actions communes +Comment[fy]=Applikaasjes en folle foarkommende aksjes +Comment[ga]=Feidhmchláir agus gníomhartha coitianta +Comment[gl]=Aplicacións e accións comuns +Comment[he]=יישומים ופעולות מזדמנות +Comment[hr]=Aplikacije i zajedničke aktivnosti +Comment[hu]=Alkalmazások és általános műveletek +Comment[is]=Forrit og algengar aðgerðir +Comment[it]=Applicazioni e azioni comuni +Comment[ja]=アプリケーションと一般的なアクションのメニュー +Comment[ka]=პროგრამები და საზოგადო ქმედებები +Comment[kk]=Қолданбалар мен жалпы амалдар +Comment[km]=កម្មវិធី និងអំពើទូទៅ +Comment[lt]=Programos ir įprasti veiksmai +Comment[mk]=Апликации и општи дејства +Comment[nb]=Programmer og vanlige handlinger +Comment[nds]=Programmen un allgemeen Akschonen +Comment[ne]=अनुप्रयोग र साझा कार्य +Comment[nl]=Programma's en veelvoorkomende acties +Comment[nn]=Program og vanlege handlingar +Comment[pa]=ਕਾਰਜ ਅਤੇ ਆਮ ਕਾਰਵਾਈਆਂ +Comment[pl]=Programy i popularne czynności +Comment[pt]=Aplicações e acções comuns +Comment[pt_BR]=Aplicativos e ações comuns +Comment[ro]=Aplicații și acțiuni uzuale +Comment[ru]=Приложения и действия +Comment[rw]=Porogaramu n'ibikorwa rusange +Comment[se]=Prográmmat ja dábálaš doaimmat +Comment[sk]=Programy a všeobecné akcie +Comment[sl]=KDE-jev meni s programi in pogostimi dejanji +Comment[sr]=Програми и уобичајене акције +Comment[sr@Latn]=Programi i uobičajene akcije +Comment[sv]=Program och vanliga åtgärder +Comment[tg]=Барномаҳо ва амалҳои умумӣ +Comment[th]=แอพพลิเคชั่น และการกระทำทั่วๆไป +Comment[tr]=Uygulamalar ve ortak eylemler +Comment[tt]=Yazılımnar belän töp ğämällär +Comment[uk]=Програми і загальні дії +Comment[uz]=Dasturlar va umumiy amallar +Comment[uz@cyrillic]=Дастурлар ва умумий амаллар +Comment[vi]=Ứng dụng và thao tác thường làm +Comment[wa]=Programes et comones accions +Comment[zh_CN]=应用程序和公共操作 +Comment[zh_TW]=應用程式與一般動作 +Icon=kmenu +X-KDE-Library=KMenuButton diff --git a/kicker/kicker/buttons/nonkdeappbutton.cpp b/kicker/kicker/buttons/nonkdeappbutton.cpp new file mode 100644 index 000000000..9413e8aaa --- /dev/null +++ b/kicker/kicker/buttons/nonkdeappbutton.cpp @@ -0,0 +1,287 @@ +/***************************************************************** + +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 <qtooltip.h> +#include <qdragobject.h> + +#include <kconfig.h> +#include <kdesktopfile.h> +#include <kapplication.h> +#include <kglobal.h> +#include <krun.h> +#include <kprocess.h> +#include <kmessagebox.h> +#include <klocale.h> +#include <kiconeffect.h> +#include <kdebug.h> + +// the header where the configuration dialog is defined. +#include "exe_dlg.h" + +// our own definition +#include "nonkdeappbutton.h" + +// we include the "moc" file so that the KDE build system knows to create it +#include "nonkdeappbutton.moc" + +// this is one of the two constructors. gets called when creating a new button +// e.g. via the "non-KDE Application" dialog, not one that was saved and then +// restored. +NonKDEAppButton::NonKDEAppButton(const QString& name, + const QString& description, + const QString& filePath, const QString& icon, + const QString &cmdLine, bool inTerm, + QWidget* parent) + : PanelButton(parent, "NonKDEAppButton") // call our superclass's constructor +{ + // call the initialization method + initialize(name, description, filePath, icon, cmdLine, inTerm); + + // and connect the clicked() signal (emitted when the button is activated) + // to the slotExec() slot + // we do this here instead of in initialize(...) since initialize(...) may + // get called later, e.g after reconfiguring it + connect(this, SIGNAL(clicked()), SLOT(slotExec())); +} + +// this constructor is used when restoring a button, usually at startup +NonKDEAppButton::NonKDEAppButton( const KConfigGroup& config, QWidget* parent ) + : PanelButton(parent, "NonKDEAppButton") // call our superclass's constructor +{ + // call the initialization method, this time with values from a config file + initialize(config.readEntry("Name"), + config.readEntry("Description"), + config.readPathEntry("Path"), + config.readEntry("Icon"), + config.readPathEntry("CommandLine"), + config.readBoolEntry("RunInTerminal")); + + // see comment on connect in above constructor + connect(this, SIGNAL(clicked()), SLOT(slotExec())); +} + +void NonKDEAppButton::initialize(const QString& name, + const QString& description, + const QString& filePath, const QString& icon, + const QString &cmdLine, bool inTerm ) +{ + // and now we actually set up most of the member variables with the + // values passed in here. by doing this all in an initialize() method + // we avoid duplicating this code all over the place + nameStr = name; + descStr = description; + pathStr = filePath; + iconStr = icon; + cmdStr = cmdLine; + term = inTerm; + + // now we set the buttons tooltip, title and icon using the appropriate + // set*() methods from the PanelButton class from which we subclass + + // assign the name or the description to a QString called tooltip + QString tooltip = description.isEmpty() ? nameStr : descStr; + + if (tooltip.isEmpty()) + { + // we had nothing, so let's try the path + tooltip = pathStr; + + // and add the command if we have one. + if (!cmdStr.isEmpty()) + { + tooltip += " " + cmdStr; + } + + // set the title to the pathStr + setTitle(pathStr); + } + else + { + // since we have a name or a description (assigned by the user) let's + // use that as the title + setTitle(nameStr.isEmpty() ? descStr : nameStr); + } + + // set the tooltip + QToolTip::add(this, tooltip); + + // set the icon + setIcon(iconStr); +} + +void NonKDEAppButton::saveConfig( KConfigGroup& config ) const +{ + // this is called whenever we change something + // the config object sent in will already be set to the + // right group and file, so we can just start writing + config.writeEntry("Name", nameStr); + config.writeEntry("Description", descStr); + config.writeEntry("RunInTerminal", term); + config.writePathEntry("Path", pathStr); + config.writeEntry("Icon", iconStr); + config.writePathEntry("CommandLine", cmdStr); +} + +void NonKDEAppButton::dragEnterEvent(QDragEnterEvent *ev) +{ + // when something is dragged onto this button, we'll accept it + // if we aren't dragged onto ourselves, and if it's a URL + if ((ev->source() != this) && KURLDrag::canDecode(ev)) + { + ev->accept(rect()); + } + else + { + ev->ignore(rect()); + } + + // and now let the PanelButton do as it wishes with it... + PanelButton::dragEnterEvent(ev); +} + +void NonKDEAppButton::dropEvent(QDropEvent *ev) +{ + // something has been droped on us! + KURL::List fileList; + QString execStr; + if (KURLDrag::decode(ev, fileList)) + { + // according to KURLDrag, we've successfully retrieved + // one or more URLs! now we iterate over them one by + // one .... + for (KURL::List::ConstIterator it = fileList.begin(); + it != fileList.end(); + ++it) + { + const KURL &url(*it); + if (KDesktopFile::isDesktopFile(url.path())) + { + // this URL is actually a .desktop file, so let's grab + // the URL it actually points to ... + KDesktopFile deskFile(url.path()); + deskFile.setDesktopGroup(); + + // ... and add it to the exec string + execStr += KProcess::quote(deskFile.readURL()) + " "; + } + else + { + // it's just a URL of some sort, add it directly to the exec + execStr += KProcess::quote(url.path()) + " "; + } + } + + // and now run the command + runCommand(execStr); + } + + // and let PanelButton clean up + PanelButton::dropEvent(ev); +} + +void NonKDEAppButton::slotExec() +{ + // the button was clicked, let's take some action + runCommand(); +} + +void NonKDEAppButton::runCommand(const QString& execStr) +{ + // run our command! this method is used both by the drag 'n drop + // facilities as well as when the button is activated (usualy w/a click) + + // we'll use the "result" variable to record our success/failure + bool result; + + // since kicker doesn't listen to or use the session manager, we have + // to make sure that our environment is set up correctly. this is + // accomlplished by doing: + kapp->propagateSessionManager(); + + if (term) + { + // run in a terminal? ok! we find this in the config file in the + // [misc] group (this will usually be in kdeglobal, actually, which + // get merged into the application config automagically for us + KConfig *config = KGlobal::config(); + config->setGroup("misc"); + QString termStr = config->readPathEntry("Terminal", "konsole"); + + // and now we run the darn thing and store how we fared in result + result = KRun::runCommand(termStr + " -e " + pathStr + " " + + cmdStr + " " + execStr, + pathStr, iconStr); + } + else + { + // just run it... + result = KRun::runCommand(pathStr + " " + cmdStr + " " + execStr, + pathStr, iconStr); + } + + if (!result) + { + // something went wrong, so let's show an error msg to the user + KMessageBox::error(this, i18n("Cannot execute non-KDE application."), + i18n("Kicker Error")); + return; + } +} + +void NonKDEAppButton::updateSettings(PanelExeDialog* dlg) +{ + // we were reconfigured via the confiugration dialog + // re-setup our member variables using initialize(...), + // this time using values from the dlg + initialize(dlg->title(), dlg->description(), dlg->command(), + dlg->iconPath(), dlg->commandLine(), dlg->useTerminal()); + + // now delete the dialog so that it doesn't leak memory + delete dlg; + + // and emit a signal that the container that houses us + // listens for so it knows when to start the process to + // save our configuration + emit requestSave(); +} + +void NonKDEAppButton::properties() +{ + // the user has requested to configure this button + // this method gets called by the ButtonContainer that houses the button + // see ButtonContainer::eventFilter(QObject *o, QEvent *e), where the + // context menu is created and dealt with. + + // so we create a new config dialog .... + PanelExeDialog* dlg = new PanelExeDialog(nameStr, descStr, pathStr, + iconStr, cmdStr, term, this); + + // ... connect the signal it emits when it has data for us to save + // to our updateSettings slot (see above) ... + connect(dlg, SIGNAL(updateSettings(PanelExeDialog*)), this, + SLOT(updateSettings(PanelExeDialog*))); + + // ... and then show it to the user + dlg->show(); +} + diff --git a/kicker/kicker/buttons/nonkdeappbutton.h b/kicker/kicker/buttons/nonkdeappbutton.h new file mode 100644 index 000000000..bbb74c892 --- /dev/null +++ b/kicker/kicker/buttons/nonkdeappbutton.h @@ -0,0 +1,92 @@ +/***************************************************************** + +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. + +******************************************************************/ + +#ifndef __nonkdeappbutton_h__ +#define __nonkdeappbutton_h__ + +// pull in the superclass's definition +#include "panelbutton.h" + +// forward declare this class +// lets the compiler know it exists without have to know all the gory details +class PanelExeDialog; + +/** + * Button that contains a non-KDE application + * subclass of PanelButton + */ +class NonKDEAppButton : public PanelButton +{ + // the Q_OBJECT macro provides the magic glue for signals 'n slots + Q_OBJECT + +public: + // define our two constructors, one used for creating new buttons... + NonKDEAppButton(const QString& name, const QString& description, + const QString& filePath, const QString& icon, + const QString& cmdLine, bool inTerm, QWidget* parent); + + // ... and once for restoring them at start up + NonKDEAppButton(const KConfigGroup& config, QWidget* parent); + + // reimplemented from PanelButton + virtual void saveConfig(KConfigGroup& config) const; + virtual void properties(); + +protected slots: + // called when the button is activated + void slotExec(); + + // called after the user reconfigures something + void updateSettings(PanelExeDialog* dlg); + +protected: + // used to set up our internal state, either when creating the button + // or after reconfiguration + void initialize(const QString& name, const QString& description, + const QString& filePath, const QString& icon, + const QString& cmdLine, bool inTerm); + + // run the command! + // the execStr parameter, which default to an empty string, + // is used to provide additional command line options aside + // from the ones in our config file; for instance a URL drag'd onto us + void runCommand(const QString& execStr = QString::null); + + // reimplemented from PanelButton + virtual QString tileName() { return "URL"; } + QString defaultIcon() const { return "exec"; }; + + // handle drag and drop actions + virtual void dropEvent(QDropEvent *ev); + virtual void dragEnterEvent(QDragEnterEvent *ev); + + QString nameStr; // the name given this button by the user + QString descStr; // the description given this button by the user + QString pathStr; // the path to the command + QString iconStr; // the path to the icon for this button + QString cmdStr; // command line flags, if any + bool term; // whether to run this in a terminal or not +}; // all done defining the class! + +#endif diff --git a/kicker/kicker/buttons/servicebutton.cpp b/kicker/kicker/buttons/servicebutton.cpp new file mode 100644 index 000000000..a5ec7c9a2 --- /dev/null +++ b/kicker/kicker/buttons/servicebutton.cpp @@ -0,0 +1,262 @@ +/***************************************************************** + +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 <qtooltip.h> + +#include <kdesktopfile.h> +#include <klocale.h> +#include <kiconeffect.h> +#include <kicontheme.h> +#include <kpropertiesdialog.h> +#include <krun.h> +#include <kstandarddirs.h> +#include <kurl.h> + +#include "global.h" +#include "kicker.h" + +#include "servicebutton.h" +#include "servicebutton.moc" + +ServiceButton::ServiceButton(const QString& desktopFile, QWidget* parent) + : PanelButton(parent, "ServiceButton"), + _service(0) +{ + loadServiceFromId(desktopFile); + initialize(); +} + +ServiceButton::ServiceButton(const KService::Ptr &service, QWidget* parent) + : PanelButton(parent, "ServiceButton"), + _service(service), + _id(service->storageId()) +{ + if (_id.startsWith("/")) + { + QString tmp = KGlobal::dirs()->relativeLocation("appdata", _id); + if (!tmp.startsWith("/")) + _id = ":"+tmp; + } + initialize(); +} + +ServiceButton::ServiceButton( const KConfigGroup& config, QWidget* parent ) + : PanelButton(parent, "ServiceButton"), + _service(0) +{ + QString id; + if (config.hasKey("StorageId")) + id = config.readPathEntry("StorageId"); + else + id = config.readPathEntry("DesktopFile"); + loadServiceFromId(id); + initialize(); +} + +ServiceButton::~ServiceButton() +{ +} + +void ServiceButton::loadServiceFromId(const QString &id) +{ + _id = id; + /* this is a KService::Ptr + don't need to delete it + delete _service; + */ + _service = 0; + + if (_id.startsWith(":")) + { + _id = locate("appdata", id.mid(1)); + if (!_id.isEmpty()) + { + KDesktopFile df(_id, true); + _service = new KService(&df); + } + } + else + { + _service = KService::serviceByStorageId(_id); + if (_service) + { + _id = _service->storageId(); + } + } + + if (_service) + { + backedByFile(_service->desktopEntryPath()); + } + + if (_id.startsWith("/")) + { + QString tmp = KGlobal::dirs()->relativeLocation("appdata", _id); + if (!tmp.startsWith("/")) + _id = ":"+tmp; + } +} + +void ServiceButton::initialize() +{ + readDesktopFile(); + connect(this, SIGNAL(clicked()), SLOT(slotExec())); +} + +void ServiceButton::readDesktopFile() +{ + if ( !_service || !_service->isValid() ) + { + m_valid = false; + return; + } + + if (!_service->genericName().isEmpty()) + { + QToolTip::add(this, _service->genericName()); + } + else if (_service->comment().isEmpty()) + { + QToolTip::add(this, _service->name()); + } + else + { + QToolTip::add(this, _service->name() + " - " + _service->comment()); + } + + setTitle( _service->name() ); + setIcon( _service->icon() ); +} + +void ServiceButton::saveConfig( KConfigGroup& config ) const +{ + config.writePathEntry("StorageId", _id ); + if (!config.hasKey("DesktopFile") && _service) + config.writePathEntry("DesktopFile", _service->desktopEntryPath()); +} + +void ServiceButton::dragEnterEvent(QDragEnterEvent *ev) +{ + if ((ev->source() != this) && KURLDrag::canDecode(ev)) + ev->accept(rect()); + else + ev->ignore(rect()); + PanelButton::dragEnterEvent(ev); +} + +void ServiceButton::dropEvent( QDropEvent* ev ) +{ + KURL::List uriList; + if( KURLDrag::decode( ev, uriList ) && _service ) { + kapp->propagateSessionManager(); + KRun::run( *_service, uriList ); + } + PanelButton::dropEvent(ev); +} + +void ServiceButton::startDrag() +{ + QString path = _service->desktopEntryPath(); + + // If the path to the desktop file is relative, try to get the full + // path from KStdDirs. + path = locate("apps", path); + + KURL url; + url.setPath(path); + emit dragme(KURL::List(url), labelIcon()); +} + +void ServiceButton::slotExec() +{ + // this allows the button to return to a non-pressed state + // before launching + QTimer::singleShot(0, this, SLOT(performExec())); +} + +void ServiceButton::performExec() +{ + if (!_service) return; + + KURL::List uriList; + kapp->propagateSessionManager(); + KRun::run( *_service, uriList ); +} + +void ServiceButton::properties() +{ + if (!_service) + { + return; + } + + QString path = _service->desktopEntryPath(); + + // If the path to the desktop file is relative, try to get the full + // path from KStdDirs. + path = locate("apps", path); + KURL serviceURL; + serviceURL.setPath(path); + + // the KPropertiesDialog deletes itself, so this isn't a memory leak + KPropertiesDialog* dialog = new KPropertiesDialog(serviceURL, 0, 0, + false, false); + dialog->setFileNameReadOnly(true); + connect(dialog, SIGNAL(saveAs(const KURL &, KURL &)), + this, SLOT(slotSaveAs(const KURL &, KURL &))); + connect(dialog, SIGNAL(propertiesClosed()), + this, SLOT(slotUpdate())); + dialog->show(); +} + +void ServiceButton::slotUpdate() +{ + loadServiceFromId(_id); + readDesktopFile(); + emit requestSave(); +} + +void ServiceButton::slotSaveAs(const KURL &oldUrl, KURL &newUrl) +{ + QString oldPath = oldUrl.path(); + if (locateLocal("appdata", oldUrl.fileName()) != oldPath) + { + QString path = KickerLib::newDesktopFile(oldUrl); + newUrl.setPath(path); + _id = path; + } +} + +bool ServiceButton::checkForBackingFile() +{ + QString id = _id; + loadServiceFromId(_id); + + // we need to reset the _id back to whatever it was + // so that when we get called again to check on it we + // know still know what to be looking for. + _id = id; + + return _service != 0; +} diff --git a/kicker/kicker/buttons/servicebutton.h b/kicker/kicker/buttons/servicebutton.h new file mode 100644 index 000000000..26f32791a --- /dev/null +++ b/kicker/kicker/buttons/servicebutton.h @@ -0,0 +1,66 @@ +/***************************************************************** + +Copyright (c) 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 __ServiceButton_h__ +#define __ServiceButton_h__ + +#include "panelbutton.h" + +#include <kservice.h> + +class ServiceButton : public PanelButton +{ + Q_OBJECT + +public: + ServiceButton( const QString& desktopFile, QWidget* parent ); + ServiceButton( const KService::Ptr& service, QWidget* parent ); + ServiceButton( const KConfigGroup& config, QWidget* parent ); + + ~ServiceButton(); + + virtual void saveConfig(KConfigGroup& config) const; + virtual void properties(); + +protected slots: + void slotUpdate(); + void slotSaveAs(const KURL&, KURL&); + void slotExec(); + void performExec(); + +protected: + void initialize(); + void loadServiceFromId(const QString &id); + void readDesktopFile(); + virtual QString tileName() { return "URL"; } + virtual void startDrag(); + virtual void dropEvent(QDropEvent *); + virtual void dragEnterEvent(QDragEnterEvent *); + QString defaultIcon() const { return "exec"; }; + bool checkForBackingFile(); + + KService::Ptr _service; + QString _id; +}; + +#endif diff --git a/kicker/kicker/buttons/servicemenubutton.cpp b/kicker/kicker/buttons/servicemenubutton.cpp new file mode 100644 index 000000000..e3fc41185 --- /dev/null +++ b/kicker/kicker/buttons/servicemenubutton.cpp @@ -0,0 +1,96 @@ +/***************************************************************** + +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 <qtooltip.h> + +#include <kconfig.h> +#include <kservicegroup.h> +#include <klocale.h> + +#include "service_mnu.h" + +#include "servicemenubutton.h" +#include "servicemenubutton.moc" + +ServiceMenuButton::ServiceMenuButton( const QString& relPath, QWidget* parent ) + : PanelPopupButton( parent, "ServiceMenuButton" ) + , topMenu( 0 ) +{ + initialize( relPath ); +} + +ServiceMenuButton::ServiceMenuButton( const KConfigGroup& config, QWidget* parent ) + : PanelPopupButton( parent, "ServiceMenuButton" ) + , topMenu( 0 ) +{ + initialize( config.readPathEntry("RelPath") ); +} + +void ServiceMenuButton::initialize( const QString& relPath ) +{ + KServiceGroup::Ptr group = KServiceGroup::group( relPath ); + + if (!group || !group->isValid()) + { + m_valid = false; + return; + } + + QString caption = group->caption(); + if (caption.isEmpty()) + { + caption = i18n("Applications"); + } + + QString comment = group->comment(); + if (comment.isEmpty()) + { + comment = caption; + } + + topMenu = new PanelServiceMenu(caption, relPath); + setPopup(topMenu); + QToolTip::add(this, comment); + setTitle(caption); + setIcon(group->icon()); +} + +void ServiceMenuButton::saveConfig( KConfigGroup& config ) const +{ + if (topMenu) + config.writePathEntry("RelPath", topMenu->relPath()); +} + +void ServiceMenuButton::initPopup() +{ + if( !topMenu->initialized() ) { + topMenu->reinitialize(); + } +} + +void ServiceMenuButton::startDrag() +{ + KURL url("programs:/" + topMenu->relPath()); + emit dragme(KURL::List(url), labelIcon()); +} + diff --git a/kicker/kicker/buttons/servicemenubutton.h b/kicker/kicker/buttons/servicemenubutton.h new file mode 100644 index 000000000..1bd9d1885 --- /dev/null +++ b/kicker/kicker/buttons/servicemenubutton.h @@ -0,0 +1,54 @@ +/***************************************************************** + +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. + +******************************************************************/ + +#ifndef __servicemenubutton_h__ +#define __servicemenubutton_h__ + +#include "panelbutton.h" + +class PanelServiceMenu; + +/** + * Button that contains a Service menu + */ +class ServiceMenuButton : public PanelPopupButton +{ + Q_OBJECT + +public: + ServiceMenuButton( const QString& relPath, QWidget* parent ); + ServiceMenuButton( const KConfigGroup& config, QWidget* parent ); + + void saveConfig( KConfigGroup& config ) const; + +protected: + void initialize( const QString& relPath ); + virtual QString tileName() { return "Browser"; } + virtual QString defaultIcon() const { return "folder"; } + virtual void startDrag(); + virtual void initPopup(); + + PanelServiceMenu* topMenu; +}; + +#endif diff --git a/kicker/kicker/buttons/urlbutton.cpp b/kicker/kicker/buttons/urlbutton.cpp new file mode 100644 index 000000000..007b0cc00 --- /dev/null +++ b/kicker/kicker/buttons/urlbutton.cpp @@ -0,0 +1,201 @@ +/***************************************************************** + +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 <qtooltip.h> +#include <qfile.h> + +#include <kdesktopfile.h> +#include <kfileitem.h> +#include <konq_operations.h> +#include <kicontheme.h> +#include <kglobal.h> +#include <kiconeffect.h> +#include <kpropertiesdialog.h> +#include <kiconloader.h> +#include <kmessagebox.h> +#include <krun.h> +#include <klocale.h> + +#include <kdebug.h> + +#include "global.h" +#include "kicker.h" + +#include "urlbutton.h" +#include "urlbutton.moc" + +URLButton::URLButton( const QString& url, QWidget* parent ) + : PanelButton( parent, "URLButton" ) + , fileItem( 0 ) + , pDlg( 0 ) +{ + initialize( url ); +} + +URLButton::URLButton( const KConfigGroup& config, QWidget* parent ) + : PanelButton( parent, "URLButton" ) + , fileItem( 0 ) + , pDlg( 0 ) +{ + initialize( config.readPathEntry("URL") ); +} + +URLButton::~URLButton() +{ + delete fileItem; +} + +void URLButton::initialize( const QString& _url ) +{ + KURL url(_url); + if (!url.isLocalFile() || !url.path().endsWith(".desktop")) + { + QString file = KickerLib::newDesktopFile(url); + KDesktopFile df(file); + df.writeEntry("Encoding", "UTF-8"); + df.writeEntry("Type","Link"); + df.writeEntry("Name", url.prettyURL()); + if (url.isLocalFile()) + { + KFileItem item( KFileItem::Unknown, KFileItem::Unknown, url ); + df.writeEntry("Icon", item.iconName() ); + } + else + { + df.writeEntry("Icon", KMimeType::favIconForURL(url)); + } + df.writeEntry("URL", url.url()); + url = KURL(); + url.setPath(file); + } + fileItem = new KFileItem( KFileItem::Unknown, KFileItem::Unknown, url ); + setIcon( fileItem->iconName() ); + connect( this, SIGNAL(clicked()), SLOT(slotExec()) ); + setToolTip(); + + if (url.isLocalFile()) + { + backedByFile(url.path()); + } +} + +void URLButton::saveConfig( KConfigGroup& config ) const +{ + config.writePathEntry("URL", fileItem->url().prettyURL()); +} + +void URLButton::setToolTip() +{ + if (fileItem->isLocalFile() + && KDesktopFile::isDesktopFile(fileItem->url().path())) + { + KDesktopFile df(fileItem->url().path()); + + if (df.readComment().isEmpty()) + { + QToolTip::add(this, df.readName()); + } + else + { + QToolTip::add(this, df.readName() + " - " + df.readComment()); + } + + setTitle(df.readName()); + } + else + { + QToolTip::add(this, fileItem->url().prettyURL()); + setTitle(fileItem->url().prettyURL()); + } +} + +void URLButton::dragEnterEvent(QDragEnterEvent *ev) +{ + if ((ev->source() != this) && fileItem->acceptsDrops() && KURLDrag::canDecode(ev)) + ev->accept(rect()); + else + ev->ignore(rect()); + PanelButton::dragEnterEvent(ev); +} + +void URLButton::dropEvent(QDropEvent *ev) +{ + kapp->propagateSessionManager(); + KURL::List execList; + if(KURLDrag::decode(ev, execList)){ + KURL url( fileItem->url() ); + if(!execList.isEmpty()) { + if (KDesktopFile::isDesktopFile(url.path())){ + KApplication::startServiceByDesktopPath(url.path(), execList.toStringList(), + 0, 0, 0, "", true); + } + else // attempt to interpret path as directory + { + KonqOperations::doDrop( fileItem, url, ev, this ); + } + } + } + PanelButton::dropEvent(ev); +} + +void URLButton::startDrag() +{ + emit dragme(KURL::List(fileItem->url()), labelIcon()); +} + +void URLButton::slotExec() +{ + kapp->propagateSessionManager(); + fileItem->run(); +} + +void URLButton::updateURL() +{ + if (pDlg->kurl() != fileItem->url()) { + fileItem->setURL(pDlg->kurl()); + setIcon(fileItem->iconName()); + setToolTip(); + emit requestSave(); + } else { + setIcon(fileItem->iconName()); + setToolTip(); + } + + pDlg = 0L; +} + +void URLButton::properties() +{ + if ( (fileItem->isLocalFile() && !QFile::exists(fileItem->url().path()) ) + || !fileItem->url().isValid()) + { + KMessageBox::error( 0L, i18n("The file %1 does not exist") + .arg(fileItem->url().prettyURL()) ); + return; + } + + pDlg = new KPropertiesDialog(fileItem, 0L, 0L, false, false); // will delete itself + pDlg->setFileNameReadOnly(true); + connect(pDlg, SIGNAL(applied()), SLOT(updateURL())); + pDlg->show(); +} diff --git a/kicker/kicker/buttons/urlbutton.h b/kicker/kicker/buttons/urlbutton.h new file mode 100644 index 000000000..e6f6b12e0 --- /dev/null +++ b/kicker/kicker/buttons/urlbutton.h @@ -0,0 +1,65 @@ +/***************************************************************** + +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. + +******************************************************************/ + +#ifndef __urlbutton_h__ +#define __urlbutton_h__ + +#include "panelbutton.h" + +class KFileItem; +class KPropertiesDialog; + +/** + * Simple URL button (files, whatever) + */ +class URLButton : public PanelButton +{ + Q_OBJECT + +public: + URLButton( const QString& url, QWidget* parent ); + URLButton( const KConfigGroup& config, QWidget* parent ); + + virtual ~URLButton(); + + void saveConfig( KConfigGroup& config ) const; + + virtual void properties(); + +protected slots: + void slotExec(); + void updateURL(); + +protected: + void initialize( const QString& url ); + virtual QString tileName() { return "URL"; } + virtual void startDrag(); + virtual void dropEvent(QDropEvent *); + virtual void dragEnterEvent(QDragEnterEvent *); + void setToolTip(); + + KFileItem *fileItem; + KPropertiesDialog *pDlg; +}; + +#endif diff --git a/kicker/kicker/buttons/windowlist.desktop b/kicker/kicker/buttons/windowlist.desktop new file mode 100644 index 000000000..c4b7c9579 --- /dev/null +++ b/kicker/kicker/buttons/windowlist.desktop @@ -0,0 +1,130 @@ +[Desktop Entry] +Name=Window List Menu +Name[af]=Venster Lys Kieslys +Name[ar]=قائمة عرض النوافذ +Name[be]=Меню спіса вокнаў +Name[bg]=Списък с прозорците +Name[bn]=উইণ্ডো তালিকা মেনু +Name[br]=Meuziad listenn ar prenester +Name[bs]=Meni sa spiskom prozora +Name[ca]=Menú de la llista de finestres +Name[cs]=Nabídka seznamu oken +Name[csb]=Menu z lëstą òknów +Name[cy]=Dewislen Rhestr Ffenestri +Name[da]=Vindueslistemenu +Name[de]=Fensterliste +Name[el]=Μενού λίστας παραθύρων +Name[eo]=Fenestrolista Menuo +Name[es]=Menú de la lista de ventanas +Name[et]=Akende nimekirja menüü +Name[eu]=Leiho zerrendaren menua +Name[fa]=گزینگان فهرست پنجره +Name[fi]=Ikkunaluettelovalikko +Name[fr]=Liste des fenêtres +Name[fy]=Finsterlistmenu +Name[gl]=Lista de Fiestras +Name[he]=תפריט רשימת חלונות +Name[hr]=Izbornik popisa prozora +Name[hu]=Ablaklista menü +Name[is]=Gluggalista valmynd +Name[it]=Menu elenco delle finestre +Name[ja]=ウィンドウリストメニュー +Name[ka]=ფანჯრების სიის მენიუ +Name[kk]=Терезелер тізімінің мәзірі +Name[km]=ម៉ឺនុយបញ្ជីបង្អួច +Name[lt]=Langų sąrašo meniu +Name[mk]=Мени со листа на прозорци +Name[nb]=Vinduslistemeny +Name[nds]=Finsterlist +Name[ne]=सञ्झ्याल सूची मेनु +Name[nl]=Vensterlijstmenu +Name[nn]=Vindaugslistemeny +Name[pa]=ਝਰੋਖਾ ਸੂਚੀ ਮੇਨੂ +Name[pl]=Menu z listą okien +Name[pt]=Menu da Lista de Janelas +Name[pt_BR]=Menu de Lista de Janelas +Name[ro]=Meniu listă de ferestre +Name[ru]=Список окон +Name[rw]=Ibikubiyemo Rutonde by'Idirishya +Name[se]=Láselistofállu +Name[sk]=Menu zoznamu okien +Name[sl]=Meni s seznamom oken +Name[sr]=Мени листе прозора +Name[sr@Latn]=Meni liste prozora +Name[sv]=Fönsterlistmeny +Name[te]=విండొల జాబితా పట్టి +Name[tg]=Менюи рӯйхати равзанаҳо +Name[th]=เมนูแสดงรายการหน้าต่าง +Name[tr]=Pencere Listeleme Menüsü +Name[tt]=Täräzä Tezmäse Saylağı +Name[uk]=Меню списку вікон +Name[uz]=Oynalar roʻyxati +Name[uz@cyrillic]=Ойналар рўйхати +Name[vi]=Thực đơn Liệt kê Cửa sổ +Name[wa]=Dressêye del djivêye des purneas +Name[zh_CN]=窗口列表菜单 +Name[zh_TW]=視窗列表選單 +Comment=A menu that lists all open windows +Comment[af]='n Kieslys wat al die oop vensters vertoon +Comment[ar]=قائمة لعرض كل النوافذ المفتوحة +Comment[be]=Меню, якое паказвае усе адкрытыя вокны +Comment[bg]=Меню-списък, което съдържа всички отворени прозорци +Comment[bn]=একটি মেনু যা সমস্ত খোলা উইণ্ডো তালিকাবদ্ধ করে +Comment[bs]=Meni u kojem su navedeni svi trenutno otvoreni prozori +Comment[ca]=Un menú que llista totes les finestres obertes +Comment[cs]=Nabídka se seznamem otevřených oken +Comment[csb]=Menu pòkazëwôjącé wszëstczé otemkłé òkna +Comment[da]=En menu der lister alle åbne vinduer +Comment[de]=Dieses Menü zeigt alle geöffneten Fenster an +Comment[el]=Ένα μενού που εμφανίζει όλα τα ανοικτά παράθυρα +Comment[eo]=Menuo kiu listigas ĉiujn malfermitajn fenestrojn +Comment[es]=Un menú que muestra todas las ventanas abiertas +Comment[et]=Menüü, mis näitab kõiki avatud aknaid +Comment[eu]=Leiho irekien zerrenda bistaratzen duen menua +Comment[fa]=گزینگانی که همۀ پنجرههای باز را فهرست میکند +Comment[fi]=Valikko, jossa on luettelo kaikista avoimista ikkunoista +Comment[fr]=Un menu affichant l'ensemble des fenêtres ouvertes +Comment[fy]=In menu mei in list fan alle iepensteande finsters +Comment[ga]=Roghchlár le gach fuinneog atá oscailte +Comment[gl]=Un menu que lista todas as fiestras abertas +Comment[he]=תפריט המציג את רשימת כל החלונות הפתוחים +Comment[hr]=Izbornik s popisom svih otvorenih prozora +Comment[hu]=Menü a nyitott ablakok kilistázásához +Comment[is]=Valmynd sem sýnir alla opna glugga +Comment[it]=Un menu che mostra tutte le finestre aperte +Comment[ja]=開いているすべてのウィンドウのリストを表示するメニュー +Comment[ka]=ყველა გახსნილი ფანჯრის სიის მენიუ +Comment[kk]=Барлық ашық терезелердің мәзір тізімі +Comment[km]=ម៉ឺនុយដែលរាយបង្អួចបើកទាំងអស់ +Comment[lt]=Visų atvertų langų sąrašą pateikiantis meniu +Comment[mk]=Мени што ги листа сите отворени прозорци +Comment[nb]=En meny som viser alle åpne vinduer +Comment[nds]=En Menü, dat all apen Finstern oplist +Comment[ne]=सबै खुला सञ्झ्यालहरू सूचीकृत गर्ने मेनु +Comment[nl]=Een menu met een lijst van alle geopende vensters +Comment[nn]=Ein meny som viser alle opne vindauge +Comment[pa]=ਸਭ ਖੁੱਲੇ ਝਰੋਖਿਆਂ ਦੀ ਸੂਚੀ ਲਈ ਇੱਕ ਮੇਨੂ ਹੈ +Comment[pl]=Menu pokazujące wszystkie otwarte okna +Comment[pt]=Um menu que mostra todas as janelas abertas +Comment[pt_BR]=Um menu que lista todas as janelas abertas +Comment[ro]=Un meniu ce listează toate ferestrele deschise +Comment[ru]=Список всех открытых окон +Comment[rw]=Ibikubiyemo bitanga urutonde w'amadirishya yose afunguye +Comment[se]=Fállu mas oidnot buot rabas láset +Comment[sk]=Menu, ktoré zobrazí zoznam okien +Comment[sl]=Meni, ki prikazuje seznam vseh odprtih oken +Comment[sr]=Мени који листа све отворене прозоре +Comment[sr@Latn]=Meni koji lista sve otvorene prozore +Comment[sv]=En meny som listar alla öppna fönster +Comment[th]=เมนูที่แสดงรายการหน้าต่างที่เปิดอยู่ทั้งหมด +Comment[tr]=Bütün Pencereleri listeleyen bir menü +Comment[tt]=Bar açıq täräzä tezmäse belän saylaq +Comment[uk]=Меню, яке дає перелік всіх відкритих вікон +Comment[uz]=Hamma ochiq oynalar roʻyxati +Comment[uz@cyrillic]=Ҳамма очиқ ойналар рўйхати +Comment[vi]=Một thực đơn liệt kê tất cả các cửa sổ đang mở +Comment[wa]=Ene dressêye ki fwait l' djivêye di tos les drovîs purneas +Comment[zh_CN]=列出打开的全部窗口的菜单 +Comment[zh_TW]=一個列出所有開啟視窗的選單 +Icon=window_list +X-KDE-Library=WindowListButton diff --git a/kicker/kicker/buttons/windowlistbutton.cpp b/kicker/kicker/buttons/windowlistbutton.cpp new file mode 100644 index 000000000..8a60ca5e8 --- /dev/null +++ b/kicker/kicker/buttons/windowlistbutton.cpp @@ -0,0 +1,47 @@ +/***************************************************************** + +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 <qtooltip.h> + +#include <kwindowlistmenu.h> +#include <klocale.h> + +#include "windowlistbutton.h" +#include "windowlistbutton.moc" + +WindowListButton::WindowListButton( QWidget* parent ) + : PanelPopupButton( parent, "WindowListButton" ) + , topMenu( 0 ) +{ + topMenu = new KWindowListMenu( this ); + setPopup(topMenu); + + setTitle(i18n("Window List")); + QToolTip::add(this, i18n("Window list")); + setIcon("window_list"); +} + +void WindowListButton::initPopup() +{ + topMenu->init(); +} diff --git a/kicker/kicker/buttons/windowlistbutton.h b/kicker/kicker/buttons/windowlistbutton.h new file mode 100644 index 000000000..23dc26c19 --- /dev/null +++ b/kicker/kicker/buttons/windowlistbutton.h @@ -0,0 +1,48 @@ +/***************************************************************** + +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. + +******************************************************************/ + +#ifndef __windowlistbutton_h__ +#define __windowlistbutton_h__ + +#include "panelbutton.h" + +class KWindowListMenu; + +/** + * Button that contains a windowlist menu + */ +class WindowListButton : public PanelPopupButton +{ + Q_OBJECT + +public: + WindowListButton( QWidget* parent ); + +protected: + virtual QString tileName() { return "WindowList"; } + virtual void initPopup(); + + KWindowListMenu* topMenu; +}; + +#endif |