Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Unmaintained
KDE Pim
Commits
c6c12511
Commit
c6c12511
authored
Jul 15, 2014
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Bug 337435 - kmail vcard import pgp key
FIXED-IN: 4.14 BUG: 337435
parent
ec8ff5d9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
142 additions
and
10 deletions
+142
-10
kmail/identity/identityaddvcarddialog.cpp
kmail/identity/identityaddvcarddialog.cpp
+44
-9
kmail/identity/identityaddvcarddialog.h
kmail/identity/identityaddvcarddialog.h
+5
-1
kmail/identity/identitydialog.cpp
kmail/identity/identitydialog.cpp
+9
-0
kmail/tests/CMakeLists.txt
kmail/tests/CMakeLists.txt
+4
-0
kmail/tests/identityaddvcarddialogtest.cpp
kmail/tests/identityaddvcarddialogtest.cpp
+47
-0
kmail/tests/identityaddvcarddialogtest.h
kmail/tests/identityaddvcarddialogtest.h
+33
-0
No files found.
kmail/identity/identityaddvcarddialog.cpp
View file @
c6c12511
...
...
@@ -22,6 +22,7 @@
#include <KComboBox>
#include <KLocalizedString>
#include <KSeparator>
#include <KUrlRequester>
#include <QButtonGroup>
#include <QVBoxLayout>
...
...
@@ -30,7 +31,7 @@
IdentityAddVcardDialog
::
IdentityAddVcardDialog
(
KPIMIdentities
::
IdentityManager
*
manager
,
QWidget
*
parent
)
:
KDialog
(
parent
)
:
KDialog
(
parent
)
{
setCaption
(
i18n
(
"Create own vCard"
)
);
setButtons
(
Ok
|
Cancel
);
...
...
@@ -43,6 +44,7 @@ IdentityAddVcardDialog::IdentityAddVcardDialog(KPIMIdentities::IdentityManager *
setMainWidget
(
mainWidget
);
mButtonGroup
=
new
QButtonGroup
(
this
);
mButtonGroup
->
setObjectName
(
QLatin1String
(
"buttongroup"
));
// row 1: radio button
QRadioButton
*
radio
=
new
QRadioButton
(
i18n
(
"&With empty fields"
),
this
);
...
...
@@ -51,19 +53,47 @@ IdentityAddVcardDialog::IdentityAddVcardDialog(KPIMIdentities::IdentityManager *
mButtonGroup
->
addButton
(
radio
,
(
int
)
Empty
);
// row 2: radio button
r
adio
=
new
QRadioButton
(
i18n
(
"&
Duplicate
existing vCard"
),
this
);
vlay
->
addWidget
(
radio
);
mButtonGroup
->
addButton
(
radio
,
(
int
)
Existing
Entry
);
QR
adio
Button
*
fromExistingVCard
=
new
QRadioButton
(
i18n
(
"&
From
existing vCard"
),
this
);
vlay
->
addWidget
(
fromExistingVCard
);
mButtonGroup
->
addButton
(
fromExistingVCard
,
(
int
)
From
Existing
VCard
);
// row 3:
combobox with existing identities and label
// row 3:
KUrlRequester
QHBoxLayout
*
hlay
=
new
QHBoxLayout
();
// inherits spacing
vlay
->
addLayout
(
hlay
);
mVCardPath
=
new
KUrlRequester
;
mVCardPath
->
setObjectName
(
QLatin1String
(
"kurlrequester_vcardpath"
));
mVCardPath
->
setMode
(
KFile
::
LocalOnly
|
KFile
::
File
);
QLabel
*
label
=
new
QLabel
(
i18n
(
"&VCard path:"
),
this
);
label
->
setBuddy
(
mVCardPath
);
label
->
setEnabled
(
false
);
mVCardPath
->
setEnabled
(
false
);
hlay
->
addWidget
(
label
);
hlay
->
addWidget
(
mVCardPath
);
connect
(
fromExistingVCard
,
SIGNAL
(
toggled
(
bool
)),
label
,
SLOT
(
setEnabled
(
bool
))
);
connect
(
fromExistingVCard
,
SIGNAL
(
toggled
(
bool
)),
mVCardPath
,
SLOT
(
setEnabled
(
bool
))
);
// row 4: radio button
QRadioButton
*
duplicateExistingVCard
=
new
QRadioButton
(
i18n
(
"&Duplicate existing vCard"
),
this
);
vlay
->
addWidget
(
duplicateExistingVCard
);
mButtonGroup
->
addButton
(
duplicateExistingVCard
,
(
int
)
ExistingEntry
);
// row 5: combobox with existing identities and label
hlay
=
new
QHBoxLayout
();
// inherits spacing
vlay
->
addLayout
(
hlay
);
mComboBox
=
new
KComboBox
(
this
);
mComboBox
->
setObjectName
(
QLatin1String
(
"identity_combobox"
));
mComboBox
->
setEditable
(
false
);
mComboBox
->
addItems
(
manager
->
shadowIdentities
()
);
mComboBox
->
addItems
(
manager
?
manager
->
shadowIdentities
()
:
QStringList
()
);
mComboBox
->
setEnabled
(
false
);
QLabel
*
label
=
new
QLabel
(
i18n
(
"&Existing identities:"
),
this
);
label
=
new
QLabel
(
i18n
(
"&Existing identities:"
),
this
);
label
->
setBuddy
(
mComboBox
);
label
->
setEnabled
(
false
);
hlay
->
addWidget
(
label
);
...
...
@@ -74,9 +104,9 @@ IdentityAddVcardDialog::IdentityAddVcardDialog(KPIMIdentities::IdentityManager *
// enable/disable combobox and label depending on the third radio
// button's state:
connect
(
radio
,
SIGNAL
(
toggled
(
bool
)),
connect
(
duplicateExistingVCard
,
SIGNAL
(
toggled
(
bool
)),
label
,
SLOT
(
setEnabled
(
bool
))
);
connect
(
radio
,
SIGNAL
(
toggled
(
bool
)),
connect
(
duplicateExistingVCard
,
SIGNAL
(
toggled
(
bool
)),
mComboBox
,
SLOT
(
setEnabled
(
bool
))
);
resize
(
350
,
130
);
}
...
...
@@ -96,3 +126,8 @@ QString IdentityAddVcardDialog::duplicateVcardFromIdentity() const
return
mComboBox
->
currentText
();
}
KUrl
IdentityAddVcardDialog
::
existingVCard
()
const
{
return
mVCardPath
->
url
();
}
kmail/identity/identityaddvcarddialog.h
View file @
c6c12511
...
...
@@ -20,6 +20,7 @@
#include <KDialog>
class
QButtonGroup
;
class
KComboBox
;
class
KUrlRequester
;
namespace
KPIMIdentities
{
class
IdentityManager
;
...
...
@@ -31,7 +32,8 @@ class IdentityAddVcardDialog: public KDialog
public:
enum
DuplicateMode
{
Empty
,
ExistingEntry
ExistingEntry
,
FromExistingVCard
};
explicit
IdentityAddVcardDialog
(
KPIMIdentities
::
IdentityManager
*
manager
,
QWidget
*
parent
=
0
);
...
...
@@ -39,10 +41,12 @@ public:
DuplicateMode
duplicateMode
()
const
;
QString
duplicateVcardFromIdentity
()
const
;
KUrl
existingVCard
()
const
;
private:
QButtonGroup
*
mButtonGroup
;
KComboBox
*
mComboBox
;
KUrlRequester
*
mVCardPath
;
};
#endif // IDENTITYADDVCARDDIALOG_H
kmail/identity/identitydialog.cpp
View file @
c6c12511
...
...
@@ -999,6 +999,15 @@ void IdentityDialog::slotEditVcard()
editVcard
(
mVcardFilename
);
break
;
}
case
IdentityAddVcardDialog
::
FromExistingVCard
:
{
const
QString
filename
=
dlg
->
existingVCard
().
path
();
if
(
!
filename
.
isEmpty
())
{
mVcardFilename
=
filename
;
}
qDebug
()
<<
" filename "
<<
filename
;
editVcard
(
mVcardFilename
);
break
;
}
}
}
delete
dlg
;
...
...
kmail/tests/CMakeLists.txt
View file @
c6c12511
...
...
@@ -18,3 +18,7 @@ kde4_add_unit_test( displaymessageformatactionmenutest ${kmail_displaymenu_sourc
target_link_libraries
(
displaymessageformatactionmenutest
${
QT_QTTEST_LIBRARY
}
${
KDE4_KDEUI_LIBS
}
messageviewer
)
set
(
kmail_identityaddvcarddialog_source identityaddvcarddialogtest.cpp ../identity/identityaddvcarddialog.cpp
)
kde4_add_unit_test
(
identityaddvcarddialogtest
${
kmail_identityaddvcarddialog_source
}
)
target_link_libraries
(
identityaddvcarddialogtest
${
QT_QTTEST_LIBRARY
}
${
KDE4_KDEUI_LIBS
}
${
KDE4_KFILE_LIBS
}
kpimidentities
)
kmail/tests/identityaddvcarddialogtest.cpp
0 → 100644
View file @
c6c12511
/*
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 "identityaddvcarddialogtest.h"
#include "../identity/identityaddvcarddialog.h"
#include <KComboBox>
#include <KUrlRequester>
#include <QButtonGroup>
#include <qtest_kde.h>
identityaddvcarddialogtest
::
identityaddvcarddialogtest
()
{
}
void
identityaddvcarddialogtest
::
shouldHaveDefaultValue
()
{
IdentityAddVcardDialog
dlg
(
0
,
0
);
KComboBox
*
identityComboBox
=
qFindChild
<
KComboBox
*>
(
&
dlg
,
QLatin1String
(
"identity_combobox"
));
QVERIFY
(
identityComboBox
);
QCOMPARE
(
identityComboBox
->
isEnabled
(),
false
);
KUrlRequester
*
urlRequester
=
qFindChild
<
KUrlRequester
*>
(
&
dlg
,
QLatin1String
(
"kurlrequester_vcardpath"
));
QVERIFY
(
urlRequester
);
QCOMPARE
(
urlRequester
->
isEnabled
(),
false
);
QButtonGroup
*
buttonGroup
=
qFindChild
<
QButtonGroup
*>
(
&
dlg
,
QLatin1String
(
"buttongroup"
));
QVERIFY
(
buttonGroup
);
QCOMPARE
(
dlg
.
duplicateMode
(),
IdentityAddVcardDialog
::
Empty
);
}
QTEST_KDEMAIN
(
identityaddvcarddialogtest
,
GUI
)
kmail/tests/identityaddvcarddialogtest.h
0 → 100644
View file @
c6c12511
/*
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 IDENTITYADDVCARDDIALOGTEST_H
#define IDENTITYADDVCARDDIALOGTEST_H
#include <QObject>
class
identityaddvcarddialogtest
:
public
QObject
{
Q_OBJECT
public:
identityaddvcarddialogtest
();
private
Q_SLOTS
:
void
shouldHaveDefaultValue
();
};
#endif // IDENTITYADDVCARDDIALOGTEST_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