Hi,

A patch for $subject is attached. This was the default behaviour in KDE3, now 
users have to open systemsettings to configure date/time.

Any reviews, comments?

PS: By the way, there is a bug about time configuration. By default, update 
interval of digital-clock plasmoid is 60 seconds when showSeconds is false, 
and 1 second if it's true. If you change time from clock kcm and showSeconds 
is false, digital-clock applet refreshes itself 1 minute later. Maybe 
updateInterval should be hardcoded as 1 second regardless of showSeconds 
variable.

-- 
Gökçen Eraslan
Pardus Developer
diff -Naur plasma/applets-orig/digital-clock/clock.cpp plasma/applets/digital-clock/clock.cpp
--- plasma/applets-orig/digital-clock/clock.cpp	2009-05-28 10:59:16.709906950 +0300
+++ plasma/applets/digital-clock/clock.cpp	2009-05-28 11:28:03.219156713 +0300
@@ -41,6 +41,7 @@
 #include <KGlobalSettings>
 #include <KConfigDialog>
 #include <KDatePicker>
+#include <KToolInvocation>
 #include <Plasma/Theme>
 #include <Plasma/Dialog>
 #include <Plasma/ToolTipManager>
@@ -71,6 +72,8 @@
 
 void Clock::init()
 {
+    createMenu();
+
     ClockApplet::init();
 
     KConfigGroup cg = config();
@@ -302,6 +305,24 @@
     return myRect;
 }
 
+void Clock::createMenu()
+{
+        QAction* configureDateTime = new QAction(SmallIcon("configure"),i18n("&Configure date and time..."), this);
+        m_actions.append(configureDateTime);
+        connect(configureDateTime, SIGNAL(triggered(bool)), this , SLOT(slotConfigureDateTime()));
+}
+
+void Clock::slotConfigureDateTime()
+{
+      QString error;
+      KToolInvocation::startServiceByDesktopName("clock", QStringList(), &error);
+}
+
+QList<QAction*> Clock::contextualActions()
+{
+      return m_actions;
+}
+
 void Clock::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect)
 {
     Q_UNUSED(option);
diff -Naur plasma/applets-orig/digital-clock/clock.h plasma/applets/digital-clock/clock.h
--- plasma/applets-orig/digital-clock/clock.h	2009-05-28 10:59:16.718906674 +0300
+++ plasma/applets/digital-clock/clock.h	2009-05-28 11:19:13.494156510 +0300
@@ -23,6 +23,8 @@
 
 #include <QtCore/QTime>
 #include <QtCore/QDate>
+#include <QtCore/QDate>
+#include <QList>
 
 #include <Plasma/Applet>
 #include <Plasma/DataEngine>
@@ -40,6 +42,7 @@
 
         void init();
         void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect &contentsRect);
+        virtual QList<QAction*> contextualActions();
 
     public slots:
         void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
@@ -47,9 +50,11 @@
 
     protected slots:
         void clockConfigAccepted();
+        void slotConfigureDateTime();
         void constraintsEvent(Plasma::Constraints constraints);
 
     protected:
+        void createMenu();
         void createClockConfigurationInterface(KConfigDialog *parent);
         void changeEngineTimezone(const QString &oldTimezone, const QString &newTimezone);
 
@@ -72,6 +77,7 @@
         bool m_showSeconds;
         bool m_showTimezone;
         bool m_dateTimezoneBesides;
+        QList<QAction*> m_actions;
 
         int updateInterval() const;
         Plasma::IntervalAlignment intervalAlignment() const;
diff -Naur kcontrol-orig/dateandtime/clock.desktop kcontrol/dateandtime/clock.desktop
--- kcontrol-orig/dateandtime/clock.desktop	2009-05-28 11:27:20.899156540 +0300
+++ kcontrol/dateandtime/clock.desktop	2009-05-28 11:27:33.742157080 +0300
@@ -1,5 +1,5 @@
 [Desktop Entry]
-Exec=kcmshell4 kde-clock.desktop
+Exec=kcmshell4 clock.desktop
 Icon=preferences-system-time
 Type=Service
 X-KDE-ServiceTypes=KCModule

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to