diff options
Diffstat (limited to 'kate/filelistloader')
-rw-r--r-- | kate/filelistloader/Makefile.am | 34 | ||||
-rw-r--r-- | kate/filelistloader/katefll.desktop | 83 | ||||
-rw-r--r-- | kate/filelistloader/katefll_initplugin.cpp | 96 | ||||
-rw-r--r-- | kate/filelistloader/katefll_initplugin.desktop | 112 | ||||
-rw-r--r-- | kate/filelistloader/katefll_initplugin.h | 46 | ||||
-rw-r--r-- | kate/filelistloader/katefll_plugin.cpp | 241 | ||||
-rw-r--r-- | kate/filelistloader/katefll_plugin.desktop | 125 | ||||
-rw-r--r-- | kate/filelistloader/katefll_plugin.h | 67 | ||||
-rw-r--r-- | kate/filelistloader/ui.rc | 13 |
9 files changed, 817 insertions, 0 deletions
diff --git a/kate/filelistloader/Makefile.am b/kate/filelistloader/Makefile.am new file mode 100644 index 0000000..8b47569 --- /dev/null +++ b/kate/filelistloader/Makefile.am @@ -0,0 +1,34 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO + +#KDE_ICON = textfilter + +# Install this plugin in the KDE modules directory +#kde_module_LTLIBRARIES = katefll_initplugin.la katefll_plugin.la +kde_module_LTLIBRARIES = katefll_plugin.la + +# This is all standard. Remove the LIB_KHTML reference if you are not +# using the KHTML Part +#katefll_initplugin_la_SOURCES = katefll_initplugin.cpp +#katefll_initplugin_la_LIBADD = -lkateinterfaces +#katefll_initplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +katefll_plugin_la_SOURCES = katefll_plugin.cpp +katefll_plugin_la_LIBADD = -lkateinterfaces +katefll_plugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +# Install the .rc file in the Part's directory (in this case, the part +# is KHTMLPart) +pluginsdir = $(kde_datadir)/kate/plugins/katefll +plugins_DATA = ui.rc + +#kde_services_DATA = katefll_initplugin.desktop katefll_plugin.desktop +kde_services_DATA = katefll_plugin.desktop + +kdelnk_DATA = katefll.desktop +kdelnkdir = $(kde_appsdir)/.hidden + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/katefll_initplugin.pot + $(XGETTEXT) *.cpp -o $(podir)/katefll_plugin.pot + diff --git a/kate/filelistloader/katefll.desktop b/kate/filelistloader/katefll.desktop new file mode 100644 index 0000000..0a5e58b --- /dev/null +++ b/kate/filelistloader/katefll.desktop @@ -0,0 +1,83 @@ +[Desktop Entry] +GenericName=Text Editor /FLL +GenericName[ar]=محرر نصوص /FLL +GenericName[az]=Mətn Editoru /FLL +GenericName[br]=Aozer skrid /FLL +GenericName[bs]=Tekst editor/FLL +GenericName[ca]=Editor de text /FLL +GenericName[cs]=Textový editor /FLL +GenericName[cy]=Golygydd Testun/FLL +GenericName[da]=Teksteditor/FLL +GenericName[de]=Texteditor /Dateilistenlader +GenericName[el]=Επεξεργαστής κειμένου /FLL +GenericName[eo]=Tekstredaktilo +GenericName[es]=Editor de texto /FLL +GenericName[et]=Tekstiredaktor /failinimekiri +GenericName[eu]=/FLL testu editorea +GenericName[fa]=ویرایشگر متن /FLL +GenericName[fi]=Tekstieditori /FLL +GenericName[fo]=Tekstritil/FLL +GenericName[fr]=Éditeur de texte / FLL +GenericName[fy]=Teksteditor /FLL +GenericName[ga]=Eagarthóir Téacs /FLL +GenericName[gl]=Lista de Ficheiros do Editor de Texto +GenericName[he]=עורך טקסט \FLL +GenericName[hi]=पाठ सम्पादक /एफएलएल +GenericName[hr]=Uređivač teksta / FLL +GenericName[hu]=Szövegszerkesztő /FLL +GenericName[is]=Textaritill /FLL +GenericName[it]=Editor di testi /FLL +GenericName[ja]=テキストエディタ/FLL +GenericName[ka]=ტექსტის რედაქტორი /FLL +GenericName[kk]=Мәтін редакторы/FLL +GenericName[km]=កម្មវិធីនិពន្ធ /FLL +GenericName[lt]=Teksto redaktorius /FLL +GenericName[mk]=Уредувач на текст /FLL +GenericName[ms]=Penyunting Teks /FLL +GenericName[mt]=Editur tat-test /FLL +GenericName[nb]=Tekstredigerer / Fillaster +GenericName[nds]=Texteditor /Dateilistlader +GenericName[ne]=पाठ सम्पादक /एफएलएल +GenericName[nl]=Teksteditor /FLL +GenericName[nn]=Skriveprogram/FLL +GenericName[nso]=/FLL ya Mofetosi wa Sengwalwana +GenericName[pa]=ਪਾਠ ਸੰਪਾਦਕ /FLL +GenericName[pl]=Edytor tekstu /Wczytywanie listy plików +GenericName[pt]=Lista de Ficheiros do Editor de Texto +GenericName[pt_BR]=Editor de Texto /FLL +GenericName[ro]=Editor de text / FFL +GenericName[ru]=Текстовый редактор/FLL +GenericName[sk]=Textový editor /FLL +GenericName[sl]=Urejevalnik besedil /FLL +GenericName[sr]=Уређивач текста /FLL +GenericName[sr@Latn]=Uređivač teksta /FLL +GenericName[sv]=Texteditor /FLL +GenericName[ta]=உரைதொகுப்பான்/FLL +GenericName[tg]=Муҳаррири матнӣ/FLL +GenericName[tr]=Metin Düzenleyici / FLL +GenericName[uk]=Редактор текстів /FLL +GenericName[vi]=Trình soạn thảo văn bản/FLL +GenericName[xh]= Umhleli wombhalo /FLL +GenericName[zh_CN]=文本编辑器 /FLL +GenericName[zh_TW]=文字編輯器 /FLL +Name=KateFLL +Name[de]=Kate Dateilistenlader +Name[eo]=Dosierlista ŝargilo por Kodredaktilo +Name[et]=Kate failinimekiri +Name[fy]=Kate FLL +Name[hi]=के-एटीईएफएलएल +Name[ne]=केट एफएलएल +Name[nl]=Kate FLL +Name[pa]=ਕੇਟFLL +Name[pl]=Program wczytujący listę plików do Kate +Name[ro]=KateFFL +Name[sv]=Kate FLL +MimeType=text/x-katefilelist +Exec=kate --initplugin katefll_initplugin %u +NoDisplay=true +Icon=kate +Path= +DocPath=kate/index.html +Type=Application +Terminal=false +X-DCOP-ServiceType=Multi diff --git a/kate/filelistloader/katefll_initplugin.cpp b/kate/filelistloader/katefll_initplugin.cpp new file mode 100644 index 0000000..4eb116f --- /dev/null +++ b/kate/filelistloader/katefll_initplugin.cpp @@ -0,0 +1,96 @@ +/*************************************************************************** + katefll_initplugin.cpp - description + ------------------- + begin : FRE July 12th 2002 + copyright : (C) 2002 by Joseph Wenninger + email : jowenn@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "katefll_initplugin.h" +#include "katefll_initplugin.moc" + +#include <kate/pluginmanager.h> + +#include <qfileinfo.h> +#include <kgenericfactory.h> +#include <kaction.h> +#include <klocale.h> +#include <kdebug.h> +#include <kurl.h> +#include <kio/netaccess.h> + +K_EXPORT_COMPONENT_FACTORY( katefll_initplugin, KGenericFactory<InitPluginKateFileListLoader>( "katefll_loader" ) ) + +InitPluginKateFileListLoader::InitPluginKateFileListLoader (QObject * parent, const char *name, const QStringList datalist) + :InitPlugin((Kate::Application*)parent,name) +{ +} + + +InitPluginKateFileListLoader:: ~InitPluginKateFileListLoader() +{ +} + + +int InitPluginKateFileListLoader::actionsKateShouldNotPerformOnRealStartup() +{ + return 0x1; +} + +int InitPluginKateFileListLoader::initKate() +{ + QString tmpFile; + KURL tmpURL; + if( KIO::NetAccess::download( configScript(), tmpFile ) ) + { + QFile file(tmpFile); + file.open(IO_ReadOnly); + + QTextStream t(&file); + + bool somethingOpened=false; + + application()->documentManager()->closeAllDocuments(); + while (!t.eof()) + { + somethingOpened=true; +// application()->activeMainWindow()->viewManager()->openURL(KURL(t.readLine())); + application()->documentManager()->openURL(tmpURL=KURL(t.readLine())); + } + if (!somethingOpened) application()->documentManager()->openURL(KURL()); + else if (application()->activeMainWindow()) + application()->activeMainWindow()->viewManager()->openURL(tmpURL); + + file.close(); + + KIO::NetAccess::removeTempFile( tmpFile ); + + } else application()->documentManager()->openURL(KURL()); + + Kate::Plugin *pl=application()->pluginManager()->plugin("katefll_plugin"); + if (pl) + { + connect(this,SIGNAL(updateInit()),pl,SLOT(updateInit())); + updateInit(); + disconnect(this,SIGNAL(updateInit()),pl,SLOT(updateInit())); + +/* int id = pl->metaObject()->findSlot( SLOT(updateInit()) ); + if ( id != -1 ) + { + kdDebug()<<"Action slot was found, it will be called now"<<endl; + QUObject o[ 1 ]; + mod->module->qt_invoke( id, o ); + } */ + } + return 0; +} + diff --git a/kate/filelistloader/katefll_initplugin.desktop b/kate/filelistloader/katefll_initplugin.desktop new file mode 100644 index 0000000..472a9ad --- /dev/null +++ b/kate/filelistloader/katefll_initplugin.desktop @@ -0,0 +1,112 @@ +[Desktop Entry] +Type=Service +ServiceTypes=Kate/InitPlugin +X-KDE-Library=katefll_initplugin +X-Kate-Version=2.5 +Name=Kate FLL Init Plugin +Name[bs]=Kate FLL init plugin +Name[ca]=Connector per iniciar FLL per a Kate +Name[cs]=Kate FLL init plugin +Name[de]=Kate Initialisierungsmodul für Dateilistenlader +Name[el]=Πρόσθετο αρχικοποίησης FLL του Kate +Name[eo]=Komenca kromaĵo por Kodredaktilo +Name[es]=Complemento Kate FLL Init +Name[et]=Kate failinimekirja lähtestamise plugin +Name[eu]=Kate FLL init plugina +Name[fa]=وصلۀ آغازین Kate FLL +Name[fi]=Kate FLL alustussovelma +Name[fr]=Module externe FLL d'initialisation pour Kate +Name[fy]=Kate FLL inisjalisaasjeplugin +Name[ga]=Breiseán Túsaithe FLL le haghaidh Kate +Name[gl]=Plugin de Lista de Ficheiros para Kate +Name[he]=תוסף אתחול FLL ל־Kate +Name[hi]=के-एटीई एफएलएल इनिट प्लगइन +Name[hr]=Kate FLL inicijalizacijski dodatak +Name[hu]=Kate FLL inicializálási bővítőmodul +Name[is]=Kate FLL ræsiviðbætur +Name[it]=Plugin di inizializzazione di Kate FLL +Name[ja]=Kate FLL 初期化プラグイン +Name[ka]=Kate FLL Init მოდული +Name[kk]=Kate FLL инициализациялау плагин модулі +Name[km]=កម្មវិធីជំនួយ Kate FLL Init +Name[lt]=Kate FLL Init priedas +Name[mk]=Приклучок за иницијализација на Kate FLL +Name[ms]=Plugin Kate FLL Init +Name[nb]=Kate FLL init-programtillegg +Name[nds]=KateFLL-Init-Moduul +Name[ne]=केट एफएफएल Init प्लगइन +Name[nl]=Kate FLL initialisatieplugin +Name[nn]=Kate FLL-oppstartstillegg +Name[pl]=Wtyczka FLL Init dla Kate +Name[pt]='Plugin' de Lista de Ficheiros do Kate +Name[pt_BR]=Plugin FLL Init do Kate +Name[ru]=Модуль инициализации Kate FLL +Name[sk]=Kate FLL inicializačný modul +Name[sl]=Vstavek za FLL v Kate +Name[sr]=Прикључак Kate за иницијализацију FLL +Name[sr@Latn]=Priključak Kate za inicijalizaciju FLL +Name[sv]=Kate FLL-initieringsinsticksprogram +Name[ta]=Kate FLL init சொருகுப்பொருள் +Name[tg]=Модули инисиализатсиякунонии Kate FLL +Name[tr]=Kate FLL İlklendirme Eklentisi +Name[uk]=Втулок ініціалізації FLL для Kate +Name[vi]=Bổ sung Init FLL Kate +Name[zh_CN]=Kate FLL 初始插件 +Name[zh_TW]=Kate FLL 初始化外掛程式 +Comment=Initializes Kate's opened files list with those URLs stored within an "init script" +Comment[ar]=تبدأ قوائم ملفات Kate المفتوحة مع العناوين المحفوظة في "initscrips" +Comment[az]=Kate-in açıq fayllar siyahısını "init script"dəki URL-lərlə yoxlayır. +Comment[bg]=Инициализиране на списъка от отворени файлове с адресите, които се намират в инициализиращ скрипт +Comment[bs]=Inicijalizira listu otvorenih Kate datoteka sa tim URL-ovima smještenim u "init skripti" +Comment[ca]=Inicialitza el llistat de fitxers oberts de Kate amb aquests URL desats en un "script d'inici" +Comment[cs]=Inicializuje otevřené soubory Kate pomocí URL uloženého v "init skriptu" +Comment[cy]=Ymgychwyn rhestr ffeiliau agored Kate efo'r URLs sydd wedi eu storio mewn "sgript init" +Comment[da]=Initialiserer Kates liste over åbne filer med de URL'er som er gemt i et "init-script" +Comment[de]=Initialisiert die Liste der von Kate geöffneten Dateien mit den Datei-Adressen aus einem "Init-Skript" +Comment[el]=Αρχικοποιεί τη λίστα ανοιγμένων αρχείων του Kate με αυτά τα URL που είναι αποθηκευμένα σε ένα "αρχείο εντολών αρχικοποίησης" +Comment[en_GB]=Initialises Kate's opened files list with those URLs stored within an "init script" +Comment[eo]=Komencas la liston de malfermitaj dosieraj de Kodredaktilo per la URLoj konservataj en « komenca skriptaĵo » +Comment[es]=Inicializa la lista de los archivos de Kate abiertos con los URL guardados en un «programa de inicio» +Comment[et]=Lähtestab Kate avatud failide nimekirja URLidega, mis on salvestatud "init script"-is +Comment[eu]=Katek irekita dituen fitxategien zerrenda hasieratzen du euren URLak "hasierako script" batean gordeta dituelarik. +Comment[fa]=فهرست پروندههای باز Kate را با آن نشانیهای وب ذخیرهشده درون یک «init script»، مقداردهی اولیه میکند. +Comment[fi]=Alustaa Katen avattujen tiedostojen listan URL:la jotka on tallennettu "alustusskriptiin" +Comment[fr]=Initialise la liste des fichiers de Kate ouverts avec les URL enregistrées dans un « init script » +Comment[fy]=inisjalisearret de list mei fanút Kate iepene triemmen mei byhearrende URL-adressen opslein yn in "init script" +Comment[gl]=Inicializa a lista de ficheiros abertos en Kate cos URLs guardados nun script inicial +Comment[he]=אתחול רשימת הקבצים הפתוחים של Kate עם כתובות השמורות ב"תסריט אתחול" +Comment[hi]=के-एटीई के फ़ाइल खोलें सूची इनिशियलाइज़ करता है जो कि उन यूआरएल के साथ एक "इनिट स्क्रिप्ट" में होते हैं +Comment[hr]=Inicijalizira popis otvorenih datoteka aplikacije Kate s URL adresama pohranjenim unutar skripte "init script" +Comment[hu]=Feltölti a Kate-ben a megnyitott fájlok listáját azokkal az URL-ekkel, melyek a megadott "inicializációs szkriptben" találhatók +Comment[is]=Frumstillir opnar skrár Kate með lista af þeim slóðum sem eru geymdar í "init script" +Comment[it]=Inizializza la lista dei file aperti da Kate con gli URL salvati in uno script di inizializzazione +Comment[ja]=Kate のファイルリストを「初期化スクリプト」に保存されている URL で初期化します +Comment[ka]=Kate-ს ღია ფაილთა სიის ინიციალიზაციას აკეთებს იმ URLებით რომლებიც "init script"-ში ინახება +Comment[kk]=Kate-те ашылған файлдар тізімін "инициализациялау скриптінде" сақталғаны бойынша инициализациялайды +Comment[km]=ចាប់ផ្ដើមបញ្ជីឯកសារដែលបានបើករបស់ Kate ជាមួយនឹង URLs ទាំងនោះដែលបានទុកក្នុង "ស្គ្រីប init" +Comment[lt]=Sužadina Kate atvertų bylų sąrašą su tais URL, kurie išsaugoti „sužadinimo scenarijuje“ +Comment[mk]=Ја иницијализира листата на отворени датотеки на Кате со URL-ата зачувани во „init script“ +Comment[ms]=Memulakan senarai fail terbuka Kate dengan fail yang distor oleh URL dalam "skrip init" +Comment[nb]=Initialiserer de åpne fil-listene i Kate med URLene i et «init skript» +Comment[nds]=Maakt Kate ehr List vun opmaakte Dateien mit de Adressen ut en "Init-Skript" torecht +Comment[ne]=एउटा "init script" मा भण्डारण गरिएका यूआरएलबाट केटका खुला फाइलहरू सुरुआत गर्छ +Comment[nl]=initialiseert de lijst met vanuit Kate geopende bestanden met bijhorende URL-adressen opgeslagen in een "init script" +Comment[nn]=Fyller fillista i Kate med URL-ar frå eit oppstartsskript +Comment[pl]=Inicjalizuje listę otwartych plików Kate zgodnie z URL-ami zapisanymi w "skrypcie inicjalizacyjnym" +Comment[pt]=Inicializa a lista de ficheiros abertos do Kate com os URLs guardados num 'script' inicial +Comment[pt_BR]=Inicializa os arquivos abertos do Kate com as URLs armazenadas dentro de um "init script" +Comment[ro]=Iniţializează lista de fişiere deschide de Kate cu URL-urile salvate într-un "script de iniţializare" +Comment[ru]=Инициализирует список открытых файлов Kate по их адресам через скрипт +Comment[sk]=Inicializuje otvorené súbory Kate s týmy URL uloženýmy v "init script" +Comment[sl]=Inicializira seznam odprtih datotek v Kate z naslovi URL znotraj le-teh»skripta init« +Comment[sr]=Иницијализује листу отворених фајлова у Kate са URL-овима похрањеним унутар „скрипте за иницијализацију“ +Comment[sr@Latn]=Inicijalizuje listu otvorenih fajlova u Kate sa URL-ovima pohranjenim unutar „skripte za inicijalizaciju“ +Comment[sv]=Initierar Kates öppnade fillista med webbadresserna lagrade inuti ett "init-skript" +Comment[ta]="init script"ல் சேமிக்கப்பட்டுள்ள வலைமனைகளுடன் கேட்ஸ்சின் திறந்துள்ள கோப்புகளின் பட்டியலை துவக்குகிறது +Comment[tg]=Ҳамаи рӯйхати файлҳои кушодаи Kate -ро бо суроғаҳояш аз дастнавис инисиалӣ мекунад +Comment[tr]=Kate'in açılan dosyalar listesini bir "ilklendirme betiği"nde saklanan URL'lerle oluşturur +Comment[uk]=Ініціалізує список фалів, відкритий Kate значеннями URL, що зберігаються в "init script" +Comment[vi]=Khởi tạo danh sách các tập tin mở của Kate bằng những địa chi URL được cất giữ bên trong một « văn lệnh khởi tạo » +Comment[xh]=Inika inani kuluhlu lweefayile ezivulekileyo kunye nezo ze URLs ezigcinwe phakathi kwi "init ushicilelo lwaphantsi" +Comment[zh_CN]=使用存储在“init script”中的 URL 来初始 Kate 的打开文件列表 +Comment[zh_TW]=初始化 Kate 開啟的檔案清單 diff --git a/kate/filelistloader/katefll_initplugin.h b/kate/filelistloader/katefll_initplugin.h new file mode 100644 index 0000000..7bfd955 --- /dev/null +++ b/kate/filelistloader/katefll_initplugin.h @@ -0,0 +1,46 @@ + /*************************************************************************** + katefll_initplugin.h - description + ------------------- + begin : FRE July 12th 2002 + copyright : (C) 2002 by Joseph Wenninger + email : jowenn@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _PLUGIN_KATE_FLL_H +#define _PLUGIN_KATE_FLL_H + +#include <qstring.h> + +#include <kate/plugin.h> +#include <kate/application.h> +#include <kate/view.h> +#include <kate/document.h> +#include <kate/documentmanager.h> +#include <kate/mainwindow.h> +#include <kate/viewmanager.h> + +class InitPluginKateFileListLoader : public Kate::InitPlugin +{ + Q_OBJECT + + public: + InitPluginKateFileListLoader (QObject * =0, const char * =0, const QStringList =QStringList()); + virtual ~InitPluginKateFileListLoader(); + virtual int actionsKateShouldNotPerformOnRealStartup(); + virtual int initKate(); + + signals: + void updateInit(); + +}; + +#endif // _PLUGIN_KATE_FLL_H diff --git a/kate/filelistloader/katefll_plugin.cpp b/kate/filelistloader/katefll_plugin.cpp new file mode 100644 index 0000000..bbb91a3 --- /dev/null +++ b/kate/filelistloader/katefll_plugin.cpp @@ -0,0 +1,241 @@ +/*************************************************************************** + katefll_plugin.cpp - description + ------------------- + begin : FRE July 12th 2002 + copyright : (C) 2002 by Joseph Wenninger + email : jowenn@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "katefll_plugin.h" +#include "katefll_plugin.moc" + +#include <kate/pluginmanager.h> + +#include <qfileinfo.h> +#include <kgenericfactory.h> +#include <kaction.h> +#include <klocale.h> +#include <kdebug.h> +#include <kurl.h> +#include <kio/netaccess.h> +#include <kfiledialog.h> +#include <ktempfile.h> +#include <kmessagebox.h> + +K_EXPORT_COMPONENT_FACTORY( katefll_plugin, KGenericFactory<PluginKateFileListLoader>( "katefll_loader" ) ) + +class PluginView : public KXMLGUIClient +{ + friend class PluginKateFileListLoader; + + public: + Kate::MainWindow *win; + KRecentFilesAction *recentFiles; +}; + +PluginKateFileListLoader::PluginKateFileListLoader (QObject * parent, const char *name, const QStringList) + : Plugin((Kate::Application*)parent,name), PluginViewInterface(), + m_config( new KConfig("katefilelistpluginrc") ) +{ + m_config->setGroup("General"); + updateInit(); +} + + +PluginKateFileListLoader:: ~PluginKateFileListLoader() +{ + m_config->sync(); + delete m_config; +} + + +void PluginKateFileListLoader::updateInit() +{ + /*if (application()->initPluginManager()->initPlugin()) + { + if (application()->initPluginManager()->initPlugin()->qt_cast("InitPluginKateFileListLoader")) //That's needed, if the plugin is loaded during a configuration change + m_saveURL=application()->initPluginManager()->initScript(); + } + else*/ m_saveURL=KURL(); + m_oldInitURL="";//application()->initPluginManager()->initScript(); + m_saveAs=false; +} + +void PluginKateFileListLoader::addView(Kate::MainWindow *win) +{ + PluginView *view = new PluginView (); + + (void) new KAction( i18n("Open File List..."), 0, + this, SLOT( slotOpenList() ), + view->actionCollection(), "file_kfllopen" ); + + view->recentFiles = new KRecentFilesAction( i18n("Open Recent"), KShortcut::null(), + this, SLOT(slotOpenList(const KURL&)), view->actionCollection(), + "file_kfllopenrecent"); + view->recentFiles->loadEntries(m_config, "Recent Files"); + + (void) new KAction( i18n("Save File List"), 0, + this, SLOT( slotSaveList() ), + view->actionCollection(), "file_kfllsave" ); + + (void) new KAction( i18n("Save File List As..."), 0, + this, SLOT( slotSaveListAs() ), + view->actionCollection(), "file_kfllsaveas" ); + + view->setInstance (new KInstance("kate")); + view->setXMLFile( "plugins/katefll/ui.rc" ); + win->guiFactory()->addClient (view); + view->win = win; + + m_views.append (view); +} + +void PluginKateFileListLoader::removeView(Kate::MainWindow *win) +{ + if (m_views.count() == 1) // yeah baby, last view! So save filelist + m_views.at(0)->recentFiles->saveEntries(m_config, "Recent Files"); + + for (uint z=0; z < m_views.count(); z++) + if (m_views.at(z)->win == win) + { + PluginView *view = m_views.at(z); + m_views.remove (view); + win->guiFactory()->removeClient (view); + delete view; + } +} + +void PluginKateFileListLoader::addURLToList(const KURL& url) +{ + // add url to all views to make sure all are synced + for (uint a = 0; a < m_views.count(); ++a) + { + m_views.at(a)->recentFiles->addURL(url); + } +} + +void PluginKateFileListLoader::removeURLFromList(const KURL& url) +{ + // remove url from all views to make sure all are synced + for (uint a = 0; a < m_views.count(); ++a) { + m_views.at(a)->recentFiles->removeURL(url); + } +} + +void PluginKateFileListLoader::slotOpenList() +{ + KURL url = KFileDialog::getOpenURL(QString::null, + "*.katefl|Kate File List (*.katefl)"); + if (url.isValid()) // cancel pressed? + slotOpenList(url); +} + +void PluginKateFileListLoader::slotOpenList(const KURL& url) +{ + if ( url.isValid() && KIO::NetAccess::exists(url, false, 0) ) + { + addURLToList( url ); + if ( KMessageBox::questionYesNo (0, + i18n("Do you want to close all other files first?"), + i18n("Kate Filelist Loader"), + KStdGuiItem::close(), i18n("Do Not Close"), + "kate-filelist-loader-close-other" ) == KMessageBox::Yes ) + application()->documentManager()->closeAllDocuments(); + + QString tmpFile; + if( KIO::NetAccess::download( url, tmpFile, 0 ) ) + { + QFile file(tmpFile); + file.open(IO_ReadOnly); + + QTextStream t(&file); + KURL tmp; + while (!t.eof()) { + if ( ! tmp.isEmpty() ) + application()->documentManager()->openURL( tmp ); + + tmp = KURL(t.readLine()); +// application()->activeMainWindow()->viewManager()->openURL(KURL(t.readLine())); + } + + file.close(); + if ( ! tmp.isEmpty() ) + application()->activeMainWindow()->viewManager()->openURL(tmp); + + KIO::NetAccess::removeTempFile( tmpFile ); + } else application()->documentManager()->openURL(KURL()); + } + else + { + KMessageBox::error(0, i18n("The selected filelist does not exist or is invalid.")); + // url not valid -> remove from list + removeURLFromList(url); + } +} + +void PluginKateFileListLoader::slotSaveList() +{ + if (m_saveURL.isValid()) + { + if (m_saveAs) + { + /* if (m_oldInitURL!=application()->initPluginManager()->initScript()) + { + switch (KMessageBox::questionYesNoCancel(0,i18n("<qt>Since the last time you saved the file list, Kate has been reinitialized by another plugin other than the <B>File List Loader</B>. Do you still want to save the list to %1?</qt>").arg(m_saveURL.prettyURL()),QString::null,KStdGuiItem::save(),KStdGuiItem::discard())) + { + case KMessageBox::Yes: save(); break; + case KMessageBox::No: slotSaveListAs(); break; + default: break; + } + } + else*/ save(); + } + else + { + /*if (m_saveURL!=application()->initPluginManager()->initScript()) + { + switch (KMessageBox::questionYesNoCancel(0,i18n("<qt>Kate has been reinitialized by another plugin other than the <B>File List Loader</B>. Do you still want to save the list to %1?</qt>").arg(m_saveURL.prettyURL()),QString::null,KStdGuiItem::save(),KStdGuiItem::discard())) + { + case KMessageBox::Yes: save(); break; + case KMessageBox::No: slotSaveListAs(); break; + default: break; + } + } + else */save(); + } + } else slotSaveListAs(); +} + +void PluginKateFileListLoader::save() +{ + KTempFile file(locateLocal("tmp", "kate"), "katefll"); + for (uint i=0;i<application()->documentManager()->documents();i++) + { + *file.textStream()<<application()->documentManager()->document(i)->url().url()<<endl; + } + file.close(); + KIO::NetAccess::upload(file.name(), m_saveURL, 0); + file.unlink(); + addURLToList( m_saveURL ); +} + +void PluginKateFileListLoader::slotSaveListAs() +{ + KURL url=KFileDialog::getSaveURL(QString::null,"*.katefl|Kate File List (*.katefl)"); + if (url.isValid()) + { + m_oldInitURL="";//application()->initPluginManager()->initScript(); + m_saveURL=url; + m_saveAs=true; + save(); + } +} diff --git a/kate/filelistloader/katefll_plugin.desktop b/kate/filelistloader/katefll_plugin.desktop new file mode 100644 index 0000000..7c7858b --- /dev/null +++ b/kate/filelistloader/katefll_plugin.desktop @@ -0,0 +1,125 @@ +[Desktop Entry] +Type=Service +ServiceTypes=Kate/Plugin +X-KDE-Library=katefll_plugin +X-Kate-Version=2.5 +Name=Kate File List Loader +Name[af]=Kate Lêer Lys Laaier +Name[ar]=محمّل قوائم ملفات Kate +Name[az]=Kate Fayl Siyahısı Yükləyicisi +Name[br]=Karger ar roll restr Kate +Name[ca]=Carregador de la llista de fitxers per a Kate +Name[cy]=Llwythydd Rhestr Ffeiliau am Kate +Name[da]=Kate Fillisteindlæser +Name[de]=Kate-Dateilistenlader +Name[el]=Φορτωτής λίστας αρχείων για το Kate +Name[eo]=Dosierlista ŝargilo por Kodredaktilo +Name[es]=Cargador de la lista de archivos de Kate +Name[et]=Kate failinimekirja avaja +Name[eu]=Kateren fitxategi zerrendaren kargatzailea +Name[fa]=بارکنندۀ فهرست پروندۀ Kate +Name[fi]=Kate tiedostolistalatain +Name[fr]=Chargeur de liste de fichiers pour Kate +Name[fy]=Kate-triemlistlader +Name[ga]=Luchtóir Liostaí Comhad Kate +Name[gl]=Leitor da Lista de Ficheiros para Kate +Name[he]=טוען רשימות הקבצים של Kate +Name[hi]=के-एटीई फ़ाइल सूची लोड करने वाला +Name[hr]=Kate učitavač popisa datoteka +Name[hu]=Kate fájllista-betöltő +Name[is]=Kate skráarlistar +Name[it]=Caricatore di Liste di File (FLL) di Kate +Name[ja]=Kate ファイルリストローダ +Name[ka]=Kate ფაილთა სიის ჩამტვირთავი +Name[kk]=Kate файл тізімін жүктеуіші +Name[km]=កម្មវិធីផ្ទុកបញ្ជីឯកសាររបស់ Kate +Name[lt]=Kate bylų sąrašo pakrovėjas +Name[mk]=Вчитувач на листа на датотеки за Кате +Name[ms]=Pemuat Senarai Fail Kate +Name[nb]=Kate Filliste-laster +Name[nds]=Kate-Dateilistlader +Name[ne]=केट फाइल सूची लोडर +Name[nl]=Kate-bestandenlijstlader +Name[nn]=Fillistelastar for Kate +Name[nso]=Molaisi wa Palo ya Faele ya Kate +Name[pa]=ਕੇਟ ਫਾਇਲ ਸੂਚੀ ਲੋਡਰ +Name[pl]=Program wczytujący listę plików do Kate +Name[pt]=Leitor da Lista de Ficheiros do Kate +Name[pt_BR]=Carregador de Lista de Arquivos do Kate +Name[ro]=Încărcător listă de fişiere Kate +Name[ru]=Загрузчик списка файлов Kate +Name[sk]=Kate nahrávač zoznamu súborov +Name[sl]=Nalagalnik seznama datotek v Kate +Name[sr]=Учитавач листе фајлова за Kate +Name[sr@Latn]=Učitavač liste fajlova za Kate +Name[sv]=Kates fillistladdare +Name[ta]=கேட் கோப்புப் பட்டியல் உள்ளிடுபவர் +Name[tg]=Пурборкунандаи рӯйхати файлҳои Kate +Name[tr]=Kate Dosya Listesi Yükleyici +Name[uk]=Завантажувач списку файлів Kate +Name[uz]=Kate fayllar roʻyxatini yuklovchisi +Name[uz@cyrillic]=Kate файллар рўйхатини юкловчиси +Name[vi]=Bộ nạp danh sách tập tin Kate +Name[xh]=Umlayishi Woluhlu Lwefayile ye Kate +Name[zh_CN]=Kate 文件列表载入器 +Name[zh_TW]=Kate 文字清單載入器 +Comment=Store Kate's file list on disc +Comment[ar]=تحفظ قوائم ملفات Kate على القرص +Comment[az]=Store Kate-in disk üstündəki fayl siyahısı +Comment[bg]=Запис на списъка от отворени файлове на диска +Comment[bs]=Snima listu datoteka programa Kate na disk +Comment[ca]=Desa la llista de fitxers de Kate al disc +Comment[cs]=Uloží seznam souborů Kate na disk +Comment[cy]=Cadw rhestr ffeiliau Kate ar ddisg +Comment[da]=Gem Kates filliste på disken +Comment[de]=Dateiliste von Kate auf Festplatte speichern +Comment[el]=Αποθήκευση της λίστας αρχείων του Kate στο δίσκο +Comment[eo]=Konservas dosierliston de Kodredaktilo en disko +Comment[es]=Guarda en disco una lista de archivos de Kate +Comment[et]=Salvestab Kate failinimekirja kõvakettale +Comment[eu]=Gorde Kateren fitxategi zerrenda diskoan +Comment[fa]=فهرست پروندۀ Kate را بر روی دیسک ذخیره میکند. +Comment[fi]=Tallenna Katen tiedostolista levylle +Comment[fr]=Enregistrement de la liste des fichiers de Kate sur le disque +Comment[fy]=triemlist fan Kate op de skiif opslaan +Comment[ga]=Stóráil an liosta comhad Kate ar an diosca +Comment[gl]=Guarda a lista de ficheiros para Kate no disco +Comment[he]=שמירת רשימת הקבצים של Kate על גבי הכונן +Comment[hi]=डिस्क पर के-एटीई की फ़ाइल सूची भंडारित करता है +Comment[hr]=Spremanje Kate popisa datoteka na disk +Comment[hu]=A Kate fájllista elmentése lemezre +Comment[is]=Geyma skráarlista Kate á diski +Comment[it]=Salva la lista di file di Kate su disco +Comment[ja]=Kate のファイルリストをディスクに保存します +Comment[ka]=ინახავს დისკზე Kate-ის ფაილთა სიას +Comment[kk]=Kate файлдар тізімін дискіде сақтау +Comment[km]=ទុកបញ្ជីឯកសាររបស់ Kate នៅក្នុងថាស +Comment[lt]=Išsaugoja Kate bylų sąrašą diske +Comment[mk]=Ја зачувува листата на датотеки на Кате на диск +Comment[ms]=Simpan senarai fail Kate atas cakera +Comment[nb]=Lagre fillistene fra Kate på disken +Comment[nds]=Sekert de Dateilist vun Kate op de Fastplaat +Comment[ne]=डिस्कमा केटको फाइल सूची भण्डारण गर्छ +Comment[nl]=Sla Kate's bestandenlijst op de schijf op +Comment[nn]=Lagra fillista i Kate +Comment[nso]=Boloka dipalo tsa faele ya Kate go disc +Comment[pl]=Zapisanie listy plików Kate na dysku +Comment[pt]=Guarda a lista de ficheiros do Kate no disco +Comment[pt_BR]=Armazena Lista de arquivos do Kate no disco +Comment[ro]=Salvează lista de fişiere Kate pe disc +Comment[ru]=Сохранить список файлов Kate на диске +Comment[sk]=Uloží zoznam súborov Kate na disk +Comment[sl]=Shrani seznam datotek v Kate na disk +Comment[sr]=Похраните листу фајлова из Kate на диск +Comment[sr@Latn]=Pohranite listu fajlova iz Kate na disk +Comment[sv]=Lagra Kates fillista på disk +Comment[ta]= கேட்ஸ்சின் கோப்புப்பட்டியலை வட்டில் சேமி +Comment[tg]=Захира кардани рӯйхати файлҳои Kate ба диск +Comment[tr]=Kate'in dosya listesini diske kaydeder +Comment[uk]=Запис списку файлів Kate на диск +Comment[uz]=Kate fayllar roʻyxatini diskda saqlash +Comment[uz@cyrillic]=Kate файллар рўйхатини дискда сақлаш +Comment[vi]=Cất giữ danh sách tập tin của Kate trên đĩa +Comment[xh]=Gcina uluhlu lodweliso lwefayile ye Kate kwi disc +Comment[zh_CN]=在磁盘上存储 Kate 的文件列表 +Comment[zh_TW]=儲存 Kate 檔案清單於磁碟中 diff --git a/kate/filelistloader/katefll_plugin.h b/kate/filelistloader/katefll_plugin.h new file mode 100644 index 0000000..81b7bb8 --- /dev/null +++ b/kate/filelistloader/katefll_plugin.h @@ -0,0 +1,67 @@ + /*************************************************************************** + katefll_plugin.h - description + ------------------- + begin : FRE July 12th 2002 + copyright : (C) 2002 by Joseph Wenninger + email : jowenn@kde.org + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#ifndef _PLUGIN_KATE_FLL_H +#define _PLUGIN_KATE_FLL_H + +#include <qstring.h> + +#include <kate/plugin.h> +#include <kate/application.h> +#include <kate/view.h> +#include <kate/document.h> +#include <kate/documentmanager.h> +#include <kate/mainwindow.h> +#include <kate/viewmanager.h> + +#include <kstandarddirs.h> + +class PluginKateFileListLoader : public Kate::Plugin, Kate::PluginViewInterface +{ + Q_OBJECT + + public: + PluginKateFileListLoader (QObject * =0, const char * =0, const QStringList =QStringList()); + virtual ~PluginKateFileListLoader(); + + void addView (Kate::MainWindow *win); + void removeView (Kate::MainWindow *win); + + public slots: + void updateInit(); + + protected: + void addURLToList(const KURL& url); + void removeURLFromList(const KURL& url); + + protected slots: + void slotOpenList(); + void slotOpenList(const KURL& url); + void slotSaveList(); + void slotSaveListAs(); + void save(); + + private: + QPtrList<class PluginView> m_views; + KRecentFilesAction *m_recentFiles; + KConfig* m_config; + KURL m_oldInitURL; + KURL m_saveURL; + bool m_saveAs; +}; + +#endif // _PLUGIN_KATE_FLL_H diff --git a/kate/filelistloader/ui.rc b/kate/filelistloader/ui.rc new file mode 100644 index 0000000..dc7e569 --- /dev/null +++ b/kate/filelistloader/ui.rc @@ -0,0 +1,13 @@ +<!DOCTYPE kpartgui> +<kpartplugin name="katefilelistloader" library="libkatefll_plugin" version="3"> +<MenuBar> +<Menu name="file"><Text>&File</Text> + <Menu name="filelistloader" group="print_merge"><Text>&Filelist</Text> + <Action name="file_kfllopen" /> + <Action name="file_kfllopenrecent" /> + <Action name="file_kfllsave" /> + <Action name="file_kfllsaveas" /> + </Menu> +</Menu> +</MenuBar> +</kpartplugin> |