openall_time_applet 0.0.23 → 0.0.24

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -18,5 +18,4 @@ group :development do
18
18
  gem "rdoc", "~> 3.12"
19
19
  gem "bundler", ">= 1.0.0"
20
20
  gem "jeweler", "~> 1.8.3"
21
- gem "rcov", ">= 0"
22
21
  end
data/Gemfile.lock CHANGED
@@ -5,7 +5,7 @@ GEM
5
5
  glib2 (>= 1.1.3)
6
6
  cairo (1.12.2)
7
7
  pkg-config
8
- datet (0.0.4)
8
+ datet (0.0.9)
9
9
  diff-lcs (1.1.3)
10
10
  gdk_pixbuf2 (1.1.3)
11
11
  glib2 (>= 1.1.3)
@@ -18,15 +18,16 @@ GEM
18
18
  atk (>= 1.1.3)
19
19
  gdk_pixbuf2 (>= 1.1.3)
20
20
  pango (>= 1.1.3)
21
- http2 (0.0.0)
22
- knjrbfw
21
+ http2 (0.0.4)
23
22
  jeweler (1.8.4)
24
23
  bundler (~> 1.0)
25
24
  git (>= 1.2.5)
26
25
  rake
27
26
  rdoc
28
27
  json (1.7.3)
29
- knjrbfw (0.0.55)
28
+ knjrbfw (0.0.65)
29
+ datet
30
+ http2
30
31
  tsafe
31
32
  wref
32
33
  locale (2.0.5)
@@ -35,7 +36,6 @@ GEM
35
36
  glib2 (>= 1.1.3)
36
37
  pkg-config (1.1.3)
37
38
  rake (0.9.2.2)
38
- rcov (0.9.11)
39
39
  rdoc (3.12)
40
40
  json (~> 1.4)
41
41
  rmagick (2.13.1)
@@ -63,7 +63,6 @@ DEPENDENCIES
63
63
  jeweler (~> 1.8.3)
64
64
  json
65
65
  knjrbfw
66
- rcov
67
66
  rdoc (~> 3.12)
68
67
  rmagick
