openall_time_applet 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.7
@@ -6,7 +6,5 @@ require "../lib/openall_time_applet.rb"
6
6
  GetText.bindtextdomain("default", "../locales", ENV["LANGUAGE"])
7
7
 
8
8
  oata = Openall_time_applet.new
9
- oata.update_db
10
- oata.spawn_trayicon
11
9
 
12
10
  Gtk.main
@@ -9,8 +9,7 @@ class Openall_time_applet::Connection
9
9
  :port => @args[:port],
10
10
  :follow_redirects => false,
11
11
  :ssl => Knj::Strings.yn_str(@args[:ssl], true, false),
12
- :debug => false,
13
- :encoding_gzip => false
12
+ :debug => false
14
13
  )
15
14
 
16
15
  self.login
@@ -21,14 +20,11 @@ class Openall_time_applet::Connection
21
20
  @http.post_multipart("index.php?c=Auth&m=validateLogin", {"username" => @args[:username], "password" => @args[:password]})
22
21
 
23
22
  #Verify login by reading dashboard HTML.
24
- @http.reconnect
25
23
  res = @http.get("index.php?c=Dashboard")
26
24
  raise _("Could not log in.") if !res.body.match(/<ul id="webticker" >/)
27
25
  end
28
26
 
29
27
  def request(args)
30
- @http.reconnect
31
-
32
28
  #Possible to give a string instead of hash to do it simple.
33
29
  args = {:url => "?c=Jsonapi&m=#{args}"} if args.is_a?(String) or args.is_a?(Symbol)
34
30
  args[:url] = "?c=Jsonapi&m=#{args[:method]}" if args[:method] and !args[:url]
