[SCM] ktp-contact-applet packaging branch, master, updated. debian/15.12.1-1-966-gde83ac5
Maximiliano Curia
maxy at moszumanska.debian.org
Sat May 28 00:12:11 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/applications/ktp-desktop-applets.git;a=commitdiff;h=38aea69
The following commit has been merged in the master branch:
commit 38aea69970d1796f4b5ddfaf75c3031e279e1892
Author: Francesco Nwokeka <francesco.nwokeka at gmail.com>
Date: Sun Dec 18 16:51:38 2011 +0100
add config dialog to set custom "onClick" command for the plasmoid
---
presence/CMakeLists.txt | 9 +++----
presence/src/presence-applet.cpp | 52 ++++++++++++++++++++++++++++++++++++----
presence/src/presence-applet.h | 17 +++++++++----
3 files changed, 65 insertions(+), 13 deletions(-)
diff --git a/presence/CMakeLists.txt b/presence/CMakeLists.txt
index 9782ec5..44fc061 100644
--- a/presence/CMakeLists.txt
+++ b/presence/CMakeLists.txt
@@ -30,12 +30,13 @@ include_directories(${CMAKE_SOURCE_DIR}
set(telepathy-kde-presence-applet_SRCS
+ src/generalsettings.cpp
src/presenceapplet.cpp
)
-#
-# kde4_add_ui_files(telepathy-kde-presence-applet_SRCS
-# src/config.ui
-# )
+
+kde4_add_ui_files(telepathy-kde-presence-applet_SRCS
+ src/generalsettings.ui
+)
kde4_add_plugin(telepathy-kde-presence-applet ${telepathy-kde-presence-applet_SRCS})
target_link_libraries(telepathy-kde-presence-applet
diff --git a/presence/src/presence-applet.cpp b/presence/src/presence-applet.cpp
index b81d01c..4417b62 100644
--- a/presence/src/presence-applet.cpp
+++ b/presence/src/presence-applet.cpp
@@ -17,10 +17,13 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
+#include "generalsettings.h"
#include "presenceapplet.h"
#include <KAction>
#include <KActionMenu>
+#include <KConfigDialog>
+#include <KConfigGroup>
#include <KToolInvocation>
#include <KUser>
@@ -46,6 +49,7 @@ TelepathyPresenceApplet::TelepathyPresenceApplet(QObject* parent, const QVariant
setMinimumSize(QSize(iconSize, iconSize));
connect(m_globalPresence, SIGNAL(currentPresenceChanged(KTp::Presence)), this, SLOT(onPresenceChanged(KTp::Presence)));
+ connect(this, SIGNAL(activate()), this, SLOT(onActivated()));
// register plasmoid for tooltip
Plasma::ToolTipManager::self()->registerWidget(this);
@@ -61,9 +65,32 @@ QList<QAction*> TelepathyPresenceApplet::contextualActions()
return m_contextActions;
}
+void TelepathyPresenceApplet::createConfigurationInterface(KConfigDialog* parentDialog)
+{
+ GeneralSettings *genSett = new GeneralSettings(m_onClickAction);
+ parentDialog->addPage(genSett, i18n("General"), "configure");
+
+ connect(genSett, SIGNAL(modified()), parentDialog, SLOT(settingsModified()));
+ connect(genSett, SIGNAL(clickActionUpdated(TelepathyPresenceApplet::OnClickAction)), this, SLOT(updateClickAction(TelepathyPresenceApplet::OnClickAction)));
+ connect(parentDialog, SIGNAL(applyClicked()), genSett, SLOT(save()));
+}
+
void TelepathyPresenceApplet::init()
{
Plasma::Applet::init();
+
+ // load on click config
+ KSharedConfigPtr config = KSharedConfig::openConfig(QLatin1String("ktelepathyrc"));
+ KConfigGroup presenceConfig = config->group("PresencePlasmoid");
+ QString actionOnClick = presenceConfig.readEntry("onClick", "nothing");
+
+ if (actionOnClick == "contactlist") {
+ m_onClickAction = SHOW_CONTACTLIST;
+ } else if (actionOnClick == "accounts") {
+ m_onClickAction = SHOW_ACCOUNT_MANAGER;
+ } else {
+ m_onClickAction = DO_NOTHING;
+ }
}
void TelepathyPresenceApplet::paintInterface(QPainter* p, const QStyleOptionGraphicsItem* option, const QRect& contentsRect)
@@ -121,12 +148,12 @@ void TelepathyPresenceApplet::setupContextMenuActions()
KAction *showContactListAction = new KAction(KIcon("meeting-attending"), i18n("Contact List"), this);
// connect actions
- connect(goOnlineAction, SIGNAL(triggered()), this, SLOT(onPresenceActionClicked()));
- connect(goBusyAction, SIGNAL(triggered()), this, SLOT(onPresenceActionClicked()));
- connect(goAwayAction, SIGNAL(triggered()), this, SLOT(onPresenceActionClicked()));
+ connect(goOnlineAction, SIGNAL(triggered()), this, SLOT(onPresenceActionClicked()));
+ connect(goBusyAction, SIGNAL(triggered()), this, SLOT(onPresenceActionClicked()));
+ connect(goAwayAction, SIGNAL(triggered()), this, SLOT(onPresenceActionClicked()));
connect(goExtendedAwayAction, SIGNAL(triggered()), this, SLOT(onPresenceActionClicked()));
- connect(goHiddenAction, SIGNAL(triggered()), this, SLOT(onPresenceActionClicked()));
- connect(goOfflineAction, SIGNAL(triggered()), this, SLOT(onPresenceActionClicked()));
+ connect(goHiddenAction, SIGNAL(triggered()), this, SLOT(onPresenceActionClicked()));
+ connect(goOfflineAction, SIGNAL(triggered()), this, SLOT(onPresenceActionClicked()));
connect(showAccountManagerAction, SIGNAL(triggered()), this, SLOT(startAccountManager()));
connect(showContactListAction, SIGNAL(triggered()), this, SLOT(startContactList()));
@@ -157,6 +184,15 @@ void TelepathyPresenceApplet::onAccountManagerReady(Tp::PendingOperation* op)
setPopupIcon(m_globalPresence->currentPresence().icon());
}
+void TelepathyPresenceApplet::onActivated()
+{
+ if (m_onClickAction == SHOW_CONTACTLIST) {
+ startContactList();
+ } else if (m_onClickAction == SHOW_ACCOUNT_MANAGER) {
+ startAccountManager();
+ }
+}
+
void TelepathyPresenceApplet::onPresenceChanged(KTp::Presence presence)
{
setPopupIcon(presence.icon());
@@ -207,5 +243,11 @@ void TelepathyPresenceApplet::toolTipHidden()
Plasma::ToolTipManager::self()->clearContent(this);
}
+void TelepathyPresenceApplet::updateClickAction(TelepathyPresenceApplet::OnClickAction clickAction)
+{
+ m_onClickAction = clickAction;
+}
+
+
// This is the command that links your applet to the .desktop file
K_EXPORT_PLASMA_APPLET(telepathy-kde-presence-applet, TelepathyPresenceApplet)
diff --git a/presence/src/presence-applet.h b/presence/src/presence-applet.h
index 423f0b5..a6d76b1 100644
--- a/presence/src/presence-applet.h
+++ b/presence/src/presence-applet.h
@@ -37,6 +37,7 @@ namespace Tp {
}
class GlobalPresenceWrapper;
+class KConfigDialog;
class QAction;
class TelepathyPresenceApplet: public Plasma::PopupApplet
@@ -44,25 +45,32 @@ class TelepathyPresenceApplet: public Plasma::PopupApplet
Q_OBJECT
public:
+ enum OnClickAction {
+ DO_NOTHING,
+ SHOW_ACCOUNT_MANAGER,
+ SHOW_CONTACTLIST
+ };
+
TelepathyPresenceApplet(QObject *parent, const QVariantList &args);
~TelepathyPresenceApplet();
QList<QAction*>contextualActions();
+ void createConfigurationInterface(KConfigDialog *parentDialog);
void init();
void paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect& contentsRect);
- /// TODO
-// /** overide of config signal */
-// void showConfigurationInterface();
-
private Q_SLOTS:
void onAccountManagerReady(Tp::PendingOperation *op);
+
+ /** called when plasmoid is clicked */
+ void onActivated();
void onPresenceChanged(KTp::Presence presence);
void onPresenceActionClicked();
void startAccountManager() const;
void startContactList() const;
void toolTipAboutToShow();
void toolTipHidden();
+ void updateClickAction(TelepathyPresenceApplet::OnClickAction);
private:
void setupAccountManager();
@@ -74,6 +82,7 @@ private:
Tp::AccountManagerPtr m_accountManager;
KTp::GlobalPresence *m_globalPresence;
+ OnClickAction m_onClickAction;
};
#endif // TELEPATHY_KDE_PRESENCE_APPLET_H
--
ktp-contact-applet packaging
More information about the pkg-kde-commits
mailing list