[rkward] /: Make the enable / disable editing action more visible by adding it to the toolbar
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Jun 2 11:12:38 UTC 2015
Git commit f68d4294e51a68a2e034be8a5b3823c6fba1ef7d by Thomas Friedrichsmeier.
Committed on 02/06/2015 at 11:11.
Pushed by tfry into branch 'master'.
Make the enable / disable editing action more visible by adding it to the toolbar
M +1 -0 ChangeLog
M +4 -1 rkward/dataeditor/rkeditordataframepart.rc
M +21 -4 rkward/dataeditor/twintable.cpp
M +3 -1 rkward/dataeditor/twintable.h
M +4 -1 rkward/misc/rkstandardicons.cpp
M +4 -1 rkward/misc/rkstandardicons.h
http://commits.kde.org/rkward/f68d4294e51a68a2e034be8a5b3823c6fba1ef7d
diff --git a/ChangeLog b/ChangeLog
index d6aaa14..9902209 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+- Make the option to disable / enable editing more visible (in the data editor's toolbar)
- Do not invoke symbol name completion while in the middle (not end) of a word
- Add context menu to HTML viewer window, including the ability to open links in a new window
- Remove dependency on KHMTLPart
diff --git a/rkward/dataeditor/rkeditordataframepart.rc b/rkward/dataeditor/rkeditordataframepart.rc
index 9713928..d9e7f4b 100644
--- a/rkward/dataeditor/rkeditordataframepart.rc
+++ b/rkward/dataeditor/rkeditordataframepart.rc
@@ -1,5 +1,5 @@
<!DOCTYPE kpartgui>
-<kpartgui name="rkeditordataframepart" version="54">
+<kpartgui name="rkeditordataframepart" version="64">
<MenuBar>
<Menu name="edit"><text>&Edit</text>
<Action name="cut"/>
@@ -44,5 +44,8 @@
<Separator/>
<Action name="paste_to_selection"/>
<Action name="paste_to_table"/>
+ <Separator/>
+ <Action name="lock_editing"/>
+ <Action name="unlock_editing"/>
</ToolBar>
</kpartgui>
diff --git a/rkward/dataeditor/twintable.cpp b/rkward/dataeditor/twintable.cpp
index c6cd2b2..6232d7a 100644
--- a/rkward/dataeditor/twintable.cpp
+++ b/rkward/dataeditor/twintable.cpp
@@ -2,7 +2,7 @@
twintable.cpp - description
-------------------
begin : Tue Oct 29 2002
- copyright : (C) 2002, 2006, 2007, 2010 by Thomas Friedrichsmeier
+ copyright : (C) 2002, 2006, 2007, 2010, 2015 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -22,6 +22,7 @@
#include <kactioncollection.h>
#include <kxmlguifactory.h>
#include <kmessagebox.h>
+#include <ktoggleaction.h>
#include <qvariant.h>
#include <qsplitter.h>
@@ -130,12 +131,27 @@ void TwinTable::initActions () {
action_delete_rows->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionDeleteRow));
// global actions
- action_enable_editing = actionCollection ()->addAction ("enable_editing", this, SLOT (enableEditing(bool)));
- action_enable_editing->setText ("Enable editing");
- action_enable_editing->setCheckable (true);
action_show_rownames = actionCollection ()->addAction ("show_rownames", this, SLOT (showRownames(bool)));
action_show_rownames->setText ("Show / Edit row names");
action_show_rownames->setCheckable (true);
+ action_enable_editing = actionCollection ()->addAction ("enable_editing", this, SLOT (enableEditing(bool)));
+ action_enable_editing->setText ("Enable editing");
+ action_enable_editing->setCheckable (true);
+ // these actually do the same thing, but are designed to work well in the toolbar
+ QActionGroup *lockactions = new QActionGroup (this);
+ lockactions->setExclusive (true);
+ action_tb_lock_editing = new KToggleAction (i18nc ("verb: switch to read-only state. Make this short.", "Lock"), this);
+ action_tb_lock_editing->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionLock));
+ action_tb_lock_editing->setActionGroup (lockactions);
+ action_tb_lock_editing->setStatusTip (i18n ("Disable editing (to prevent accidental modification of data)"));
+ actionCollection ()->addAction ("lock_editing", action_tb_lock_editing);
+ action_tb_unlock_editing = new KToggleAction (i18nc ("verb: switch to read-write state. Make this short.", "Unlock"), this);
+ action_tb_unlock_editing->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionUnlock));
+ action_tb_unlock_editing->setActionGroup (lockactions);
+ action_tb_unlock_editing->setStatusTip (i18n ("Enable editing"));
+ actionCollection ()->addAction ("unlock_editing", action_tb_unlock_editing);
+ connect (action_tb_unlock_editing, SIGNAL (toggled(bool)), this, SLOT (enableEditing(bool)));
+ // NOTE: No need to connect lock_editing, too, as they are radio-exclusive
// add all edit-actions to a group, so they can be enabled/disabled easily
edit_actions = new QActionGroup (this);
@@ -469,6 +485,7 @@ void TwinTable::enableEditing (bool on) {
edit_actions->setEnabled (rw);
action_enable_editing->setChecked (rw);
+ action_tb_unlock_editing->setChecked (rw);
if (main_object) objectMetaChanged (main_object); // update_caption;
}
diff --git a/rkward/dataeditor/twintable.h b/rkward/dataeditor/twintable.h
index 7ecc94f..89526b4 100644
--- a/rkward/dataeditor/twintable.h
+++ b/rkward/dataeditor/twintable.h
@@ -2,7 +2,7 @@
twintable.h - description
-------------------
begin : Tue Oct 29 2002
- copyright : (C) 2002, 2006, 2007, 2010 by Thomas Friedrichsmeier
+ copyright : (C) 2002, 2006, 2007, 2010, 2015 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -98,6 +98,8 @@ protected:
KAction* action_delete_row;
KAction* action_delete_rows;
KAction* action_enable_editing;
+ KAction* action_tb_lock_editing;
+ KAction* action_tb_unlock_editing;
KAction* action_show_rownames;
KAction* editCut;
KAction* editCopy;
diff --git a/rkward/misc/rkstandardicons.cpp b/rkward/misc/rkstandardicons.cpp
index 8fce6f3..8504eca 100644
--- a/rkward/misc/rkstandardicons.cpp
+++ b/rkward/misc/rkstandardicons.cpp
@@ -2,7 +2,7 @@
rkstandardicons - description
-------------------
begin : Wed Oct 24 2007
- copyright : (C) 2007, 2009, 2010, 2011 by Thomas Friedrichsmeier
+ copyright : (C) 2007, 2009, 2010, 2011, 2015 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -76,6 +76,9 @@ void RKStandardIcons::initIcons () {
icons[ActionDetachWindow] = KIcon ("view-fullscreen");
icons[ActionAttachWindow] = KIcon ("view-restore");
+ icons[ActionLock] = KIcon ("object-locked");
+ icons[ActionUnlock] = KIcon ("object-unlocked");
+
// objects
icons[ObjectList] = QIcon (rkward_icon_base + "list.png");
icons[ObjectFunction] = QIcon (rkward_icon_base + "function.png");
diff --git a/rkward/misc/rkstandardicons.h b/rkward/misc/rkstandardicons.h
index c90669b..5bbad0e 100644
--- a/rkward/misc/rkstandardicons.h
+++ b/rkward/misc/rkstandardicons.h
@@ -2,7 +2,7 @@
rkstandardicons - description
-------------------
begin : Wed Oct 24 2007
- copyright : (C) 2007, 2009, 2010, 2011 by Thomas Friedrichsmeier
+ copyright : (C) 2007, 2009, 2010, 2011, 2015 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -76,6 +76,9 @@ public:
ActionDetachWindow,
ActionAttachWindow,
+ ActionLock,
+ ActionUnlock,
+
ObjectList,
ObjectFunction,
ObjectEnvironment,
More information about the rkward-tracker
mailing list