mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +00:00
kdeplasma-addons: drop incomingmsg applet
xchat, kopete and qutim are dead. that leaves pidgin which probably has broken the interface that the applet uses by now Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
f4ab10dc56
commit
87fa5d6d47
8 changed files with 0 additions and 824 deletions
|
@ -12,5 +12,4 @@ add_subdirectory(spellcheck)
|
||||||
add_subdirectory(timer)
|
add_subdirectory(timer)
|
||||||
add_subdirectory(eyes)
|
add_subdirectory(eyes)
|
||||||
add_subdirectory(unitconverter)
|
add_subdirectory(unitconverter)
|
||||||
add_subdirectory(incomingmsg)
|
|
||||||
add_subdirectory(paste)
|
add_subdirectory(paste)
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
# Project Needs a name ofcourse
|
|
||||||
project(plasma-incomingmsg)
|
|
||||||
|
|
||||||
# We add our source code here
|
|
||||||
set(incomingmsg_SRCS incomingmsg.cpp widget.ui)
|
|
||||||
kde4_add_plugin(plasma_applet_incomingmsg ${incomingmsg_SRCS})
|
|
||||||
|
|
||||||
target_link_libraries(plasma_applet_incomingmsg
|
|
||||||
${QT_QTNETWORK_LIBRARY} KDE4::plasma KDE4::kdeui)
|
|
||||||
|
|
||||||
install(TARGETS plasma_applet_incomingmsg
|
|
||||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
|
|
||||||
|
|
||||||
install(FILES plasma-applet-incomingmsg.desktop
|
|
||||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
|
|
|
@ -1,3 +0,0 @@
|
||||||
#! /usr/bin/env bash
|
|
||||||
$EXTRACTRC *.ui >> rc.cpp
|
|
||||||
$XGETTEXT *.cpp -o $podir/plasma_applet_incomingmsg.pot
|
|
|
@ -1,8 +0,0 @@
|
||||||
This is a basic plasmoid to notify you about
|
|
||||||
new messages from any service you have running.
|
|
||||||
This is particularly useful and designed for locked
|
|
||||||
screen with the plasma-overlay so you don't have to
|
|
||||||
unlock just to check if you got new messages (mail,im,
|
|
||||||
any other service, ...).
|
|
||||||
It uses DBus and only adds information for apps that are
|
|
||||||
running (it checks for the dbus interface).
|
|
|
@ -1,442 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2008-2010 Christian Weilbach <dunsens@web.de>
|
|
||||||
* Copyright (C) 2010 Ruslan Nigmatullin <euroelessar@ya.ru>
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Description:
|
|
||||||
* plasma-incomingmsg is a plasmoid that notifies you about new messages
|
|
||||||
* it is designed to be used on a locked screen so you don't have to unlock
|
|
||||||
* to check them.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "incomingmsg.h"
|
|
||||||
|
|
||||||
#include <QtCore/QProcess>
|
|
||||||
#include <QtDBus/QDBusInterface>
|
|
||||||
#include <QtDBus/QDBusConnection>
|
|
||||||
#include <QtDBus/QDBusConnectionInterface>
|
|
||||||
#include <QtDBus/QDBusReply>
|
|
||||||
#include <QtGui/QFontMetrics>
|
|
||||||
#include <QtGui/QFrame>
|
|
||||||
#include <QtGui/QLabel>
|
|
||||||
#include <QtGui/QPainter>
|
|
||||||
|
|
||||||
#include <QGraphicsLinearLayout>
|
|
||||||
|
|
||||||
#include <Plasma/Label>
|
|
||||||
#include <Plasma/Svg>
|
|
||||||
|
|
||||||
#include <KConfigDialog>
|
|
||||||
#include <KDebug>
|
|
||||||
#include <KIcon>
|
|
||||||
#include <KIconEffect>
|
|
||||||
#include <KLocale>
|
|
||||||
|
|
||||||
IncomingMsg::IncomingMsg(QObject *parent, const QVariantList &args)
|
|
||||||
: Plasma::Applet(parent, args),
|
|
||||||
mXChatLabel(0), mXChatIconLabel(0),
|
|
||||||
mKopeteLabel(0), mKopeteIconLabel(0),
|
|
||||||
mPidginLabel(0), mPidginIconLabel(0),
|
|
||||||
mQutIMLabel(0), mQutIMIconLabel(0),
|
|
||||||
mErrorLabel(0), mLayout(0),
|
|
||||||
mXChatLayout(0), mKopeteLayout(0),
|
|
||||||
mPidginLayout(0), mQutIMLayout(0),
|
|
||||||
mQutIUnreadCount(0)
|
|
||||||
{
|
|
||||||
// this will get us the standard applet background, for free!
|
|
||||||
setBackgroundHints(DefaultBackground);
|
|
||||||
resize(300, 80);
|
|
||||||
}
|
|
||||||
|
|
||||||
IncomingMsg::~IncomingMsg()
|
|
||||||
{
|
|
||||||
delete mXChatLayout;
|
|
||||||
delete mXChatIconLabel;
|
|
||||||
delete mXChatLabel;
|
|
||||||
|
|
||||||
delete mKopeteLayout;
|
|
||||||
delete mKopeteIconLabel;
|
|
||||||
delete mKopeteLabel;
|
|
||||||
|
|
||||||
delete mPidginLayout;
|
|
||||||
delete mPidginIconLabel;
|
|
||||||
delete mPidginLabel;
|
|
||||||
|
|
||||||
delete mQutIMLayout;
|
|
||||||
delete mQutIMIconLabel;
|
|
||||||
delete mQutIMLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::init()
|
|
||||||
{
|
|
||||||
/* initialize layout */
|
|
||||||
setHasConfigurationInterface(true);
|
|
||||||
|
|
||||||
configChanged();
|
|
||||||
|
|
||||||
initLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::configChanged()
|
|
||||||
{
|
|
||||||
KConfigGroup cg = config();
|
|
||||||
mShowXChat = cg.readEntry("showXChat", true);
|
|
||||||
mShowKopete = cg.readEntry("showKopete", true);
|
|
||||||
mShowPidgin = cg.readEntry("showPidgin", true);
|
|
||||||
mShowQutIM = cg.readEntry("showQutIM", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::initXChatLayout()
|
|
||||||
{
|
|
||||||
/* test for the xchat dbus interface */
|
|
||||||
// do not really understand how this interface works
|
|
||||||
// got this working code from http://arstechnica.com/reviews/hardware/tux-droid-review.ars/3
|
|
||||||
// we need to hook it up first. this first call is not only for interface testing but also for
|
|
||||||
// setup.
|
|
||||||
if (mShowXChat) {
|
|
||||||
QDBusReply<bool> reply = QDBusConnection::sessionBus().interface()->isServiceRegistered("org.xchat.service");
|
|
||||||
if (reply.isValid() && reply.value()){
|
|
||||||
QDBusConnection mDBus = QDBusConnection::sessionBus();
|
|
||||||
if (!mDBus.connect("org.xchat.service", "/org/xchat/Remote",
|
|
||||||
"org.xchat.plugin", "PrintSignal",
|
|
||||||
this, SLOT(slotNewXChatIM())))
|
|
||||||
kDebug() << "Could not connect XChat to slot.";
|
|
||||||
else {
|
|
||||||
mXChatLayout = new QGraphicsLinearLayout(Qt::Horizontal);
|
|
||||||
mXChatLabel = new Plasma::Label(this);
|
|
||||||
mXChatLabel->setText(i18n("No new XChat messages."));
|
|
||||||
KIcon icon("xchat");
|
|
||||||
mXChatIconLabel = new Plasma::Label(this);
|
|
||||||
mXChatIconLabel->setMinimumWidth(32);
|
|
||||||
mXChatIconLabel->setMinimumHeight(32);
|
|
||||||
KIconEffect effect;
|
|
||||||
mXChatIconLabel->nativeWidget()->setPixmap(
|
|
||||||
effect.apply(icon.pixmap(32, 32), KIconEffect::ToGray, 1, QColor(), QColor(), true)
|
|
||||||
);
|
|
||||||
|
|
||||||
mXChatLayout->addItem(mXChatIconLabel);
|
|
||||||
mXChatLayout->addItem(mXChatLabel);
|
|
||||||
mXChatLayout->setAlignment(mXChatLabel, Qt::AlignLeft);
|
|
||||||
|
|
||||||
mLayout->addItem(mXChatLayout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::initKopeteLayout()
|
|
||||||
{
|
|
||||||
/* test for the kopete dbus interface */
|
|
||||||
if (mShowKopete) {
|
|
||||||
QDBusInterface kopeteDBusTest("org.kde.kopete", "/kopete", "org.freedesktop.DBus.Introspectable");
|
|
||||||
QDBusReply<QString>kopeteReply = kopeteDBusTest.call("Introspect");
|
|
||||||
if (!kopeteReply.isValid())
|
|
||||||
kDebug() << "Kopete DBus interface test error: " << kopeteReply.error();
|
|
||||||
else {
|
|
||||||
QDBusConnection mDBus = QDBusConnection::sessionBus();
|
|
||||||
|
|
||||||
if (!mDBus.connect("org.kde.kopete", "/Kopete", "org.kde.Kopete",
|
|
||||||
"contactChanged",
|
|
||||||
this, SLOT(slotNewKopeteIM(QString))))
|
|
||||||
kDebug() << "Could not connect Kopete to slot.";
|
|
||||||
else {
|
|
||||||
mKopeteLayout = new QGraphicsLinearLayout(Qt::Horizontal);
|
|
||||||
mKopeteLabel = new Plasma::Label(this);
|
|
||||||
mKopeteLabel->setText(i18n("No new Kopete messages."));
|
|
||||||
KIcon icon("kopete");
|
|
||||||
mKopeteIconLabel = new Plasma::Label(this);
|
|
||||||
mKopeteIconLabel->setMinimumWidth(32);
|
|
||||||
mKopeteIconLabel->setMinimumHeight(32);
|
|
||||||
KIconEffect effect;
|
|
||||||
mKopeteIconLabel->nativeWidget()->setPixmap(
|
|
||||||
effect.apply(icon.pixmap(32, 32), KIconEffect::ToGray, 1, QColor(), QColor(), true)
|
|
||||||
);
|
|
||||||
|
|
||||||
mKopeteLayout->addItem(mKopeteIconLabel);
|
|
||||||
mKopeteLayout->addItem(mKopeteLabel);
|
|
||||||
mKopeteLayout->setAlignment(mKopeteLabel, Qt::AlignLeft);
|
|
||||||
|
|
||||||
mLayout->addItem(mKopeteLayout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::initPidginLayout()
|
|
||||||
{
|
|
||||||
/* test for the pidgin dbus interface */
|
|
||||||
// FIXME introspect does not work here with qdbus trying sth. else
|
|
||||||
if (mShowPidgin) {
|
|
||||||
QDBusInterface pidginDBusTest("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject",
|
|
||||||
"im.pidgin.purple.PurpleInterface");
|
|
||||||
QDBusReply<QString> pidginReply = pidginDBusTest.call("PurpleBuddyGetName", int(0));
|
|
||||||
if (!pidginReply.isValid())
|
|
||||||
kDebug() << "Pidgin DBus interface test error: " << pidginReply.error();
|
|
||||||
else {
|
|
||||||
QDBusConnection mDBus = QDBusConnection::sessionBus();
|
|
||||||
|
|
||||||
if (!mDBus.connect("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject",
|
|
||||||
"im.pidgin.purple.PurpleInterface", "ReceivedImMsg",
|
|
||||||
this, SLOT(slotNewPidginIM())))
|
|
||||||
kDebug() << "Could not connect to Pidgin on DBus.";
|
|
||||||
else {
|
|
||||||
mPidginLayout = new QGraphicsLinearLayout(Qt::Horizontal);
|
|
||||||
mPidginLabel = new Plasma::Label(this);
|
|
||||||
mPidginLabel->setText(i18n("No new Pidgin messages."));
|
|
||||||
KIcon icon("pidgin");
|
|
||||||
mPidginIconLabel = new Plasma::Label(this);
|
|
||||||
mPidginIconLabel->setMinimumWidth(32);
|
|
||||||
mPidginIconLabel->setMinimumHeight(32);
|
|
||||||
KIconEffect effect;
|
|
||||||
mPidginIconLabel->nativeWidget()->setPixmap(
|
|
||||||
effect.apply(icon.pixmap(32, 32), KIconEffect::ToGray, 1, QColor(), QColor(), true)
|
|
||||||
);
|
|
||||||
|
|
||||||
mPidginLayout->addItem(mPidginIconLabel);
|
|
||||||
mPidginLayout->addItem(mPidginLabel);
|
|
||||||
mPidginLayout->setAlignment(mPidginLabel, Qt::AlignLeft);
|
|
||||||
|
|
||||||
mLayout->addItem(mPidginLayout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::initQutIMLayout()
|
|
||||||
{
|
|
||||||
if (mShowQutIM) {
|
|
||||||
QDBusInterface qutimDBusTest("org.qutim", "/ChatLayer", "org.qutim.ChatLayer");
|
|
||||||
QDBusReply<QList<QDBusObjectPath> > sessionsReply = qutimDBusTest.call("sessions");
|
|
||||||
if (!sessionsReply.isValid())
|
|
||||||
kDebug() << "qutIM DBus interface test error: " << sessionsReply.error();
|
|
||||||
else {
|
|
||||||
QList<QDBusObjectPath> sessions = sessionsReply.value();
|
|
||||||
for (int i = 0; i < sessions.size(); i++) {
|
|
||||||
QDBusInterface qutimSession("org.qutim", sessions.at(i).path(),
|
|
||||||
"org.freedesktop.DBus.Properties");
|
|
||||||
QDBusMessage msg = qutimSession.call("Get", "org.qutim.ChatSession", "unread");
|
|
||||||
slotNewQutIM(msg, sessions.at(i).path());
|
|
||||||
}
|
|
||||||
QDBusConnection mDBus = QDBusConnection::sessionBus();
|
|
||||||
if (!mDBus.connect("org.qutim", QString(),
|
|
||||||
"org.qutim.ChatSession", "unreadChanged",
|
|
||||||
this, SLOT(slotNewQutIM(QDBusMessage))))
|
|
||||||
kDebug() << "Could not connect to qutIM on DBus.";
|
|
||||||
else {
|
|
||||||
mQutIMLayout = new QGraphicsLinearLayout(Qt::Horizontal);
|
|
||||||
mQutIMLabel = new Plasma::Label(this);
|
|
||||||
mQutIMIconLabel = new Plasma::Label(this);
|
|
||||||
mQutIMIconLabel->setMinimumWidth(32);
|
|
||||||
mQutIMIconLabel->setMinimumHeight(32);
|
|
||||||
|
|
||||||
updateQutIMStatus(false);
|
|
||||||
|
|
||||||
mQutIMLayout->addItem(mQutIMIconLabel);
|
|
||||||
mQutIMLayout->addItem(mQutIMLabel);
|
|
||||||
mQutIMLayout->setAlignment(mQutIMLabel, Qt::AlignLeft);
|
|
||||||
|
|
||||||
mLayout->addItem(mQutIMLayout);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::updateQutIMStatus(bool saveIcon)
|
|
||||||
{
|
|
||||||
if (!saveIcon) {
|
|
||||||
KIcon icon("qutim");
|
|
||||||
if (mQutIUnreadCount == 0) {
|
|
||||||
KIconEffect effect;
|
|
||||||
mQutIMIconLabel->nativeWidget()->setPixmap(
|
|
||||||
effect.apply(icon.pixmap(32, 32), KIconEffect::ToGray, 1, QColor(), QColor(), true)
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
mQutIMIconLabel->nativeWidget()->setPixmap(icon.pixmap(32, 32));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (mQutIUnreadCount > 0) {
|
|
||||||
kDebug() << "You have " << mQutIUnreadCount << " new qutIM message(s).";
|
|
||||||
mQutIMLabel->setText(i18np("You have a new qutIM message.",
|
|
||||||
"You have %1 new qutIM messages.",
|
|
||||||
mQutIUnreadCount));
|
|
||||||
} else {
|
|
||||||
kDebug() << "No new qutIM messages.";
|
|
||||||
mQutIMLabel->setText(i18n("No new qutIM messages."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::clearLayout()
|
|
||||||
{
|
|
||||||
delete mXChatLayout;
|
|
||||||
mXChatLayout = NULL;
|
|
||||||
delete mXChatIconLabel;
|
|
||||||
mXChatIconLabel = NULL;
|
|
||||||
delete mXChatLabel;
|
|
||||||
mXChatLabel = NULL;
|
|
||||||
|
|
||||||
delete mKopeteLayout;
|
|
||||||
mKopeteLayout = NULL;
|
|
||||||
delete mKopeteIconLabel;
|
|
||||||
mKopeteIconLabel = NULL;
|
|
||||||
delete mKopeteLabel;
|
|
||||||
mKopeteLabel = NULL;
|
|
||||||
|
|
||||||
delete mPidginLayout;
|
|
||||||
mPidginLayout = NULL;
|
|
||||||
delete mPidginIconLabel;
|
|
||||||
mPidginIconLabel = NULL;
|
|
||||||
delete mPidginLabel;
|
|
||||||
mPidginLabel = NULL;
|
|
||||||
|
|
||||||
delete mQutIMLayout;
|
|
||||||
mQutIMLayout = NULL;
|
|
||||||
delete mQutIMIconLabel;
|
|
||||||
mQutIMIconLabel = NULL;
|
|
||||||
delete mQutIMLabel;
|
|
||||||
mQutIMLabel = NULL;
|
|
||||||
mQutIMUnread.clear();
|
|
||||||
mQutIUnreadCount = 0;
|
|
||||||
|
|
||||||
delete mErrorLabel;
|
|
||||||
mErrorLabel = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::initLayout()
|
|
||||||
{
|
|
||||||
mLayout = new QGraphicsLinearLayout(Qt::Vertical);
|
|
||||||
|
|
||||||
initXChatLayout();
|
|
||||||
initKopeteLayout();
|
|
||||||
initPidginLayout();
|
|
||||||
initQutIMLayout();
|
|
||||||
|
|
||||||
if (!mLayout->count()) {
|
|
||||||
mErrorLabel = new Plasma::Label();
|
|
||||||
mErrorLabel->setText(i18n("No running messaging apps found. Supported apps are %1, %2, %3, %4.",
|
|
||||||
QString("XChat"), QString("Kopete"),
|
|
||||||
QString("Pidgin"), QString("qutIM")));
|
|
||||||
mLayout->addItem(mErrorLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
setLayout(mLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::createConfigurationInterface(KConfigDialog *dialog)
|
|
||||||
{
|
|
||||||
QWidget *widget = new QWidget();
|
|
||||||
ui.setupUi(widget);
|
|
||||||
|
|
||||||
KConfigGroup cg = config();
|
|
||||||
ui.showXChat->setChecked(cg.readEntry("showXChat", true));
|
|
||||||
ui.showKopete->setChecked(cg.readEntry("showKopete", true));
|
|
||||||
ui.showPidgin->setChecked(cg.readEntry("showPidgin", true));
|
|
||||||
ui.showQutIM->setChecked(cg.readEntry("showQutIM", true));
|
|
||||||
|
|
||||||
connect(dialog, SIGNAL(applyClicked()), this, SLOT(configAccepted()));
|
|
||||||
connect(dialog, SIGNAL(okClicked()), this, SLOT(configAccepted()));
|
|
||||||
|
|
||||||
dialog->addPage(widget, i18n("General"), icon());
|
|
||||||
|
|
||||||
connect(ui.showKopete, SIGNAL(toggled(bool)), dialog, SLOT(settingsModified()));
|
|
||||||
connect(ui.showPidgin, SIGNAL(toggled(bool)), dialog, SLOT(settingsModified()));
|
|
||||||
connect(ui.showQutIM, SIGNAL(toggled(bool)), dialog, SLOT(settingsModified()));
|
|
||||||
connect(ui.showXChat, SIGNAL(toggled(bool)), dialog, SLOT(settingsModified()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void IncomingMsg::configAccepted()
|
|
||||||
{
|
|
||||||
mShowXChat = ui.showXChat->isChecked();
|
|
||||||
mShowKopete = ui.showKopete->isChecked();
|
|
||||||
mShowPidgin = ui.showPidgin->isChecked();
|
|
||||||
mShowQutIM = ui.showQutIM->isChecked();
|
|
||||||
|
|
||||||
KConfigGroup cg = config();
|
|
||||||
cg.writeEntry("showXChat", ui.showXChat->isChecked());
|
|
||||||
cg.writeEntry("showKopete", ui.showKopete->isChecked());
|
|
||||||
cg.writeEntry("showPidgin", ui.showPidgin->isChecked());
|
|
||||||
cg.writeEntry("showQutIM", ui.showQutIM->isChecked());
|
|
||||||
|
|
||||||
clearLayout();
|
|
||||||
initLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::slotNewXChatIM()
|
|
||||||
{
|
|
||||||
KIcon icon("xchat");
|
|
||||||
mXChatIconLabel->nativeWidget()->setPixmap(icon.pixmap(32, 32));
|
|
||||||
mXChatLabel->setText(i18n("You have new XChat messages."));
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::slotNewQutIM(const QDBusMessage &msg, QString path)
|
|
||||||
{
|
|
||||||
if (path.isNull())
|
|
||||||
path = msg.path();
|
|
||||||
bool hasUnread = mQutIUnreadCount > 0;
|
|
||||||
QVariant var = msg.arguments().value(0);
|
|
||||||
if (var.canConvert<QDBusVariant>())
|
|
||||||
var = var.value<QDBusVariant>().variant();
|
|
||||||
int currentCount = mQutIMUnread.value(path, 0);
|
|
||||||
int count = 0;
|
|
||||||
const QDBusArgument arg = qvariant_cast<QDBusArgument>(var);
|
|
||||||
// Parse aa{sv} value
|
|
||||||
arg.beginArray();
|
|
||||||
while (!arg.atEnd()) {
|
|
||||||
arg.beginMap();
|
|
||||||
while (!arg.atEnd()) {
|
|
||||||
QString key;
|
|
||||||
QVariant value;
|
|
||||||
arg.beginMapEntry();
|
|
||||||
arg >> key >> value;
|
|
||||||
arg.endMapEntry();
|
|
||||||
}
|
|
||||||
arg.endMap();
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
arg.endArray();
|
|
||||||
mQutIUnreadCount -= currentCount;
|
|
||||||
mQutIUnreadCount += count;
|
|
||||||
if (count > 0)
|
|
||||||
mQutIMUnread.insert(path, count);
|
|
||||||
else
|
|
||||||
mQutIMUnread.remove(path);
|
|
||||||
if (mQutIMLayout)
|
|
||||||
updateQutIMStatus(hasUnread == (mQutIUnreadCount > 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::slotNewKopeteIM(const QString& contactId)
|
|
||||||
{
|
|
||||||
QDBusInterface kopeteDBusTest("org.kde.kopete", "/Kopete", "org.kde.Kopete");
|
|
||||||
QDBusReply<QVariantMap>kopeteReply = kopeteDBusTest.call("contactProperties", contactId);
|
|
||||||
if (kopeteReply.isValid()
|
|
||||||
&& !kopeteReply.value()["pending_messages"].toStringList().empty()) {
|
|
||||||
KIcon icon("kopete");
|
|
||||||
mKopeteIconLabel->nativeWidget()->setPixmap(icon.pixmap(32, 32));
|
|
||||||
mKopeteLabel->setText(i18n("You have new Kopete messages."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void IncomingMsg::slotNewPidginIM()
|
|
||||||
{
|
|
||||||
KIcon icon("pidgin");
|
|
||||||
mPidginIconLabel->nativeWidget()->setPixmap(icon.pixmap(32, 32));
|
|
||||||
mPidginLabel->setText(i18n("You have new Pidgin messages."));
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_incomingmsg.cpp"
|
|
|
@ -1,99 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2008-2010 Christian Weilbach <dunsens@web.de>
|
|
||||||
* Copyright (C) 2010 Ruslan Nigmatullin <euroelessar@ya.ru>
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Here we avoid loading the header multiple times
|
|
||||||
#ifndef incomingmsg_HEADER
|
|
||||||
#define incomingmsg_HEADER
|
|
||||||
|
|
||||||
#include <QtDBus/QDBusConnection>
|
|
||||||
|
|
||||||
// We need the Plasma Applet headers
|
|
||||||
#include <Plasma/Applet>
|
|
||||||
#include <Plasma/Svg>
|
|
||||||
|
|
||||||
#include "ui_widget.h"
|
|
||||||
|
|
||||||
#include <QGraphicsLinearLayout>
|
|
||||||
#include <QDBusObjectPath>
|
|
||||||
|
|
||||||
namespace Plasma
|
|
||||||
{
|
|
||||||
class Label;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define our plasma Applet
|
|
||||||
class IncomingMsg : public Plasma::Applet
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
// Basic Create/Destroy
|
|
||||||
IncomingMsg(QObject *parent, const QVariantList &args);
|
|
||||||
~IncomingMsg();
|
|
||||||
void init();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void createConfigurationInterface(KConfigDialog *parent);
|
|
||||||
|
|
||||||
void initXChatLayout();
|
|
||||||
void initKopeteLayout();
|
|
||||||
void initPidginLayout();
|
|
||||||
void initQutIMLayout();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void configChanged();
|
|
||||||
|
|
||||||
protected slots:
|
|
||||||
void configAccepted();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void clearLayout();
|
|
||||||
void initLayout();
|
|
||||||
void updateQutIMStatus(bool saveIcon);
|
|
||||||
|
|
||||||
// text labels
|
|
||||||
Plasma::Label *mXChatLabel,
|
|
||||||
*mXChatIconLabel, *mKopeteLabel, *mKopeteIconLabel,
|
|
||||||
*mPidginLabel, *mPidginIconLabel, *mQutIMLabel,
|
|
||||||
*mQutIMIconLabel, *mErrorLabel;
|
|
||||||
|
|
||||||
QGraphicsLinearLayout *mLayout,
|
|
||||||
*mXChatLayout, *mKopeteLayout, *mPidginLayout,
|
|
||||||
*mQutIMLayout;
|
|
||||||
|
|
||||||
bool mShowXChat, mShowKopete, mShowPidgin, mShowQutIM;
|
|
||||||
|
|
||||||
QHash<QString, int> mQutIMUnread;
|
|
||||||
int mQutIUnreadCount;
|
|
||||||
|
|
||||||
Ui::incomingmsgConfig ui;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void slotNewPidginIM();
|
|
||||||
void slotNewKopeteIM(const QString&);
|
|
||||||
void slotNewXChatIM();
|
|
||||||
void slotNewQutIM(const QDBusMessage &msg, QString path = QString());
|
|
||||||
};
|
|
||||||
|
|
||||||
// This is the command that links your applet to the .desktop file
|
|
||||||
K_EXPORT_PLASMA_APPLET(incomingmsg, IncomingMsg)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void verboseLog(QString);
|
|
|
@ -1,127 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Name=Incoming Message
|
|
||||||
Name[ar]=رسالة قادمة
|
|
||||||
Name[ast]=Mensax entrante
|
|
||||||
Name[bs]=dolazeća poruka
|
|
||||||
Name[ca]=Missatge entrant
|
|
||||||
Name[ca@valencia]=Missatge entrant
|
|
||||||
Name[cs]=Příchozí zpráva
|
|
||||||
Name[da]=Indkommende besked
|
|
||||||
Name[de]=Posteingang
|
|
||||||
Name[el]=Εισερχόμενο μήνυμα
|
|
||||||
Name[en_GB]=Incoming Message
|
|
||||||
Name[eo]=Alvenanta mesaĝo
|
|
||||||
Name[es]=Mensaje entrante
|
|
||||||
Name[et]=Sisenev sõnum
|
|
||||||
Name[eu]=Sarrerako mezua
|
|
||||||
Name[fi]=Tulevat viestit
|
|
||||||
Name[fr]=Message entrant
|
|
||||||
Name[ga]=Teachtaireacht Isteach
|
|
||||||
Name[gl]=Mensaxe entrante
|
|
||||||
Name[he]=הודעות נכנסות
|
|
||||||
Name[hr]=Dolazna poruka
|
|
||||||
Name[hu]=Bejövő üzenet
|
|
||||||
Name[is]=Innkomið skeyti
|
|
||||||
Name[it]=Messaggio in arrivo
|
|
||||||
Name[ja]=着信メッセージ
|
|
||||||
Name[kk]=Хабарлама келді
|
|
||||||
Name[km]=សារចូល
|
|
||||||
Name[ko]=받은 메시지
|
|
||||||
Name[ku]=Peyamên Hatî
|
|
||||||
Name[lt]=Gauta žinutė
|
|
||||||
Name[lv]=Ienākošās ziņas
|
|
||||||
Name[mr]=येणारा संदेश
|
|
||||||
Name[nb]=Innkommende melding
|
|
||||||
Name[nds]=Ankamen Naricht
|
|
||||||
Name[nl]=Inkomend bericht
|
|
||||||
Name[nn]=Nye meldingar
|
|
||||||
Name[pa]=ਆ ਰਿਹਾ ਸੁਨੇਹਾ
|
|
||||||
Name[pl]=Wiadomości przychodzące
|
|
||||||
Name[pt]=Mensagem Recebida
|
|
||||||
Name[pt_BR]=Mensagem recebida
|
|
||||||
Name[ro]=Mesaj recepționat
|
|
||||||
Name[ru]=Входящие сообщения
|
|
||||||
Name[sk]=Prichádzajúca správa
|
|
||||||
Name[sl]=Dohodno sporočilo
|
|
||||||
Name[sr]=долазећа порука
|
|
||||||
Name[sr@ijekavian]=долазећа порука
|
|
||||||
Name[sr@ijekavianlatin]=dolazeća poruka
|
|
||||||
Name[sr@latin]=dolazeća poruka
|
|
||||||
Name[sv]=Inkommande meddelande
|
|
||||||
Name[th]=มีจดหมายใหม่
|
|
||||||
Name[tr]=Gelen İletiler
|
|
||||||
Name[ug]=كىرگەن ئۇچۇر
|
|
||||||
Name[uk]=Вхідне повідомлення
|
|
||||||
Name[wa]=Messaedje en intrêye
|
|
||||||
Name[x-test]=xxIncoming Messagexx
|
|
||||||
Name[zh_CN]=接收消息
|
|
||||||
Name[zh_TW]=進來的訊息
|
|
||||||
Icon=mail-message-new
|
|
||||||
Comment=Notification of new messages
|
|
||||||
Comment[ar]=إخطار الرسائل الجديدة
|
|
||||||
Comment[ast]=Notificación de mensaxes nuevos
|
|
||||||
Comment[bs]=Obavještenje o novim porukama
|
|
||||||
Comment[ca]=Notificació de missatges nous
|
|
||||||
Comment[ca@valencia]=Notificació de missatges nous
|
|
||||||
Comment[cs]=Upozornění na nové zprávy
|
|
||||||
Comment[da]=Bekendtgørelse om nye beskeder.
|
|
||||||
Comment[de]=Benachrichtigung über neue Nachrichten
|
|
||||||
Comment[el]=Ειδοποίηση νέων μηνυμάτων
|
|
||||||
Comment[en_GB]=Notification of new messages
|
|
||||||
Comment[es]=Notificación de mensajes nuevos
|
|
||||||
Comment[et]=Uue sõnumi märguanne
|
|
||||||
Comment[eu]=Mezu berrien jakinarazpena
|
|
||||||
Comment[fi]=Ilmoitus uusista viesteistä
|
|
||||||
Comment[fr]=Notification de nouveaux messages
|
|
||||||
Comment[ga]=Fógra nuair atá teachtaireacht nua ann
|
|
||||||
Comment[gl]=Notificación de novas mensaxes
|
|
||||||
Comment[he]=מודיע על הודעות חדשות
|
|
||||||
Comment[hr]=Obavijest o novim porukama
|
|
||||||
Comment[hu]=Értesítés az új üzenetekről
|
|
||||||
Comment[is]=Tilkynningar um ný skilaboð
|
|
||||||
Comment[it]=Notifica di nuovi messaggi
|
|
||||||
Comment[ja]=新着メールを通知します
|
|
||||||
Comment[kk]=Жаңа хабарлама келгені туралы құлақтандыру
|
|
||||||
Comment[km]=ការជូនដំណឹងថាមានសារថ្មី
|
|
||||||
Comment[ko]=새 메시지 알림
|
|
||||||
Comment[ku]=Hişyariya peyamên nû
|
|
||||||
Comment[lt]=Pranešimas apie naujas žinutes
|
|
||||||
Comment[lv]=Jaunu ziņu paziņotājs
|
|
||||||
Comment[mr]=नवीन संदेशाची सूचना
|
|
||||||
Comment[nb]=Varsling om nye meldinger
|
|
||||||
Comment[nds]=Bescheed över niege Narichten
|
|
||||||
Comment[nl]=Notificatie van nieuwe berichten
|
|
||||||
Comment[nn]=Varsling av nye meldingar
|
|
||||||
Comment[pa]=ਨਵੇਂ ਸੁਨੇਹਿਆਂ ਉੱਤੇ ਸੂਚਨਾ ਦਿਓ
|
|
||||||
Comment[pl]=Powiadomienia o nowych wiadomościach
|
|
||||||
Comment[pt]=Notificação de mensagens novas
|
|
||||||
Comment[pt_BR]=Notificação de novas mensagens
|
|
||||||
Comment[ro]=Notificare la mesaje noi
|
|
||||||
Comment[ru]=Уведомление о новых сообщениях
|
|
||||||
Comment[sk]=Upozornenie na nové správy
|
|
||||||
Comment[sl]=Obvestilo o novih sporočilih
|
|
||||||
Comment[sr]=Обавештење о новим порукама
|
|
||||||
Comment[sr@ijekavian]=Обавештење о новим порукама
|
|
||||||
Comment[sr@ijekavianlatin]=Obaveštenje o novim porukama
|
|
||||||
Comment[sr@latin]=Obaveštenje o novim porukama
|
|
||||||
Comment[sv]=Underrättele om nytt meddelande
|
|
||||||
Comment[th]=แจ้งให้ทราบว่ามีจดหมายใหม่
|
|
||||||
Comment[tr]=Yeni ileti bildirimi
|
|
||||||
Comment[uk]=Інформує про нові повідомлення
|
|
||||||
Comment[wa]=Notifiaedje des noveas messaedjes
|
|
||||||
Comment[x-test]=xxNotification of new messagesxx
|
|
||||||
Comment[zh_CN]=新消息通知
|
|
||||||
Comment[zh_TW]=新訊息的通知
|
|
||||||
Type=Service
|
|
||||||
|
|
||||||
X-KDE-ServiceTypes=Plasma/Applet
|
|
||||||
X-KDE-Library=plasma_applet_incomingmsg
|
|
||||||
X-KDE-PluginInfo-Author=Christian Weilbach
|
|
||||||
X-KDE-PluginInfo-Email=dunsens@web.de
|
|
||||||
X-KDE-PluginInfo-Name=incomingmsg
|
|
||||||
X-KDE-PluginInfo-Version=1.0
|
|
||||||
X-KDE-PluginInfo-Website=
|
|
||||||
X-KDE-PluginInfo-Category=Miscellaneous
|
|
||||||
X-KDE-PluginInfo-Depends=
|
|
||||||
X-KDE-PluginInfo-License=GPL
|
|
||||||
X-KDE-PluginInfo-EnabledByDefault=true
|
|
|
@ -1,129 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>incomingmsgConfig</class>
|
|
||||||
<widget class="QWidget" name="incomingmsgConfig">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>284</width>
|
|
||||||
<height>175</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0" colspan="2">
|
|
||||||
<widget class="QLabel" name="topLabel">
|
|
||||||
<property name="text">
|
|
||||||
<string>Show these applications if they are running:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeType">
|
|
||||||
<enum>QSizePolicy::Fixed</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QCheckBox" name="showKopete">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Kopete</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QCheckBox" name="showPidgin">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Pidgin</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QCheckBox" name="showXChat">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>XChat</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QCheckBox" name="showQutIM">
|
|
||||||
<property name="text">
|
|
||||||
<string>qutIM</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<layoutdefault spacing="4" margin="4"/>
|
|
||||||
<connections/>
|
|
||||||
<designerdata>
|
|
||||||
<property name="gridDeltaX">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="gridDeltaY">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="gridSnapX">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="gridSnapY">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="gridVisible">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</designerdata>
|
|
||||||
</ui>
|
|
Loading…
Add table
Reference in a new issue