Allow triggering custom actions via double-clicking a file in the file view
FossilOrigin-Name: 4270974c3f9f7fb166a74a9d76c9db8a24428fe5
This commit is contained in:
@@ -1433,6 +1433,8 @@ void MainWindow::on_fileTableView_doubleClicked(const QModelIndex &/*index*/)
|
||||
on_actionOpenFile_triggered();
|
||||
else if(action==FILE_DLBCLICK_ACTION_OPENCONTAINING)
|
||||
on_actionOpenContaining_triggered();
|
||||
else if(action==FILE_DLBCLICK_ACTION_CUSTOM)
|
||||
invokeCustomAction(0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -2783,15 +2785,10 @@ void MainWindow::updateCustomActions()
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionCustomAction_triggered()
|
||||
void MainWindow::invokeCustomAction(int actionId)
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
if(!action)
|
||||
return;
|
||||
|
||||
int action_id = action->data().toInt();
|
||||
Q_ASSERT(action_id < settings.GetCustomActions().size());
|
||||
CustomAction &cust_action = settings.GetCustomActions()[action_id];
|
||||
Q_ASSERT(actionId < settings.GetCustomActions().size());
|
||||
CustomAction &cust_action = settings.GetCustomActions()[actionId];
|
||||
Q_ASSERT(cust_action.IsValid());
|
||||
|
||||
Q_ASSERT(!cust_action.Command.isEmpty());
|
||||
@@ -2826,3 +2823,14 @@ void MainWindow::on_actionCustomAction_triggered()
|
||||
|
||||
SpawnExternalProcess(this, cust_action.Command, file_selection, path_selection, wkdir, uiCallback);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void MainWindow::on_actionCustomAction_triggered()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
if(!action)
|
||||
return;
|
||||
|
||||
int action_id = action->data().toInt();
|
||||
invokeCustomAction(action_id);
|
||||
}
|
||||
|
@@ -54,7 +54,7 @@ private:
|
||||
void selectRootDir();
|
||||
void mergeRevision(const QString& defaultRevision);
|
||||
void updateCustomActions();
|
||||
|
||||
void invokeCustomAction(int actionId);
|
||||
|
||||
void fossilBrowse(const QString &fossilUrl);
|
||||
void dragEnterEvent(class QDragEnterEvent *event);
|
||||
|
@@ -25,6 +25,7 @@ enum FileDblClickAction
|
||||
FILE_DLBCLICK_ACTION_DIFF,
|
||||
FILE_DLBCLICK_ACTION_OPEN,
|
||||
FILE_DLBCLICK_ACTION_OPENCONTAINING,
|
||||
FILE_DLBCLICK_ACTION_CUSTOM, // Custom Action 1
|
||||
FILE_DLBCLICK_ACTION_MAX
|
||||
};
|
||||
|
||||
|
@@ -17,6 +17,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, Settings &_settings) :
|
||||
ui->cmbDoubleClickAction->addItem(tr("Diff File"));
|
||||
ui->cmbDoubleClickAction->addItem(tr("Open File"));
|
||||
ui->cmbDoubleClickAction->addItem(tr("Open Containing Folder"));
|
||||
ui->cmbDoubleClickAction->addItem(tr("Custom Action %0").arg(1));
|
||||
|
||||
ui->cmbFossilBrowser->addItem(tr("System"));
|
||||
ui->cmbFossilBrowser->addItem(tr("Internal"));
|
||||
|
Reference in New Issue
Block a user