[rkward-cvs] SF.net SVN: rkward:[3438] trunk/rkward/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Wed Feb 16 11:36:26 UTC 2011
Revision: 3438
http://rkward.svn.sourceforge.net/rkward/?rev=3438&view=rev
Author: tfry
Date: 2011-02-16 11:36:26 +0000 (Wed, 16 Feb 2011)
Log Message:
-----------
Consolidate the main window toolbar actions into action menus. This also allows us to place many more typical 'first timer' actions into the toolbar.
Modified Paths:
--------------
trunk/rkward/rkward/rkward.cpp
trunk/rkward/rkward/rkwardui.rc
Modified: trunk/rkward/rkward/rkward.cpp
===================================================================
--- trunk/rkward/rkward/rkward.cpp 2011-02-16 09:25:35 UTC (rev 3437)
+++ trunk/rkward/rkward/rkward.cpp 2011-02-16 11:36:26 UTC (rev 3438)
@@ -47,6 +47,7 @@
#include <krecentfilesaction.h>
#include <khbox.h>
#include <ktoolbar.h>
+#include <kactionmenu.h>
// application specific includes
#include "rkward.h"
@@ -307,7 +308,7 @@
void RKWardMainWindow::initActions()
{
RK_TRACE (APP);
- KAction *action;
+ KAction *action, *import_data_action = 0;
// TODO: is there a way to insert actions between standard actions without having to give all standard actions custom ids?
new_data_frame = actionCollection ()->addAction ("new_data_frame", this, SLOT (slotNewDataFrame ()));
@@ -320,25 +321,27 @@
new_command_editor->setIcon (RKStandardIcons::getIcon (RKStandardIcons::WindowCommandEditor));
fileOpen = actionCollection ()->addAction (KStandardAction::Open, "file_openy", this, SLOT(slotOpenCommandEditor()));
- fileOpen->setText (i18n ("Open R Script File"));
+ fileOpen->setText (i18n ("Open R Script File..."));
fileOpenRecent = static_cast<KRecentFilesAction*> (actionCollection ()->addAction (KStandardAction::OpenRecent, "file_open_recenty", this, SLOT(slotOpenCommandEditor (const KUrl&))));
+ fileOpenRecent->setText (i18n ("Open Recent R Script File"));
#ifdef Q_WS_WIN
// TODO: find the cause and fix it! http://sourceforge.net/tracker/?func=detail&aid=2848341&group_id=50231&atid=459007
# warning TODO: import data dialog is disabled on windows due to bug in kdelibs
#else
- action = actionCollection ()->addAction ("import_data", this, SLOT (importData()));
+ import_data_action = action = actionCollection ()->addAction ("import_data", this, SLOT (importData()));
action->setText (i18n ("Import Data"));
action->setStatusTip (i18n ("Import data from a variety of file formats"));
#endif
fileOpenWorkspace = actionCollection ()->addAction (KStandardAction::Open, "file_openx", this, SLOT(slotFileOpenWorkspace()));
- fileOpenWorkspace->setText (i18n ("Open Workspace"));
+ fileOpenWorkspace->setText (i18n ("Open Workspace..."));
fileOpenWorkspace->setShortcut (Qt::ControlModifier + Qt::ShiftModifier + Qt::Key_O);
fileOpenWorkspace->setStatusTip (i18n ("Opens an existing document"));
fileOpenRecentWorkspace = static_cast<KRecentFilesAction*> (actionCollection ()->addAction (KStandardAction::OpenRecent, "file_open_recentx", this, SLOT(slotFileOpenRecentWorkspace(const KUrl&))));
+ fileOpenRecentWorkspace->setText (i18n ("Open Recent Workspace"));
fileOpenRecentWorkspace->setStatusTip (i18n ("Opens a recently used file"));
fileSaveWorkspace = actionCollection ()->addAction (KStandardAction::Save, "file_savex", this, SLOT(slotFileSaveWorkspace()));
@@ -390,6 +393,28 @@
run_menu_dummy = actionCollection ()->addAction ("run_menu_dummy", this);
run_menu_dummy->setText (edit_menu_dummy->text ());
run_menu_dummy->setEnabled (false);
+
+ // collections for the toolbar:
+ KActionMenu* open_any_action = new KActionMenu (KIcon ("document-open-folder"), i18n ("Open..."), this);
+ open_any_action->setDelayed (false);
+ actionCollection ()->addAction ("open_any", open_any_action);
+
+ open_any_action->addAction (fileOpenWorkspace);
+ open_any_action->addAction (fileOpenRecentWorkspace);
+ open_any_action->addSeparator ();
+ open_any_action->addAction (fileOpen);
+ open_any_action->addAction (fileOpenRecent);
+ if (import_data_action) { // not on Windows, currently.
+ open_any_action->addSeparator ();
+ open_any_action->addAction (import_data_action);
+ }
+
+ KActionMenu* new_any_action = new KActionMenu (KIcon ("document-new"), i18n ("Create..."), this);
+ new_any_action->setDelayed (false);
+ actionCollection ()->addAction ("new_any", new_any_action);
+
+ new_any_action->addAction (new_data_frame);
+ new_any_action->addAction (new_command_editor);
}
/*
Modified: trunk/rkward/rkward/rkwardui.rc
===================================================================
--- trunk/rkward/rkward/rkwardui.rc 2011-02-16 09:25:35 UTC (rev 3437)
+++ trunk/rkward/rkward/rkwardui.rc 2011-02-16 11:36:26 UTC (rev 3438)
@@ -1,5 +1,5 @@
<!DOCTYPE kpartgui>
-<kpartgui name="rkward_main" version="54">
+<kpartgui name="rkward_main" version="550">
<MenuBar>
<!-- The Main Window ui.rc is the only one, where merging happens, reliably. That is, why we need to define
a lot of merge points, here, which can then be used be mdi windows and their children.
@@ -89,9 +89,8 @@
</Menu>
</MenuBar>
<ToolBar fullWidth="true" name="mainToolBar">
- <Action name="new_data_frame"/>
- <Action name="new_command_editor"/>
- <Action name="file_openy"/>
+ <Action name="open_any"/>
+ <Action name="new_any"/>
</ToolBar>
<ToolBar fullWidth="true" name="mdiToolBar">
<DefineGroup name="pretoolbar_actions_merge" append="pretoolbar_actions_merge"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list