mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-24 02:42:52 +00:00
kdeplasma-addons: remove browserhistory and kopete runners
browserhistory relies on konq_history config to get the recently visited URLs which was supported by Konqueror only. Kopete is also not supported by the Katana project Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
be3042c58d
commit
47dcfa81d9
12 changed files with 0 additions and 802 deletions
|
@ -1,9 +1,7 @@
|
||||||
add_subdirectory(audioplayercontrol)
|
add_subdirectory(audioplayercontrol)
|
||||||
add_subdirectory(browserhistory)
|
|
||||||
add_subdirectory(converter)
|
add_subdirectory(converter)
|
||||||
add_subdirectory(datetime)
|
add_subdirectory(datetime)
|
||||||
add_subdirectory(katesessions)
|
add_subdirectory(katesessions)
|
||||||
add_subdirectory(kopete)
|
|
||||||
add_subdirectory(mediawiki)
|
add_subdirectory(mediawiki)
|
||||||
add_subdirectory(spellchecker)
|
add_subdirectory(spellchecker)
|
||||||
add_subdirectory(characters)
|
add_subdirectory(characters)
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
set(krunner_browserhistory_SRCS
|
|
||||||
browserhistory.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
kde4_add_plugin(krunner_browserhistory ${krunner_browserhistory_SRCS})
|
|
||||||
target_link_libraries(krunner_browserhistory ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS})
|
|
||||||
|
|
||||||
install(TARGETS krunner_browserhistory DESTINATION ${KDE4_PLUGIN_INSTALL_DIR} )
|
|
||||||
|
|
||||||
install(FILES browserhistory.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
#! /usr/bin/env bash
|
|
||||||
$XGETTEXT *.cpp -o $podir/plasma_runner_browserhistory.pot
|
|
|
@ -1,15 +0,0 @@
|
||||||
Browser history runner
|
|
||||||
========================
|
|
||||||
This Runner loads Konqueror's history from its
|
|
||||||
config file. KRunner's query is matched against
|
|
||||||
these items.
|
|
||||||
|
|
||||||
Open
|
|
||||||
=====
|
|
||||||
- Is there a way to get notified on updates to
|
|
||||||
the browser's history, rather than reloading
|
|
||||||
the config file?
|
|
||||||
- Do we want Firefox's history as well?
|
|
||||||
|
|
||||||
--
|
|
||||||
sebas@kde.org
|
|
|
@ -1,112 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2008 Sebastian Kügler <sebas@kde.org>
|
|
||||||
*
|
|
||||||
* This program 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, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program 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 General Public License for more details
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this program; if not, write to the
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "browserhistory.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <KDebug>
|
|
||||||
#include <KStandardDirs>
|
|
||||||
#include <KDirWatch>
|
|
||||||
#include <KToolInvocation>
|
|
||||||
#include <KIcon>
|
|
||||||
#include <KConfig>
|
|
||||||
#include <KConfigGroup>
|
|
||||||
|
|
||||||
|
|
||||||
BrowserHistoryRunner::BrowserHistoryRunner(QObject *parent, const QVariantList& args)
|
|
||||||
: Plasma::AbstractRunner(parent, args)
|
|
||||||
{
|
|
||||||
Q_UNUSED(args);
|
|
||||||
setObjectName(QLatin1String( "Browser History" ));
|
|
||||||
m_icon = KIcon(QLatin1String( "view-history" ));
|
|
||||||
|
|
||||||
loadHistory();
|
|
||||||
|
|
||||||
// listen for changes to the list of recent documents
|
|
||||||
KDirWatch *historyWatch = new KDirWatch(this);
|
|
||||||
historyWatch->addFile(KStandardDirs::locate("config", QLatin1String( "konq_history" )));
|
|
||||||
connect(historyWatch,SIGNAL(dirty(QString)),this,SLOT(loadHistory()));
|
|
||||||
connect(historyWatch,SIGNAL(created(QString)),this,SLOT(loadHistory()));
|
|
||||||
connect(historyWatch,SIGNAL(deleted(QString)),this,SLOT(loadHistory()));
|
|
||||||
|
|
||||||
addSyntax(Plasma::RunnerSyntax(QLatin1String( ":q:" ), i18n("Finds web sites you have visited matching :q:.")));
|
|
||||||
}
|
|
||||||
|
|
||||||
BrowserHistoryRunner::~BrowserHistoryRunner()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void BrowserHistoryRunner::loadHistory()
|
|
||||||
{
|
|
||||||
KConfig *konq_config = new KConfig(QLatin1String( "konq_history" ), KConfig::NoGlobals);
|
|
||||||
KConfigGroup locationBarGroup( konq_config, "Location Bar" );
|
|
||||||
QStringList lstHistory = locationBarGroup.readPathEntry( "ComboContents", QStringList() );
|
|
||||||
delete konq_config;
|
|
||||||
|
|
||||||
QMutableStringListIterator it(lstHistory);
|
|
||||||
while (it.hasNext()) {
|
|
||||||
if (it.next().startsWith(QLatin1String("error:/"))) {
|
|
||||||
it.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_history = lstHistory;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BrowserHistoryRunner::match(Plasma::RunnerContext &context)
|
|
||||||
{
|
|
||||||
const QString term = context.query();
|
|
||||||
if (term.length() < 3) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (const QString &historyitem, m_history) {
|
|
||||||
if (!context.isValid()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter out error pages, and match ...
|
|
||||||
if (historyitem.contains(term, Qt::CaseInsensitive)) {
|
|
||||||
Plasma::QueryMatch match(this);
|
|
||||||
match.setType(Plasma::QueryMatch::PossibleMatch);
|
|
||||||
match.setRelevance(0.5);
|
|
||||||
match.setIcon(m_icon);
|
|
||||||
match.setData(historyitem);
|
|
||||||
QString text = historyitem;
|
|
||||||
text.remove(QLatin1String( "http://" ));
|
|
||||||
text.remove(QLatin1String( "https://" ));
|
|
||||||
match.setSubtext(text);
|
|
||||||
text.remove(QRegExp(QLatin1String( "/.*" )));
|
|
||||||
match.setText(text);
|
|
||||||
context.addMatch(term, match);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void BrowserHistoryRunner::run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match)
|
|
||||||
{
|
|
||||||
Q_UNUSED(context)
|
|
||||||
const QString location = match.data().toString();
|
|
||||||
kDebug() << "Browse to " << location;
|
|
||||||
if (!location.isEmpty()) {
|
|
||||||
KToolInvocation::invokeBrowser(location);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_browserhistory.cpp"
|
|
|
@ -1,119 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Name=Web Browser History
|
|
||||||
Name[ar]=تاريخ متصفح الويب
|
|
||||||
Name[ast]=Hestorial del restolador web
|
|
||||||
Name[bs]=Historija web preglednika
|
|
||||||
Name[ca]=Historial del navegador web
|
|
||||||
Name[ca@valencia]=Historial del navegador web
|
|
||||||
Name[cs]=Historie prohlížeče
|
|
||||||
Name[da]=Webbrowser-historik
|
|
||||||
Name[de]=Webbrowser-Verlauf
|
|
||||||
Name[el]=Ιστορικό περιηγητή ιστού
|
|
||||||
Name[en_GB]=Web Browser History
|
|
||||||
Name[es]=Historial del navegador web
|
|
||||||
Name[et]=Veebibrauseri ajalugu
|
|
||||||
Name[fi]=Selainhistoria
|
|
||||||
Name[fr]=Historique du navigateur Web
|
|
||||||
Name[ga]=Stair Bhrabhsála
|
|
||||||
Name[gl]=Historial de navegación web
|
|
||||||
Name[hr]=Povijest web preglednika
|
|
||||||
Name[hu]=Előzmények
|
|
||||||
Name[is]=Ferill vafra
|
|
||||||
Name[it]=Cronologia della navigazione web
|
|
||||||
Name[ja]=ウェブブラウザの履歴
|
|
||||||
Name[kk]=Веб браузерінің журналы
|
|
||||||
Name[km]=ប្រវត្តិកម្មវិធីរុករកបណ្ដាញ
|
|
||||||
Name[ko]=웹 브라우저 과거 기록
|
|
||||||
Name[lt]=Žiniatinklio naršyklės istorija
|
|
||||||
Name[lv]=Tīmekļa pārlūka vēsture
|
|
||||||
Name[mr]=वेब ब्राऊजर इतिहास
|
|
||||||
Name[nb]=Nettleser-historie
|
|
||||||
Name[nds]=Nettkieker-Vörgeschicht
|
|
||||||
Name[nl]=Webbrowser-geschiedenis
|
|
||||||
Name[nn]=Nettlesarlogg
|
|
||||||
Name[pa]=ਵੈੱਬ ਬਰਾਊਜ਼ਰ ਅਤੀਤ
|
|
||||||
Name[pl]=Historia przeglądarki sieciowej
|
|
||||||
Name[pt]=Histórico do Navegador Web
|
|
||||||
Name[pt_BR]=Histórico do navegador da Internet
|
|
||||||
Name[ro]=Istoricul navigatorului web
|
|
||||||
Name[ru]=Журнал посещения сайтов
|
|
||||||
Name[sk]=História webového prehliadača
|
|
||||||
Name[sl]=Zgodovina spletnega brskalnika
|
|
||||||
Name[sr]=историјат веб прегледача
|
|
||||||
Name[sr@ijekavian]=историјат веб прегледача
|
|
||||||
Name[sr@ijekavianlatin]=istorijat veb pregledača
|
|
||||||
Name[sr@latin]=istorijat veb pregledača
|
|
||||||
Name[sv]=Webbläsningshistorik
|
|
||||||
Name[th]=ประวัติการใช้งานเว็บเบราว์เซอร์
|
|
||||||
Name[tr]=Web Tarayıcı Geçmişi
|
|
||||||
Name[uk]=Історія переглядача Тенет
|
|
||||||
Name[wa]=Istwere do betchteu waibe
|
|
||||||
Name[x-test]=xxWeb Browser Historyxx
|
|
||||||
Name[zh_CN]=网页浏览器历史
|
|
||||||
Name[zh_TW]=網頁瀏覽器歷史紀錄
|
|
||||||
Comment=Searches in Konqueror's history
|
|
||||||
Comment[ar]=تبحث في تاريخ كنيكر
|
|
||||||
Comment[ast]=Guetes nel hestorial de Konqueror
|
|
||||||
Comment[bs]=Pretažuje u Konquerovoj histroiji
|
|
||||||
Comment[ca]=Cerques a l'historial del Konqueror
|
|
||||||
Comment[ca@valencia]=Cerques a l'historial del Konqueror
|
|
||||||
Comment[cs]=Vyhledávání v historii prohlížeče Konqueror
|
|
||||||
Comment[da]=Søger i Konquerors historik.
|
|
||||||
Comment[de]=Suche im Verlauf von Konqueror
|
|
||||||
Comment[el]=Αναζήτηση στο ιστορικό του Konqueror
|
|
||||||
Comment[en_GB]=Searches in Konqueror's history
|
|
||||||
Comment[es]=Búsquedas en el historial de Konqueror
|
|
||||||
Comment[et]=Otsing Konquerori ajaloos
|
|
||||||
Comment[eu]=Konquerorren historian bilatzen du
|
|
||||||
Comment[fi]=Hakee Konquerorin selaushistoriasta
|
|
||||||
Comment[fr]=Cherche dans l'historique de Konqueror
|
|
||||||
Comment[ga]=Cuardaigh i stair Konqueror
|
|
||||||
Comment[gl]=Procura no historial de Konqueror
|
|
||||||
Comment[he]=חיפוש בהיסטוריה של Konqueror
|
|
||||||
Comment[hr]=Pretražuje u povijesti Konquerora
|
|
||||||
Comment[hu]=Keresés a Konqueror előzményeiben
|
|
||||||
Comment[is]=Leitar í ferli Konqueror
|
|
||||||
Comment[it]=Cerca nella cronologia di Konqueror
|
|
||||||
Comment[ja]=Konqueror の履歴を検索します
|
|
||||||
Comment[kk]=Konqueror шолғышының журналы
|
|
||||||
Comment[km]=ស្វែងរកនៅក្នុងប្រវត្តិរបស់ Konqueror
|
|
||||||
Comment[ko]=Konqueror 과거 기록 검색
|
|
||||||
Comment[ku]=Di dîroka Konqueror de lê digere
|
|
||||||
Comment[lt]=Ieško Konqueror istorijoje
|
|
||||||
Comment[lv]=Meklē Konqueror vēsturē
|
|
||||||
Comment[mr]=कॉन्कररच्या इतिहासामध्ये शोधतो
|
|
||||||
Comment[nb]=Søker i Konquerors historie
|
|
||||||
Comment[nds]=Söcht binnen Konqueror sien Vörgeschicht
|
|
||||||
Comment[nl]=Zoekt in Konquerors geschiedenis
|
|
||||||
Comment[nn]=Søk i loggen til Konqueror
|
|
||||||
Comment[pa]=ਕੋਨਕਿਊਰੋਰ ਦੇ ਅਤੀਤ ਵਿੱਚ ਖੋਜੋ
|
|
||||||
Comment[pl]=Wyszukiwanie w historii Konquerora
|
|
||||||
Comment[pt]=Pesquisa no histórico do Konqueror
|
|
||||||
Comment[pt_BR]=Pesquisa no histórico do Konqueror
|
|
||||||
Comment[ro]=Caută în istoricul Konqueror
|
|
||||||
Comment[ru]=Поиск в журнале посещения сайтов Konqueror
|
|
||||||
Comment[sk]=Vyhľadávanie v histórii Konquerora
|
|
||||||
Comment[sl]=Išče po Konqueror-jevi zgodovini
|
|
||||||
Comment[sr]=Претраге кроз К‑освајачев историјат
|
|
||||||
Comment[sr@ijekavian]=Претраге кроз К‑освајачев историјат
|
|
||||||
Comment[sr@ijekavianlatin]=Pretrage kroz K‑osvajačev istorijat
|
|
||||||
Comment[sr@latin]=Pretrage kroz K‑osvajačev istorijat
|
|
||||||
Comment[sv]=Söker i Konquerors historik
|
|
||||||
Comment[th]=ค้นหาในประวัติการใช้งานของคอนเควอร์เรอร์
|
|
||||||
Comment[tr]=Konqueror geçmişinde arama yapar
|
|
||||||
Comment[uk]=Пошук у історії перегляду у Konqueror
|
|
||||||
Comment[wa]=Cwîre dins l' istwere da Konqueror
|
|
||||||
Comment[x-test]=xxSearches in Konqueror's historyxx
|
|
||||||
Comment[zh_CN]=在 Konqueror 历史中搜索
|
|
||||||
Comment[zh_TW]=搜尋 Konqueror 的歷史紀錄
|
|
||||||
|
|
||||||
X-KDE-ServiceTypes=Plasma/Runner
|
|
||||||
Type=Service
|
|
||||||
Icon=view-history
|
|
||||||
X-KDE-Library=krunner_browserhistory
|
|
||||||
X-KDE-PluginInfo-Author=Sebastian Kügler
|
|
||||||
X-KDE-PluginInfo-Email=sebas@kde.org
|
|
||||||
X-KDE-PluginInfo-Name=browserhistory
|
|
||||||
X-KDE-PluginInfo-Version=1.0
|
|
||||||
X-KDE-PluginInfo-License=LGPL
|
|
||||||
X-KDE-PluginInfo-EnabledByDefault=true
|
|
|
@ -1,47 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2008 Sebastian Kügler <sebas@kde.org>
|
|
||||||
*
|
|
||||||
* This program 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, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program 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 General Public License for more details
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this program; if not, write to the
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BROWSERHISTORY_H
|
|
||||||
#define BROWSERHISTORY_H
|
|
||||||
|
|
||||||
#include <plasma/abstractrunner.h>
|
|
||||||
|
|
||||||
#include <KIcon>
|
|
||||||
|
|
||||||
class BrowserHistoryRunner : public Plasma::AbstractRunner {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
BrowserHistoryRunner( QObject *parent, const QVariantList& args );
|
|
||||||
~BrowserHistoryRunner();
|
|
||||||
|
|
||||||
void match(Plasma::RunnerContext &context);
|
|
||||||
void run(const Plasma::RunnerContext &context, const Plasma::QueryMatch &match);
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void loadHistory();
|
|
||||||
|
|
||||||
private:
|
|
||||||
KIcon m_icon;
|
|
||||||
QStringList m_history;
|
|
||||||
};
|
|
||||||
|
|
||||||
K_EXPORT_PLASMA_RUNNER(browserhistory, BrowserHistoryRunner)
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,31 +0,0 @@
|
||||||
include_directories(
|
|
||||||
${CMAKE_BINARY_DIR}
|
|
||||||
${KDE4_INCLUDE_DIR}
|
|
||||||
${KDE4_INCLUDE_DIR}/KDE
|
|
||||||
)
|
|
||||||
|
|
||||||
set(kopeterunner_SRCS
|
|
||||||
kopeterunner.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
kde4_add_plugin(krunner_kopete
|
|
||||||
${kopeterunner_SRCS}
|
|
||||||
)
|
|
||||||
target_link_libraries(krunner_kopete
|
|
||||||
${QT4_QTCORE_LIBRARY}
|
|
||||||
${KDE4_PLASMA_LIBRARY}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS
|
|
||||||
krunner_kopete
|
|
||||||
DESTINATION
|
|
||||||
${KDE4_PLUGIN_INSTALL_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
|
||||||
FILES
|
|
||||||
plasma-runner-kopete.desktop
|
|
||||||
DESTINATION
|
|
||||||
${KDE4_SERVICES_INSTALL_DIR}
|
|
||||||
)
|
|
|
@ -1,2 +0,0 @@
|
||||||
#! /usr/bin/env bash
|
|
||||||
$XGETTEXT *.cpp -o $podir/plasma_runner_kopete.pot
|
|
|
@ -1,304 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2009 Ben Boeckel <MathStuf@gmail.com>
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* This program 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 General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this program; if not, write to the
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Header include
|
|
||||||
#include "kopeterunner.h"
|
|
||||||
|
|
||||||
// Qt includes
|
|
||||||
#include <QtCore/qhash.h>
|
|
||||||
#include <QtCore/QUuid>
|
|
||||||
#include <QtDBus/QDBusConnection>
|
|
||||||
#include <QtDBus/QDBusConnectionInterface>
|
|
||||||
#include <QtDBus/QDBusMessage>
|
|
||||||
#include <QtDBus/QDBusMessage>
|
|
||||||
#include <QtDBus/QDBusReply>
|
|
||||||
|
|
||||||
// KDE includes
|
|
||||||
#include <KAboutData>
|
|
||||||
#include <KIcon>
|
|
||||||
#include <KUrl>
|
|
||||||
|
|
||||||
using namespace Plasma;
|
|
||||||
|
|
||||||
// DBus information for Kopete
|
|
||||||
static const QString KopeteDBusService = "org.kde.kopete";
|
|
||||||
static const QString KopeteDBusPath = "/Kopete";
|
|
||||||
static const QString KopeteDBusInterface = "org.kde.Kopete";
|
|
||||||
|
|
||||||
static QDBusMessage generateMethodCall(const QString& method)
|
|
||||||
{
|
|
||||||
return QDBusMessage::createMethodCall(KopeteDBusService, KopeteDBusPath, KopeteDBusInterface, method);
|
|
||||||
}
|
|
||||||
|
|
||||||
KopeteRunner::KopeteRunner(QObject* parent, const QVariantList& args) :
|
|
||||||
AbstractRunner(parent, args),
|
|
||||||
m_loaded(false),
|
|
||||||
m_checkLoaded(false)
|
|
||||||
{
|
|
||||||
Q_UNUSED(args);
|
|
||||||
setObjectName("Kopete contacts");
|
|
||||||
|
|
||||||
setIgnoredTypes(RunnerContext::Directory | RunnerContext::File | RunnerContext::NetworkLocation);
|
|
||||||
addSyntax(RunnerSyntax(":q:", i18n("Searches your Kopete buddylist for contacts matching :q:.")));
|
|
||||||
addSyntax(RunnerSyntax("connect", i18n("Connect all Kopete accounts")));
|
|
||||||
addSyntax(RunnerSyntax("disconnect", i18n("Disconnect all Kopete accounts")));
|
|
||||||
addSyntax(RunnerSyntax("status :q:", i18n("Set Kopete accounts to a status with an optional message")));
|
|
||||||
addSyntax(RunnerSyntax("message :q:", i18n("Set Kopete status message")));
|
|
||||||
|
|
||||||
// Connect up signals
|
|
||||||
connect(this, SIGNAL(prepare()), SLOT(slotPrepare()));
|
|
||||||
connect(this, SIGNAL(teardown()), SLOT(slotTeardown()));
|
|
||||||
}
|
|
||||||
|
|
||||||
KopeteRunner::~KopeteRunner()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void KopeteRunner::match(Plasma::RunnerContext& context)
|
|
||||||
{
|
|
||||||
if (!m_loaded) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString term = context.query().toLower();
|
|
||||||
if (term.length() < 3) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QueryMatch> matches;
|
|
||||||
|
|
||||||
if (term == "connect")
|
|
||||||
{
|
|
||||||
QueryMatch match(this);
|
|
||||||
|
|
||||||
match.setType(QueryMatch::ExactMatch);
|
|
||||||
match.setIcon(KIcon("user-"));
|
|
||||||
match.setText(i18n("Set all accounts as online"));
|
|
||||||
match.setData("connect");
|
|
||||||
|
|
||||||
matches.append(match);
|
|
||||||
}
|
|
||||||
else if (term == "disconnect")
|
|
||||||
{
|
|
||||||
QueryMatch match(this);
|
|
||||||
|
|
||||||
match.setType(QueryMatch::ExactMatch);
|
|
||||||
match.setIcon(KIcon("user-offline"));
|
|
||||||
match.setText(i18n("Set all accounts as offline"));
|
|
||||||
match.setData("disconnect");
|
|
||||||
|
|
||||||
matches.append(match);
|
|
||||||
}
|
|
||||||
else if (term.startsWith(QLatin1String("status")))
|
|
||||||
{
|
|
||||||
QStringList query = context.query().split(' ');
|
|
||||||
// Take the status text
|
|
||||||
query.takeFirst();
|
|
||||||
if (!query.isEmpty())
|
|
||||||
{
|
|
||||||
// Take the status to set
|
|
||||||
const QString status = query.takeFirst();
|
|
||||||
if (!status.isEmpty())
|
|
||||||
{
|
|
||||||
QueryMatch match(this);
|
|
||||||
|
|
||||||
match.setType(QueryMatch::ExactMatch);
|
|
||||||
match.setIcon(KIcon("user-away"));
|
|
||||||
match.setText(i18nc("The \': \' is used as a separator", "Status: %1", status));
|
|
||||||
// Rejoin the status message
|
|
||||||
const QString message = query.join(" ");
|
|
||||||
if (!message.isEmpty())
|
|
||||||
match.setSubtext(i18nc("The \': \' is used as a separator", "Message: %1", message));
|
|
||||||
match.setData("status");
|
|
||||||
|
|
||||||
matches.append(match);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (term.startsWith(QLatin1String("message")))
|
|
||||||
{
|
|
||||||
QStringList query = context.query().split(' ');
|
|
||||||
// Take the status text
|
|
||||||
query.takeFirst();
|
|
||||||
if (!query.isEmpty())
|
|
||||||
{
|
|
||||||
// Rejoin the rest of the message
|
|
||||||
const QString message = query.join(" ");
|
|
||||||
if (!message.isEmpty())
|
|
||||||
{
|
|
||||||
QueryMatch match(this);
|
|
||||||
|
|
||||||
match.setType(QueryMatch::ExactMatch);
|
|
||||||
match.setIcon(KIcon("im-status-message-edit"));
|
|
||||||
match.setText(i18nc("The \': \' is used as a separator", "Message: %1", message));
|
|
||||||
match.setData(i18n("Set Status Message"));
|
|
||||||
match.setData("status");
|
|
||||||
|
|
||||||
matches.append(match);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QHashIterator<QString, QVariantMap> i(m_contactData);
|
|
||||||
while (i.hasNext()) {
|
|
||||||
i.next();
|
|
||||||
// Keep a reference for easier use
|
|
||||||
const ContactProperties& props = i.value();
|
|
||||||
// Skip unreachable contacts
|
|
||||||
if (!props["message_reachable"].toBool())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
const QString name = props["display_name"].toString();
|
|
||||||
const QString picture = props["picture"].toString();
|
|
||||||
const QString status = props["status"].toString();
|
|
||||||
const QString message = props["status_message"].toString();
|
|
||||||
if (name.contains(term, Qt::CaseInsensitive))
|
|
||||||
{
|
|
||||||
QueryMatch match(this);
|
|
||||||
|
|
||||||
match.setType((name.compare(context.query(), Qt::CaseInsensitive)) ? QueryMatch::PossibleMatch : QueryMatch::ExactMatch);
|
|
||||||
match.setIcon(KIcon(KUrl(picture).isLocalFile() ? picture : "kopete"));
|
|
||||||
match.setText(i18n("Send message to %1", name));
|
|
||||||
const QString statusLine = i18n("Status: %1", status);
|
|
||||||
const QString subtext = message.isEmpty() ? statusLine : i18n("%1\nMessage: %2", statusLine, message);
|
|
||||||
match.setSubtext(subtext);
|
|
||||||
match.setData(i.key());
|
|
||||||
|
|
||||||
matches.append(match);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
context.addMatches(term, matches);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KopeteRunner::run(const Plasma::RunnerContext& context, const Plasma::QueryMatch& match)
|
|
||||||
{
|
|
||||||
Q_UNUSED(context)
|
|
||||||
|
|
||||||
// HACK: Strip off the "kopete_" prefix
|
|
||||||
const QString id = match.data().toString();
|
|
||||||
QString method;
|
|
||||||
QVariantList args;
|
|
||||||
if (id == "connect")
|
|
||||||
method = "connectAll";
|
|
||||||
else if (id == "disconnect")
|
|
||||||
method = "disconnectAll";
|
|
||||||
else if (id == "status")
|
|
||||||
{
|
|
||||||
method = "setOnlineStatus";
|
|
||||||
QStringList status = match.text().split(": ");
|
|
||||||
status.takeFirst();
|
|
||||||
QStringList message = match.subtext().split(": ");
|
|
||||||
message.takeFirst();
|
|
||||||
args << status.join(": ") << message.join(": ");
|
|
||||||
}
|
|
||||||
else if (id == "message")
|
|
||||||
{
|
|
||||||
method = "setStatusMessage";
|
|
||||||
QStringList message = match.text().split(": ");
|
|
||||||
message.takeFirst();
|
|
||||||
args << message.join(": ");
|
|
||||||
}
|
|
||||||
else if (!QUuid(id).isNull())
|
|
||||||
{
|
|
||||||
method = "openChat";
|
|
||||||
args << id;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
qDebug("Unknown ID: %s", id.toUtf8().constData());
|
|
||||||
if (!method.isNull())
|
|
||||||
{
|
|
||||||
QDBusMessage message = generateMethodCall(method);
|
|
||||||
message.setArguments(args);
|
|
||||||
QDBusConnection::sessionBus().send(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void KopeteRunner::loadData()
|
|
||||||
{
|
|
||||||
if (m_checkLoaded) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
m_checkLoaded = true;
|
|
||||||
QDBusReply<bool> reply = QDBusConnection::sessionBus().interface()->isServiceRegistered(KopeteDBusService);
|
|
||||||
m_loaded = reply.isValid() && reply.value();
|
|
||||||
//kDebug() << "**************************" << m_loaded;
|
|
||||||
#if 0
|
|
||||||
// Request contacts
|
|
||||||
QDBusMessage request = generateMethodCall("contacts");
|
|
||||||
QDBusReply<QStringList> reply = QDBusConnection::sessionBus().call(request);
|
|
||||||
// If the request succeeded
|
|
||||||
if (reply.isValid())
|
|
||||||
{
|
|
||||||
// Mark that we are loading
|
|
||||||
m_loaded = true;
|
|
||||||
// Get the contact list
|
|
||||||
const QStringList& contacts = reply.value();
|
|
||||||
|
|
||||||
// Fetch data each time a contact status changes
|
|
||||||
QDBusConnection::sessionBus().connect(KopeteDBusService, KopeteDBusPath, KopeteDBusInterface,
|
|
||||||
"contactChanged", "s", this, SLOT(updateContact(QString)));
|
|
||||||
// Update each one
|
|
||||||
// THIS IS BROKEN
|
|
||||||
|
|
||||||
// do not make one call per contact
|
|
||||||
// this makes over a thousand calls on my system
|
|
||||||
// please modify Kopete to transfer all information in one call
|
|
||||||
|
|
||||||
// Alternatively, cache this data. On my system, this causes
|
|
||||||
// kopete to spike to 100% CPU usage for between 5 to 10
|
|
||||||
// seconds every time I press Alt+F2 (or Esc in krunner).
|
|
||||||
// -thiago
|
|
||||||
|
|
||||||
foreach (const QString& contact, contacts)
|
|
||||||
updateContact(contact);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void KopeteRunner::slotPrepare()
|
|
||||||
{
|
|
||||||
//kDebug();
|
|
||||||
// Refresh the data
|
|
||||||
loadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
void KopeteRunner::slotTeardown()
|
|
||||||
{
|
|
||||||
// Don't get updated when not needed
|
|
||||||
#if 0
|
|
||||||
QDBusConnection::sessionBus().disconnect(KopeteDBusService, KopeteDBusPath, KopeteDBusInterface, "contactChanged", this, SLOT(updateContact(QString)));
|
|
||||||
#endif
|
|
||||||
//kDebug();
|
|
||||||
m_contactData.clear();
|
|
||||||
m_checkLoaded = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KopeteRunner::updateContact(const QString& uuid)
|
|
||||||
{
|
|
||||||
QDBusMessage message = generateMethodCall("contactProperties");
|
|
||||||
message << uuid;
|
|
||||||
QDBusReply<QVariantMap> reply = QDBusConnection::sessionBus().call(message);
|
|
||||||
|
|
||||||
if (reply.isValid())
|
|
||||||
m_contactData[uuid] = reply.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_kopeterunner.cpp"
|
|
|
@ -1,57 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright 2009 Ben Boeckel <MathStuf@gmail.com>
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*
|
|
||||||
* This program 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 General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Library General Public
|
|
||||||
* License along with this program; if not, write to the
|
|
||||||
* Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef KOPETERUNNER_H
|
|
||||||
#define KOPETERUNNER_H
|
|
||||||
|
|
||||||
// KDE includes
|
|
||||||
#include <KIcon>
|
|
||||||
#include <Plasma/AbstractRunner>
|
|
||||||
|
|
||||||
class KopeteRunner : public Plasma::AbstractRunner
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
KopeteRunner(QObject* parent, const QVariantList& args);
|
|
||||||
~KopeteRunner();
|
|
||||||
|
|
||||||
void match(Plasma::RunnerContext& context);
|
|
||||||
void run(const Plasma::RunnerContext& context, const Plasma::QueryMatch& match);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void loadData();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void slotPrepare();
|
|
||||||
void slotTeardown();
|
|
||||||
void updateContact(const QString& uuid);
|
|
||||||
|
|
||||||
private:
|
|
||||||
typedef QVariantMap ContactProperties;
|
|
||||||
typedef QHash<QString, ContactProperties> ContactData;
|
|
||||||
|
|
||||||
ContactData m_contactData;
|
|
||||||
bool m_loaded : 1;
|
|
||||||
bool m_checkLoaded : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
K_EXPORT_PLASMA_RUNNER(kopete, KopeteRunner)
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,100 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Name=Kopete Contacts
|
|
||||||
Name[ar]=جهات اتصال كوبيت
|
|
||||||
Name[bs]=Kopete kontakti
|
|
||||||
Name[ca]=Contactes del Kopete
|
|
||||||
Name[ca@valencia]=Contactes del Kopete
|
|
||||||
Name[cs]=Kontakty Kopete
|
|
||||||
Name[da]=Kopete-kontakter
|
|
||||||
Name[de]=Kopete-Kontakte
|
|
||||||
Name[el]=Επαφές Kopete
|
|
||||||
Name[en_GB]=Kopete Contacts
|
|
||||||
Name[es]=Contactos de Kopete
|
|
||||||
Name[et]=Kopete kontaktid
|
|
||||||
Name[fi]=Kopeten yhteystiedot
|
|
||||||
Name[fr]=Contacts Kopete
|
|
||||||
Name[ga]=Teagmhálacha Kopete
|
|
||||||
Name[gl]=Contactos de Kopete
|
|
||||||
Name[hu]=Kopete névjegyek
|
|
||||||
Name[it]=Contatti di Kopete
|
|
||||||
Name[kk]=Kopete контакттары
|
|
||||||
Name[km]=ទំនាក់ទំនងរបស់ Kopete
|
|
||||||
Name[ko]=Kopete 대화 상대
|
|
||||||
Name[lt]=Kopete kontaktai
|
|
||||||
Name[lv]=Kopete kontakti
|
|
||||||
Name[mr]=कोपेट संपर्क
|
|
||||||
Name[nb]=Kopete kontakter
|
|
||||||
Name[nds]=Kopete-Kontakten
|
|
||||||
Name[nl]=Contactpersonen van Kopete
|
|
||||||
Name[pa]=ਕੋਪਟੀ ਸੰਪਰਕ
|
|
||||||
Name[pl]=Kontakty Kopete
|
|
||||||
Name[pt]=Contactos do Kopete
|
|
||||||
Name[pt_BR]=Contatos do Kopete
|
|
||||||
Name[ro]=Contacte Kopete
|
|
||||||
Name[ru]=Контакты Kopete
|
|
||||||
Name[sk]=Kontakty Kopete
|
|
||||||
Name[sl]=Stiki v Kopete
|
|
||||||
Name[sr]=Копетеови контакти
|
|
||||||
Name[sr@ijekavian]=Копетеови контакти
|
|
||||||
Name[sr@ijekavianlatin]=Kopeteovi kontakti
|
|
||||||
Name[sr@latin]=Kopeteovi kontakti
|
|
||||||
Name[sv]=Kopete kontakter
|
|
||||||
Name[tr]=Kopete Kişileri
|
|
||||||
Name[uk]=Контакти Kopete
|
|
||||||
Name[x-test]=xxKopete Contactsxx
|
|
||||||
Name[zh_CN]=Kopete 联系人
|
|
||||||
Name[zh_TW]=Kopete 聯絡人
|
|
||||||
Comment=Search contacts from Kopete
|
|
||||||
Comment[ar]=ابحث في جهات الاتصال في كوبيت
|
|
||||||
Comment[bs]=Traži kontakte iz Kopete
|
|
||||||
Comment[ca]=Cerca contactes del Kopete
|
|
||||||
Comment[ca@valencia]=Cerca contactes del Kopete
|
|
||||||
Comment[cs]=Hledání kontaktů z Kopete
|
|
||||||
Comment[da]=Søg efter kontakter fra Kopete
|
|
||||||
Comment[de]=Sucht nach Kontakten in Kopete
|
|
||||||
Comment[el]=Αναζήτηση επαφών από το Kopete
|
|
||||||
Comment[en_GB]=Search contacts from Kopete
|
|
||||||
Comment[es]=Buscar contactos de Kopete
|
|
||||||
Comment[et]=Kopete kontaktide otsing
|
|
||||||
Comment[fi]=Etsi Kopeten yhteystietoja
|
|
||||||
Comment[fr]=Chercher des contacts depuis Kopete
|
|
||||||
Comment[gl]=Buscar contactos de Kopete.
|
|
||||||
Comment[hu]=Névjegyek keresése a Kopetében
|
|
||||||
Comment[it]=Cerca contatti da Kopete
|
|
||||||
Comment[kk]=Kopete-тен контактты іздеу
|
|
||||||
Comment[km]=ស្វែងរកទំនាក់ទំនងពី Kopete
|
|
||||||
Comment[ko]=Kopete 대화 상대 검색
|
|
||||||
Comment[lt]=Ieškoti tarp Kopete kontaktų
|
|
||||||
Comment[lv]=Meklēt Kopete kontaktos
|
|
||||||
Comment[mr]=कोपेट मधील संपर्क शोधा
|
|
||||||
Comment[nb]=Søk i kontakter fra Kopete
|
|
||||||
Comment[nds]=Na Kopete-Kontakten söken
|
|
||||||
Comment[nl]=In contactpersonen van Kopete zoeken
|
|
||||||
Comment[pl]=Wyszukiwarka kontaktów Kopete
|
|
||||||
Comment[pt]=Procurar nos contactos do Kopete
|
|
||||||
Comment[pt_BR]=Procura nos contatos do Kopete
|
|
||||||
Comment[ro]=Caută contacte din Kopete
|
|
||||||
Comment[ru]=Поиск контактов из Kopete
|
|
||||||
Comment[sk]=Hľadanie kontaktov z Kopete
|
|
||||||
Comment[sl]=Poiščite stike iz Kopete
|
|
||||||
Comment[sr]=Тражи контакте у Копетеу
|
|
||||||
Comment[sr@ijekavian]=Тражи контакте у Копетеу
|
|
||||||
Comment[sr@ijekavianlatin]=Traži kontakte u Kopeteu
|
|
||||||
Comment[sr@latin]=Traži kontakte u Kopeteu
|
|
||||||
Comment[sv]=Sök bland kontakter från Kopete
|
|
||||||
Comment[tr]=Kopete uygulamasındaki kişileri ara
|
|
||||||
Comment[uk]=Пошук записів контактів у даних Kopete
|
|
||||||
Comment[x-test]=xxSearch contacts from Kopetexx
|
|
||||||
Comment[zh_CN]=搜索 Kopete 联系人
|
|
||||||
Comment[zh_TW]=搜尋 Kopete 裡的聯絡人
|
|
||||||
Icon=kopete
|
|
||||||
|
|
||||||
X-KDE-ServiceTypes=Plasma/Runner
|
|
||||||
Type=Service
|
|
||||||
X-KDE-Library=krunner_kopete
|
|
||||||
X-KDE-PluginInfo-Author=Ben Boeckel
|
|
||||||
X-KDE-PluginInfo-Email=MathStuf@gmail.com
|
|
||||||
X-KDE-PluginInfo-Name=kopete_runner
|
|
||||||
X-KDE-PluginInfo-Version=0.1
|
|
||||||
X-KDE-PluginInfo-License=GPLv2
|
|
||||||
X-KDE-PluginInfo-EnabledByDefault=true
|
|
Loading…
Add table
Reference in a new issue