IncomingMsg::IncomingMsg(QObject *parent, const QVariantList &args)
: Plasma::Applet(parent, args),
mEvolutionLabel(0), mEvolutionIconLabel(0),
- mKMailLabel(0), mKMailIconLabel(0),
mXChatLabel(0), mXChatIconLabel(0),
mKopeteLabel(0), mKopeteIconLabel(0),
mPidginLabel(0), mPidginIconLabel(0),
mQutIMLabel(0), mQutIMIconLabel(0),
mErrorLabel(0), mLayout(0),
- mEvolutionLayout(0), mKMailLayout(0),
- mXChatLayout(0), mKopeteLayout(0),
- mPidginLayout(0), mQutIMLayout(0),
+ mEvolutionLayout(0), mXChatLayout(0),
+ mKopeteLayout(0), mPidginLayout(0),
+ mQutIMLayout(0),
mQutIUnreadCount(0)
{
// this will get us the standard applet background, for free!
IncomingMsg::~IncomingMsg()
{
- delete mKMailLayout;
- delete mKMailIconLabel;
- delete mKMailLabel;
-
delete mXChatLayout;
delete mXChatIconLabel;
delete mXChatLabel;
void IncomingMsg::configChanged()
{
KConfigGroup cg = config();
- mShowKMail = cg.readEntry("showKMail", true);
mShowXChat = cg.readEntry("showXChat", true);
mShowKopete = cg.readEntry("showKopete", true);
mShowPidgin = cg.readEntry("showPidgin", true);
// }
}
-void IncomingMsg::initKMailLayout()
-{
- /* test for the kmail dbus interface */
- if (mShowKMail) {
- QDBusInterface kmailDBusTest("org.kde.kmail", "/KMail", "org.freedesktop.DBus.Introspectable");
- QDBusReply<QString>kmailReply = kmailDBusTest.call("Introspect");
- if (!kmailReply.isValid())
- kDebug() << "KMail DBus interface test error: " << kmailReply.error();
- else {
- QDBusConnection mDBus = QDBusConnection::sessionBus();
-
- if (!mDBus.connect("org.kde.kmail", "/KMail", "org.kde.kmail.kmail",
- "unreadCountChanged",
- this, SLOT(slotNewKMailMail())))
- kDebug() << "Could not connect KMail to slot.";
- else {
- mKMailLayout = new QGraphicsLinearLayout(Qt::Horizontal);
- mKMailLabel = new Plasma::Label(this);
- mKMailLabel->setText(i18n("No new mail."));
- KIcon icon("kmail");
- mKMailIconLabel = new Plasma::Label(this);
- mKMailIconLabel->setMinimumWidth(32);
- mKMailIconLabel->setMinimumHeight(32);
- KIconEffect effect;
- mKMailIconLabel->nativeWidget()->setPixmap(effect.apply(icon.pixmap(32, 32),
- KIconEffect::ToGray, 1,
- QColor(), QColor(), true)
- );
-
- mKMailLayout->addItem(mKMailIconLabel);
- mKMailLayout->addItem(mKMailLabel);
- mKMailLayout->setAlignment(mKMailLabel, Qt::AlignLeft);
-
- mLayout->addItem(mKMailLayout);
- }
- }
- }
-}
-
void IncomingMsg::initXChatLayout()
{
/* test for the xchat dbus interface */
void IncomingMsg::clearLayout()
{
- delete mKMailLayout;
- mKMailLayout = NULL;
- delete mKMailIconLabel;
- mKMailIconLabel = NULL;
- delete mKMailLabel;
- mKMailLabel = NULL;
-
delete mXChatLayout;
mXChatLayout = NULL;
delete mXChatIconLabel;
mLayout = new QGraphicsLinearLayout(Qt::Vertical);
//initEvolutionLayout();
- initKMailLayout();
initXChatLayout();
initKopeteLayout();
initPidginLayout();
if (!mLayout->count()) {
mErrorLabel = new Plasma::Label();
- mErrorLabel->setText(i18n("No running messaging apps found. Supported apps are %1, %2, %3, %4, %5.",
- QString("KMail"), QString("XChat"), QString("Kopete"),
+ 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);
}
ui.setupUi(widget);
KConfigGroup cg = config();
- ui.showKMail->setChecked(cg.readEntry("showKMail", true));
ui.showXChat->setChecked(cg.readEntry("showXChat", true));
ui.showKopete->setChecked(cg.readEntry("showKopete", true));
ui.showPidgin->setChecked(cg.readEntry("showPidgin", true));
dialog->addPage(widget, i18n("General"), icon());
- connect(ui.showKMail, SIGNAL(toggled(bool)), dialog, SLOT(settingsModified()));
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()));
void IncomingMsg::configAccepted()
{
- mShowKMail = ui.showKMail->isChecked();
mShowXChat = ui.showXChat->isChecked();
mShowKopete = ui.showKopete->isChecked();
mShowPidgin = ui.showPidgin->isChecked();
mShowQutIM = ui.showQutIM->isChecked();
KConfigGroup cg = config();
- cg.writeEntry("showKMail", ui.showKMail->isChecked());
cg.writeEntry("showXChat", ui.showXChat->isChecked());
cg.writeEntry("showKopete", ui.showKopete->isChecked());
cg.writeEntry("showPidgin", ui.showPidgin->isChecked());
}
}
-void IncomingMsg::slotNewKMailMail()
-{
- if (mKMailIconLabel) {
- KIcon icon("kmail");
- mKMailIconLabel->nativeWidget()->setPixmap(icon.pixmap(32, 32));
- mKMailLabel->setText(i18n("Your KMail mail count has changed."));
- }
-}
-
void IncomingMsg::slotNewXChatIM()
{
KIcon icon("xchat");
void createConfigurationInterface(KConfigDialog *parent);
void initEvolutionLayout();
- void initKMailLayout();
void initXChatLayout();
void initKopeteLayout();
void initPidginLayout();
// text labels
Plasma::Label *mEvolutionLabel, *mEvolutionIconLabel,
- *mKMailLabel, *mKMailIconLabel, *mXChatLabel,
+ *mXChatLabel,
*mXChatIconLabel, *mKopeteLabel, *mKopeteIconLabel,
*mPidginLabel, *mPidginIconLabel, *mQutIMLabel,
*mQutIMIconLabel, *mErrorLabel;
QGraphicsLinearLayout *mLayout, *mEvolutionLayout,
- *mKMailLayout, *mXChatLayout, *mKopeteLayout,
- *mPidginLayout, *mQutIMLayout;
+ *mXChatLayout, *mKopeteLayout, *mPidginLayout,
+ *mQutIMLayout;
- bool mShowKMail, mShowXChat, mShowKopete, mShowPidgin, mShowQutIM;
+ bool mShowXChat, mShowKopete, mShowPidgin, mShowQutIM;
QHash<QString, int> mQutIMUnread;
int mQutIUnreadCount;
private slots:
void slotNewEvolutionMail();
- void slotNewKMailMail();
void slotNewPidginIM();
void slotNewKopeteIM(const QString&);
void slotNewXChatIM();
</spacer>
</item>
<item row="1" column="1">
- <widget class="QCheckBox" name="showKMail">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>KMail</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
<widget class="QCheckBox" name="showKopete">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="2" column="1">
<widget class="QCheckBox" name="showPidgin">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
</property>
</widget>
</item>
- <item row="5" column="1">
+ <item row="4" column="1">
<widget class="QCheckBox" name="showXChat">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
</property>
</widget>
</item>
- <item row="6" column="1">
+ <item row="5" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</spacer>
</item>
- <item row="4" column="1">
+ <item row="3" column="1">
<widget class="QCheckBox" name="showQutIM">
<property name="text">
<string>qutIM</string>