[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/klipper
From: Dmitry Suzdalev <dimsuz () gmail ! com>
Date: 2009-03-31 13:46:12
Message-ID: 1238507172.036019.1555.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 947425 by dimsuz:
Open action editor when double clicking an action or command.
If a command was selected when activating a dialog, preselect it in dialog
M +5 -2 configdialog.cpp
M +7 -3 editactiondialog.cpp
M +4 -3 editactiondialog.h
M +3 -0 editactiondialog.ui
--- trunk/KDE/kdebase/workspace/klipper/configdialog.cpp #947424:947425
@@ -65,6 +65,8 @@
#endif
connect(m_ui.kcfg_ActionList, SIGNAL(itemSelectionChanged()), SLOT(onSelectionChanged()));
+ connect(m_ui.kcfg_ActionList, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
+ SLOT(onEditAction()));
connect(m_ui.pbAddAction, SIGNAL(clicked()), SLOT(onAddAction()));
connect(m_ui.pbEditAction, SIGNAL(clicked()), SLOT(onEditAction()));
@@ -195,10 +197,11 @@
}
QTreeWidgetItem *item = m_ui.kcfg_ActionList->currentItem();
+ int commandIdx = -1;
if (item) {
if (item->parent()) {
+ commandIdx = item->parent()->indexOfChild( item );
item = item->parent(); // interested in toplevel action
- // TODO in action props dialog focus on selected command if any
}
int idx = m_ui.kcfg_ActionList->indexOfTopLevelItem( item );
@@ -209,7 +212,7 @@
return;
}
- m_editActDlg->setAction(action);
+ m_editActDlg->setAction(action, commandIdx);
// dialog will save values into action if user hits OK
m_editActDlg->exec();
--- trunk/KDE/kdebase/workspace/klipper/editactiondialog.cpp #947424:947425
@@ -59,14 +59,14 @@
delete m_ui;
}
-void EditActionDialog::setAction(ClipAction* act)
+void EditActionDialog::setAction(ClipAction* act, int commandIdxToSelect)
{
m_action = act;
- updateWidgets();
+ updateWidgets( commandIdxToSelect );
}
-void EditActionDialog::updateWidgets()
+void EditActionDialog::updateWidgets(int commandIdxToSelect)
{
if (!m_action) {
kDebug() << "no action to edit was set";
@@ -90,6 +90,10 @@
m_ui->twCommandList->addTopLevelItem( item );
}
+ if (commandIdxToSelect != -1) {
+ m_ui->twCommandList->setCurrentItem( m_ui->twCommandList->topLevelItem( commandIdxToSelect ) );
+ }
+
// update Remove button
onSelectionChanged();
}
--- trunk/KDE/kdebase/workspace/klipper/editactiondialog.h #947424:947425
@@ -41,7 +41,7 @@
/**
* Sets the action this dialog will work with
*/
- void setAction(ClipAction* act);
+ void setAction(ClipAction* act, int commandIdxToSelect = -1);
private slots:
void onAddCommand();
@@ -52,9 +52,10 @@
private:
/**
* Updates dialog's widgets according to values
- * in m_action
+ * in m_action.
+ * If commandIdxToSelect != -1 this command will be preselected
*/
- void updateWidgets();
+ void updateWidgets(int commandIdxToSelect);
/**
* Saves a values from widgets to action
--- trunk/KDE/kdebase/workspace/klipper/editactiondialog.ui #947424:947425
@@ -70,6 +70,9 @@
</item>
<item row="4" column="1">
<widget class="QTreeWidget" name="twCommandList">
+ <property name="toolTip">
+ <string>Double-click an item to edit</string>
+ </property>
<column>
<property name="text">
<string>Command</string>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic