Commit f95587b9 authored by Laurent Montel's avatar Laurent Montel 😁

Fix enable/disable copy/cut action

parent d2e1ea52
......@@ -192,6 +192,18 @@ bool SieveEditorMainWidget::isRedoAvailable() const
return false;
}
bool SieveEditorMainWidget::hasSelection() const
{
QWidget *w = mTabWidget->currentWidget();
if (w) {
SieveEditorPageWidget *page = qobject_cast<SieveEditorPageWidget *>(w);
if (page) {
return page->hasSelection();
}
}
return false;
}
void SieveEditorMainWidget::slotCopy()
{
QWidget *w = mTabWidget->currentWidget();
......
......@@ -50,6 +50,7 @@ public:
bool isUndoAvailable() const;
bool isRedoAvailable() const;
bool hasSelection() const;
public Q_SLOTS:
void slotGoToLine();
......
......@@ -236,9 +236,9 @@ void SieveEditorMainWindow::slotUpdateActions()
mUndoAction->setEnabled(editActionEnabled && mMainWidget->sieveEditorMainWidget()->isUndoAvailable());
mRedoAction->setEnabled(editActionEnabled && mMainWidget->sieveEditorMainWidget()->isRedoAvailable());
mCopyAction->setEnabled(editActionEnabled);
mPasteAction->setEnabled(editActionEnabled); //FIXME
mCutAction->setEnabled(editActionEnabled);
mCopyAction->setEnabled(editActionEnabled && mMainWidget->sieveEditorMainWidget()->hasSelection() );
mPasteAction->setEnabled(editActionEnabled);
mCutAction->setEnabled(editActionEnabled && mMainWidget->sieveEditorMainWidget()->hasSelection());
mSaveScript->setEnabled(hasPage && !mNetworkIsDown);
mRefreshList->setEnabled(!mNetworkIsDown);
......
......@@ -186,6 +186,11 @@ bool SieveEditorPageWidget::isRedoAvailable() const
return mSieveEditorWidget->isRedoAvailable();
}
bool SieveEditorPageWidget::hasSelection() const
{
return mSieveEditorWidget->hasSelection();
}
void SieveEditorPageWidget::redo()
{
mSieveEditorWidget->redo();
......
......@@ -56,6 +56,7 @@ public:
void paste();
void cut();
void copy();
bool hasSelection() const;
Q_SIGNALS:
void refreshList();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment