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
K
KDE Pim
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
0
Merge Requests
0
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
Unmaintained
KDE Pim
Commits
11443941
Commit
11443941
authored
Oct 24, 2014
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new widget to change override mode now we can click on this widget which is
in statusbar to change mode
parent
5d32e36f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
280 additions
and
15 deletions
+280
-15
kmail/CMakeLists.txt
kmail/CMakeLists.txt
+1
-0
kmail/editor/kmcomposewin.cpp
kmail/editor/kmcomposewin.cpp
+23
-13
kmail/editor/kmcomposewin.h
kmail/editor/kmcomposewin.h
+4
-2
kmail/tests/CMakeLists.txt
kmail/tests/CMakeLists.txt
+4
-0
kmail/tests/overwritemodewidgettest.cpp
kmail/tests/overwritemodewidgettest.cpp
+95
-0
kmail/tests/overwritemodewidgettest.h
kmail/tests/overwritemodewidgettest.h
+42
-0
kmail/widgets/overwritemodewidget.cpp
kmail/widgets/overwritemodewidget.cpp
+62
-0
kmail/widgets/overwritemodewidget.h
kmail/widgets/overwritemodewidget.h
+49
-0
No files found.
kmail/CMakeLists.txt
View file @
11443941
...
...
@@ -161,6 +161,7 @@ if (KDEPIM_BUILD_DESKTOP)
widgets/collectionpane.cpp
widgets/vacationscriptindicatorwidget.cpp
widgets/displaymessageformatactionmenu.cpp
widgets/overwritemodewidget.cpp
)
set
(
kmailprivate_tag_LIB_SRCS
tag/tagactionmanager.cpp
...
...
kmail/editor/kmcomposewin.cpp
View file @
11443941
...
...
@@ -110,6 +110,8 @@
#include "mailcommon/folder/folderrequester.h"
#include "mailcommon/folder/foldercollection.h"
#include "widgets/overwritemodewidget.h"
// LIBKDEPIM includes
#include <libkdepim/addressline/recentaddresses.h>
...
...
@@ -229,7 +231,9 @@ KMComposeWin::KMComposeWin( const KMime::Message::Ptr &aMsg, bool lastSignState,
mWasModified
(
false
),
mCryptoStateIndicatorWidget
(
0
),
mStorageService
(
new
KMStorageService
(
this
,
this
)),
mSendNowByShortcutUsed
(
false
)
mSendNowByShortcutUsed
(
false
),
mFollowUpToggleAction
(
0
),
mOverwriteModeWidget
(
0
)
{
m_verifyMissingAttachment
=
0
;
mComposerBase
=
new
MessageComposer
::
ComposerViewBase
(
this
,
this
);
...
...
@@ -1435,10 +1439,10 @@ void KMComposeWin::setupActions( void )
mComposerBase
->
editor
()
->
createActions
(
actionCollection
()
);
actionCollection
()
->
addAction
(
QLatin1String
(
"shared_link"
),
mStorageService
->
menuShareLinkServices
()
);
KToggleAction
*
followUpToggel
Action
=
new
KToggleAction
(
i18n
(
"Follow Up Mail..."
),
this
);
actionCollection
()
->
addAction
(
QLatin1String
(
"follow_up_mail"
),
followUpToggel
Action
);
connect
(
followUpToggel
Action
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
slotFollowUpMail
(
bool
))
);
followUpToggel
Action
->
setEnabled
(
FollowUpReminder
::
FollowUpReminderUtil
::
followupReminderAgentEnabled
());
mFollowUpToggle
Action
=
new
KToggleAction
(
i18n
(
"Follow Up Mail..."
),
this
);
actionCollection
()
->
addAction
(
QLatin1String
(
"follow_up_mail"
),
mFollowUpToggle
Action
);
connect
(
mFollowUpToggle
Action
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
slotFollowUpMail
(
bool
))
);
mFollowUpToggle
Action
->
setEnabled
(
FollowUpReminder
::
FollowUpReminderUtil
::
followupReminderAgentEnabled
());
createGUI
(
QLatin1String
(
"kmcomposerui.rc"
)
);
connect
(
toolBar
(
QLatin1String
(
"htmlToolBar"
)
)
->
toggleViewAction
(),
...
...
@@ -1486,7 +1490,9 @@ void KMComposeWin::setupStatusBar( QWidget *w )
statusBar
()
->
insertItem
(
QString
(),
0
,
1
);
statusBar
()
->
setItemAlignment
(
0
,
Qt
::
AlignLeft
|
Qt
::
AlignVCenter
);
statusBar
()
->
insertPermanentItem
(
overwriteModeStr
(),
4
,
0
);
mOverwriteModeWidget
=
new
OverwriteModeWidget
(
this
);
statusBar
()
->
addPermanentWidget
(
mOverwriteModeWidget
,
0
);
connect
(
mOverwriteModeWidget
,
SIGNAL
(
overwriteModeChanged
(
bool
)),
this
,
SLOT
(
slotOverwriteModeWasChanged
(
bool
)));
statusBar
()
->
insertPermanentItem
(
i18n
(
" Spellcheck: %1 "
,
QLatin1String
(
" "
)),
3
,
0
)
;
statusBar
()
->
insertPermanentItem
(
i18n
(
" Column: %1 "
,
QLatin1String
(
" "
)
),
2
,
0
);
...
...
@@ -3338,13 +3344,9 @@ void KMComposeWin::slotFolderRemoved( const Akonadi::Collection & col )
void
KMComposeWin
::
slotOverwriteModeChanged
()
{
mComposerBase
->
editor
()
->
setCursorWidth
(
mComposerBase
->
editor
()
->
overwriteMode
()
?
5
:
1
);
statusBar
()
->
changeItem
(
overwriteModeStr
(),
4
);
}
QString
KMComposeWin
::
overwriteModeStr
()
const
{
return
mComposerBase
->
editor
()
->
overwriteMode
()
?
i18n
(
"OVR"
)
:
i18n
(
"INS"
);
const
bool
overwriteMode
=
mComposerBase
->
editor
()
->
overwriteMode
();
mComposerBase
->
editor
()
->
setCursorWidth
(
overwriteMode
?
5
:
1
);
mOverwriteModeWidget
->
setOverwriteMode
(
overwriteMode
);
}
void
KMComposeWin
::
slotCursorPositionChanged
()
...
...
@@ -3625,6 +3627,8 @@ void KMComposeWin::slotFollowUpMail(bool toggled)
if
(
dlg
->
exec
())
{
mFollowUpDate
=
dlg
->
selectedDate
();
mFollowUpCollection
=
dlg
->
collection
();
}
else
{
mFollowUpToggleAction
->
setChecked
(
false
);
}
delete
dlg
;
}
else
{
...
...
@@ -3638,3 +3642,9 @@ void KMComposeWin::slotSnippetWidgetVisibilityChanged(bool b)
mSnippetWidget
->
setVisible
(
b
);
mSnippetSplitterCollapser
->
setVisible
(
b
);
}
void
KMComposeWin
::
slotOverwriteModeWasChanged
(
bool
state
)
{
mComposerBase
->
editor
()
->
setCursorWidth
(
state
?
5
:
1
);
mComposerBase
->
editor
()
->
setOverwriteMode
(
state
);
}
kmail/editor/kmcomposewin.h
View file @
11443941
...
...
@@ -69,7 +69,7 @@ class AttachmentMissingWarning;
class
ExternalEditorWarning
;
class
KActionMenu
;
class
CryptoStateIndicatorWidget
;
class
OverwriteModeWidget
;
namespace
boost
{
template
<
typename
T
>
class
shared_ptr
;
...
...
@@ -458,6 +458,7 @@ private slots:
void
slotFollowUpMail
(
bool
toggled
);
void
slotSendNowByShortcut
();
void
slotSnippetWidgetVisibilityChanged
(
bool
b
);
void
slotOverwriteModeWasChanged
(
bool
state
);
public:
// kmcommand
// FIXME we need to remove these, but they're pure virtual in Composer.
void
addAttach
(
KMime
::
Content
*
msgPart
);
...
...
@@ -484,7 +485,6 @@ private:
void
updateSignature
(
uint
uoid
,
uint
uOldId
);
Kleo
::
CryptoMessageFormat
cryptoMessageFormat
()
const
;
QString
overwriteModeStr
()
const
;
void
printComposeResult
(
KJob
*
job
,
bool
preview
);
void
printComposer
(
bool
preview
);
/**
...
...
@@ -696,6 +696,8 @@ private:
KMStorageService
*
mStorageService
;
bool
mSendNowByShortcutUsed
;
PimCommon
::
SplitterCollapser
*
mSnippetSplitterCollapser
;
KToggleAction
*
mFollowUpToggleAction
;
OverwriteModeWidget
*
mOverwriteModeWidget
;
};
#endif
kmail/tests/CMakeLists.txt
View file @
11443941
...
...
@@ -28,3 +28,7 @@ kde4_add_unit_test( followupreminderselectdatedialogtest ${kmail_followupreminde
target_link_libraries
(
followupreminderselectdatedialogtest
${
QT_QTTEST_LIBRARY
}
${
KDE4_KDEUI_LIBS
}
${
KDEPIMLIBS_AKONADI_LIBS
}
${
KDEPIMLIBS_AKONADI_CALENDAR_LIBS
}
${
KDEPIMLIBS_KCALCORE_LIBS
}
)
set
(
kmail_overwritewidget_source overwritemodewidgettest.cpp ../widgets/overwritemodewidget.cpp
)
kde4_add_unit_test
(
overwritemodewidgettest
${
kmail_overwritewidget_source
}
)
target_link_libraries
(
overwritemodewidgettest
${
QT_QTTEST_LIBRARY
}
${
KDE4_KDEUI_LIBS
}
)
kmail/tests/overwritemodewidgettest.cpp
0 → 100644
View file @
11443941
/*
Copyright (c) 2014 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "overwritemodewidgettest.h"
#include "../widgets/overwritemodewidget.h"
#include <qtest_kde.h>
#include <qtestmouse.h>
#include <QSignalSpy>
OverwriteModeWidgetTest
::
OverwriteModeWidgetTest
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
OverwriteModeWidgetTest
::~
OverwriteModeWidgetTest
()
{
}
void
OverwriteModeWidgetTest
::
shouldHasDefaultValue
()
{
OverwriteModeWidget
widget
;
QVERIFY
(
!
widget
.
overwriteMode
());
}
void
OverwriteModeWidgetTest
::
shouldChangeState
()
{
OverwriteModeWidget
widget
;
widget
.
setOverwriteMode
(
true
);
QVERIFY
(
widget
.
overwriteMode
());
widget
.
setOverwriteMode
(
true
);
QVERIFY
(
widget
.
overwriteMode
());
widget
.
setOverwriteMode
(
false
);
QVERIFY
(
!
widget
.
overwriteMode
());
}
void
OverwriteModeWidgetTest
::
shouldEmitSignalWhenChangeState
()
{
OverwriteModeWidget
widget
;
QSignalSpy
spy
(
&
widget
,
SIGNAL
(
overwriteModeChanged
(
bool
)));
widget
.
setOverwriteMode
(
true
);
QCOMPARE
(
spy
.
count
(),
1
);
widget
.
setOverwriteMode
(
false
);
QCOMPARE
(
spy
.
count
(),
2
);
}
void
OverwriteModeWidgetTest
::
shouldNotEmitSignalWhenWeDontChangeState
()
{
OverwriteModeWidget
widget
;
QSignalSpy
spy
(
&
widget
,
SIGNAL
(
overwriteModeChanged
(
bool
)));
widget
.
setOverwriteMode
(
false
);
QCOMPARE
(
spy
.
count
(),
0
);
widget
.
setOverwriteMode
(
true
);
QCOMPARE
(
spy
.
count
(),
1
);
widget
.
setOverwriteMode
(
true
);
QCOMPARE
(
spy
.
count
(),
1
);
}
void
OverwriteModeWidgetTest
::
shouldEmitSignalWhenClickOnLabel
()
{
OverwriteModeWidget
widget
;
QSignalSpy
spy
(
&
widget
,
SIGNAL
(
overwriteModeChanged
(
bool
)));
widget
.
show
();
QTest
::
qWaitForWindowShown
(
&
widget
);
QTest
::
mouseClick
(
&
widget
,
Qt
::
LeftButton
);
QCOMPARE
(
spy
.
count
(),
1
);
QTest
::
mouseClick
(
&
widget
,
Qt
::
LeftButton
);
QCOMPARE
(
spy
.
count
(),
2
);
}
QTEST_KDEMAIN
(
OverwriteModeWidgetTest
,
GUI
)
kmail/tests/overwritemodewidgettest.h
0 → 100644
View file @
11443941
/*
Copyright (c) 2014 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef OVERWRITEMODEWIDGETTEST_H
#define OVERWRITEMODEWIDGETTEST_H
#include <QObject>
class
OverwriteModeWidgetTest
:
public
QObject
{
Q_OBJECT
public:
explicit
OverwriteModeWidgetTest
(
QObject
*
parent
=
0
);
~
OverwriteModeWidgetTest
();
private
Q_SLOTS
:
void
shouldHasDefaultValue
();
void
shouldChangeState
();
void
shouldEmitSignalWhenChangeState
();
void
shouldNotEmitSignalWhenWeDontChangeState
();
void
shouldEmitSignalWhenClickOnLabel
();
};
#endif // OVERWRITEMODEWIDGETTEST_H
kmail/widgets/overwritemodewidget.cpp
0 → 100644
View file @
11443941
/*
Copyright (c) 2014 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "overwritemodewidget.h"
#include <KLocalizedString>
#include <QDebug>
OverwriteModeWidget
::
OverwriteModeWidget
(
QWidget
*
parent
)
:
QLabel
(
parent
),
mOverwriteMode
(
false
)
{
updateLabel
();
}
OverwriteModeWidget
::~
OverwriteModeWidget
()
{
}
void
OverwriteModeWidget
::
setOverwriteMode
(
bool
state
)
{
if
(
mOverwriteMode
!=
state
)
{
mOverwriteMode
=
state
;
Q_EMIT
overwriteModeChanged
(
mOverwriteMode
);
updateLabel
();
}
}
bool
OverwriteModeWidget
::
overwriteMode
()
const
{
return
mOverwriteMode
;
}
void
OverwriteModeWidget
::
updateLabel
()
{
if
(
mOverwriteMode
)
{
setText
(
i18n
(
"OVR"
));
}
else
{
setText
(
i18n
(
"INS"
));
}
}
void
OverwriteModeWidget
::
mousePressEvent
(
QMouseEvent
*
ev
)
{
Q_UNUSED
(
ev
);
setOverwriteMode
(
!
mOverwriteMode
);
}
kmail/widgets/overwritemodewidget.h
0 → 100644
View file @
11443941
/*
Copyright (c) 2014 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef OVERWRITEMODEWIDGET_H
#define OVERWRITEMODEWIDGET_H
#include <QLabel>
class
OverwriteModeWidget
:
public
QLabel
{
Q_OBJECT
public:
explicit
OverwriteModeWidget
(
QWidget
*
parent
=
0
);
~
OverwriteModeWidget
();
void
setOverwriteMode
(
bool
state
);
bool
overwriteMode
()
const
;
Q_SIGNALS:
void
overwriteModeChanged
(
bool
state
);
protected:
void
mousePressEvent
(
QMouseEvent
*
ev
);
private:
void
updateLabel
();
bool
mOverwriteMode
;
};
#endif // OVERWRITEMODEWIDGET_H
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