diff options
-rw-r--r-- | src/ClockTool.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/ClockTool.cc b/src/ClockTool.cc index 4120749..c23028f 100644 --- a/src/ClockTool.cc +++ b/src/ClockTool.cc | |||
@@ -20,12 +20,13 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: ClockTool.cc,v 1.6 2003/12/04 23:02:23 fluxgen Exp $ | 23 | // $Id: ClockTool.cc,v 1.7 2003/12/06 16:49:06 fluxgen Exp $ |
24 | 24 | ||
25 | #include "ClockTool.hh" | 25 | #include "ClockTool.hh" |
26 | 26 | ||
27 | #include "ToolTheme.hh" | 27 | #include "ToolTheme.hh" |
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
29 | #include "CommandParser.hh" | ||
29 | 30 | ||
30 | #include "FbTk/SimpleCommand.hh" | 31 | #include "FbTk/SimpleCommand.hh" |
31 | #include "FbTk/ImageControl.hh" | 32 | #include "FbTk/ImageControl.hh" |
@@ -40,7 +41,7 @@ | |||
40 | 41 | ||
41 | class ClockMenuItem: public FbTk::MenuItem { | 42 | class ClockMenuItem: public FbTk::MenuItem { |
42 | public: | 43 | public: |
43 | ClockMenuItem::ClockMenuItem(ClockTool &tool): | 44 | explicit ClockMenuItem::ClockMenuItem(ClockTool &tool): |
44 | FbTk::MenuItem(""), m_tool(tool) { | 45 | FbTk::MenuItem(""), m_tool(tool) { |
45 | // determine 12/24 hour format | 46 | // determine 12/24 hour format |
46 | if (m_tool.timeFormat().find("%k") != std::string::npos || | 47 | if (m_tool.timeFormat().find("%k") != std::string::npos || |
@@ -85,12 +86,17 @@ public: | |||
85 | else if ((pos = newformat.find("%P")) != std::string::npos) | 86 | else if ((pos = newformat.find("%P")) != std::string::npos) |
86 | newformat.erase(pos, 2); | 87 | newformat.erase(pos, 2); |
87 | } | 88 | } |
88 | if (clock24hour) | 89 | |
90 | |||
91 | m_tool.setTimeFormat(newformat); | ||
92 | |||
93 | if (m_tool.timeFormat().find("%k") != std::string::npos || | ||
94 | m_tool.timeFormat().find("%H") != std::string::npos || | ||
95 | m_tool.timeFormat().find("%T") != std::string::npos) | ||
89 | setLabel("Clock: 24h"); | 96 | setLabel("Clock: 24h"); |
90 | else | 97 | else |
91 | setLabel("Clock: 12h"); | 98 | setLabel("Clock: 12h"); |
92 | 99 | ||
93 | m_tool.setTimeFormat(newformat); | ||
94 | } // else some other strange format...so we don't do anything | 100 | } // else some other strange format...so we don't do anything |
95 | FbTk::MenuItem::click(button, time); | 101 | FbTk::MenuItem::click(button, time); |
96 | } | 102 | } |
@@ -121,7 +127,10 @@ ClockTool::ClockTool(const FbTk::FbWindow &parent, | |||
121 | m_timer.start(); | 127 | m_timer.start(); |
122 | 128 | ||
123 | m_button.setGC(m_theme.textGC()); | 129 | m_button.setGC(m_theme.textGC()); |
124 | menu.insert(new ClockMenuItem(*this)); | 130 | FbTk::RefCount<FbTk::Command> saverc(CommandParser::instance().parseLine("saverc")); |
131 | FbTk::MenuItem *item = new ClockMenuItem(*this); | ||
132 | item->setCommand(saverc); | ||
133 | menu.insert(item); | ||
125 | update(0); | 134 | update(0); |
126 | } | 135 | } |
127 | 136 | ||