summaryrefslogtreecommitdiffstats
path: root/kicker/menuext/remote
diff options
context:
space:
mode:
Diffstat (limited to 'kicker/menuext/remote')
-rw-r--r--kicker/menuext/remote/Makefile.am17
-rw-r--r--kicker/menuext/remote/remotemenu.cpp164
-rw-r--r--kicker/menuext/remote/remotemenu.desktop133
-rw-r--r--kicker/menuext/remote/remotemenu.h53
4 files changed, 367 insertions, 0 deletions
diff --git a/kicker/menuext/remote/Makefile.am b/kicker/menuext/remote/Makefile.am
new file mode 100644
index 000000000..85736d0a2
--- /dev/null
+++ b/kicker/menuext/remote/Makefile.am
@@ -0,0 +1,17 @@
+INCLUDES = -I$(srcdir)/../../ui -I../../libkicker $(all_includes)
+
+kde_module_LTLIBRARIES = kickermenu_remotemenu.la
+
+kickermenu_remotemenu_la_SOURCES = remotemenu.cpp remotemenu.skel
+kickermenu_remotemenu_la_LDFLAGS = $(all_libraries) -module -avoid-version
+kickermenu_remotemenu_la_LIBADD = $(LIB_KDEUI) $(top_builddir)/kicker/libkicker/libkickermain.la
+
+kickermenu_remotemenu_la_METASOURCES = AUTO
+
+desktopmenu_DATA = remotemenu.desktop
+desktopmenudir = $(kde_datadir)/kicker/menuext
+
+messages:
+ $(XGETTEXT) *.cpp -o $(podir)/libkickermenu_remotemenu.pot
+
+remotemenu.lo: ../../libkicker/kickerSettings.h
diff --git a/kicker/menuext/remote/remotemenu.cpp b/kicker/menuext/remote/remotemenu.cpp
new file mode 100644
index 000000000..42b3d5339
--- /dev/null
+++ b/kicker/menuext/remote/remotemenu.cpp
@@ -0,0 +1,164 @@
+/* This file is part of the KDE project
+ Copyright (c) 2004 Kevin Ottens <ervin ipsquad net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "remotemenu.h"
+
+#include <kdebug.h>
+#include <kglobal.h>
+#include <kstandarddirs.h>
+#include <krun.h>
+#include <kiconloader.h>
+#include <kdesktopfile.h>
+#include <kservice.h>
+
+#include <qpixmap.h>
+#include <qdir.h>
+#include <qtimer.h>
+
+#include "kickerSettings.h"
+
+#define WIZARD_SERVICE "knetattach"
+
+K_EXPORT_KICKER_MENUEXT(remotemenu, RemoteMenu)
+
+
+RemoteMenu::RemoteMenu(QWidget *parent, const char *name,
+ const QStringList &/*args*/)
+ : KPanelMenu(parent, name), KDirNotify()
+{
+ KGlobal::dirs()->addResourceType("remote_entries",
+ KStandardDirs::kde_default("data") + "remoteview");
+
+ QString path = KGlobal::dirs()->saveLocation("remote_entries");
+
+ QDir dir = path;
+ if (!dir.exists())
+ {
+ dir.cdUp();
+ dir.mkdir("remoteview");
+ }
+}
+
+RemoteMenu::~RemoteMenu()
+{
+}
+
+void RemoteMenu::initialize()
+{
+ int id = 0;
+ if (KickerSettings::showMenuTitles())
+ {
+ insertTitle(i18n("Network Folders"));
+ }
+
+ id = insertItem(SmallIcon("wizard"), i18n("Add Network Folder"));
+ connectItem(id, this, SLOT(startWizard()));
+ id = insertItem(SmallIcon("kfm"), i18n("Manage Network Folders"));
+ connectItem(id, this, SLOT(openRemoteDir()));
+
+ insertSeparator();
+
+ m_desktopMap.clear();
+ QStringList names_found;
+ QStringList dirList = KGlobal::dirs()->resourceDirs("remote_entries");
+
+ QStringList::ConstIterator dirpath = dirList.begin();
+ QStringList::ConstIterator end = dirList.end();
+ for(; dirpath!=end; ++dirpath)
+ {
+ QDir dir = *dirpath;
+ if (!dir.exists()) continue;
+
+ QStringList filenames
+ = dir.entryList( QDir::Files | QDir::Readable );
+
+ QStringList::ConstIterator name = filenames.begin();
+ QStringList::ConstIterator endf = filenames.end();
+
+ for(; name!=endf; ++name)
+ {
+ if (!names_found.contains(*name))
+ {
+ names_found.append(*name);
+ QString filename = *dirpath+*name;
+ KDesktopFile desktop(filename);
+ id = insertItem(SmallIcon(desktop.readIcon()), desktop.readName());
+ m_desktopMap[id] = filename;
+ }
+ }
+ }
+}
+
+void RemoteMenu::startWizard()
+{
+ KURL url;
+ KService::Ptr service = KService::serviceByDesktopName(WIZARD_SERVICE);
+
+ if (service && service->isValid())
+ {
+ url.setPath(locate("apps", service->desktopEntryPath()));
+ new KRun(url, 0, true); // will delete itself
+ }
+}
+
+void RemoteMenu::openRemoteDir()
+{
+ new KRun(KURL("remote:/"));
+}
+
+void RemoteMenu::slotExec(int id)
+{
+ if (m_desktopMap.contains(id))
+ {
+ new KRun(m_desktopMap[id]);
+ }
+}
+
+ASYNC RemoteMenu::FilesAdded(const KURL &directory)
+{
+ if (directory.protocol()=="remote") reinitialize();
+}
+
+ASYNC RemoteMenu::FilesRemoved(const KURL::List &fileList)
+{
+ KURL::List::ConstIterator it = fileList.begin();
+ KURL::List::ConstIterator end = fileList.end();
+
+ for (; it!=end; ++it)
+ {
+ if ((*it).protocol()=="remote")
+ {
+ reinitialize();
+ return;
+ }
+ }
+}
+
+ASYNC RemoteMenu::FilesChanged(const KURL::List &fileList)
+{
+ FilesRemoved(fileList);
+}
+
+ASYNC RemoteMenu::FilesRenamed(const KURL &src, const KURL &dest)
+{
+ if (src.protocol()=="remote" || dest.protocol()=="remote")
+ reinitialize();
+}
+
+#include "remotemenu.moc"
diff --git a/kicker/menuext/remote/remotemenu.desktop b/kicker/menuext/remote/remotemenu.desktop
new file mode 100644
index 000000000..82f0de72c
--- /dev/null
+++ b/kicker/menuext/remote/remotemenu.desktop
@@ -0,0 +1,133 @@
+[Desktop Entry]
+Name=Network Folders
+Name[af]=Netwerk Gidse
+Name[ar]=مجلّدات الشبكة
+Name[be]=Сеткавыя тэчкі
+Name[bg]=Мрежови директории
+Name[bn]=নেটওয়ার্ক ফোল্ডার
+Name[br]=Renkelloù rouedad
+Name[bs]=Mrežni folderi
+Name[ca]=Carpetes de xarxa
+Name[cs]=Síťové složky
+Name[csb]=Sécowé katalodżi
+Name[da]=Netværksmapper
+Name[de]=Netzwerkordner
+Name[el]=Δικτυακοί φάκελοι
+Name[eo]=Retaj Dosierujoj
+Name[es]=Carpetas de red
+Name[et]=Võrgukataloogid
+Name[eu]=Sareko karpetak
+Name[fa]=پوشه‌های شبکه
+Name[fi]=Verkkokansiot
+Name[fr]=Dossiers réseau
+Name[fy]=Netwurkmappen
+Name[ga]=Fillteáin Líonra
+Name[gl]=Cartafoles en Rede
+Name[he]=תיקיות רשת
+Name[hi]=नेटवर्क फोल्डर्स
+Name[hr]=Mrežne mape
+Name[hu]=Hálózati mappák
+Name[is]=Netmöppur
+Name[it]=Cartelle di rete
+Name[ja]=ネットワークフォルダ
+Name[ka]=ქსელური საქაღალდეები
+Name[kk]=Желідегі қапшықтар
+Name[km]=ថត​បណ្ដាញ
+Name[ko]=네트워크 폴더 마법사
+Name[lt]=Tinklo aplankai
+Name[lv]=Tīkla mape
+Name[mk]=Мрежни папки
+Name[ms]=Folder Rangkaian
+Name[nb]=Nettverksmapper
+Name[nds]=Nettwarkorner
+Name[ne]=सञ्जाल फोल्डर
+Name[nl]=Netwerkmappen
+Name[nn]=Nettverksmapper
+Name[pa]=ਨੈੱਟਵਰਕ ਫੋਲਡਰ
+Name[pl]=Foldery sieciowe
+Name[pt]=Pastas de Rede
+Name[pt_BR]=Pastas de Rede
+Name[ro]=Foldere de rețea
+Name[ru]=Сетевые папки
+Name[rw]=Ububiko bw'Urusobemiyoboro
+Name[se]=Fierpmádatmáhpat
+Name[sk]=Sieťové priečinky
+Name[sl]=Omrežne mape
+Name[sr]=Мрежне фасцикле
+Name[sr@Latn]=Mrežne fascikle
+Name[sv]=Nätverkskataloger
+Name[ta]=வலைப்பின்னல் அடைவுகள்
+Name[te]=నెట్వర్క్ ఫొల్డర్లు
+Name[tg]=Феҳрастҳои шабака
+Name[th]=โฟลเดอร์เครือข่าย
+Name[tr]=Ağ Dizinleri
+Name[tt]=Çeltärle Törgäklär
+Name[uk]=Мережні теки
+Name[uz]=Tarmoq jildlari
+Name[uz@cyrillic]=Тармоқ жилдлари
+Name[vi]=Thư mục Mạng
+Name[wa]=Ridants rantoele
+Name[zh_CN]=网络文件夹
+Name[zh_TW]=網路資料夾
+Comment=Menu of network folders
+Comment[af]=Kieslys vir netwerk gidse
+Comment[ar]=قائمة مجلّدات الشبكة
+Comment[be]=Меню сеткавых тэчак
+Comment[bg]=Меню за достъп до мрежови директории
+Comment[bn]=নেটওয়ার্ক ফোল্ডার-এর তালিকা
+Comment[bs]=Meni sa mrežnim direktorijima
+Comment[ca]=Menú de les carpetes de xarxa
+Comment[cs]=Nabídka síťových složek
+Comment[csb]=Menu sécowëch katalogów
+Comment[da]=Menu med netværksmapper
+Comment[de]=Menü für den Zugriff auf Netzwerkordner
+Comment[el]=Μενού των δικτυακών φακέλων
+Comment[eo]=Menuo de retaj dosierujoj
+Comment[es]=Menú de las carpetas de red
+Comment[et]=Võrgukataloogide menüü
+Comment[eu]=Sareko karpeten menua
+Comment[fa]=گزینگان پوشه‌های شبکه
+Comment[fi]=Verkkokansiovalikko
+Comment[fr]=Menu des dossiers réseau
+Comment[fy]=Menu mei netwurkmappen
+Comment[gl]=Aceso doado cartafoles en rede
+Comment[he]=תפריט של תיקיות רשת
+Comment[hr]=Izbornik mrežnih mapa
+Comment[hu]=A hálózati mappák menüje
+Comment[is]=Einföld leið að netmöppum
+Comment[it]=Menu delle cartelle di rete
+Comment[ja]=ネットワークフォルダのメニュー
+Comment[ka]=ქსელური დასტების მენიუ
+Comment[kk]=Желідегі қапшықтар мәзірі
+Comment[km]=ម៉ឺនុយ​របស់​ថត​បណ្តាញ
+Comment[lt]=Tinklo aplankų meniu
+Comment[mk]=Мени на мрежните папки
+Comment[nb]=Meny over nettverksmappene
+Comment[nds]=Menü vun Nettwarkornern
+Comment[ne]=सञ्जाल फोल्डरको मेनु
+Comment[nl]=Menu met netwerkmappen
+Comment[nn]=Meny over nettverksmapper
+Comment[pa]=ਨੈੱਟਵਰਕ ਫੋਲਡਰ ਲਈ ਮੇਨੂ
+Comment[pl]=Menu folderów sieciowych
+Comment[pt]=Menu de pastas de rede
+Comment[pt_BR]=Acesso fácil às pastas de rede
+Comment[ro]=Meniu cu folderele de rețea
+Comment[ru]=Быстрый доступ к сетевым папкам
+Comment[se]=Fállu mii čájeha fierpmádatmáhpaid
+Comment[sk]=Menu sieťových priečinkov
+Comment[sl]=Meni z omrežnimi mapami
+Comment[sr]=Мени мрежних фасцикли
+Comment[sr@Latn]=Meni mrežnih fascikli
+Comment[sv]=Meny med nätverkskataloger
+Comment[th]=เมนูของโฟลเดอร์บนเครือข่าย
+Comment[tr]=Ağ dizinlerinin menüsü
+Comment[uk]=Меню мережних тек
+Comment[uz]=Tarmoq jildlarining menyusi
+Comment[uz@cyrillic]=Тармоқ жилдларининг менюси
+Comment[vi]=Thực đơn chứa thư mục mạng
+Comment[wa]=Dressêye des ridants rantoele
+Comment[zh_CN]=网络文件夹菜单
+Comment[zh_TW]=網路資料夾選單
+Icon=network
+
+X-KDE-Library=kickermenu_remotemenu
diff --git a/kicker/menuext/remote/remotemenu.h b/kicker/menuext/remote/remotemenu.h
new file mode 100644
index 000000000..1e46bb4e3
--- /dev/null
+++ b/kicker/menuext/remote/remotemenu.h
@@ -0,0 +1,53 @@
+/* This file is part of the KDE project
+ Copyright (c) 2004 Kevin Ottens <ervin ipsquad net>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef REMOTEMENU_H
+#define REMOTEMENU_H
+
+#include <kdirnotify.h>
+#include <kpanelmenu.h>
+#include <qmap.h>
+
+class RemoteMenu : public KPanelMenu, public KDirNotify
+{
+ Q_OBJECT
+ K_DCOP
+
+ public:
+ RemoteMenu(QWidget *parent, const char *name,
+ const QStringList & /*args*/);
+ ~RemoteMenu();
+
+ k_dcop:
+ virtual ASYNC FilesAdded(const KURL &directory);
+ virtual ASYNC FilesRemoved(const KURL::List &fileList);
+ virtual ASYNC FilesChanged(const KURL::List &fileList);
+ virtual ASYNC FilesRenamed(const KURL &src, const KURL &dest);
+
+ protected slots:
+ void initialize();
+ void startWizard();
+ void openRemoteDir();
+ void slotExec(int id);
+
+ private:
+ QMap<int, QString> m_desktopMap;
+};
+
+#endif