69
68
  rspec (~> 2.8.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.23
1
+ 0.0.24
data/gui/win_main.rb CHANGED
@@ -4,7 +4,7 @@ class Openall_time_applet::Gui::Win_main
4
4
  def initialize(args)
5
5
  @args = args
6
6
 
7
- @gui = Gtk::Builder.new.add("../glade/win_main.glade")
7
+ @gui = Gtk::Builder.new.add("#{File.dirname(__FILE__)}/../glade/win_main.glade")
8
8
  @gui.translate
9
9
  @gui.connect_signals{|h| method(h)}
10
10
 
@@ -591,7 +591,11 @@ class Openall_time_applet::Gui::Win_main
591
591
  end
592
592
 
593
593
  return nil if Knj::Gtk2.msgbox(_("Do you want to remove this timelog?"), "yesno") != "yes"
594
- @args[:oata].ob.delete(tlog)
594
+ begin
595
+ @args[:oata].ob.delete(tlog)
596
+ rescue => e
597
+ Knj::Gtk2.msgbox(sprintf(_("Could not delete the timelog: %s"), e.message))
598
+ end
595
599
  end
596
600
 
597
601
  def on_btnPlus_clicked
@@ -314,11 +314,6 @@ class Openall_time_applet
314
314
  end
315
315
  end
316
316
 
317
- #Shows the sync overview, which must be seen before the actual sync.
318
- def show_prepare_sync
319
- Openall_time_applet::Gui::Win_sync_overview.new(:oata => self)
320
- end
321
-
322
317
  #Refreshes task-cache, create missing worktime from timelogs and push tracked time to timelogs. Shows a status-window while doing so.
323
318
  def sync_real
324
319
  sw = Knj::Gtk2::StatusWindow.new
data/models/timelog.rb CHANGED
@@ -107,7 +107,7 @@ class Openall_time_applet::Models::Timelog < Knj::Datarow
107
107
  def descr_short
108
108
  descr = self[:descr].to_s.gsub("\n", " ").gsub(/\s{2,}/, " ")
109
109
  descr = Knj::Strings.shorten(descr, 20)
110
- descr = "[#{_("no description")}]" if descr.to_s.strip.length <= 0
110
+ #descr = "[#{_("no description")}]" if descr.to_s.strip.length <= 0
111
111
  return descr
112
112
  end
113
113
 
@@ -115,7 +115,7 @@ class Openall_time_applet::Models::Timelog < Knj::Datarow
115
115
  def transport_descr_short
116
116
  descr = self[:transportdescription].to_s.gsub("\n", " ").gsub(/\s{2,}/, " ")
117
117
  descr = Knj::Strings.shorten(descr, 20)
118
- descr = "[#{_("no description")}]" if descr.to_s.strip.length <= 0
118
+ #descr = "[#{_("no description")}]" if descr.to_s.strip.length <= 0
119
119
  return descr
120
120
  end
121
121
 
data/models/worktime.rb CHANGED
@@ -15,6 +15,11 @@ class Openall_time_applet::Models::Worktime < Knj::Datarow
15
15
  found << wt_d["uid"]
16
16
  task = self.ob.get_by(:Task, {"openall_uid" => wt_d["task_uid"]})
17
17
 
18
+ if !task
19
+ $stderr.puts sprintf(_("Task with UID '%s' was not found."), wt_d["task_uid"]) + " - " + sprintf(_("Skipping worktime with UID %s"), wt_d["uid"])
20
+ next
21
+ end
22
+
18
23
  save_hash = {
19
24
  :openall_uid => wt_d["uid"],
20
25
  :task_id => task.id,
@@ -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.23"
8
+ s.version = "0.0.24"
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-07-16}
12
+ s.date = %q{2012-07-17}
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"]
@@ -78,7 +78,6 @@ Gem::Specification.new do |s|
78
78
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
79
79
  s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
80
80
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
81
- s.add_development_dependency(%q<rcov>, [">= 0"])
82
81
  else
83
82
  s.add_dependency(%q<knjrbfw>, [">= 0"])
84
83
  s.add_dependency(%q<gtk2>, [">= 0"])
@@ -92,7 +91,6 @@ Gem::Specification.new do |s|
92
91
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
93
92
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
94
93
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
95
- s.add_dependency(%q<rcov>, [">= 0"])
96
94
  end
97
95
  else
98
96
  s.add_dependency(%q<knjrbfw>, [">= 0"])
@@ -107,7 +105,6 @@ Gem::Specification.new do |s|
107
105
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
108
106
  s.add_dependency(%q<bundler>, [">= 1.0.0"])
109
107
  s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
110
- s.add_dependency(%q<rcov>, [">= 0"])
111
108
  end
112
109
  end
113
110
 
@@ -1,13 +1,17 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+ require "timeout"
2
3
 
3
4
  describe "OpenallTimeApplet" do
4
5
  it "should be able to start" do
5
6
  $tmp_path = "/tmp/openall_spec.sqlite3"
7
+ File.unlink($tmp_path) if File.exists?($tmp_path)
6
8
  Openall_time_applet::CONFIG[:db_path] = $tmp_path
7
9
  $oata = Openall_time_applet.new
8
10
  end
9
11
 
10
12
  it "should be able to clone timelogs" do
13
+ debug = false
14
+
11
15
  date = Datet.new
12
16
  date.days - 1
13
17
 
@@ -33,17 +37,69 @@ describe "OpenallTimeApplet" do
33
37
  timelogs = $oata.ob.list(:Timelog, "orderby" => "timestamp").to_a
34
38
  raise "Expected amount of timelogs to be 2 but it wasnt: #{timelogs.length}" if timelogs.length != 2
35
39
 
40
+ #Try to delete a timelog that has a sub-timelog with logged time. It should show an error message-box.
41
+ $oata.show_main
42
+ main = Knj::Gtk2::Window.get("main")
43
+ main.gui["expOverview"].expanded = true
44
+ main.gui["tvTimelogs"].selection.select_iter(main.gui["tvTimelogs"].model.iter_first)
45
+
46
+ #Click the minus.
47
+ t = Thread.new do
48
+ main.gui["btnMinus"].clicked
49
+ end
50
+
51
+ #Answer 'yes' to delete timelog.
52
+ print "Passing until msgbox is shown.\n" if debug
53
+ Thread.pass while !Knj::Gtk2::Msgbox.shown?
54
+ raise "Unexpected label: '#{Knj::Gtk2::Msgbox.cur_label}'." if Knj::Gtk2::Msgbox.cur_label.to_s != _("Do you want to remove this timelog?")
55
+ Knj::Gtk2::Msgbox.cur_respond(Gtk::Dialog::RESPONSE_YES)
56
+
57
+ #Wait for the 'could not delete timelog' to be shown.
58
+ Thread.pass while !Knj::Gtk2::Msgbox.shown?
59
+
60
+ #Could-not-delete-timelog was shown - press ok to that.
61
+ raise "Unexpected msgbox-label: #{Knj::Gtk2::Msgbox.cur_label}." if Knj::Gtk2::Msgbox.cur_label.index("Could not delete the timelog") == nil
62
+
63
+ Knj::Gtk2::Msgbox.cur_respond(Gtk::Dialog::RESPONSE_OK)
64
+ raise "Didnt expect the timelog to be deleted." if timelog.deleted?
65
+
66
+ #Reset the sub-timelogs time and try to delete again. This time it should actually be deleted.
36
67
  #Or else it wont be possible to delete main timelog.
37
68
  timelog.child_timelogs do |child_timelog|
38
69
  child_timelog[:time] = 0
39
70
  end
40
- end
41
-
42
- it "should automatically delete sub-timelogs" do
43
- main = $oata.ob.get_by(:Timelog, "parent_timelog_id" => 0)
44
- $oata.ob.delete(main)
45
- timelogs = $oata.ob.list(:Timelog, "orderby" => "timestamp").to_a
46
- raise "Expected amount of timelogs to be 0 but it wasnt: #{timelogs.length}" if timelogs.length != 0
71
+
72
+ #Mark timelog.
73
+ main.gui["tvTimelogs"].selection.select_iter(main.gui["tvTimelogs"].model.iter_first)
74
+
75
+ #Click the minus.
76
+ t = Thread.new do
77
+ main.gui["btnMinus"].clicked
78
+ end
79
+
80
+ #Answer 'yes' to delete timelog.
81
+ print "Passing until msgbox is shown.\n" if debug
82
+ Thread.pass while !Knj::Gtk2::Msgbox.shown?
83
+ raise "Unexpected label: '#{Knj::Gtk2::Msgbox.cur_label}'." if Knj::Gtk2::Msgbox.cur_label.to_s != _("Do you want to remove this timelog?")
84
+
85
+ print "Doing yes-response to last.\n" if debug
86
+ Knj::Gtk2::Msgbox.cur_respond(Gtk::Dialog::RESPONSE_YES)
87
+
88
+ #Wait for timelog to be deleted or another msgbox to be shown.
89
+ print "Passing until msgbox is shown or timelog deleted.\n" if debug
90
+ Timeout.timeout(2) do
91
+ Thread.pass while !Knj::Gtk2::Msgbox.shown? and !timelog.deleted?
92
+ end
93
+ sleep 0.1
94
+
95
+ print "Done with passing.\n" if debug
96
+
97
+ if Knj::Gtk2::Msgbox.shown?
98
+ raise "A new message box was shown: '#{Knj::Gtk2::Msgbox.cur_label}'."
99
+ Knj::Gtk2::Msgbox.cur_respond(Gtk::Dialog::RESPONSE_OK)
100
+ end
101
+
102
+ raise "Timelog was not deleted." if !timelog.deleted?
47
103
  end
48
104
 
49
105
  it "should remove the temp db" do
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.23
5
+ version: 0.0.24
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-07-16 00:00:00 +02:00
13
+ date: 2012-07-17 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -145,17 +145,6 @@ dependencies:
145
145
  type: :development
146
146
  prerelease: false
147
147
  version_requirements: *id012
148
- - !ruby/object:Gem::Dependency
149
- name: rcov
150
- requirement: &id013 !ruby/object:Gem::Requirement
151
- none: false
152
- requirements:
153
- - - ">="
154
- - !ruby/object:Gem::Version
155
- version: "0"
156
- type: :development
157
- prerelease: false
158
- version_requirements: *id013
159
148
  description: Off-line time-tracking for OpenAll with syncing when online.
160
149
  email: k@spernj.org
161
150
  executables:
@@ -218,7 +207,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
207
  requirements:
219
208
  - - ">="
220
209
  - !ruby/object:Gem::Version
221
- hash: 1310176801953661997
210
+ hash: 749465964052469739
222
211
  segments:
223
212
  - 0
224
213
  version: "0"