diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch) | |
tree | 2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /konq-plugins/minitools | |
download | tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip |
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/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins/minitools')
-rw-r--r-- | konq-plugins/minitools/Makefile.am | 14 | ||||
-rw-r--r-- | konq-plugins/minitools/cr16-action-minitools.png | bin | 0 -> 690 bytes | |||
-rw-r--r-- | konq-plugins/minitools/cr22-action-minitools.png | bin | 0 -> 996 bytes | |||
-rw-r--r-- | konq-plugins/minitools/cr32-action-minitools.png | bin | 0 -> 1454 bytes | |||
-rw-r--r-- | konq-plugins/minitools/cr48-action-minitools.png | bin | 0 -> 2272 bytes | |||
-rw-r--r-- | konq-plugins/minitools/minitoolsplugin.cpp | 156 | ||||
-rw-r--r-- | konq-plugins/minitools/minitoolsplugin.desktop | 121 | ||||
-rw-r--r-- | konq-plugins/minitools/minitoolsplugin.h | 66 | ||||
-rw-r--r-- | konq-plugins/minitools/minitoolsplugin.rc | 11 |
9 files changed, 368 insertions, 0 deletions
diff --git a/konq-plugins/minitools/Makefile.am b/konq-plugins/minitools/Makefile.am new file mode 100644 index 0000000..48f63e4 --- /dev/null +++ b/konq-plugins/minitools/Makefile.am @@ -0,0 +1,14 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO +KDE_ICON = AUTO + +kde_module_LTLIBRARIES = libminitoolsplugin.la +libminitoolsplugin_la_SOURCES = minitoolsplugin.cpp +libminitoolsplugin_la_LIBADD = $(LIB_KHTML) -lkonq +libminitoolsplugin_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) + +pluginsdir = $(kde_datadir)/khtml/kpartplugins +plugins_DATA = minitoolsplugin.rc minitoolsplugin.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/minitoolsplugin.pot diff --git a/konq-plugins/minitools/cr16-action-minitools.png b/konq-plugins/minitools/cr16-action-minitools.png Binary files differnew file mode 100644 index 0000000..5e76158 --- /dev/null +++ b/konq-plugins/minitools/cr16-action-minitools.png diff --git a/konq-plugins/minitools/cr22-action-minitools.png b/konq-plugins/minitools/cr22-action-minitools.png Binary files differnew file mode 100644 index 0000000..ced954c --- /dev/null +++ b/konq-plugins/minitools/cr22-action-minitools.png diff --git a/konq-plugins/minitools/cr32-action-minitools.png b/konq-plugins/minitools/cr32-action-minitools.png Binary files differnew file mode 100644 index 0000000..028869c --- /dev/null +++ b/konq-plugins/minitools/cr32-action-minitools.png diff --git a/konq-plugins/minitools/cr48-action-minitools.png b/konq-plugins/minitools/cr48-action-minitools.png Binary files differnew file mode 100644 index 0000000..aa335b2 --- /dev/null +++ b/konq-plugins/minitools/cr48-action-minitools.png diff --git a/konq-plugins/minitools/minitoolsplugin.cpp b/konq-plugins/minitools/minitoolsplugin.cpp new file mode 100644 index 0000000..53f109b --- /dev/null +++ b/konq-plugins/minitools/minitoolsplugin.cpp @@ -0,0 +1,156 @@ +/* + Copyright (c) 2003 Alexander Kellett <lypanov@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License (LGPL) 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 <qfile.h> + +#include <kdebug.h> +#include <kaction.h> +#include <kglobal.h> +#include <kconfig.h> +#include <kinstance.h> +#include <khtml_part.h> +#include <kgenericfactory.h> + +#include <kstandarddirs.h> + +#include <krun.h> +#include <kservice.h> + +#include <kpopupmenu.h> +#include <kbookmarkimporter.h> +#include <kbookmarkmanager.h> + +#include "minitoolsplugin.h" + +typedef KGenericFactory<MinitoolsPlugin> MinitoolsPluginFactory; +K_EXPORT_COMPONENT_FACTORY( libminitoolsplugin, MinitoolsPluginFactory("minitoolsplugin") ) + +MinitoolsPlugin::MinitoolsPlugin(QObject* parent, const char* name, const QStringList &) + : KParts::Plugin(parent, name) { + m_part = (parent && parent->inherits( "KHTMLPart" )) ? static_cast<KHTMLPart*>(parent) : 0L; + + m_pMinitoolsMenu = new KActionMenu(i18n("&Minitools"), "minitools", actionCollection(), "minitools"); + + m_pMinitoolsMenu->setDelayed(false); + m_pMinitoolsMenu->setEnabled(true); + + connect(m_pMinitoolsMenu->popupMenu(), SIGNAL( aboutToShow() ), + this, SLOT( slotAboutToShow() )); +} + +MinitoolsPlugin::~MinitoolsPlugin() { + ; +} + +void MinitoolsPlugin::slotAboutToShow() { + + m_minitoolsList.clear(); + KXBELBookmarkImporterImpl importer; + connect(&importer, SIGNAL( newBookmark( const QString &, const QCString &, const QString &) ), + SLOT( newBookmarkCallback( const QString &, const QCString &, const QString & ) )); + connect(&importer, SIGNAL( endFolder() ), + SLOT( endFolderCallback() )); + QString filename = minitoolsFilename(true); + if (!filename.isEmpty() && QFile::exists(filename)) { + importer.setFilename(filename); + importer.parse(); + } + filename = minitoolsFilename(false); + if (!filename.isEmpty() && QFile::exists(filename)) { + importer.setFilename(filename); + importer.parse(); + } + + m_pMinitoolsMenu->popupMenu()->clear(); + + int count = m_pMinitoolsMenu->popupMenu()->count(); // why not 0??? + bool gotSep = true; // don't start with a sep + + if (m_minitoolsList.count() > 0) { + MinitoolsList::ConstIterator e = m_minitoolsList.begin(); + for( ; e != m_minitoolsList.end(); ++e ) { + if ( ((*e).first == "-") + && ((*e).second == "-") + ) { + if (!gotSep) + m_pMinitoolsMenu->popupMenu()->insertSeparator(); + gotSep = true; + count++; + } else { + QString str = (*e).first; + // emsquieezzy thingy? + if (str.length() > 48) { + str.truncate(48); + str.append("..."); + } + m_pMinitoolsMenu->popupMenu()->insertItem( + str, this, + SLOT(slotItemSelected(int)), + 0, ++count ); + gotSep = false; + } + } + } + + if (!gotSep) { + // don't have an extra sep + m_pMinitoolsMenu->popupMenu()->insertSeparator(); + } + + m_pMinitoolsMenu->popupMenu() + ->insertItem(i18n("&Edit Minitools"), + this, SLOT(slotEditBookmarks()), + 0, ++count ); +} + +void MinitoolsPlugin::newBookmarkCallback( + const QString & text, const QCString & url, const QString & +) { + kdDebug(90150) << "MinitoolsPlugin::newBookmarkCallback" << text << url << endl; + m_minitoolsList.prepend(qMakePair(text,url)); +} + +void MinitoolsPlugin::endFolderCallback() { + kdDebug(90150) << "MinitoolsPlugin::endFolderCallback" << endl; + m_minitoolsList.prepend(qMakePair(QString("-"),QCString("-"))); +} + +QString MinitoolsPlugin::minitoolsFilename(bool local) { + return local ? locateLocal("data", QString::fromLatin1("konqueror/minitools.xml")) + : locateLocal("data", QString::fromLatin1("konqueror/minitools-global.xml")); +} + +void MinitoolsPlugin::slotEditBookmarks() { + KBookmarkManager *manager = KBookmarkManager::managerForFile(minitoolsFilename(true)); + manager->slotEditBookmarks(); +} + +void MinitoolsPlugin::slotItemSelected(int id) { + if (m_minitoolsList.count() == 0) + return; + QString tmp = m_minitoolsList[id-1].second; + QString script = KURL::decode_string(tmp.right(tmp.length() - 11)); // sizeof("javascript:") + connect(this, SIGNAL( executeScript(const QString &) ), + m_part, SLOT( executeScript(const QString &) )); + emit executeScript(script); + disconnect(this, SIGNAL( executeScript(const QString &) ), 0, 0); +} + +#include "minitoolsplugin.moc" diff --git a/konq-plugins/minitools/minitoolsplugin.desktop b/konq-plugins/minitools/minitoolsplugin.desktop new file mode 100644 index 0000000..4f6894c --- /dev/null +++ b/konq-plugins/minitools/minitoolsplugin.desktop @@ -0,0 +1,121 @@ +[Desktop Entry] +X-KDE-Library=Minitools +X-KDE-PluginInfo-Author=Alexander Kellett +X-KDE-PluginInfo-Email=lypanov@kde.org +X-KDE-PluginInfo-Name=Minitools +X-KDE-PluginInfo-Version=3.3 +X-KDE-PluginInfo-Website= +X-KDE-PluginInfo-Category=Tools +X-KDE-PluginInfo-Depends= +X-KDE-PluginInfo-License=GPL +X-KDE-PluginInfo-EnabledByDefault=true +Icon=minitools +Name=Mini-Tools +Name[az]=Kiçik-Vasitələr +Name[bg]=Мини инструменти +Name[bs]=Mini-alati +Name[ca]=Mini-eines +Name[cs]=Mini nástroje +Name[cy]=Mini-Offer +Name[da]=Mini-værktøjer +Name[de]=Mini-Dienstprogramme +Name[el]=Μικρά εργαλεία +Name[eo]=Iletoj +Name[es]=Mini-herramientas +Name[eu]=Mini-tresnak +Name[fa]=ریزابزارها +Name[fi]=Minityökalut +Name[fr]=Mini-outils +Name[fy]=Miny-Ark +Name[ga]=Mion-Uirlisí +Name[gl]=Mini-Ferramentas +Name[hi]=मिनि-औज़ार +Name[hr]=Mini-alati +Name[hu]=Mini könyvjelzők +Name[is]=Lítil tól +Name[it]=Strumenti miniaturizzati +Name[ja]=ミニツール +Name[ka]=მინი-ხელსაწყოები +Name[kk]=Шағын құралдар +Name[km]=ឧបករណ៍ខ្នាតតូច +Name[lt]=Mini įrankiai +Name[mk]=Мини-алатки +Name[ms]=Minialat +Name[nb]=Mini-verktøy +Name[nds]=Lüttwarktüüch +Name[ne]=साना-उपकरण +Name[nn]=Miniverktøy +Name[pa]=ਮਿੰਨੀ-ਸੰਦ +Name[pl]=Mini-narzędzia +Name[pt]=Mini-Ferramentas +Name[pt_BR]=Mini Ferramentas +Name[ro]=Mini-unelte +Name[ru]=Мини-утилиты +Name[sk]=Mini-nástroje +Name[sl]=Mini orodja +Name[sr]=Мини алати +Name[sr@Latn]=Mini alati +Name[sv]=Miniverktyg +Name[ta]=மிகச்சிறிய-கருவிகள் +Name[tg]=Мини-асбобҳо +Name[tr]=Küçük Araçlar +Name[uk]=Міні-засоби +Name[vi]=Công cụ nhỏ +Name[zh_CN]=小工具 +Comment=Mini-Tools +Comment[az]=Kiçik-Vasitələr +Comment[bg]=Миниатюрни инструменти +Comment[bs]=Mini-alati +Comment[ca]=Mini-eines +Comment[cs]=Mini nástroje +Comment[cy]=Mini-Offer +Comment[da]=Mini-værktøjer +Comment[de]=Kleine Dienstprogramme +Comment[el]=Μικρά εργαλεία +Comment[eo]=Iletoj +Comment[es]=Mini-herramientas +Comment[et]=Mini-tööriistad +Comment[eu]=Mini-tresnak +Comment[fa]=ریزابزارها +Comment[fi]=Minityökalut +Comment[fr]=Mini-outils +Comment[fy]=Miny-helpmiddels +Comment[ga]=Mion-Uirlisí +Comment[gl]=Mini-Ferramentas +Comment[he]=מיני כלים +Comment[hi]=मिनि-औज़ार +Comment[hr]=Minijaturni alati +Comment[hu]=Mini könyvjelzők +Comment[is]=Lítil tól +Comment[it]=Strumenti miniaturizzati +Comment[ja]=ミニツール +Comment[ka]=მინი-ხელსაწყოები +Comment[kk]=Шағын құралдар +Comment[km]=ឧបករណ៍ខ្នាតតូច +Comment[lt]=Mini įrankiai +Comment[mk]=Мини-алатки +Comment[ms]=Minialat +Comment[nb]=Mini-verktøy +Comment[nds]=Lütte Warktüüch +Comment[ne]=साना-उपकरण +Comment[nl]=Mini-hulpmiddelen +Comment[nn]=Miniverktøy +Comment[pa]=ਮਿੰਨੀ-ਸੰਦ +Comment[pl]=Mini-narzędzia +Comment[pt]=Mini-Ferramentas +Comment[pt_BR]=Mini Ferramentas +Comment[ro]=Mini-unelte +Comment[ru]=Мини-утилиты +Comment[sk]=Mini-nástroje +Comment[sl]=Mini orodja +Comment[sr]=Мини-алати +Comment[sr@Latn]=Mini-alati +Comment[sv]=Miniverktyg +Comment[ta]=மிகச்சிறியக்- கருவிகள் +Comment[tg]=Мини-асбобҳо +Comment[tr]=Küçük Araçlar +Comment[uk]=Міні-засоби +Comment[vi]=Công cụ nhỏ +Comment[zh_CN]=小工具 +X-KDE-ParentApp=konqueror +DocPath=konq-plugins/minitools/index.html diff --git a/konq-plugins/minitools/minitoolsplugin.h b/konq-plugins/minitools/minitoolsplugin.h new file mode 100644 index 0000000..7db1a77 --- /dev/null +++ b/konq-plugins/minitools/minitoolsplugin.h @@ -0,0 +1,66 @@ +/* + Copyright (c) 2003 Alexander Kellett <lypanov@kde.org> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License (LGPL) 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 __MINITOOLS_PLUGIN_H +#define __MINITOOLS_PLUGIN_H + +#include <qmap.h> +#include <qvaluelist.h> +#include <qstringlist.h> + +#include <kurl.h> +#include <klibloader.h> +#include <kparts/plugin.h> + +class KHTMLPart; +class KActionMenu; + +class MinitoolsPlugin : public KParts::Plugin { + Q_OBJECT + +public: + MinitoolsPlugin( QObject* parent, const char* name, const QStringList & ); + ~MinitoolsPlugin(); + +protected slots: + void slotAboutToShow(); + void slotEditBookmarks(); + void slotItemSelected(int); + void newBookmarkCallback( const QString &, const QCString &, const QString & ); + void endFolderCallback( ); + +signals: + void executeScript( const QString &script ); + +private: + QString minitoolsFilename(bool local); + + int m_selectedItem; + + KHTMLPart* m_part; + KActionMenu* m_pMinitoolsMenu; + + typedef QPair<QString,QCString> Minitool; + typedef QValueList<Minitool> MinitoolsList; + + MinitoolsList m_minitoolsList; +}; + +#endif diff --git a/konq-plugins/minitools/minitoolsplugin.rc b/konq-plugins/minitools/minitoolsplugin.rc new file mode 100644 index 0000000..b5af77a --- /dev/null +++ b/konq-plugins/minitools/minitoolsplugin.rc @@ -0,0 +1,11 @@ +<!DOCTYPE kpartplugin> +<kpartplugin name="Minitools" library="libminitoolsplugin"> +<MenuBar> + <Menu name="tools"><Text>&Tools</Text> + <Action name="minitools"/> + </Menu> +</MenuBar> +<ToolBar name="extraToolBar"><text>Extra Toolbar</text> + <Action name="minitools"/> +</ToolBar> +</kpartplugin> |