Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PIM Sieve Editor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PIM
PIM Sieve Editor
Commits
39d277b7
Commit
39d277b7
authored
Feb 17, 2015
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cut/paste/copy action too
parent
3446394f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
0 deletions
+78
-0
sieveeditormainwidget.cpp
sieveeditormainwidget.cpp
+34
-0
sieveeditormainwidget.h
sieveeditormainwidget.h
+4
-0
sieveeditormainwindow.cpp
sieveeditormainwindow.cpp
+14
-0
sieveeditormainwindow.h
sieveeditormainwindow.h
+4
-0
sieveeditorpagewidget.cpp
sieveeditorpagewidget.cpp
+17
-0
sieveeditorpagewidget.h
sieveeditorpagewidget.h
+5
-0
No files found.
sieveeditormainwidget.cpp
View file @
39d277b7
...
...
@@ -98,6 +98,7 @@ void SieveEditorMainWidget::slotCreateScriptPage(const KUrl &url, const QStringL
connect
(
editor
,
SIGNAL
(
modeEditorChanged
(
KSieveUi
::
SieveEditorWidget
::
EditorMode
)),
SIGNAL
(
modeEditorChanged
(
KSieveUi
::
SieveEditorWidget
::
EditorMode
)));
connect
(
editor
,
SIGNAL
(
undoAvailable
(
bool
)),
SIGNAL
(
undoAvailable
(
bool
)));
connect
(
editor
,
SIGNAL
(
redoAvailable
(
bool
)),
SIGNAL
(
redoAvailable
(
bool
)));
connect
(
editor
,
SIGNAL
(
copyAvailable
(
bool
)),
SIGNAL
(
copyAvailable
(
bool
)));
editor
->
setIsNewScript
(
isNewScript
);
editor
->
loadScript
(
url
,
capabilities
);
mTabWidget
->
addTab
(
editor
,
url
.
fileName
());
...
...
@@ -191,6 +192,39 @@ bool SieveEditorMainWidget::isRedoAvailable() const
return
false
;
}
void
SieveEditorMainWidget
::
slotCopy
()
{
QWidget
*
w
=
mTabWidget
->
currentWidget
();
if
(
w
)
{
SieveEditorPageWidget
*
page
=
qobject_cast
<
SieveEditorPageWidget
*>
(
w
);
if
(
page
)
{
page
->
copy
();
}
}
}
void
SieveEditorMainWidget
::
slotPaste
()
{
QWidget
*
w
=
mTabWidget
->
currentWidget
();
if
(
w
)
{
SieveEditorPageWidget
*
page
=
qobject_cast
<
SieveEditorPageWidget
*>
(
w
);
if
(
page
)
{
page
->
paste
();
}
}
}
void
SieveEditorMainWidget
::
slotCut
()
{
QWidget
*
w
=
mTabWidget
->
currentWidget
();
if
(
w
)
{
SieveEditorPageWidget
*
page
=
qobject_cast
<
SieveEditorPageWidget
*>
(
w
);
if
(
page
)
{
page
->
cut
();
}
}
}
void
SieveEditorMainWidget
::
slotUndo
()
{
QWidget
*
w
=
mTabWidget
->
currentWidget
();
...
...
sieveeditormainwidget.h
View file @
39d277b7
...
...
@@ -55,6 +55,9 @@ public Q_SLOTS:
void
slotReplace
();
void
slotFind
();
void
slotCopy
();
void
slotPaste
();
void
slotCut
();
Q_SIGNALS:
void
updateButtons
(
bool
newScriptAction
,
bool
editScriptAction
,
bool
deleteScriptAction
,
bool
desactivateScriptAction
);
void
updateScriptList
();
...
...
@@ -62,6 +65,7 @@ Q_SIGNALS:
void
serverSieveFound
(
bool
);
void
undoAvailable
(
bool
);
void
redoAvailable
(
bool
);
void
copyAvailable
(
bool
);
private
slots
:
...
...
sieveeditormainwindow.cpp
View file @
39d277b7
...
...
@@ -60,6 +60,7 @@ SieveEditorMainWindow::SieveEditorMainWindow()
connect
(
mMainWidget
->
sieveEditorMainWidget
(),
SIGNAL
(
modeEditorChanged
(
KSieveUi
::
SieveEditorWidget
::
EditorMode
)),
SLOT
(
slotUpdateActions
()));
connect
(
mMainWidget
->
sieveEditorMainWidget
(),
SIGNAL
(
undoAvailable
(
bool
)),
SLOT
(
slotUndoAvailable
(
bool
)));
connect
(
mMainWidget
->
sieveEditorMainWidget
(),
SIGNAL
(
redoAvailable
(
bool
)),
SLOT
(
slotRedoAvailable
(
bool
)));
connect
(
mMainWidget
->
sieveEditorMainWidget
(),
SIGNAL
(
copyAvailable
(
bool
)),
SLOT
(
slotCopyAvailable
(
bool
)));
const
Solid
::
Networking
::
Status
status
=
Solid
::
Networking
::
status
();
slotSystemNetworkStatusChanged
(
status
);
slotRefreshList
();
...
...
@@ -157,6 +158,9 @@ void SieveEditorMainWindow::setupActions()
mReplaceAction
=
KStandardAction
::
replace
(
mMainWidget
->
sieveEditorMainWidget
(),
SLOT
(
slotReplace
()),
ac
);
mUndoAction
=
KStandardAction
::
undo
(
mMainWidget
->
sieveEditorMainWidget
(),
SLOT
(
slotUndo
()),
ac
);
mRedoAction
=
KStandardAction
::
redo
(
mMainWidget
->
sieveEditorMainWidget
(),
SLOT
(
slotRedo
()),
ac
);
mCopyAction
=
KStandardAction
::
copy
(
mMainWidget
->
sieveEditorMainWidget
(),
SLOT
(
slotCopy
()),
ac
);
mPasteAction
=
KStandardAction
::
paste
(
mMainWidget
->
sieveEditorMainWidget
(),
SLOT
(
slotPaste
()),
ac
);
mCutAction
=
KStandardAction
::
cut
(
mMainWidget
->
sieveEditorMainWidget
(),
SLOT
(
slotCut
()),
ac
);
}
void
SieveEditorMainWindow
::
slotRefreshList
()
...
...
@@ -232,6 +236,10 @@ 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
);
mSaveScript
->
setEnabled
(
hasPage
&&
!
mNetworkIsDown
);
mRefreshList
->
setEnabled
(
!
mNetworkIsDown
);
}
...
...
@@ -250,3 +258,9 @@ void SieveEditorMainWindow::slotRedoAvailable(bool b)
mRedoAction
->
setEnabled
(
editActionEnabled
&&
b
);
}
void
SieveEditorMainWindow
::
slotCopyAvailable
(
bool
b
)
{
const
bool
hasPage
=
(
mMainWidget
->
sieveEditorMainWidget
()
->
tabWidget
()
->
count
()
>
0
);
const
bool
editActionEnabled
=
(
hasPage
&&
mMainWidget
->
sieveEditorMainWidget
()
->
pageMode
()
==
KSieveUi
::
SieveEditorWidget
::
TextMode
);
mCopyAction
->
setEnabled
(
editActionEnabled
&&
b
);
}
sieveeditormainwindow.h
View file @
39d277b7
...
...
@@ -51,6 +51,7 @@ private slots:
void
slotUpdateActions
();
void
slotUndoAvailable
(
bool
);
void
slotRedoAvailable
(
bool
);
void
slotCopyAvailable
(
bool
b
);
private:
void
initStatusBar
();
...
...
@@ -68,6 +69,9 @@ private:
KAction
*
mReplaceAction
;
KAction
*
mUndoAction
;
KAction
*
mRedoAction
;
KAction
*
mCopyAction
;
KAction
*
mPasteAction
;
KAction
*
mCutAction
;
QLabel
*
mStatusBarInfo
;
bool
mNetworkIsDown
;
...
...
sieveeditorpagewidget.cpp
View file @
39d277b7
...
...
@@ -43,6 +43,7 @@ SieveEditorPageWidget::SieveEditorPageWidget(QWidget *parent)
connect
(
mSieveEditorWidget
,
SIGNAL
(
modeEditorChanged
(
KSieveUi
::
SieveEditorWidget
::
EditorMode
)),
SIGNAL
(
modeEditorChanged
(
KSieveUi
::
SieveEditorWidget
::
EditorMode
)));
connect
(
mSieveEditorWidget
,
SIGNAL
(
undoAvailable
(
bool
)),
SIGNAL
(
undoAvailable
(
bool
)));
connect
(
mSieveEditorWidget
,
SIGNAL
(
redoAvailable
(
bool
)),
SIGNAL
(
redoAvailable
(
bool
)));
connect
(
mSieveEditorWidget
,
SIGNAL
(
copyAvailable
(
bool
)),
SIGNAL
(
copyAvailable
(
bool
)));
//qDebug()<<"SieveEditorPageWidget::SieveEditorPageWidget "<<this;
}
...
...
@@ -204,3 +205,19 @@ KSieveUi::SieveEditorWidget::EditorMode SieveEditorPageWidget::pageMode() const
{
return
mSieveEditorWidget
->
mode
();
}
void
SieveEditorPageWidget
::
paste
()
{
mSieveEditorWidget
->
paste
();
}
void
SieveEditorPageWidget
::
cut
()
{
mSieveEditorWidget
->
cut
();
}
void
SieveEditorPageWidget
::
copy
()
{
mSieveEditorWidget
->
copy
();
}
sieveeditorpagewidget.h
View file @
39d277b7
...
...
@@ -53,12 +53,17 @@ public:
void
undo
();
bool
isUndoAvailable
()
const
;
bool
isRedoAvailable
()
const
;
void
paste
();
void
cut
();
void
copy
();
Q_SIGNALS:
void
refreshList
();
void
scriptModified
(
bool
,
SieveEditorPageWidget
*
);
void
modeEditorChanged
(
KSieveUi
::
SieveEditorWidget
::
EditorMode
);
void
undoAvailable
(
bool
);
void
redoAvailable
(
bool
);
void
copyAvailable
(
bool
);
private
slots
:
void
slotGetResult
(
KManageSieve
::
SieveJob
*
,
bool
success
,
const
QString
&
script
,
bool
isActive
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment