ruber 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/CHANGES +25 -0
  2. data/bin/ruber +0 -0
  3. data/data/share/apps/ruber/ruberui.rc +15 -1
  4. data/data/share/icons/{ruber.png → ruber-old.pgn} +0 -0
  5. data/lib/ruber/application/application.rb +216 -73
  6. data/lib/ruber/application/plugin.yaml +2 -2
  7. data/lib/ruber/document_project.rb +25 -5
  8. data/lib/ruber/documents/document_list.rb +11 -15
  9. data/lib/ruber/editor/document.rb +106 -50
  10. data/lib/ruber/editor/editor_view.rb +4 -2
  11. data/lib/ruber/external_program_plugin.rb +8 -0
  12. data/lib/ruber/kde_config_option_backend.rb +12 -4
  13. data/lib/ruber/kde_sugar.rb +35 -1
  14. data/lib/ruber/main_window/choose_plugins_dlg.rb +10 -10
  15. data/lib/ruber/main_window/hint_solver.rb +263 -0
  16. data/lib/ruber/main_window/main_window.rb +462 -206
  17. data/lib/ruber/main_window/main_window_actions.rb +228 -62
  18. data/lib/ruber/main_window/main_window_internal.rb +169 -115
  19. data/lib/ruber/main_window/plugin.yaml +13 -3
  20. data/lib/ruber/main_window/save_modified_files_dlg.rb +1 -1
  21. data/lib/ruber/main_window/ui/choose_plugins_widget.rb +1 -1
  22. data/lib/ruber/main_window/ui/main_window_settings_widget.rb +1 -1
  23. data/lib/ruber/main_window/ui/new_project_widget.rb +1 -1
  24. data/lib/ruber/main_window/ui/open_file_in_project_dlg.rb +1 -1
  25. data/lib/ruber/main_window/ui/output_color_widget.rb +1 -1
  26. data/lib/ruber/main_window/ui/workspace_settings_widget.rb +51 -0
  27. data/lib/ruber/main_window/ui/workspace_settings_widget.ui +28 -0
  28. data/lib/ruber/main_window/view_manager.rb +418 -0
  29. data/lib/ruber/main_window/workspace.png +0 -0
  30. data/lib/ruber/output_widget.rb +43 -37
  31. data/lib/ruber/pane.rb +621 -0
  32. data/lib/ruber/plugin_specification_reader.rb +8 -1
  33. data/lib/ruber/projects/project_files_list.rb +6 -0
  34. data/lib/ruber/projects/ui/project_files_rule_chooser_widget.rb +1 -1
  35. data/lib/ruber/projects/ui/project_files_widget.rb +1 -1
  36. data/lib/ruber/qt_sugar.rb +94 -4
  37. data/lib/ruber/utils.rb +16 -7
  38. data/lib/ruber/version.rb +2 -2
  39. data/plugins/autosave/autosave.rb +62 -1
  40. data/plugins/autosave/plugin.yaml +1 -0
  41. data/plugins/autosave/ui/autosave_config_widget.rb +37 -14
  42. data/plugins/autosave/ui/autosave_config_widget.ui +62 -12
  43. data/plugins/find_in_files/find_in_files_widgets.rb +1 -3
  44. data/plugins/find_in_files/ui/config_widget.rb +1 -1
  45. data/plugins/find_in_files/ui/find_in_files_widget.rb +1 -1
  46. data/plugins/rake/plugin.yaml +1 -1
  47. data/plugins/rake/ui/add_quick_task_widget.rb +1 -1
  48. data/plugins/rake/ui/choose_task_widget.rb +1 -1
  49. data/plugins/rake/ui/config_widget.rb +1 -1
  50. data/plugins/rake/ui/project_widget.rb +1 -1
  51. data/plugins/rspec/rspec.rb +14 -22
  52. data/plugins/rspec/ruber_rspec_formatter.rb +4 -1
  53. data/plugins/rspec/ui/rspec_project_widget.rb +1 -1
  54. data/plugins/ruby_development/plugin.yaml +7 -2
  55. data/plugins/ruby_development/ruby_development.rb +134 -13
  56. data/plugins/ruby_development/ui/config_widget.rb +66 -0
  57. data/plugins/ruby_development/ui/config_widget.ui +58 -0
  58. data/plugins/ruby_development/ui/project_widget.rb +1 -1
  59. data/plugins/ruby_runner/plugin.yaml +2 -2
  60. data/plugins/ruby_runner/ruby_runner.rb +15 -3
  61. data/plugins/ruby_runner/ui/config_widget.rb +1 -1
  62. data/plugins/ruby_runner/ui/project_widget.rb +1 -1
  63. data/plugins/ruby_runner/ui/ruby_runnner_plugin_option_widget.rb +1 -1
  64. data/plugins/state/plugin.yaml +6 -2
  65. data/plugins/state/state.rb +305 -81
  66. data/plugins/state/ui/config_widget.rb +1 -1
  67. data/spec/common.rb +11 -3
  68. data/spec/document_list_spec.rb +8 -8
  69. data/spec/document_project_spec.rb +98 -25
  70. data/spec/document_spec.rb +178 -152
  71. data/spec/editor_view_spec.rb +26 -5
  72. data/spec/framework.rb +5 -0
  73. data/spec/hint_solver_spec.rb +450 -0
  74. data/spec/kde_sugar_spec.rb +73 -6
  75. data/spec/output_widget_spec.rb +172 -156
  76. data/spec/pane_spec.rb +1165 -0
  77. data/spec/plugin_specification_reader_spec.rb +37 -1
  78. data/spec/project_files_list_spec.rb +30 -20
  79. data/spec/qt_sugar_spec.rb +269 -0
  80. data/spec/state_spec.rb +566 -353
  81. data/spec/utils_spec.rb +1 -1
  82. data/spec/view_manager_spec.rb +71 -0
  83. metadata +16 -4
data/CHANGES CHANGED
@@ -1,5 +1,30 @@
1
1
  h1. Changes
2
2
 
3
+ h2. Ruber 0.0.7
4
+
5
+ * Ability to split views in tabs
6
+ * Ability to have more than one view for each document
7
+ * Made the terminal program used to run ruby programs configurable
8
+ * Added (optional) close buttons on tabs
9
+
10
+ h2. Ruber 0.0.6
11
+
12
+ h3. Features
13
+
14
+ * Allow Ruber to work with remote files
15
+
16
+ h3. Bug fixes
17
+
18
+ * Fixed a bug causing a crash from the Choose Plugins dialog in case of an error
19
+ * Fixed a bug causing Ruber to look for plugins in the directory installation of
20
+ a previous version if the plugin directories settings had been changed (even if
21
+ the default directory hadn't been changed)
22
+ * Made the rake plugin depend on the autosave plugin
23
+
24
+ h2. Ruber 0.0.5
25
+
26
+ * Fixed a bug causing an error when opening files
27
+
3
28
  h2. Ruber 0.0.4
4
29
 
5
30
  * Fixed a bug causing Ruber to fail starting up if the @$KDEHOME/share/apps/ruber/plugins@
data/bin/ruber CHANGED
File without changes
@@ -1,5 +1,5 @@
1
1
  <!DOCTYPE kpartgui SYSTEM 'kpartgui.dtd'>
2
- <kpartgui version="10" name="ruber" >
2
+ <kpartgui version="13" name="ruber" >
3
3
  <MenuBar>
4
4
  <Menu name="file" >
5
5
  <text>&amp;File</text>
@@ -18,6 +18,7 @@
18
18
  <DefineGroup name="export_merge" />
19
19
  <Separator/>
20
20
  <Action name="file_close" />
21
+ <Action name="file-close_tab"/>
21
22
  <Action name="file-close_all" />
22
23
  <Action name="file-close_other" />
23
24
  <Separator/>
@@ -76,6 +77,19 @@
76
77
  <DefineGroup name="tools_operations" />
77
78
  <Action name="scripts" />
78
79
  </Menu>
80
+ <Menu name="window">
81
+ <text>&amp;Window</text>
82
+ <Action name="window-split_horizontally"/>
83
+ <Action name="window-split_vertically"/>
84
+ <Separator/>
85
+ <Action name="window-switch_to_new_document"/>
86
+ <Action name="window-switch_to_file"/>
87
+ <Menu name="window-switch_to_open_document">
88
+ <text>&amp;Switch to Document</text>
89
+ <ActionList name="window-switch_to_open_document_list"/>
90
+ </Menu>
91
+ <Action name="window-switch_to_recent_file"/>
92
+ </Menu>
79
93
  <Menu name="settings" >
80
94
  <text>&amp;Settings</text>
81
95
  <Action name="options_configure" />
@@ -27,35 +27,40 @@ require 'facets/kernel/__dir__'
27
27
  require 'fileutils'
28
28
 
29
29
  require 'ruber/plugin_like'
30
+ require 'ruber/project'
30
31
  require 'ruber/exception_widgets'
31
32
 
32
33
  module Ruber
33
34
 
34
35
  =begin rdoc
35
- Returns the component providing the feature _feature_
36
-
37
- <b>Note:</b> this method can only be used _after_ the application has been
38
- created, otherwise +NoMethodError+ will be raised.
36
+ The component providing a feature
37
+
38
+ @param [Symbol] feature the feature the component should provide
39
+ @return [PluginLike,nil] the component providing the given feature or *nil* if
40
+ no components provide it
41
+ @raise [NoMethodError] if called before the application is created
39
42
  =end
40
43
  def self.[](feature)
41
44
  # This instance variable is initialized by the application's constructor
42
45
  @components[feature]
43
46
  end
44
47
 
45
-
46
48
  class Application < KDE::Application
47
49
 
48
50
  =begin rdoc
49
- The default path where to look for plugins. It only includes the _plugins_ directory
50
- in the Ruber installation path
51
+ The default paths where to look for plugins.
52
+
53
+ It includes @$KDEHOME/share/apps/ruber/plugins@ and the @plugins@ subdirectory
54
+ of the ruber installation directory
51
55
  =end
52
56
  DEFAULT_PLUGIN_PATHS = [
53
57
  File.join(KDE::Global.dirs.find_dirs( 'data', '')[0], File.join('ruber','plugins')),
54
- File.expand_path(File.join(RUBER_LIB_DIR, '..', '..', 'plugins'))
58
+ RUBER_PLUGIN_DIR
55
59
  ]
56
60
  =begin rdoc
57
- The default plugins to load. They are: ruby_development, find_in_files, syntax_checker,
58
- command and state
61
+ The default plugins to load
62
+
63
+ Currently, they are: ruby_development, find_in_files, syntax_checker, command and state
59
64
  =end
60
65
  DEFAULT_PLUGINS = %w[ruby_development find_in_files rake command syntax_checker state]
61
66
 
@@ -63,28 +68,47 @@ command and state
63
68
 
64
69
  slots 'load_settings()', :setup
65
70
 
66
- # A hash containing the command line options
71
+ =begin rdoc
72
+ @return [Hash] the command line options passed to ruber (after they've been processed)
73
+ =end
67
74
  attr_reader :cmd_line_options
68
75
 
69
76
  =begin rdoc
70
- The status of the application. It can be: +:starting+, +:running+ or +:quitting+
77
+ <<<<<<< HEAD
78
+ =======
79
+ The state Ruber is in
80
+
81
+ Ruber can be in three states:
82
+
83
+ - *starting*:= from the time it's launched to when {#setup} returns
84
+ - *running*:= from after {#setup} has returend to when the user chooses to quit
85
+ it (either with the @File/Quit@ menu entry or clicking on the button on the title
86
+ bar)
87
+ - *quitting*:= from when the user chooses to quit Ruber onwards
88
+
89
+ >>>>>>> master
90
+ @return [Symbol] the status of the application. It can be: @:starting@, @:running@
91
+ or @:quitting@
71
92
  =end
72
93
  attr_reader :status
73
94
 
74
95
  =begin rdoc
75
- Creates a new application object.
76
-
77
- Besides creating the application, this method also loads the core components
78
- and sets up a timer which will cause the application's _setup_ method to be
79
- called as soon as <tt>Application#exec</tt> is called.
96
+ Creates a new instance of {Application}
97
+
98
+ It loads the core components and sets up a single shot timer which calls {#setup}
99
+ and is fired as soon as the event loop starts.
100
+
101
+ @param [ComponentManager] manager the component manager
102
+ @param [PluginSpecification] psf the plugin specification object describing the
103
+ application component
80
104
  =end
81
- def initialize manager, pdf
105
+ def initialize manager, psf
82
106
  super()
83
107
  @components = manager
84
108
  @components.parent = self
85
109
  Ruber.instance_variable_set :@components, @components
86
- initialize_plugin pdf
87
- KDE::Global.dirs.addPrefix File.expand_path(File.join( RUBER_DATA_DIR, '..', '..', 'data'))
110
+ initialize_plugin psf
111
+ KDE::Global.dirs.addPrefix File.expand_path(File.join( RUBER_DATA_DIR, '..', 'data'))
88
112
  icon_path = KDE::Global.dirs.find_resource('icon', 'ruber')
89
113
  self.window_icon = Qt::Icon.new icon_path
90
114
  KDE::Global.main_component.about_data.program_icon_name = icon_path
@@ -95,52 +119,109 @@ The status of the application. It can be: +:starting+, +:running+ or +:quitting+
95
119
  Qt::Timer.single_shot(0, self, SLOT(:setup))
96
120
  end
97
121
 
122
+ =begin rdoc
123
+ @return [Array<String>] a list of the directories where Ruber looks for plugins
124
+ =end
125
+ def plugin_directories
126
+ @plugin_dirs.dup
127
+ end
128
+ alias :plugin_dirs :plugin_directories
129
+
130
+ =begin rdoc
131
+ Sets the list of directories where Ruber looks for plugins
132
+
133
+ This also changes the setting in the global configuration object, but it *doesn't*
134
+ write the change to file. It's up to whoever called this method to do so.
135
+
136
+ @param [Array<String> dirs] the directories Ruber should search for plugins
137
+ =end
138
+ def plugin_directories= dirs
139
+ @plugin_directories = dirs
140
+ Ruber[:config][:general, :plugin_dirs] = @plugin_directories
141
+ end
142
+ alias :plugin_dirs= :plugin_directories=
143
+
144
+ =begin rdoc
145
+ Quits ruber
146
+
147
+ Sets the application status to @:quitting@ and calls {ComponentManager#shutdown}
148
+ @return [nil]
149
+ =end
98
150
  def quit_ruber
99
151
  @status = :quitting
100
152
  @components.shutdown
153
+ nil
101
154
  end
102
155
 
103
156
  =begin rdoc
104
- Returns *true* if the application is starting and *false* if it has already
105
- started otherwise. The application is considered to have started after the
106
- application's +setup+ method has been called and has returned. Before that,
107
- it is considered to be starting.
108
-
109
- This method is mostly useful for plugins which need to perform different actions
110
- depending on whether they're loaded at application startup (in which case
111
- <tt>starting?</tt> returns *true*) or later (when <tt>starting?</tt> returns
112
- *false*)
157
+ Whether the application is starting or has already started
158
+
159
+ You should seldom need this method. It's mostly useful for plugins which need to
160
+ erform different actions depending on whether they're loaded at application
161
+ startup (in which case it'll return *true*) or later (when it'll return *false*)
162
+
163
+ @return [Boolean] *true* if the application status is @starting@ and *false*
164
+ otherwise
165
+ @see #status
113
166
  =end
114
167
  def starting?
115
168
  @status == :starting
116
169
  end
117
170
 
171
+ =begin rdoc
172
+ Whether the application is running or not
173
+
174
+ @return [Boolean] *true* if the application status is @running@ and *false*
175
+ otherwise
176
+ @see #status
177
+ =end
118
178
  def running?
119
179
  @status == :running
120
180
  end
121
-
181
+
182
+ =begin rdoc
183
+ Whether the application is quitting or not
184
+
185
+ @return [Boolean] *true* if the application status is @quitting@ and *false*
186
+ otherwise
187
+ @see #status
188
+ =end
122
189
  def quitting?
123
190
  @status == :quitting
124
191
  end
125
192
 
126
193
  =begin rdoc
127
- It is a wrapper around ComponentManager#load_plugins which allows an easier handling
128
- of exceptions raised by the loaded plugins.
129
-
130
- If a block is given, it is passed to ComponentManager#load_plugins, to determine
131
- what to do if an exception is raised while loading a plugin. If no block is given
132
- and _silent_ is *false*, then a dialog displaying the error message is shown to
133
- the user, who has the following options: ignore the plugin which gave the error,
134
- skip all the remaining plugins, go on ignoring other errors or aborting. If no
135
- block is given and _silent_ is a true value, then all errors will be ignored.
136
-
137
- _plugins_ should be an array containing the names of the plugins to load
138
- (dependencies) will be computed automatically. _dirs_ is an array containing the
139
- directories where to look for plugins. If *nil*, the values stored in the
140
- "Plugin directories" entry in the configuration file will be used.
141
-
142
- <b>Note:</b> this method doesn't attempt to handle exceptions raised while computing
194
+ Loads plugins handling the exceptions they may raise in the meanwhile
195
+
196
+ It is a wrapper around {ComponentManager#load_plugins}.
197
+
198
+ If it's given a block, it simply calls {ComponentManager#load_plugins} passing
199
+ it the block.
200
+
201
+ If no block is given, the behaviour in case of an exception depends on the _silent_
202
+ argument:
203
+ * if *true*, then the error will be silently ignored and the component manager will
204
+ go on loading the remaining plugins. Errors caused by those will be ignored as
205
+ well
206
+ * if *false*, the user will be shown a {ComponentLoadingErrorDialog}. According
207
+ to what the user chooses in the dialog, the component manager will behave in
208
+ a different way, as described in {ComponentManager#load_plugins}
209
+
210
+ *Note:* this method doesn't attempt to handle exceptions raised while computing
143
211
  or sorting dependencies.
212
+ @param [Array<Symbol>] plugins the names of the plugins to load. It doesn't need
213
+ to include dependencies, as they're computed automatically
214
+ @param [Boolean] silent whether errors while loading plugins should be silently
215
+ ignored or not
216
+ @param [Array<String>,nil] dirs the directories where to look for plugins. If *nil*,
217
+ then the value returned by {#plugin_directories} will be used
218
+ @yield [pso, ex] block called when loading a plugin raises an exception
219
+ @yieldparam [PluginSpecification] pso the plugin specification object associated
220
+ with the plugin which raised the exception
221
+ @yieldparam [Exception] ex the exception raised while loading the plugin
222
+ @return [Boolen] *true* if the plugins were loaded successfully and *false* otherwise
223
+ @see ComponentManager#load_plugins
224
+ @see ComponentLoadingErrorDialog
144
225
  =end
145
226
  def safe_load_plugins plugins, silent = false, dirs = nil, &blk
146
227
  if blk.nil? and silent then blk = proc{|_pl, _e| :silent}
@@ -148,30 +229,53 @@ or sorting dependencies.
148
229
  blk = Proc.new{|pl, e| ComponentLoadingErrorDialog.new(pl.name, e, nil).exec}
149
230
  end
150
231
  @components.load_plugins plugins, dirs || @plugin_dirs, &blk
232
+
151
233
  end
152
234
 
153
235
  private
154
236
 
155
237
  =begin rdoc
156
- Applies the application's configuration settings. It also adds any plugin directory
157
- to the load path, unless it's already there.
238
+ Override of {PluginLike#load_settings}
239
+
240
+ It reads the list of plugin directories from the configuration object, replacing
241
+ all mentions of the installation paths for a different version of Ruber with the
242
+ installation path for the current version, and adds to the load path all missing
243
+ directories
244
+ @return [nil]
158
245
  =end
159
246
  def load_settings
160
247
  @plugin_dirs = Ruber[:config][:general].plugin_dirs
248
+ ruber_base_dir = File.dirname(RUBER_DIR)
249
+ @plugin_dirs.map! do |d|
250
+ if d =~ /#{File.join Regexp.quote(ruber_base_dir), 'ruber-\d+\.\d+\.\d+'}/
251
+ RUBER_PLUGIN_DIR
252
+ else d
253
+ end
254
+ end
161
255
  new_dirs = @plugin_dirs - $:
162
256
  new_dirs.each{|d| $:.unshift d}
257
+ nil
163
258
  end
164
259
 
165
260
  =begin rdoc
166
- Loads the plugins in the configuration file and opens the files and/or
167
- projects listed in the command line. At the end, marks the application
168
- as _running_.
261
+ Prepares the application for running
262
+
263
+ It loads the plugins chosen by the user according to the configuration file. If
264
+ an error occurs while finding plugin dependencies (either because of a missing
265
+ dependency or a circular dependency), the user is shown a dialog asking what to
266
+ do (quit ruber or load no plugin). If an exception is raised while loading a plugin,
267
+ it's handled according to the behaviour specified in {#safe_load_plugins} with no
268
+ block given.
269
+
270
+ It also takes care of the command line options, opening the files and projects
271
+ specified in it.
272
+
273
+ At the end, the main window is shown
274
+ @return [nil]
169
275
  =end
170
276
  def setup
171
277
  # Create $KDEHOME/share/apps/ruber/plugins if it's missing
172
- begin FileUtils.mkdir_p DEFAULT_PLUGIN_PATHS[0]
173
- rescue Errno::EEXIST
174
- end
278
+ FileUtils.mkdir_p DEFAULT_PLUGIN_PATHS[0]
175
279
  chosen_plugins = Ruber[:config][:general, :plugins].map(&:to_sym)
176
280
  needed_plugins = []
177
281
  deps_problem_msg = Proc.new do |e|
@@ -217,17 +321,28 @@ Do you want to start the application without them or to quit Ruber?
217
321
  end
218
322
  @status = :running
219
323
  Ruber[:main_window].show
324
+ nil
220
325
  end
221
326
 
222
327
 
223
328
  =begin rdoc
224
- Loads the core components. In order, they are:
225
- * the configuration manager
226
- * the document keeper
227
- * the main window
329
+ Loads the core components
228
330
 
229
- After creating the configuration manager, the <tt>register_with_config</tt>
230
- method is called
331
+ In loading order, the core components are:
332
+ * the configuration manager
333
+ * the document list
334
+ * the project list
335
+ * the main window
336
+
337
+ In case loading one of the core components raises an exception, the user is
338
+ warned with a dialog and ruber is closed.
339
+
340
+ After creating the configuration manager, {#register_with_config} is called.
341
+
342
+ If a previous session is being restored, {MainWindow#restore} is called, otherwise
343
+ an empty document is created (unless the user specified some files or project
344
+ on the command line)
345
+ @return [nil]
231
346
  =end
232
347
  def load_core_components
233
348
  begin
@@ -247,40 +362,68 @@ Do you want to start the application without them or to quit Ruber?
247
362
  else
248
363
  open_command_line_files
249
364
  if Ruber[:projects].projects.empty? and Ruber[:documents].documents.empty?
250
- Ruber[:main_window].display_doc Ruber[:documents].new_document
365
+ doc = Ruber[:documents].new_document
366
+ # This is the default document. Set the default_document attribute of
367
+ # the ruber_default_document extension to true
368
+ # TODO this extension is currently provided by the main window because
369
+ # the application component is actually loaded after the other. This
370
+ # is wrong. To avoid it, don't call load_core_components from initialize
371
+ # but have the ruber starting code (in bin/ruber) start it manually. Then
372
+ # move the extension to the application
373
+ doc.extension(:ruber_default_document).default_document = true
374
+ Ruber[:main_window].display_doc doc
251
375
  end
252
376
  end
253
377
  end
254
378
 
255
379
  =begin rdoc
256
- Registers the configuration options with the configuration manager, calls the
257
- <tt>load_settings</tt> method and connects to the configuration manager's
258
- <tt>settings_changed</tt> signal.
380
+ Registers the configuration options with the configuration manager
259
381
 
260
- This tasks are performed by the <tt>PluginLike#initialize_plugin</tt> method,
261
- but as the config manager didn't exist when that method was called, it is
262
- necessary to to them here
382
+ This means, calling {#load_settings} and connecting to the configuration manager's
383
+ {ConfigurationManager#settings_changed settings_changed}signal.
384
+
385
+ This tasks are usually performed by {PluginLike#initialize_plugin},
386
+ but as the config manager didn't exist when that method was called, it is
387
+ necessary to to them later
388
+ @return [nil]
263
389
  =end
264
390
  def register_with_config
265
391
  config = Ruber[:config]
266
392
  @plugin_description.config_options.each_value{|o| config.add_option o}
267
393
  load_settings
268
394
  connect config, SIGNAL(:settings_changed), self, SLOT(:load_settings)
395
+ nil
269
396
  end
270
397
 
271
398
  =begin rdoc
272
- Opens the files and/or project listed on the command line, or creates a single
273
- empty document if neither files nor projects have been specified.
399
+ Opens the files and/or project listed on the command line
400
+
401
+ If neither files nor projects have been specified on the command line,
402
+ a single empty document is created.
403
+ @return [nil]
274
404
  =end
275
405
  def open_command_line_files
276
- args = @cmd_line_options.files
406
+ urls = @cmd_line_options.urls
277
407
  win = Ruber[:main_window]
278
- projects, files = args.partition{|f| File.extname(f) == '.ruprj'}
279
- prj = win.safe_open_project projects.last unless projects.empty?
280
- files += @cmd_line_options.getOptionList('file')
408
+ projects, files = urls.partition{|u| File.extname(u.to_local_file || '') == '.ruprj'}
409
+ prj = win.safe_open_project projects.last.to_local_file unless projects.empty?
410
+ files += @cmd_line_options.getOptionList('file').map do |f|
411
+ url = KDE::Url.new f
412
+ url.path = File.expand_path(f) if url.protocol.empty?
413
+ url
414
+ end
281
415
  files.each do |f|
282
416
  win.display_document f
283
417
  end
418
+ nil
419
+ end
420
+
421
+ class DefaultDocumentExtension
422
+ include Extension
423
+ attr_accessor :default_document
424
+ def initialize doc
425
+ @default_document = false
426
+ end
284
427
  end
285
428
 
286
429
  end