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/autorefresh | |
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/autorefresh')
-rw-r--r-- | konq-plugins/autorefresh/Makefile.am | 21 | ||||
-rw-r--r-- | konq-plugins/autorefresh/autorefresh.cpp | 107 | ||||
-rw-r--r-- | konq-plugins/autorefresh/autorefresh.desktop | 120 | ||||
-rw-r--r-- | konq-plugins/autorefresh/autorefresh.h | 55 | ||||
-rw-r--r-- | konq-plugins/autorefresh/autorefresh.rc | 10 | ||||
-rw-r--r-- | konq-plugins/autorefresh/lo16-app-autorefresh.png | bin | 0 -> 258 bytes |
6 files changed, 313 insertions, 0 deletions
diff --git a/konq-plugins/autorefresh/Makefile.am b/konq-plugins/autorefresh/Makefile.am new file mode 100644 index 0000000..f97432b --- /dev/null +++ b/konq-plugins/autorefresh/Makefile.am @@ -0,0 +1,21 @@ +kde_module_LTLIBRARIES = libautorefresh.la + +INCLUDES = $(all_includes) + +libautorefresh_la_METASOURCES = AUTO +libautorefresh_la_SOURCES = autorefresh.cpp +libautorefresh_la_LIBADD = $(LIB_KHTML) + +libautorefresh_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) + +KDE_ICON = autorefresh + +autorefreshdir = $(kde_datadir)/khtml/kpartplugins +autorefresh_DATA = autorefresh.rc autorefresh.desktop + +messages: rc.cpp + LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \ + if test -n "$$LIST"; then \ + $(XGETTEXT) $$LIST -o $(podir)/autorefresh.pot; \ + fi + diff --git a/konq-plugins/autorefresh/autorefresh.cpp b/konq-plugins/autorefresh/autorefresh.cpp new file mode 100644 index 0000000..6d06ea0 --- /dev/null +++ b/konq-plugins/autorefresh/autorefresh.cpp @@ -0,0 +1,107 @@ +// -*- c++ -*- + +/* + * Copyright 2003 by Richard J. Moore, rich@kde.org + */ + + +#include <khtml_part.h> // this plugin applies to a khtml part +#include <kdebug.h> +#include "autorefresh.h" +#include <kaction.h> +#include <kinstance.h> +#include <kiconloader.h> +#include <qmessagebox.h> +#include <klocale.h> +#include <qtimer.h> +#include <kgenericfactory.h> + +AutoRefresh::AutoRefresh( QObject* parent, const char* name, const QStringList & /*args*/ ) + : Plugin( parent, name ) +{ + timer = new QTimer( this ); + connect( timer, SIGNAL( timeout() ), this, SLOT( slotRefresh() ) ); + + refresher = new KSelectAction( i18n("&Auto Refresh"), + "reload", 0, + this, SLOT(slotIntervalChanged()), + actionCollection(), "autorefresh" ); + QStringList sl; + sl << i18n("None"); + sl << i18n("Every 15 Seconds"); + sl << i18n("Every 30 Seconds"); + sl << i18n("Every Minute"); + sl << i18n("Every 5 Minutes"); + sl << i18n("Every 10 Minutes"); + sl << i18n("Every 15 Minutes"); + sl << i18n("Every 30 Minutes"); + sl << i18n("Every 60 Minutes"); + + refresher->setItems( sl ); + refresher->setCurrentItem( 0 ); +} + +AutoRefresh::~AutoRefresh() +{ +} + +void AutoRefresh::slotIntervalChanged() +{ + int idx = refresher->currentItem(); + int timeout = 0; + switch (idx) { + case 1: + timeout = ( 15*1000 ); + break; + case 2: + timeout = ( 30*1000 ); + break; + case 3: + timeout = ( 60*1000 ); + break; + case 4: + timeout = ( 5*60*1000 ); + break; + case 5: + timeout = ( 10*60*1000 ); + break; + case 6: + timeout = ( 15*60*1000 ); + break; + case 7: + timeout = ( 30*60*1000 ); + break; + case 8: + timeout = ( 60*60*1000 ); + break; + default: + break; + } + + timer->stop(); + if ( timeout ) + timer->start( timeout ); +} + +void AutoRefresh::slotRefresh() +{ + if ( !parent()->inherits("KParts::ReadOnlyPart") ) { + QString title = i18n( "Cannot Refresh Source" ); + QString text = i18n( "<qt>This plugin cannot auto-refresh the current part.</qt>" ); + + QMessageBox::warning( 0, title, text ); + } + else + { + KParts::ReadOnlyPart *part = (KParts::ReadOnlyPart *) parent(); + + // Get URL + KURL url = part->url(); + part->openURL( url ); + } +} + +K_EXPORT_COMPONENT_FACTORY( libautorefresh, KGenericFactory<AutoRefresh>( "autorefresh" ) ) + +#include "autorefresh.moc" + diff --git a/konq-plugins/autorefresh/autorefresh.desktop b/konq-plugins/autorefresh/autorefresh.desktop new file mode 100644 index 0000000..7df9332 --- /dev/null +++ b/konq-plugins/autorefresh/autorefresh.desktop @@ -0,0 +1,120 @@ +[Desktop Entry] +X-KDE-Library=autorefresh +X-KDE-PluginInfo-Author=Richard J. Moore +X-KDE-PluginInfo-Email=rich@kde.org +X-KDE-PluginInfo-Name=autorefresh +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=false +Name=Auto Refresh Plugin +Name[bg]=Приставка за автоматично опресняване +Name[ca]=Connector de refresc automàtic +Name[cs]=Modul automatického obnovení +Name[da]=Plugin til autogenopfriskning +Name[de]=Aktualisierungsmodul +Name[el]=Πρόσθετο αυτόματης ανανέωσης +Name[eo]=Aŭtomata refreŝa kromaĵo +Name[es]=Complemento para actualización automática +Name[et]=Automaatse uuendamise plugin +Name[eu]=Auto Refresh plugina +Name[fa]=بازآوری خودکار وصله +Name[fi]=Automaattivirkistyssovelma +Name[fr]=Module d'auto-rafraîchissement +Name[fy]=Autoferfarskplugin +Name[gl]=Plugin de Actualización Automática +Name[he]=תוסף רענון אוטומטי +Name[hi]=स्वचालित ताज़ा करने का प्लगइन +Name[hr]=Dodatak za automatsko osvježavanje +Name[hu]=Automatikus frissítési bővítőmodul +Name[is]=Sjálfvirkt uppfærsluíforrit +Name[it]=Aggiornamento automatico +Name[ja]=自動更新プラグイン +Name[ka]=ავტო განახლების მოდული +Name[kk]=Авто жаңарту плагин модулі +Name[km]=ធ្វើឲ្យកម្មវិធីជំនួយស្រស់ដោយស្វ័យប្រវត្តិ +Name[lt]=Automatinio atnaujinimo priedas +Name[mk]=Приклучок за автоматско освежување +Name[ms]=Plugin Automuat Semula +Name[nb]=Programtillegg for auto-oppfrisking +Name[nds]=Moduul för't automaatsche Opfrischen +Name[ne]=स्वत: ताजा पार्ने प्लगइन +Name[nl]=Autoverversplugin +Name[nn]=Programtillegg for automatisk oppfrisking +Name[pa]=ਸਵੈਚਾਲਿਤ ਤਾਜ਼ਾ ਪਲੱਗਇਨ +Name[pl]=Wtyczka automatycznego odświeżania +Name[pt]='Plugin' de Actualização Automática +Name[pt_BR]=Plug-in de atualização automática +Name[ru]=Модуль автообновления +Name[sk]=Modul automatického obnovenia +Name[sl]=Vstavek za samodejno osveževanje +Name[sr]=Прикључак за аутоматско освежавање +Name[sr@Latn]=Priključak za automatsko osvežavanje +Name[sv]=Insticksprogram för automatisk uppdatering +Name[ta]=தானாகவே புதுப்பிக்கும் சொருகுப்பொருள் +Name[tg]=Худкорона аз нав кардани модул +Name[tr]=Otomatik Tazeleme Eklentisi +Name[uk]=Втулок автоматичного перезавантаження +Name[uz]=Avto-yangilash plagini +Name[uz@cyrillic]=Авто-янгилаш плагини +Name[vi]=Bổ sung tự động làm tươi +Name[zh_CN]=自动刷新插件 +Name[zh_TW]=自動刷新外掛程式 +Comment=Auto Refresh plugin +Comment[bg]=Приставка за автоматично опресняване +Comment[ca]=Connector de refresc automàtic +Comment[cs]=Modul automatického obnovení +Comment[da]=Plugin til autogenopfriskning +Comment[de]=Ein Modul zur automatischen Aktualisierung +Comment[el]=Πρόσθετο αυτόματης ανανέωσης +Comment[eo]=Aŭtomata refreŝa kromaĵo +Comment[es]=Complemento para actualización automática +Comment[et]=Automaatse uuendamise plugin +Comment[eu]=Auto Refresh plugina +Comment[fa]=بازآوری خودکار وصله +Comment[fi]=Automaattivirkistyssovelma +Comment[fr]=Module d'auto-rafraîchissement +Comment[fy]=Autoferfarskplugin +Comment[gl]=Plugin de actualización automática +Comment[he]=תוסף רענון אוטומטי +Comment[hi]=स्वचालित ताज़ा करने का प्लगइन +Comment[hr]=Dodatak za automatsko osvježavanje +Comment[hu]=Automatikus frissítési bővítőmodul +Comment[is]=Sjálfvirkt uppfærsluíforrit +Comment[it]=Plugin per l'aggiornamento automatico +Comment[ja]=自動更新プラグイン +Comment[ka]=ავტო განახლების მოდული +Comment[kk]=Авто жаңарту плагин модулі +Comment[km]=ធ្វើកម្មវិធីជំនួយឲ្យស្រស់ដោយស្វ័យប្រវត្តិ +Comment[lt]=Automatinio atnaujinimo priedas +Comment[mk]=Приклучок за автоматско освежување +Comment[ms]=Plugin AutoMuat Semula +Comment[nb]=Programtillegg for auto-oppfrisk +Comment[nds]=Moduul för't automaatsche Opfrischen +Comment[ne]=स्वत: ताजा पार्ने प्लगइन +Comment[nl]=Autoverversplugin +Comment[nn]=Programtillegg for automatisk oppfrisking +Comment[pa]=ਸਵੈ-ਚਾਲਿਤ ਤਾਜ਼ਾ ਪਲੱਗਇਨ +Comment[pl]=Wtyczka automatycznego odświeżania +Comment[pt]='Plugin' de actualização automática +Comment[pt_BR]=Plug-in de atualização automática +Comment[ru]=Модуль автообновления +Comment[sk]=Modul automatického obnovenia +Comment[sl]=Vstavek za samodejno osveževanje +Comment[sr]=Прикључак за аутоматско освежавање +Comment[sr@Latn]=Priključak za automatsko osvežavanje +Comment[sv]=Insticksprogram för automatisk uppdatering +Comment[ta]=தானாகவே புதுப்பிக்கும் சொருகுப்பொருள் +Comment[tg]=Худкорона аз нав кардани модул +Comment[tr]=Otomatik Tazeleme Eklentisi +Comment[uk]=Втулок автоматичного перезавантаження +Comment[uz]=Veb-sahifani avto-yangilash vositasi +Comment[uz@cyrillic]=Веб-саҳифани авто-янгилаш воситаси +Comment[vi]=Bổ sung tự động làm tươi +Comment[zh_CN]=自动刷新插件 +Comment[zh_TW]=自動刷新外掛程式 +Icon=reload +X-KDE-ParentApp=konqueror + diff --git a/konq-plugins/autorefresh/autorefresh.h b/konq-plugins/autorefresh/autorefresh.h new file mode 100644 index 0000000..370e42b --- /dev/null +++ b/konq-plugins/autorefresh/autorefresh.h @@ -0,0 +1,55 @@ +// -*- c++ -*- + +/* + * Copyright 2003 by Richard J. Moore, rich@kde.org + */ + +#ifndef __plugin_autorefresh_h +#define __plugin_autorefresh_h + +#include <kparts/plugin.h> +#include <klibloader.h> + +class KURL; +class KInstance; +class QTimer; + +/** + * A plugin is the way to add actions to an existing @ref KParts application, + * or to a @ref Part. + * + * The XML of those plugins looks exactly like of the shell or parts, + * with one small difference: The document tag should have an additional + * attribute, named "library", and contain the name of the library implementing + * the plugin. + * + * If you want this plugin to be used by a part, you need to + * install the rc file under the directory + * "data" (KDEDIR/share/apps usually)+"/instancename/kpartplugins/" + * where instancename is the name of the part's instance. + **/ +class AutoRefresh : public KParts::Plugin +{ + Q_OBJECT +public: + + /** + * Construct a new KParts plugin. + */ + AutoRefresh( QObject* parent = 0, const char* name = 0, const QStringList &args = QStringList() ); + + /** + * Destructor. + */ + virtual ~AutoRefresh(); + +public slots: + void slotRefresh(); + void slotIntervalChanged(); + +private: + KSelectAction *refresher; + QTimer *timer; +}; + +#endif diff --git a/konq-plugins/autorefresh/autorefresh.rc b/konq-plugins/autorefresh/autorefresh.rc new file mode 100644 index 0000000..9226178 --- /dev/null +++ b/konq-plugins/autorefresh/autorefresh.rc @@ -0,0 +1,10 @@ +<!DOCTYPE kpartgui> + <kpartgui library="libautorefresh" name="autorefresh" version="0.1" > + <MenuBar> + <Menu name="tools"> + <Text>&Tools</Text> + <Action name="autorefresh"/> + </Menu> + </MenuBar> +</kpartgui> + diff --git a/konq-plugins/autorefresh/lo16-app-autorefresh.png b/konq-plugins/autorefresh/lo16-app-autorefresh.png Binary files differnew file mode 100644 index 0000000..e4c699a --- /dev/null +++ b/konq-plugins/autorefresh/lo16-app-autorefresh.png |