OSDN Git Service

kdeplasma-addons: update incommingmsg applet
authorIvailo Monev <xakepa10@gmail.com>
Mon, 5 Jun 2023 05:35:03 +0000 (08:35 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 5 Jun 2023 05:35:47 +0000 (08:35 +0300)
KMail is e-mail sender only now

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
kdeplasma-addons/applets/incomingmsg/README
kdeplasma-addons/applets/incomingmsg/incomingmsg.cpp
kdeplasma-addons/applets/incomingmsg/incomingmsg.h
kdeplasma-addons/applets/incomingmsg/widget.ui

index fa84ee5..d66e4fb 100644 (file)
@@ -5,7 +5,4 @@ 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). At the moment
-sadly only kmail notifies over DBus for new messages.
-Also qutIM notifies about count of unreaded messages.
-Hack on it as you like.
+running (it checks for the dbus interface).
index 3826133..5754c35 100644 (file)
 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!
@@ -69,10 +68,6 @@ IncomingMsg::IncomingMsg(QObject *parent, const QVariantList &args)
 
 IncomingMsg::~IncomingMsg()
 {
-    delete mKMailLayout;
-    delete mKMailIconLabel;
-    delete mKMailLabel;
-
     delete mXChatLayout;
     delete mXChatIconLabel;
     delete mXChatLabel;
@@ -103,7 +98,6 @@ void IncomingMsg::init()
 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);
@@ -149,45 +143,6 @@ void IncomingMsg::initEvolutionLayout()
 //    }
 }
 
-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 */
@@ -369,13 +324,6 @@ void IncomingMsg::updateQutIMStatus(bool saveIcon)
 
 void IncomingMsg::clearLayout()
 {
-    delete mKMailLayout;
-    mKMailLayout = NULL;
-    delete mKMailIconLabel;
-    mKMailIconLabel = NULL;
-    delete mKMailLabel;
-    mKMailLabel = NULL;
-
     delete mXChatLayout;
     mXChatLayout = NULL;
     delete mXChatIconLabel;
@@ -415,7 +363,6 @@ void IncomingMsg::initLayout()
     mLayout = new QGraphicsLinearLayout(Qt::Vertical);
 
     //initEvolutionLayout();
-    initKMailLayout();
     initXChatLayout();
     initKopeteLayout();
     initPidginLayout();
@@ -423,8 +370,8 @@ void IncomingMsg::initLayout()
 
     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);
     }
@@ -438,7 +385,6 @@ void IncomingMsg::createConfigurationInterface(KConfigDialog *dialog)
     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));
@@ -449,7 +395,6 @@ void IncomingMsg::createConfigurationInterface(KConfigDialog *dialog)
 
     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()));
@@ -459,14 +404,12 @@ void IncomingMsg::createConfigurationInterface(KConfigDialog *dialog)
 
 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());
@@ -485,15 +428,6 @@ void IncomingMsg::slotNewEvolutionMail()
     }
 }
 
-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");
index f4f4c27..6773c4d 100644 (file)
@@ -52,7 +52,6 @@ protected:
     void createConfigurationInterface(KConfigDialog *parent);
 
     void initEvolutionLayout();
-    void initKMailLayout();
     void initXChatLayout();
     void initKopeteLayout();
     void initPidginLayout();
@@ -71,16 +70,16 @@ private:
 
     // 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;
@@ -89,7 +88,6 @@ private:
 
 private slots:
     void slotNewEvolutionMail();
-    void slotNewKMailMail();
     void slotNewPidginIM();
     void slotNewKopeteIM(const QString&);
     void slotNewXChatIM();
index 9a9eadf..5b3457c 100644 (file)
     </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">
@@ -66,7 +50,7 @@
      </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">
@@ -82,7 +66,7 @@
      </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">
@@ -98,7 +82,7 @@
      </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>