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
b65d333d
Commit
b65d333d
authored
Apr 02, 2015
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add autotest
parent
b593adf9
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
250 additions
and
33 deletions
+250
-33
kmail/CMakeLists.txt
kmail/CMakeLists.txt
+2
-0
kmail/configuredialog/configureagents/configureagentitem.cpp
kmail/configuredialog/configureagents/configureagentitem.cpp
+98
-0
kmail/configuredialog/configureagents/configureagentitem.h
kmail/configuredialog/configureagents/configureagentitem.h
+57
-0
kmail/configuredialog/configureagents/configureagentlistmodel.cpp
...nfiguredialog/configureagents/configureagentlistmodel.cpp
+13
-15
kmail/configuredialog/configureagents/configureagentlistmodel.h
...configuredialog/configureagents/configureagentlistmodel.h
+3
-18
kmail/configuredialog/configureagents/configureagentlistview.cpp
...onfiguredialog/configureagents/configureagentlistview.cpp
+7
-0
kmail/tests/CMakeLists.txt
kmail/tests/CMakeLists.txt
+7
-0
kmail/tests/configureagentlistviewtest.cpp
kmail/tests/configureagentlistviewtest.cpp
+32
-0
kmail/tests/configureagentlistviewtest.h
kmail/tests/configureagentlistviewtest.h
+31
-0
No files found.
kmail/CMakeLists.txt
View file @
b65d333d
...
...
@@ -102,6 +102,8 @@ if (KDEPIM_BUILD_DESKTOP)
configuredialog/configurestorageservicewidget.cpp
configuredialog/configureagents/configureagentlistmodel.cpp
configuredialog/configureagents/configureagentlistdelegate.cpp
configuredialog/configureagents/configureagentlistview.cpp
configuredialog/configureagents/configureagentitem.cpp
)
set
(
kmailprivate_searchdialog_LIB_SRCS
...
...
kmail/configuredialog/configureagents/configureagentitem.cpp
0 → 100644
View file @
b65d333d
/*
Copyright (c) 2015 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 "configureagentitem.h"
ConfigureAgentItem
::
ConfigureAgentItem
()
:
mChecked
(
false
),
mFailed
(
false
)
{
}
ConfigureAgentItem
::~
ConfigureAgentItem
()
{
}
QString
ConfigureAgentItem
::
agentName
()
const
{
return
mAgentName
;
}
void
ConfigureAgentItem
::
setAgentName
(
const
QString
&
agentName
)
{
mAgentName
=
agentName
;
}
QString
ConfigureAgentItem
::
description
()
const
{
return
mDescription
;
}
void
ConfigureAgentItem
::
setDescription
(
const
QString
&
description
)
{
mDescription
=
description
;
}
QString
ConfigureAgentItem
::
path
()
const
{
return
mPath
;
}
void
ConfigureAgentItem
::
setPath
(
const
QString
&
path
)
{
mPath
=
path
;
}
QString
ConfigureAgentItem
::
interfaceName
()
const
{
return
mInterfaceName
;
}
void
ConfigureAgentItem
::
setInterfaceName
(
const
QString
&
interfaceName
)
{
mInterfaceName
=
interfaceName
;
}
bool
ConfigureAgentItem
::
checked
()
const
{
return
mChecked
;
}
void
ConfigureAgentItem
::
setChecked
(
bool
checked
)
{
mChecked
=
checked
;
}
bool
ConfigureAgentItem
::
failed
()
const
{
return
mFailed
;
}
void
ConfigureAgentItem
::
setFailed
(
bool
failed
)
{
mFailed
=
failed
;
}
kmail/configuredialog/configureagents/configureagentitem.h
0 → 100644
View file @
b65d333d
/*
Copyright (c) 2015 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 CONFIGUREAGENTITEM_H
#define CONFIGUREAGENTITEM_H
#include <QString>
class
ConfigureAgentItem
{
public:
ConfigureAgentItem
();
~
ConfigureAgentItem
();
QString
agentName
()
const
;
void
setAgentName
(
const
QString
&
agentName
);
QString
description
()
const
;
void
setDescription
(
const
QString
&
description
);
QString
path
()
const
;
void
setPath
(
const
QString
&
path
);
QString
interfaceName
()
const
;
void
setInterfaceName
(
const
QString
&
interfaceName
);
bool
checked
()
const
;
void
setChecked
(
bool
checked
);
bool
failed
()
const
;
void
setFailed
(
bool
failed
);
private:
QString
mAgentName
;
QString
mDescription
;
QString
mPath
;
QString
mInterfaceName
;
bool
mChecked
;
bool
mFailed
;
};
Q_DECLARE_TYPEINFO
(
ConfigureAgentItem
,
Q_MOVABLE_TYPE
);
#endif // CONFIGUREAGENTITEM_H
kmail/configuredialog/configureagents/configureagentlistmodel.cpp
View file @
b65d333d
...
...
@@ -40,9 +40,7 @@ bool ConfigureAgentListModel::insertRows(int row, int count, const QModelIndex&
beginInsertRows
(
parent
,
row
,
row
+
count
-
1
);
for
(
int
i
=
0
;
i
<
count
;
++
i
)
{
AgentItem
info
;
info
.
checked
=
false
;
info
.
failed
=
false
;
ConfigureAgentItem
info
;
mAgentItems
.
insert
(
row
,
info
);
}
endInsertRows
();
...
...
@@ -59,22 +57,22 @@ bool ConfigureAgentListModel::setData(const QModelIndex& index, const QVariant&
switch
(
role
)
{
case
Qt
::
DisplayRole
:
mAgentItems
[
row
].
agentName
=
value
.
toString
(
);
mAgentItems
[
row
].
setAgentName
(
value
.
toString
()
);
break
;
case
DescriptionRole
:
mAgentItems
[
row
].
description
=
value
.
toString
(
);
mAgentItems
[
row
].
setDescription
(
value
.
toString
()
);
break
;
case
PathRole
:
mAgentItems
[
row
].
path
=
value
.
toString
(
);
mAgentItems
[
row
].
setPath
(
value
.
toString
()
);
break
;
case
InterfaceNameRole
:
mAgentItems
[
row
].
interfaceName
=
value
.
toString
(
);
mAgentItems
[
row
].
setInterfaceName
(
value
.
toString
()
);
break
;
case
FailedRole
:
mAgentItems
[
row
].
failed
=
value
.
toBool
(
);
mAgentItems
[
row
].
setFailed
(
value
.
toBool
()
);
break
;
case
Qt
::
CheckStateRole
:
mAgentItems
[
row
].
checked
=
value
.
toBool
(
);
mAgentItems
[
row
].
setChecked
(
value
.
toBool
()
);
break
;
default:
return
false
;
...
...
@@ -90,17 +88,17 @@ QVariant ConfigureAgentListModel::data(const QModelIndex& index, int role) const
if
(
row
<
rowCount
())
{
switch
(
role
)
{
case
Qt
::
DisplayRole
:
return
mAgentItems
[
row
].
agentName
;
return
mAgentItems
[
row
].
agentName
()
;
case
DescriptionRole
:
return
mAgentItems
[
row
].
description
;
return
mAgentItems
[
row
].
description
()
;
case
PathRole
:
return
mAgentItems
[
row
].
path
;
return
mAgentItems
[
row
].
path
()
;
case
InterfaceNameRole
:
return
mAgentItems
[
row
].
interfaceName
;
return
mAgentItems
[
row
].
interfaceName
()
;
case
FailedRole
:
return
mAgentItems
[
row
].
failed
;
return
mAgentItems
[
row
].
failed
()
;
case
Qt
::
CheckStateRole
:
return
mAgentItems
[
row
].
checked
;
return
mAgentItems
[
row
].
checked
()
;
default:
break
;
}
...
...
kmail/configuredialog/configureagents/configureagentlistmodel.h
View file @
b65d333d
...
...
@@ -20,7 +20,8 @@
#define CONFIGUREAGENTLISTMODEL_H
#include <QAbstractItemModel>
#include <QVector>
#include "configureagentitem.h"
class
ConfigureAgentListModel
:
public
QAbstractListModel
...
...
@@ -45,23 +46,7 @@ public:
virtual
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
;
private:
struct
AgentItem
{
AgentItem
()
:
checked
(
false
),
failed
(
false
)
{
}
QString
agentName
;
QString
description
;
QString
path
;
QString
interfaceName
;
bool
checked
;
bool
failed
;
};
QList
<
AgentItem
>
mAgentItems
;
QVector
<
ConfigureAgentItem
>
mAgentItems
;
};
#endif // CONFIGUREAGENTLISTMODEL_H
kmail/configuredialog/configureagents/configureagentlistview.cpp
View file @
b65d333d
...
...
@@ -16,11 +16,18 @@
*/
#include "configureagentlistview.h"
#include "configureagentlistdelegate.h"
#include "configureagentlistmodel.h"
ConfigureAgentListView
::
ConfigureAgentListView
(
QWidget
*
parent
)
:
QListView
(
parent
)
{
ConfigureAgentListDelegate
*
configureListDelegate
=
new
ConfigureAgentListDelegate
(
this
,
this
);
ConfigureAgentListModel
*
configureAgentListModel
=
new
ConfigureAgentListModel
(
this
);
setModel
(
configureAgentListModel
);
setItemDelegate
(
configureListDelegate
);
}
ConfigureAgentListView
::~
ConfigureAgentListView
()
...
...
kmail/tests/CMakeLists.txt
View file @
b65d333d
...
...
@@ -53,3 +53,10 @@ set(KDEPIMLIBS_RUN_SQLITE_ISOLATED_TESTS TRUE)
add_akonadi_isolated_test_advanced
(
followupreminderselectdatedialogtest.cpp
"../followupreminder/followupreminderselectdatedialog.cpp"
"
${
KDEPIMLIBS_AKONADI_CALENDAR_LIBS
}
;
${
KDEPIMLIBS_KCALCORE_LIBS
}
"
)
set
(
kmail_configureagentlistviewtest_source configureagentlistviewtest.cpp ../configuredialog/configureagents/configureagentitem.cpp
../configuredialog/configureagents/configureagentlistmodel.cpp ../configuredialog/configureagents/configureagentlistview.cpp
../configuredialog/configureagents/configureagentlistdelegate.cpp
)
kde4_add_unit_test
(
configureagentlistviewtest
${
kmail_configureagentlistviewtest_source
}
)
target_link_libraries
(
configureagentlistviewtest
${
QT_QTTEST_LIBRARY
}
${
KDE4_KDEUI_LIBS
}
)
kmail/tests/configureagentlistviewtest.cpp
0 → 100644
View file @
b65d333d
/*
Copyright (c) 2015 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 "configureagentlistviewtest.h"
#include <qtest_kde.h>
ConfigureAgentListViewTest
::
ConfigureAgentListViewTest
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
ConfigureAgentListViewTest
::~
ConfigureAgentListViewTest
()
{
}
QTEST_KDEMAIN
(
ConfigureAgentListViewTest
,
GUI
)
kmail/tests/configureagentlistviewtest.h
0 → 100644
View file @
b65d333d
/*
Copyright (c) 2015 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 CONFIGUREAGENTLISTVIEWTEST_H
#define CONFIGUREAGENTLISTVIEWTEST_H
#include <QObject>
class
ConfigureAgentListViewTest
:
public
QObject
{
Q_OBJECT
public:
explicit
ConfigureAgentListViewTest
(
QObject
*
parent
=
0
);
~
ConfigureAgentListViewTest
();
};
#endif // CONFIGUREAGENTLISTVIEWTEST_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