data/conf/db_schema.rb CHANGED
@@ -32,7 +32,6 @@ Openall_time_applet::DB_SCHEMA = {
32
32
  "Timelog" => {
33
33
  "columns" => [
34
34
  {"name" => "id", "type" => "int", "autoincr" => true, "primarykey" => true},
35
- {"name" => "openall_uid", "type" => "int"},
36
35
  {"name" => "task_id", "type" => "int"},
37
36
  {"name" => "time", "type" => "int"},
38
37
  {"name" => "time_transport", "type" => "int"},
@@ -41,7 +40,6 @@ Openall_time_applet::DB_SCHEMA = {
41
40
  {"name" => "sync_last", "type" => "datetime"}
42
41
  ],
43
42
  "indexes" => [
44
- "openall_uid",
45
43
  "task_id"
46
44
  ]
47
45
  },
data/gfx/icon_time.png CHANGED
Binary file
Binary file
@@ -0,0 +1,139 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <interface>
3
+ <requires lib="gtk+" version="2.24"/>
4
+ <!-- interface-naming-policy project-wide -->
5
+ <object class="GtkWindow" id="window">
6
+ <property name="can_focus">False</property>
7
+ <property name="title" translatable="yes">Overview of sync</property>
8
+ <property name="window_position">center</property>
9
+ <property name="default_width">640</property>
10
+ <child>
11
+ <object class="GtkVBox" id="vbox1">
12
+ <property name="visible">True</property>
13
+ <property name="can_focus">False</property>
14
+ <child>
15
+ <object class="GtkFrame" id="frame1">
16
+ <property name="visible">True</property>
17
+ <property name="can_focus">False</property>
18
+ <property name="label_xalign">0</property>
19
+ <property name="shadow_type">none</property>
20
+ <child>
21
+ <object class="GtkAlignment" id="alignment1">
22
+ <property name="visible">True</property>
23
+ <property name="can_focus">False</property>
24
+ <property name="left_padding">12</property>
25
+ <child>
26
+ <object class="GtkVBox" id="vbox2">
27
+ <property name="visible">True</property>
28
+ <property name="can_focus">False</property>
29
+ <property name="spacing">3</property>
30
+ <child>
31
+ <object class="GtkTable" id="tableTimelogs">
32
+ <property name="visible">True</property>
33
+ <property name="can_focus">False</property>
34
+ <property name="n_columns">3</property>
35
+ <child>
36
+ <object class="GtkLabel" id="label3">
37
+ <property name="visible">True</property>
38
+ <property name="can_focus">False</property>
39
+ <property name="xalign">0</property>
40
+ <property name="label" translatable="yes">&lt;b&gt;Timelog&lt;/b&gt;</property>
41
+ <property name="use_markup">True</property>
42
+ </object>
43
+ </child>
44
+ <child>
45
+ <object class="GtkLabel" id="label4">
46
+ <property name="visible">True</property>
47
+ <property name="can_focus">False</property>
48
+ <property name="xalign">0</property>
49
+ <property name="label" translatable="yes">&lt;b&gt;Logged time&lt;/b&gt;</property>
50
+ <property name="use_markup">True</property>
51
+ </object>
52
+ <packing>
53
+ <property name="left_attach">1</property>
54
+ <property name="right_attach">2</property>
55
+ </packing>
56
+ </child>
57
+ <child>
58
+ <object class="GtkLabel" id="label5">
59
+ <property name="visible">True</property>
60
+ <property name="can_focus">False</property>
61
+ <property name="xalign">0</property>
62
+ <property name="label" translatable="yes">&lt;b&gt;Sync. as time&lt;/b&gt;</property>
63
+ <property name="use_markup">True</property>
64
+ </object>
65
+ <packing>
66
+ <property name="left_attach">2</property>
67
+ <property name="right_attach">3</property>
68
+ </packing>
69
+ </child>
70
+ </object>
71
+ <packing>
72
+ <property name="expand">True</property>
73
+ <property name="fill">True</property>
74
+ <property name="position">0</property>
75
+ </packing>
76
+ </child>
77
+ <child>
78
+ <object class="GtkHButtonBox" id="hbuttonbox1">
79
+ <property name="visible">True</property>
80
+ <property name="can_focus">False</property>
81
+ <property name="spacing">3</property>
82
+ <property name="layout_style">end</property>
83
+ <child>
84
+ <object class="GtkButton" id="btnSync">
85
+ <property name="label">gtk-harddisk</property>
86
+ <property name="visible">True</property>
87
+ <property name="can_focus">True</property>
88
+ <property name="receives_default">True</property>
89
+ <property name="use_action_appearance">False</property>
90
+ <property name="use_stock">True</property>
91
+ <signal name="clicked" handler="on_btnSync_clicked" swapped="no"/>
92
+ </object>
93
+ <packing>
94
+ <property name="expand">False</property>
95
+ <property name="fill">False</property>
96
+ <property name="position">0</property>
97
+ </packing>
98
+ </child>
99
+ </object>
100
+ <packing>
101
+ <property name="expand">True</property>
102
+ <property name="fill">True</property>
103
+ <property name="position">1</property>
104
+ </packing>
105
+ </child>
106
+ </object>
107
+ </child>
108
+ </object>
109
+ </child>
110
+ <child type="label">
111
+ <object class="GtkLabel" id="label2">
112
+ <property name="visible">True</property>
113
+ <property name="can_focus">False</property>
114
+ <property name="label" translatable="yes">&lt;b&gt;Sync with OpenAll&lt;/b&gt;</property>
115
+ <property name="use_markup">True</property>
116
+ </object>
117
+ </child>
118
+ </object>
119
+ <packing>
120
+ <property name="expand">False</property>
121
+ <property name="fill">True</property>
122
+ <property name="position">0</property>
123
+ </packing>
124
+ </child>
125
+ <child>
126
+ <object class="GtkLabel" id="label1">
127
+ <property name="visible">True</property>
128
+ <property name="can_focus">False</property>
129
+ </object>
130
+ <packing>
131
+ <property name="expand">True</property>
132
+ <property name="fill">True</property>
133
+ <property name="position">1</property>
134
+ </packing>
135
+ </child>
136
+ </object>
137
+ </child>
138
+ </object>
139
+ </interface>
data/gui/trayicon.rb CHANGED
@@ -33,7 +33,6 @@ class Openall_time_applet::Gui::Trayicon
33
33
  #Calculate minutes tracked and generate variables.
34
34
  secs = Time.now.to_i - @args[:oata].timelog_active_time.to_i
35
35
  mins = (secs.to_f / 60.0)
36
- mins = 1 if mins < 1
37
36
 
38
37
  if mins >= 60
39
38
  hours = mins / 60
@@ -54,7 +53,7 @@ class Openall_time_applet::Gui::Trayicon
54
53
 
55
54
  #Generate image.
56
55
  require "RMagick"
57
- canvas = Magick::Image.new(53, 48){
56
+ canvas = Magick::Image.new(53, 53){
58
57
  self.background_color = "transparent"
59
58
  self.format = "png"
60
59
  }
@@ -136,7 +135,8 @@ class Openall_time_applet::Gui::Trayicon
136
135
 
137
136
  #If tracking is active, then show how many seconds has been tracked until now in menu as an item.
138
137
  secs = Time.now.to_i - @args[:oata].timelog_active_time.to_i
139
- label = Gtk::MenuItem.new(sprintf(_("%s seconds"), secs))
138
+ mins = (secs.to_f / 60.0).round(0)
139
+ label = Gtk::MenuItem.new(sprintf(_("%s minutes"), mins))
140
140
  menu.append(label)
141
141
  end
142
142
 
@@ -60,6 +60,7 @@ class Openall_time_applet::Gui::Win_preferences
60
60
  def on_btnTraySave_clicked
61
61
  color_key = @tray_colors.keys[@gui["cbTrayTextColor"].sel["active"]]
62
62
  Knj::Opts.set("tray_text_color", color_key)
63
+ @args[:oata].ti.update_icon if @args[:oata].ti
63
64
  Knj::Gtk2.msgbox(_("The tray-settings was saved."), "info")
64
65
  end
65
66
 
@@ -0,0 +1,86 @@
1
+ #This class handels the window that will be shown before the actual sync takes place.
2
+ class Openall_time_applet::Gui::Win_sync_overview
3
+ def initialize(args)
4
+ @args = args
5
+
6
+ @gui = Gtk::Builder.new.add("../glade/win_sync_overview.glade")
7
+ @gui.translate
8
+ @gui.connect_signals{|h|method(h)}
9
+ @gui["btnSync"].label = _("Synchronize")
10
+
11
+ #This hash holds the text-widgets which time, which are used to update the timelogs later.
12
+ @sync_time_text_widgets = {}
13
+
14
+ rowc = 1
15
+ @args[:oata].ob.list(:Timelog, {"sync_need" => 1, "task_id_not" => 0}) do |timelog|
16
+ #Read time and transport from timelog.
17
+ time = timelog[:time].to_i
18
+ transport = timelog[:time_transport].to_i
19
+
20
+ #If transport is logged, then the work if offsite. It should be rounded up by 30 min. Else 15 min. round up.
21
+ if transport > 0
22
+ roundup = 1800
23
+ else
24
+ roundup = 900
25
+ end
26
+
27
+ #Do the actual counting.
28
+ count_rounded_time = 0
29
+ loop do
30
+ break if count_rounded_time >= time
31
+ count_rounded_time += roundup
32
+ end
33
+
34
+ #Spawn widgets.
35
+ timelog_label = Gtk::Label.new(timelog[:descr])
36
+ timelog_label.xalign = 0
37
+ timelog_label.selectable = true
38
+
39
+ logged_time_label = Gtk::Label.new(Knj::Strings.secs_to_human_time_str(timelog[:time]))
40
+ logged_time_label.xalign = 0
41
+ logged_time_label.selectable = true
42
+
43
+ sync_time_text = Gtk::Entry.new
44
+ sync_time_text.text = Knj::Strings.secs_to_human_time_str(count_rounded_time)
45
+ @sync_time_text_widgets[timelog.id] = sync_time_text
46
+
47
+ #Attach widgets in table.
48
+ @gui["tableTimelogs"].attach(timelog_label, 0, 1, rowc, rowc + 1)
49
+ @gui["tableTimelogs"].attach(logged_time_label, 1, 2, rowc, rowc + 1)
50
+ @gui["tableTimelogs"].attach(sync_time_text, 2, 3, rowc, rowc + 1)
51
+
52
+ rowc += 1
53
+ end
54
+
55
+ if rowc == 1
56
+ #Show error-message and destroy the window, if no timelogs was to be synced.
57
+ Knj::Gtk2.msgbox(_("There is nothing to sync at this time."))
58
+ @gui["window"].destroy
59
+ else
60
+ #...else show the window.
61
+ @gui["window"].show_all
62
+ end
63
+ end
64
+
65
+ def on_btnSync_clicked
66
+ begin
67
+ #Go through the shown timelogs and update their time to the entered and rounded time.
68
+ @sync_time_text_widgets.each do |timelog_id, sync_time_text|
69
+ timelog = @args[:oata].ob.get(:Timelog, timelog_id)
70
+ secs = Knj::Strings.human_time_str_to_secs(sync_time_text.text)
71
+ if !Knj::Php.is_numeric(secs)
72
+ raise sprintf(_("Time was not numeric for: '%s'."), timelog[:descr])
73
+ end
74
+
75
+ #Update the time so that is what will be synchronized.
76
+ timelog[:time] = secs
77
+ end
78
+
79
+ #Destroy this window and start syncing for real.
80
+ @gui["window"].destroy
81
+ @args[:oata].sync_real
82
+ rescue => e
83
+ Knj::Gtk2.msgbox(Knj::Errors.error_str(e))
84
+ end
85
+ end
86
+ end
@@ -1,5 +1,7 @@
1
+ #Support for libs loaded through RubyGems.
1
2
  require "rubygems"
2
3
 
4
+ #For secs-to-human-string (MySQL-format), model-framework, database-framework, options-framework, date-framework and more.
3
5
  if ENV["HOME"] == "/home/kaspernj" and File.exists?("/home/kaspernj/Dev/Ruby/knjrbfw")
4
6
  #For development.
5
7
  require "/home/kaspernj/Dev/Ruby/knjrbfw/lib/knjrbfw"
@@ -12,11 +14,19 @@ require "sqlite3"
12
14
  require "gettext"
13
15
  require "base64"
14
16
 
17
+ #For msgbox and translation of windows.
15
18
  require "knj/gtk2"
19
+
20
+ #For easy initialization, getting and settings of values on comboboxes.
16
21
  require "knj/gtk2_cb"
22
+
23
+ #For easy initialization, getting and settings of values on treeviews.
17
24
  require "knj/gtk2_tv"
25
+
26
+ #For easy making status-windows with progressbar.
18
27
  require "knj/gtk2_statuswindow"
19
28
 
29
+ #The base class of the applet. Spawns all windows, holds subclasses for models and gui, holds models objects and holds database-objects.
20
30
  class Openall_time_applet
21
31
  #Shortcut to start the application. Used by the Ubuntu-package.
22
32
  def self.exec
@@ -58,7 +68,7 @@ class Openall_time_applet
58
68
  end
59
69
 
60
70
  #Various readable variables.
61
- attr_reader :db, :ob, :timelog_active, :timelog_active_time
71
+ attr_reader :db, :ob, :ti, :timelog_active, :timelog_active_time
62
72
  attr_accessor :reminder_next
63
73
 
64
74
  #Config controlling paths and more.
@@ -79,6 +89,9 @@ class Openall_time_applet
79
89
  :index_append_table_name => true
80
90
  )
81
91
 
92
+ #Update to latest db-revision.
93
+ self.update_db
94
+
82
95
  #Models-handeler.
83
96
  @ob = Knj::Objects.new(
84
97
  :datarow => true,
@@ -97,6 +110,9 @@ class Openall_time_applet
97
110
  #Set crash-operation to save tracked time instead of loosing it.
98
111
  Kernel.at_exit(&self.method(:destroy))
99
112
 
113
+ #Spawn tray-icon.
114
+ self.spawn_trayicon
115
+
100
116
  #Start reminder.
101
117
  self.reminding
102
118
  end
@@ -199,8 +215,13 @@ class Openall_time_applet
199
215
  @ob.static(:Timelog, :push_time_updates, {:oata => self})
200
216
  end
201
217
 
202
- #Refreshes task-cache, create missing worktime from timelogs and push tracked time to timelogs. Shows a status-window while doing so.
218
+ #Shows the sync overview, which must be seen before the actual sync.
203
219
  def sync
220
+ Openall_time_applet::Gui::Win_sync_overview.new(:oata => self)
221
+ end
222
+
223
+ #Refreshes task-cache, create missing worktime from timelogs and push tracked time to timelogs. Shows a status-window while doing so.
224
+ def sync_real
204
225
  sw = Knj::Gtk2::StatusWindow.new
205
226
 
206
227
  if @timelog_active
@@ -232,7 +253,7 @@ class Openall_time_applet
232
253
  rescue => e
233
254
  Knj::Gtk2.msgbox("msg" => Knj::Errors.error_str(e), "type" => "warning", "title" => _("Error"), "run" => false)
234
255
  ensure
235
- sw.destroy
256
+ sw.destroy if sw
236
257
  self.timelog_active = timelog_active if timelog_active
237
258
  end
238
259
  end
Binary file
@@ -1,8 +1,8 @@
1
1
  msgid ""
2
2
  msgstr ""
3
3
  "Project-Id-Version: Openall_time_applet\n"
4
- "POT-Creation-Date: 2012-05-21 13:20+0100\n"
5
- "PO-Revision-Date: 2012-05-21 13:20+0100\n"
4
+ "POT-Creation-Date: 2012-05-25 10:56+0100\n"
5
+ "PO-Revision-Date: 2012-05-25 10:58+0100\n"
6
6
  "Last-Translator: Kasper Johansen <k@spernj.org>\n"
7
7
  "Language-Team: Kasper Johansen <k@spernj.org>\n"
8
8
  "Language: \n"
@@ -16,15 +16,15 @@ msgstr ""
16
16
  "X-Poedit-SourceCharset: utf-8\n"
17
17
  "X-Poedit-SearchPath-0: .\n"
18
18
 
19
- #: classes/connection.rb:26
19
+ #: classes/connection.rb:24
20
20
  msgid "Could not log in."
21
21
  msgstr "Kunne ikke logge ind."
22
22
 
23
- #: classes/connection.rb:43
23
+ #: classes/connection.rb:39
24
24
  msgid "Empty body returned from OpenAll."
25
25
  msgstr "Tom body returneret fra OpenAll."
26
26
 
27
- #: classes/connection.rb:49
27
+ #: classes/connection.rb:45
28
28
  msgid "Could not parse JSON from: %s"
29
29
  msgstr "Kunne ikke oversætte JSON fra: %s"
30
30
 
@@ -56,29 +56,29 @@ msgstr "Lørday"
56
56
  msgid "Sunday"
57
57
  msgstr "Søndag"
58
58
 
59
- #: gui/trayicon.rb:15
59
+ #: gui/trayicon.rb:84
60
60
  msgid "New timelog"
61
61
  msgstr "Ny tidslog"
62
62
 
63
- #: gui/trayicon.rb:19
63
+ #: gui/trayicon.rb:88
64
64
  msgid "Overview"
65
65
  msgstr "Oversigt"
66
66
 
67
- #: gui/trayicon.rb:23
67
+ #: gui/trayicon.rb:92
68
68
  msgid "Time overview"
69
69
  msgstr "Tids oversigt"
70
70
 
71
- #: gui/trayicon.rb:33
71
+ #: gui/trayicon.rb:102
72
72
  msgid "Synchronize with OpenAll"
73
73
  msgstr "Synkroniserer med OpenAll"
74
74
 
75
- #: gui/trayicon.rb:46
75
+ #: gui/trayicon.rb:115
76
76
  msgid "Track: %s"
77
77
  msgstr "Følg: %s"
78
78
 
79
- #: gui/trayicon.rb:69
80
- msgid "%s seconds"
81
- msgstr "%s sekunder"
79
+ #: gui/trayicon.rb:139
80
+ msgid "%s minutes"
81
+ msgstr "%s minutter"
82
82
 
83
83
  #: gui/win_overview.rb:11
84
84
  msgid "ID"
@@ -112,20 +112,44 @@ msgstr "Ja"
112
112
  msgid "No"
113
113
  msgstr "Nej"
114
114
 
115
- #: gui/win_preferences.rb:43
115
+ #: gui/win_preferences.rb:30
116
+ msgid "Black"
117
+ msgstr "Sort"
118
+
119
+ #: gui/win_preferences.rb:30
120
+ msgid "White"
121
+ msgstr "Hvid"
122
+
123
+ #: gui/win_preferences.rb:42
124
+ msgid "The OpenAll-settings was saved."
125
+ msgstr "OpenAll-indstillinger blev gemt."
126
+
127
+ #: gui/win_preferences.rb:47
128
+ msgid "Reminder-minute was not numeric."
129
+ msgstr "Påmindelses-minutter var ikke et gyldigt tal."
130
+
131
+ #: gui/win_preferences.rb:57
132
+ msgid "The reminder-settings was saved."
133
+ msgstr "Påmindelses-indstillinger blev gemt."
134
+
135
+ #: gui/win_preferences.rb:64
136
+ msgid "The tray-settings was saved."
137
+ msgstr "Tray-indstillinger blev gemt."
138
+
139
+ #: gui/win_preferences.rb:70
116
140
  msgid "Connecting and logging in..."
117
141
  msgstr "Forbinder og logger ind..."
118
142
 
119
- #: gui/win_preferences.rb:51
143
+ #: gui/win_preferences.rb:78
120
144
  msgid "Getting task-list."
121
145
  msgstr "Henter opgave-liste."
122
146
 
123
- #: gui/win_preferences.rb:54
147
+ #: gui/win_preferences.rb:81
124
148
  msgid "Got %s tasks."
125
149
  msgstr "Hentet %s opgaver."
126
150
 
127
- #: gui/win_preferences.rb:62
128
- #: lib/openall_time_applet.rb:203
151
+ #: gui/win_preferences.rb:89
152
+ #: lib/openall_time_applet.rb:254
129
153
  msgid "Error"
130
154
  msgstr "Fejl"
131
155
 
@@ -133,7 +157,7 @@ msgstr "Fejl"
133
157
  msgid "Week %s"
134
158
  msgstr "Uge %s"
135
159
 
136
- #: gui/win_worktime_overview.rb:103
160
+ #: gui/win_worktime_overview.rb:115
137
161
  msgid "No worktimes was found that week."
138
162
  msgstr "Der blev ikke fundet nogle arbejdstimer i denne uge."
139
163
 
@@ -153,27 +177,43 @@ msgstr "Du har indtastet et ugyldigt transport-tids-format."
153
177
  msgid "Do you want to remove this timelog? This will not delete the timelog on OpenAll."
154
178
  msgstr "Vil du fjerne denne tidslogning? Dette vil ikke slette tidslogningen fra OpenAll."
155
179
 
156
- #: lib/openall_time_applet.rb:90
180
+ #: gui/win_sync_overview.rb:9
181
+ msgid "Synchronize"
182
+ msgstr "Synkroniser"
183
+
184
+ #: gui/win_sync_overview.rb:57
185
+ msgid "There is nothing to sync at this time."
186
+ msgstr "Der er intet at synce på nuværende tidspunkt."
187
+
188
+ #: gui/win_sync_overview.rb:72
189
+ msgid "Time was not numeric for: '%s'."
190
+ msgstr "Tid var ikke numerisk for: '%s'."
191
+
192
+ #: lib/openall_time_applet.rb:104
157
193
  msgid "not set"
158
194
  msgstr "ikke sat"
159
195
 
160
- #: lib/openall_time_applet.rb:183
196
+ #: lib/openall_time_applet.rb:149
197
+ msgid "Tracking task: %s"
198
+ msgstr "Følger opgave: %s"
199
+
200
+ #: lib/openall_time_applet.rb:234
161
201
  msgid "Updating organisation-cache."
162
202
  msgstr "Opdaterer organisations-cache."
163
203
 
164
- #: lib/openall_time_applet.rb:187
204
+ #: lib/openall_time_applet.rb:238
165
205
  msgid "Updating task-cache."
166
206
  msgstr "Opdaterer opgave-cache."
167
207
 
168
- #: lib/openall_time_applet.rb:191
208
+ #: lib/openall_time_applet.rb:242
169
209
  msgid "Pushing time-updates."
170
210
  msgstr "Sender tids-opdateringer."
171
211
 
172
- #: lib/openall_time_applet.rb:195
212
+ #: lib/openall_time_applet.rb:246
173
213
  msgid "Updating worktime-cache."
174
214
  msgstr "Opdaterer arbejdstids-cache."
175
215
 
176
- #: lib/openall_time_applet.rb:199
216
+ #: lib/openall_time_applet.rb:250
177
217
  msgid "Done"
178
218
  msgstr "Færdig"
179
219
 
@@ -198,6 +238,7 @@ msgid "Start tracking after saving"
198
238
  msgstr "Starter med at følge efter gem"
199
239
 
200
240
  #: glade/win_timelog_edit.glade:188
241
+ #: glade/win_sync_overview.glade:40
201
242
  msgid "<b>Timelog</b>"
202
243
  msgstr "<b>Tidslog</b>"
203
244
 
@@ -205,37 +246,76 @@ msgstr "<b>Tidslog</b>"
205
246
  msgid "Preferences"
206
247
  msgstr "Indstillinger"
207
248
 
208
- #: glade/win_preferences.glade:42
249
+ #: glade/win_preferences.glade:35
209
250
  msgid "Host"
210
251
  msgstr "Host"
211
252
 
212
- #: glade/win_preferences.glade:53
253
+ #: glade/win_preferences.glade:46
213
254
  msgid "Username"
214
255
  msgstr "Brugernavn"
215
256
 
216
- #: glade/win_preferences.glade:99
257
+ #: glade/win_preferences.glade:94
217
258
  msgid "Password"
218
259
  msgstr "Adagngskode"
219
260
 
220
- #: glade/win_preferences.glade:130
261
+ #: glade/win_preferences.glade:126
221
262
  msgid "Port"
222
263
  msgstr "Port"
223
264
 
224
- #: glade/win_preferences.glade:158
265
+ #: glade/win_preferences.glade:155
225
266
  msgid "SSL"
226
267
  msgstr "SSL"
227
268
 
228
- #: glade/win_preferences.glade:187
229
- msgid "<b>OpenAll</b>"
230
- msgstr "<b>OpenAll</b>"
231
-
232
- #: glade/win_preferences.glade:206
269
+ #: glade/win_preferences.glade:190
233
270
  msgid "Test"
234
271
  msgstr "Test"
235
272
 
273
+ #: glade/win_preferences.glade:243
274
+ msgid "OpenAll"
275
+ msgstr "OpenAll"
276
+
277
+ #: glade/win_preferences.glade:267
278
+ msgid "Reminder enabled"
279
+ msgstr "Påmindelser slået til"
280
+
281
+ #: glade/win_preferences.glade:283
282
+ msgid "Remind every minute"
283
+ msgstr "Påmind hver minut"
284
+
285
+ #: glade/win_preferences.glade:372
286
+ msgid "Reminder"
287
+ msgstr "Påminder"
288
+
289
+ #: glade/win_preferences.glade:398
290
+ msgid "Text color"
291
+ msgstr "Tekst farve"
292
+
293
+ #: glade/win_preferences.glade:478
294
+ msgid "Tray"
295
+ msgstr "Tray"
296
+
297
+ #: glade/win_sync_overview.glade:7
298
+ msgid "Overview of sync"
299
+ msgstr "Oversigt over synk"
300
+
301
+ #: glade/win_sync_overview.glade:49
302
+ msgid "<b>Logged time</b>"
303
+ msgstr "<b>Logget tid</b>"
304
+
305
+ #: glade/win_sync_overview.glade:62
306
+ msgid "<b>Sync. as time</b>"
307
+ msgstr "<b>Synk. som tid</b>"
308
+
309
+ #: glade/win_sync_overview.glade:114
310
+ msgid "<b>Sync with OpenAll</b>"
311
+ msgstr "<b>Synk med OpenAll</b>"
312
+
236
313
  #: glade/win_overview.glade:54
237
314
  msgid "<b>Timelogs</b>"
238
315
  msgstr "<b>Tidslogs</b>"
239
316
 
317
+ #~ msgid "%s seconds"
318
+ #~ msgstr "%s sekunder"
319
+
240
320
  #~ msgid "URL"
241
321
  #~ msgstr "URL"
data/models/timelog.rb CHANGED
@@ -18,26 +18,17 @@ class Openall_time_applet::Models::Timelog < Knj::Datarow
18
18
  next if secs_sum <= 0
19
19
 
20
20
  #The timelog has not yet been created in OpenAll - create it!
21
- if timelog[:openall_uid].to_i == 0
22
- res = conn.request(
23
- :method => :createWorktime,
24
- :post => {
25
- :task_uid => timelog.task[:openall_uid].to_i,
26
- :comment => timelog[:descr]
27
- }
28
- )
29
- timelog[:openall_uid] = res["worktime_uid"]
30
- end
31
-
32
- #Push latest work-time.
33
21
  res = conn.request(
34
- :method => :pushTimeToWorktime,
22
+ :method => :createWorktime,
35
23
  :post => {
36
- :worktime_uid => timelog[:openall_uid].to_i,
37
- :secs => timelog[:time].to_i,
38
- :secs_transport => timelog[:time_transport].to_i
24
+ :task_uid => timelog.task[:openall_uid].to_i,
25
+ :comment => timelog[:descr],
26
+ :worktime => Knj::Strings.secs_to_human_time_str(timelog[:time]),
27
+ :transporttime => Knj::Strings.secs_to_human_time_str(timelog[:time_transport])
39
28
  }
40
29
  )
30
+
31
+ #Reset timelog.
41
32
  timelog.update(
42
33
  :time => 0,
43
34
  :time_transport => 0,
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{openall_time_applet}
8
- s.version = "0.0.5"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kasper Johansen"]
12
- s.date = %q{2012-05-21}
12
+ s.date = %q{2012-05-25}
13
13
  s.default_executable = %q{openall_time_applet.rb}
14
14
  s.description = %q{Off-line time-tracking for OpenAll with syncing when online.}
15
15
  s.email = %q{k@spernj.org}
@@ -32,13 +32,16 @@ Gem::Specification.new do |s|
32
32
  "classes/translations.rb",
33
33
  "conf/db_schema.rb",
34
34
  "gfx/icon_time.png",
35
+ "gfx/icon_time_orig.png",
35
36
  "glade/win_overview.glade",
36
37
  "glade/win_preferences.glade",
38
+ "glade/win_sync_overview.glade",
37
39
  "glade/win_timelog_edit.glade",
38
40
  "glade/win_worktime_overview.glade",
39
41
  "gui/trayicon.rb",
40
42
  "gui/win_overview.rb",
41
43
  "gui/win_preferences.rb",
44
+ "gui/win_sync_overview.rb",
42
45
  "gui/win_timelog_edit.rb",
43
46
  "gui/win_worktime_overview.rb",
44
47
  "lib/openall_time_applet.rb",
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: openall_time_applet
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.5
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kasper Johansen
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-05-21 00:00:00 +02:00
13
+ date: 2012-05-25 00:00:00 +02:00
14
14
  default_executable: openall_time_applet.rb
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -157,13 +157,16 @@ files:
157
157
  - classes/translations.rb
158
158
  - conf/db_schema.rb
159
159
  - gfx/icon_time.png
160
+ - gfx/icon_time_orig.png
160
161
  - glade/win_overview.glade
161
162
  - glade/win_preferences.glade
163
+ - glade/win_sync_overview.glade
162
164
  - glade/win_timelog_edit.glade
163
165
  - glade/win_worktime_overview.glade
164
166
  - gui/trayicon.rb
165
167
  - gui/win_overview.rb
166
168
  - gui/win_preferences.rb
169
+ - gui/win_sync_overview.rb
167
170
  - gui/win_timelog_edit.rb
168
171
  - gui/win_worktime_overview.rb
169
172
  - lib/openall_time_applet.rb
@@ -190,7 +193,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
193
  requirements:
191
194
  - - ">="
192
195
  - !ruby/object:Gem::Version
193
- hash: -3134655013415234649
196
+ hash: 3607958173407388700
194
197
  segments:
195
198
  - 0
196
199
  version: "0"