diff --git a/apps/opencs/model/settings/usersettings.cpp b/apps/opencs/model/settings/usersettings.cpp
index 5b6e7ab8b7..d1dddf8ba5 100644
--- a/apps/opencs/model/settings/usersettings.cpp
+++ b/apps/opencs/model/settings/usersettings.cpp
@@ -234,6 +234,47 @@ void CSMSettings::UserSettings::buildSettingModelDefaults()
jumpToAdded->setDeclaredValues (jumpValues);
}
+ declareSection ("report-input", "Report Input");
+ {
+ QString none ("None");
+ QString edit ("Edit");
+ QString remove ("Remove");
+ QString editAndRemove ("Edit And Remove");
+
+ QStringList values;
+ values << none << edit << remove << editAndRemove;
+
+ QString toolTip = "
"
+ "- None
"
+ "- Edit: Open a table or dialogue suitable for addressing the listed report
"
+ "- Remove: Remove the report from the report table
"
+ "- Edit and Remove: Open a table or dialogue suitable for addressing the listed report, then remove the report from the report table
"
+ "
";
+
+ Setting *doubleClick = createSetting (Type_ComboBox, "double", "Double Click");
+ doubleClick->setDeclaredValues (values);
+ doubleClick->setDefaultValue (edit);
+ doubleClick->setToolTip ("Action on double click in report table:" + toolTip);
+
+ Setting *shiftDoubleClick = createSetting (Type_ComboBox, "double-s",
+ "Shift Double Click");
+ shiftDoubleClick->setDeclaredValues (values);
+ shiftDoubleClick->setDefaultValue (remove);
+ shiftDoubleClick->setToolTip ("Action on shift double click in report table:
" + toolTip);
+
+ Setting *ctrlDoubleClick = createSetting (Type_ComboBox, "double-c",
+ "Control Double Click");
+ ctrlDoubleClick->setDeclaredValues (values);
+ ctrlDoubleClick->setDefaultValue (editAndRemove);
+ ctrlDoubleClick->setToolTip ("Action on control double click in report table:
" + toolTip);
+
+ Setting *shiftCtrlDoubleClick = createSetting (Type_ComboBox, "double-sc",
+ "Shift Control Double Click");
+ shiftCtrlDoubleClick->setDeclaredValues (values);
+ shiftCtrlDoubleClick->setDefaultValue (none);
+ shiftCtrlDoubleClick->setToolTip ("Action on shift control double click in report table:
" + toolTip);
+ }
+
declareSection ("search", "Search & Replace");
{
Setting *before = createSetting (Type_SpinBox, "char-before",
diff --git a/apps/opencs/view/tools/reporttable.cpp b/apps/opencs/view/tools/reporttable.cpp
index c1c8a35dd3..e530e1159e 100644
--- a/apps/opencs/view/tools/reporttable.cpp
+++ b/apps/opencs/view/tools/reporttable.cpp
@@ -96,21 +96,35 @@ void CSVTools::ReportTable::mouseDoubleClickEvent (QMouseEvent *event)
selectionModel()->select (index,
QItemSelectionModel::Clear | QItemSelectionModel::Select | QItemSelectionModel::Rows);
- switch (modifiers)
+ std::map::iterator iter =
+ mDoubleClickActions.find (modifiers);
+
+ if (iter==mDoubleClickActions.end())
{
- case 0:
+ event->accept();
+ return;
+ }
+
+ switch (iter->second)
+ {
+ case Action_None:
+
+ event->accept();
+ break;
+
+ case Action_Edit:
event->accept();
showSelection();
break;
- case Qt::ShiftModifier:
+ case Action_Remove:
event->accept();
removeSelection();
break;
- case Qt::ControlModifier:
+ case Action_EditAndRemove:
event->accept();
showSelection();
@@ -155,7 +169,11 @@ CSVTools::ReportTable::ReportTable (CSMDoc::Document& document,
mReplaceAction = new QAction (tr ("Replace"), this);
connect (mReplaceAction, SIGNAL (triggered()), this, SIGNAL (replaceRequest()));
- addAction (mReplaceAction);
+ addAction (mReplaceAction);
+
+ mDoubleClickActions.insert (std::make_pair (Qt::NoModifier, Action_Edit));
+ mDoubleClickActions.insert (std::make_pair (Qt::ShiftModifier, Action_Remove));
+ mDoubleClickActions.insert (std::make_pair (Qt::ControlModifier, Action_EditAndRemove));
}
std::vector CSVTools::ReportTable::getDraggedRecords() const
@@ -176,6 +194,35 @@ std::vector CSVTools::ReportTable::getDraggedRecords() co
void CSVTools::ReportTable::updateUserSetting (const QString& name, const QStringList& list)
{
mIdTypeDelegate->updateUserSetting (name, list);
+
+ QString base ("report-input/double");
+ if (name.startsWith (base))
+ {
+ QString modifierString = name.mid (base.size());
+ Qt::KeyboardModifiers modifiers = 0;
+
+ if (modifierString=="-s")
+ modifiers = Qt::ShiftModifier;
+ else if (modifierString=="-c")
+ modifiers = Qt::ControlModifier;
+ else if (modifierString=="-sc")
+ modifiers = Qt::ShiftModifier | Qt::ControlModifier;
+
+ DoubleClickAction action = Action_None;
+
+ QString value = list.at (0);
+
+ if (value=="Edit")
+ action = Action_Edit;
+ else if (value=="Remove")
+ action = Action_Remove;
+ else if (value=="Edit And Remove")
+ action = Action_EditAndRemove;
+
+ mDoubleClickActions[modifiers] = action;
+
+ return;
+ }
}
std::vector CSVTools::ReportTable::getReplaceIndices (bool selection) const
diff --git a/apps/opencs/view/tools/reporttable.hpp b/apps/opencs/view/tools/reporttable.hpp
index c4d5b414ea..95ab07cbbf 100644
--- a/apps/opencs/view/tools/reporttable.hpp
+++ b/apps/opencs/view/tools/reporttable.hpp
@@ -1,6 +1,8 @@
#ifndef CSV_TOOLS_REPORTTABLE_H
#define CSV_TOOLS_REPORTTABLE_H
+#include