openall_time_applet 0.0.28 → 0.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.28
1
+ 0.0.29
data/gui/win_main.rb CHANGED
@@ -17,7 +17,7 @@ class Openall_time_applet::Gui::Win_main
17
17
  iter[1] = 0.to_s
18
18
 
19
19
  tasks = [_("Choose:")]
20
- @args[:oata].ob.list(:Task, {"orderby" => "title"}) do |task|
20
+ @args[:oata].ob.list(:Task, "orderby" => "title") do |task|
21
21
  iter = task_ls.append
22
22
  iter[0] = task[:title]
23
23
  iter[1] = task.id.to_s
@@ -26,25 +26,14 @@ class Openall_time_applet::Gui::Win_main
26
26
 
27
27
 
28
28
  #Set up completion for description entry.
29
- ec = Gtk::EntryCompletion.new
30
- ec.model = Gtk::ListStore.new(String)
31
- ec.text_column = 0
32
- @gui["txtDescr"].completion = ec
29
+ @descr_ec = Gtk::EntryCompletion.new
30
+ @descr_ec.model = Gtk::ListStore.new(String)
31
+ @descr_ec.text_column = 0
32
+ @gui["txtDescr"].completion = @descr_ec
33
+ self.reload_descr_completion
33
34
 
34
- added = {}
35
- @args[:oata].ob.list(:Worktime, {"orderby" => "timestamp"}) do |worktime|
36
- next if added.key?(worktime[:comment])
37
- added[worktime[:comment]] = true
38
- ec.model.append[0] = worktime[:comment]
39
- end
40
35
 
41
- @args[:oata].ob.list(:Timelog, {"orderby" => "descr"}) do |timelog|
42
- next if added.key?(timelog[:descr])
43
- added[timelog[:descr]] = true
44
- ec.model.append[0] = timelog[:descr]
45
- end
46
-
47
- ec.signal_connect("match-selected") do |me, model, iter|
36
+ @descr_ec.signal_connect("match-selected") do |me, model, iter|
48
37
  text = model.get_value(iter, 0)
49
38
  me.entry.text = text
50
39
  true
@@ -295,6 +284,24 @@ class Openall_time_applet::Gui::Win_main
295
284
  @gui["window"].resize(width, 1)
296
285
  end
297
286
 
287
+ #Reloads the suggestions for the description-entry-completion.
288
+ def reload_descr_completion
289
+ added = {}
290
+ @descr_ec.model.clear
291
+
292
+ @args[:oata].ob.list(:Worktime, "orderby" => "timestamp") do |worktime|
293
+ next if added.key?(worktime[:comment])
294
+ added[worktime[:comment]] = true
295
+ @descr_ec.model.append[0] = worktime[:comment]
296
+ end
297
+
298
+ @args[:oata].ob.list(:Timelog, "orderby" => "descr") do |timelog|
299
+ next if added.key?(timelog[:descr])
300
+ added[timelog[:descr]] = true
301
+ @descr_ec.model.append[0] = timelog[:descr]
302
+ end
303
+ end
304
+
298
305
  def reload_timelogs_preparetransfer
299
306
  return nil if @dont_reload_sync or @gui["tvTimelogsPrepareTransfer"].destroyed?
300
307
  @gui["tvTimelogsPrepareTransfer"].model.clear
@@ -399,6 +406,8 @@ class Openall_time_applet::Gui::Win_main
399
406
 
400
407
  #Removes all timelogs from the treeview and adds them again. Does nothing if the 'dont_reload'-variable is set.
401
408
  def reload_timelogs
409
+ self.reload_descr_completion
410
+
402
411
  return nil if @dont_reload or @gui["tvTimelogs"].destroyed?
403
412
  @gui["tvTimelogs"].model.clear
404
413
  @args[:oata].ob.list(:Timelog, "orderby" => ["task_id", "descr", "timestamp"]) do |timelog|
@@ -493,6 +502,8 @@ class Openall_time_applet::Gui::Win_main
493
502
  @args[:oata].timelog_stop_tracking
494
503
  @gui["txtDescr"].grab_focus
495
504
  else
505
+ descr = @gui["txtDescr"].text.to_s.strip
506
+
496
507
  task = @gui["cbTask"].sel
497
508
  if !task.is_a?(Knj::Datarow)
498
509
  task_id = 0
@@ -500,11 +511,20 @@ class Openall_time_applet::Gui::Win_main
500
511
  task_id = task.id
501
512
  end
502
513
 
503
- @timelog = @args[:oata].ob.add(:Timelog, {
504
- :task_id => task_id,
505
- :descr => @gui["txtDescr"].text
514
+ timelog = @args[:oata].ob.get_by(:Timelog, {
515
+ "task_id" => task_id,
516
+ "descr_lower" => descr,
517
+ "timestamp_day" => Time.now
506
518
  })
507
- @args[:oata].timelog_active = @timelog
519
+
520
+ if !timelog
521
+ timelog = @args[:oata].ob.add(:Timelog, {
522
+ :task_id => task_id,
523
+ :descr => descr
524
+ })
525
+ end
526
+
527
+ @args[:oata].timelog_active = timelog
508
528
  @gui["txtDescr"].text = ""
509
529
  @gui["cbTask"].sel = _("Choose:")
510
530
  end
@@ -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.28"
8
+ s.version = "0.0.29"
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-08-04}
12
+ s.date = %q{2012-08-06}
13
13
  s.description = %q{Off-line time-tracking for OpenAll with syncing when online.}
14
14
  s.email = %q{k@spernj.org}
15
15
  s.executables = ["OpenAll Timelogging", "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.28
5
+ version: 0.0.29
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-08-04 00:00:00 +02:00
13
+ date: 2012-08-06 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -209,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
209
  requirements:
210
210
  - - ">="
211
211
  - !ruby/object:Gem::Version
212
- hash: 571149335129027176
212
+ hash: -1365935635038666068
213
213
  segments:
214
214
  - 0
215
215
  version: "0"