[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdeplasma-addons/frameworks] applets/notes/package/contents: Notes plamoid: add support for differe
From:       Davide Bettio <bettio () kde ! org>
Date:       2014-04-22 18:11:17
Message-ID: E1WcfA5-00049Q-Lc () scm ! kde ! org
[Download RAW message or body]

Git commit c9aeb58c7aec2770f03daca2b61f46d62e439ed1 by Davide Bettio.
Committed on 22/04/2014 at 18:10.
Pushed by bettio into branch 'frameworks'.

Notes plamoid: add support for different sticky notes colors.

Signed-off-by: Davide Bettio <bettio@kde.org>

M  +5    -0    applets/notes/package/contents/config/main.xml
M  +29   -5    applets/notes/package/contents/ui/notes.qml

http://commits.kde.org/kdeplasma-addons/c9aeb58c7aec2770f03daca2b61f46d62e439ed1

diff --git a/applets/notes/package/contents/config/main.xml \
b/applets/notes/package/contents/config/main.xml index aedaf71..a614f7e 100644
--- a/applets/notes/package/contents/config/main.xml
+++ b/applets/notes/package/contents/config/main.xml
@@ -6,6 +6,11 @@
   <kcfgfile name=""/>
 
   <group name="General">
+
+    <entry name="color" type="String">
+      <default>yellow</default>
+    </entry>
+
     <entry name="noteText" type="String">
       <default></default>
     </entry>
diff --git a/applets/notes/package/contents/ui/notes.qml \
b/applets/notes/package/contents/ui/notes.qml index 5e88cc4..df0a3e6 100644
--- a/applets/notes/package/contents/ui/notes.qml
+++ b/applets/notes/package/contents/ui/notes.qml
@@ -28,9 +28,10 @@ Item
 {
     id: root;
 
+    property string color: plasmoid.configuration.color;
     property string noteText: plasmoid.configuration.noteText;
 
-    Plasmoid.backgroundHints: "NoBackground";
+    Plasmoid.backgroundHints: PlasmaCore.Types.NoBackground
 
     PlasmaCore.Svg {
         id: notesSvg;
@@ -40,13 +41,13 @@ Item
     PlasmaCore.SvgItem {
         anchors.fill: parent;
         svg: notesSvg;
-        elementId: "yellow-notes";
+        elementId: color + "-notes";
     }
 
     Timer {
-        id: saveTimer;
+        id: delayedSaveTimer;
         onTriggered: saveNote();
-        interval: 5000;
+        interval: 2000;
     }
 
     PlasmaComponents.TextArea {
@@ -64,7 +65,23 @@ Item
         text: noteText;
         textFormat: TextEdit.RichText;
 
-        onTextChanged: saveTimer.start();
+        onTextChanged:{
+            delayedSaveTimer.stop();
+            delayedSaveTimer.start();
+        }
+    }
+
+    Component.onCompleted: {
+        plasmoid.setAction("change_note_color_white", i18n("White"));
+        plasmoid.setAction("change_note_color_black", i18n("Black"));
+        plasmoid.setAction("change_note_color_red", i18n("Red"));
+        plasmoid.setAction("change_note_color_orange", i18n("Orange"));
+        plasmoid.setAction("change_note_color_yellow", i18n("Yellow"));
+        plasmoid.setAction("change_note_color_green", i18n("Green"));
+        plasmoid.setAction("change_note_color_blue", i18n("Blue"));
+        plasmoid.setAction("change_note_color_pink", i18n("Pink"));
+        plasmoid.setAction("change_note_color_translucent", i18n("Translucent"));
+        plasmoid.setActionSeparator("separator0");
     }
 
     function saveNote()
@@ -73,5 +90,12 @@ Item
            plasmoid.configuration.noteText = textEdit.text;
        }
     }
+
+    function actionTriggered(actionName)
+    {
+        if (actionName.indexOf("change_note_color_") == 0){
+            plasmoid.configuration.color = actionName.replace("change_note_color_", \
""); +        }
+    }
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic