From 4aed2c8219774f5d797760606b8489a92ddc5163 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kicker/menuext/recentdocs/Makefile.am | 15 +++ kicker/menuext/recentdocs/recentdocs.desktop | 140 +++++++++++++++++++++++++++ kicker/menuext/recentdocs/recentdocsmenu.cpp | 139 ++++++++++++++++++++++++++ kicker/menuext/recentdocs/recentdocsmenu.h | 55 +++++++++++ 4 files changed, 349 insertions(+) create mode 100644 kicker/menuext/recentdocs/Makefile.am create mode 100644 kicker/menuext/recentdocs/recentdocs.desktop create mode 100644 kicker/menuext/recentdocs/recentdocsmenu.cpp create mode 100644 kicker/menuext/recentdocs/recentdocsmenu.h (limited to 'kicker/menuext/recentdocs') diff --git a/kicker/menuext/recentdocs/Makefile.am b/kicker/menuext/recentdocs/Makefile.am new file mode 100644 index 000000000..38f95814b --- /dev/null +++ b/kicker/menuext/recentdocs/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = $(all_includes) + +kde_module_LTLIBRARIES = kickermenu_recentdocs.la + +kickermenu_recentdocs_la_SOURCES = recentdocsmenu.cpp +kickermenu_recentdocs_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined +kickermenu_recentdocs_la_LIBADD = $(LIB_KDEUI) $(LIB_KIO) + +kickermenu_recentdocs_la_METASOURCES = AUTO + +desktopmenu_DATA = recentdocs.desktop +desktopmenudir = $(kde_datadir)/kicker/menuext + +messages: + $(XGETTEXT) *.cpp -o $(podir)/libkickermenu_recentdocs.pot diff --git a/kicker/menuext/recentdocs/recentdocs.desktop b/kicker/menuext/recentdocs/recentdocs.desktop new file mode 100644 index 000000000..a2f406079 --- /dev/null +++ b/kicker/menuext/recentdocs/recentdocs.desktop @@ -0,0 +1,140 @@ +[Desktop Entry] +Name=Recent Documents +Name[af]=Onlangse Dokumente +Name[ar]=مستندات حديثة +Name[az]=Son Sənədlər +Name[be]=Ранейшыя дакументы +Name[bg]=Документи +Name[bn]=সম্প্রতি ব্যবহৃত নথী +Name[br]=Teulioù nevez +Name[bs]=Najnoviji dokumenti +Name[ca]=Documents recents +Name[cs]=Nedávné dokumenty +Name[csb]=Slédno òtemkłé dokùmentë +Name[cy]=Dogfenni Diweddar +Name[da]=Nylige dokumenter +Name[de]=Zuletzt geöffnete Dokumente +Name[el]=Πρόσφατα έγγραφα +Name[eo]=Lastaj dokumentoj +Name[es]=Documentos recientes +Name[et]=Viimati kasutatud dokumendid +Name[eu]=Azken dokumentuak +Name[fa]=سندهای اخیر +Name[fi]=Viimeaikaiset asiakirjat +Name[fr]=Documents récents +Name[fy]=Nijste dokuminten +Name[ga]=Cáipéisí is déanaí +Name[gl]=Documentos Recentes +Name[he]=מסמכים אחרונים +Name[hi]=हालिया दस्तावेज़ +Name[hr]=Nedavno pristupljeni dokumenti +Name[hu]=A legutóbbi dokumentumok +Name[is]=Nýleg skjöl +Name[it]=Documenti recenti +Name[ja]=最近開いたドキュメント +Name[ka]=ბოლო დოკუმენტები +Name[kk]=Жуырдағы құжаттар +Name[km]=ឯកសារ​ថ្មីៗ​នេះ +Name[lo]=ເອກະສານຂໍ້ຄວາມ +Name[lt]=Neseni dokumentai +Name[lv]=Nesenie dokumenti +Name[mk]=Скорешни документи +Name[mn]=Сүүлд нээгдсэн баримтууд +Name[ms]=Dokumen Terkini +Name[mt]=Dokumenti riċenti +Name[nb]=Nylig brukte dokumenter +Name[nds]=Tolest bruukte Dokmenten +Name[ne]=हालको कागजात +Name[nl]=Recente documenten +Name[nn]=Nyleg bruka dokument +Name[nso]=Ditokomane tsa Gabjale +Name[pa]=ਤਾਜ਼ਾ ਦਸਤਾਵੇਜ਼ +Name[pl]=Ostatnio otwarte dokumenty +Name[pt]=Documentos Recentes +Name[pt_BR]=Documentos Recentes +Name[ro]=Documente recente +Name[ru]=Последние документы +Name[rw]=Inyandiko za Vuba +Name[se]=Áiddo geavahuvvon dokumeanttat +Name[sk]=Nedávne dokumenty +Name[sl]=Nedavni dokumenti +Name[sr]=Пређашњи документи +Name[sr@Latn]=Pređašnji dokumenti +Name[sv]=Senaste dokument +Name[ta]=தற்போதைய ஆவணங்கள் +Name[tg]=Ҳуҷҷатҳои охирин +Name[th]=เอกสารที่เคยเรียกใช้ +Name[tr]=Son Kullanılan Belgeler +Name[tt]=Soñğı İstäleklär +Name[uk]=Недавні документи +Name[uz]=Yaqinda ochilgan hujjatlar +Name[uz@cyrillic]=Яқинда очилган ҳужжатлар +Name[ven]=Manwalwa a Zwino +Name[vi]=Tài liệu Gần đây +Name[wa]=Documints d' enawaire +Name[xh]=Uxwebhu Olusandukusebenziswa +Name[zh_CN]=最近文档 +Name[zh_TW]=最近的文件 +Name[zu]=Ushicilelo olusanda kuvulwa +Comment=Menu of documents you have used recently +Comment[af]=Kieslys met dokumente wat onlangs deur jou gebruik is +Comment[ar]=قائمة المستنادات التي إستخدمتها حديثاً +Comment[be]=Меню раней выкарыстаных дакументаў +Comment[bg]=Последно използвани документи +Comment[bn]=আপনি সম্প্রতি ব্যবহার করেছেন এমন নথীর তালিকা +Comment[bs]=Meni sa dokumentima koje ste nedavno koristili +Comment[ca]=Menú dels documents usats fa poc +Comment[cs]=Nabídka nedávno použitých dokumentů +Comment[csb]=Menu slédno òtemkłëch dokùmentów +Comment[da]=Menu med dokumenter du har brugt for nyligt +Comment[de]=Menü mit Dokumenten, die Sie zuletzt geöffnet hatten +Comment[el]=Μενού εγγράφων που χρησιμοποιήθηκαν πρόσφατα +Comment[eo]=Menuo de dokumentoj kiujn vi laste uzis +Comment[es]=Menú de los documentos recientemente usados +Comment[et]=Viimati kasutatud dokumentide menüü +Comment[eu]=Erabili dituzun azken dokumentuen menua +Comment[fa]=گزینگان سندهایی که اخیراً استفاده کرده‌اید +Comment[fi]=Viimeksi käyttämiesi asiakirjojen valikko +Comment[fr]=Menu des documents récemment utilisés +Comment[fy]=Menu mei dokuminten dy jo koartlyn iepene ha +Comment[gl]=Os documentos que usou recentemente +Comment[he]=תפריט המסמכים שהשתמשת בהם לאחרונה +Comment[hr]=Izbornik s nedavno pristupljenim dokumentima +Comment[hu]=A nemrég használt dokumentumok menüje +Comment[is]=Listi yfir skjöl sem þú hefur nýlega notað +Comment[it]=Menu dei documenti usati recentemente +Comment[ja]=最近使ったドキュメントのメニュー +Comment[ka]=ბოლო დროს გამოყენებული დოკუმენტების მენიუ +Comment[kk]=Жуырда қолданған құжаттар мәзірі +Comment[km]=ម៉ឺនុយ​ឯកសារ​ដែល​អ្នក​បាន​ប្រើ​ថ្មីៗនេះ +Comment[lt]=Nesenai naudotų dokumentų meniu +Comment[mk]=Мени со последните документи што сте ги користеле +Comment[nb]=Meny over dokumenter du nylig har brukt +Comment[nds]=Menü vun Dokmenten, de Du tolest bruukt hest +Comment[ne]=तपाईँले भरखरै प्रयोग गर्नु भएको कागजातका मेनु +Comment[nl]=Menu met documenten die u recentelijk hebt geopend +Comment[nn]=Meny over dokument du nyleg har bruka +Comment[pa]=ਤਾਜ਼ਾ ਦਸਤਾਵੇਜ਼, ਜੋ ਕਿ ਤੁਸੀਂ ਹੁਣੇ ਵਰਤੇ ਹਨ +Comment[pl]=Menu ostatnio używanych dokumentów +Comment[pt]=Menu com os documentos recentes que você usou +Comment[pt_BR]=Menu de documentos que você usou recentemente +Comment[ro]=Meniu cu lista de documente pe care le-ați utilizat recent +Comment[ru]=Последние документы +Comment[se]=Fállu mii čájeha dokumeanttaid mat áiddo leat geavahuvvon +Comment[sk]=Menu nedávno použitých dokumentov +Comment[sl]=Meni z dokumenti, ki ste jih uporabljali pred kratkim +Comment[sr]=Мени докумената које сте скорије користили +Comment[sr@Latn]=Meni dokumenata koje ste skorije koristili +Comment[sv]=Meny med dokument som du nyligen har använt +Comment[th]=เมนูของเอกสารที่คุณเคยเรียกใช้มาแล้ว +Comment[tr]=Son kullanılan belgelerin menüsü +Comment[uk]=Меню документів, які ви недавно використовували +Comment[uz]=Yaqinda ishlatilgan hujjatlarning menyusi +Comment[uz@cyrillic]=Яқинда ишлатилган ҳужжатларнинг менюси +Comment[vi]=Thực đơn chứa các tài liệu bạn mới truy cập gần đây +Comment[wa]=Dressêye des documints ki vs avoz eployîz enawaire +Comment[zh_CN]=您最近使用过的文档的菜单 +Comment[zh_TW]=您最近使用過的文件選單 +Icon=document + +X-KDE-Library=kickermenu_recentdocs diff --git a/kicker/menuext/recentdocs/recentdocsmenu.cpp b/kicker/menuext/recentdocs/recentdocsmenu.cpp new file mode 100644 index 000000000..98357fe52 --- /dev/null +++ b/kicker/menuext/recentdocs/recentdocsmenu.cpp @@ -0,0 +1,139 @@ +/***************************************************************** + +Copyright (c) 1996-2000 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "recentdocsmenu.h" + +K_EXPORT_KICKER_MENUEXT(recentdocs, RecentDocsMenu) + +RecentDocsMenu::RecentDocsMenu(QWidget *parent, const char *name, + const QStringList &/*args*/) + : KPanelMenu(KRecentDocument::recentDocumentDirectory(), parent, name) +{ +} + +RecentDocsMenu::~RecentDocsMenu() +{ +} + +void RecentDocsMenu::initialize() { + if (initialized()) clear(); + + insertItem(SmallIconSet("history_clear"), i18n("Clear History"), + this, SLOT(slotClearHistory())); + insertSeparator(); + + _fileList = KRecentDocument::recentDocuments(); + + if (_fileList.isEmpty()) { + insertItem(i18n("No Entries"), 0); + setItemEnabled(0, false); + return; + } + + int id = 0; + + for (QStringList::ConstIterator it = _fileList.begin(); + it != _fileList.end(); + ++it) + { + KDesktopFile f(*it, true /* read only */); + insertItem(SmallIconSet(f.readIcon()), f.readName().replace('&', QString::fromAscii("&&") ), id++); + } + + setInitialized(true); +} + +void RecentDocsMenu::slotClearHistory() { + KRecentDocument::clear(); + reinitialize(); +} + +void RecentDocsMenu::slotExec(int id) { + if (id >= 0) { + kapp->propagateSessionManager(); + KURL u; + u.setPath(_fileList[id]); + KDEDesktopMimeType::run(u, true); + } +} + +void RecentDocsMenu::mousePressEvent(QMouseEvent* e) { + _mouseDown = e->pos(); + QPopupMenu::mousePressEvent(e); +} + +void RecentDocsMenu::mouseMoveEvent(QMouseEvent* e) { + KPanelMenu::mouseMoveEvent(e); + + if (!(e->state() & LeftButton)) + return; + + if (!rect().contains(_mouseDown)) + return; + + int dragLength = (e->pos() - _mouseDown).manhattanLength(); + + if (dragLength <= KGlobalSettings::dndEventDelay()) + return; // ignore it + + int id = idAt(_mouseDown); + + // Don't drag 'manual' items. + if (id < 0) + return; + + KDesktopFile f(_fileList[id], true /* read only */); + + KURL url ( f.readURL() ); + + if (url.isEmpty()) // What are we to do ? + return; + + KURL::List lst; + lst.append(url); + + KURLDrag* d = new KURLDrag(lst, this); + d->setPixmap(SmallIcon(f.readIcon())); + d->dragCopy(); + close(); +} + +void RecentDocsMenu::slotAboutToShow() +{ + reinitialize(); + KPanelMenu::slotAboutToShow(); +} + +#include "recentdocsmenu.moc" diff --git a/kicker/menuext/recentdocs/recentdocsmenu.h b/kicker/menuext/recentdocs/recentdocsmenu.h new file mode 100644 index 000000000..1e3157495 --- /dev/null +++ b/kicker/menuext/recentdocs/recentdocsmenu.h @@ -0,0 +1,55 @@ +/***************************************************************** + +Copyright (c) 1996-2002 the kicker authors. See file AUTHORS. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +******************************************************************/ + +#ifndef RECENTDOCSMENU_H +#define RECENTDOCSMENU_H + +#include + +class QStringList; +class QPoint; + +class RecentDocsMenu : public KPanelMenu +{ + Q_OBJECT + +public: + RecentDocsMenu(QWidget* parent, const char* name, const QStringList &/*args*/); + ~RecentDocsMenu(); + void initialize(); + +protected slots: + void slotClearHistory(); + void slotExec(int id); + void slotAboutToShow(); + +protected: + void mousePressEvent(QMouseEvent* e); + void mouseMoveEvent(QMouseEvent* e); + +private: + QStringList _fileList; + QPoint _mouseDown; +}; + +#endif // RECENTDOCSMENU_H -- cgit v1.2.1