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
PIM
KAddressBook
Commits
f4a0c421
Commit
f4a0c421
authored
Jan 02, 2012
by
Allen Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CamelCase headers
coding style
parent
142a62e7
Changes
29
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
1468 additions
and
1112 deletions
+1468
-1112
aboutdata.cpp
aboutdata.cpp
+14
-14
aboutdata.h
aboutdata.h
+14
-15
contactfields.cpp
contactfields.cpp
+619
-449
contactfields.h
contactfields.h
+14
-14
contactselectiondialog.cpp
contactselectiondialog.cpp
+19
-19
contactselectiondialog.h
contactselectiondialog.h
+16
-16
contactselectionwidget.cpp
contactselectionwidget.cpp
+50
-38
contactsorter.cpp
contactsorter.cpp
+41
-26
contactsorter.h
contactsorter.h
+15
-14
contactswitcher.cpp
contactswitcher.cpp
+32
-27
globalcontactmodel.cpp
globalcontactmodel.cpp
+28
-26
globalcontactmodel.h
globalcontactmodel.h
+15
-15
grantleecontactformatter.cpp
grantleecontactformatter.cpp
+118
-43
grantleecontactformatter.h
grantleecontactformatter.h
+4
-4
grantleecontactgroupformatter.cpp
grantleecontactgroupformatter.cpp
+51
-28
grantleecontactgroupformatter.h
grantleecontactgroupformatter.h
+4
-4
kaddressbookpart.cpp
kaddressbookpart.cpp
+22
-22
kaddressbookpart.h
kaddressbookpart.h
+17
-17
main.cpp
main.cpp
+19
-18
mainwidget.cpp
mainwidget.cpp
+104
-89
mainwidget.h
mainwidget.h
+25
-25
mainwindow.cpp
mainwindow.cpp
+27
-24
mainwindow.h
mainwindow.h
+14
-14
modelcolumnmanager.cpp
modelcolumnmanager.cpp
+77
-48
modelcolumnmanager.h
modelcolumnmanager.h
+15
-15
quicksearchwidget.cpp
quicksearchwidget.cpp
+17
-18
quicksearchwidget.h
quicksearchwidget.h
+15
-15
xxportmanager.cpp
xxportmanager.cpp
+42
-35
xxportmanager.h
xxportmanager.h
+20
-20
No files found.
aboutdata.cpp
View file @
f4a0c421
/*
This file is part of KAddressBook.
This file is part of KAddressBook.
Copyright (c) 2009 Laurent Montel <montel@kde.org>
Copyright (c) 2009 Laurent Montel <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 as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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.
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.
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 "aboutdata.h"
#include "kdepim-version.h"
#include <
kl
ocale
.h
>
#include <
KL
ocale>
AboutData
::
AboutData
()
:
KAboutData
(
"kaddressbook"
,
0
,
ki18n
(
"KAddressBook"
),
...
...
aboutdata.h
View file @
f4a0c421
/*
This file is part of KAddressBook.
This file is part of KAddressBook.
Copyright (c) 2009 Laurent Montel <montel@kde.org>
Copyright (c) 2009 Laurent Montel <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 as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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.
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.
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 ABOUTDATA_H
...
...
@@ -23,7 +23,7 @@
#include "kaddressbook_export.h"
#include <
ka
bout
d
ata
.h
>
#include <
KA
bout
D
ata>
class
KADDRESSBOOK_EXPORT
AboutData
:
public
KAboutData
{
...
...
@@ -39,6 +39,5 @@ class KADDRESSBOOK_EXPORT AboutData : public KAboutData
~
AboutData
();
};
#endif
/* ABOUTDATA_H */
contactfields.cpp
View file @
f4a0c421
This diff is collapsed.
Click to expand it.
contactfields.h
View file @
f4a0c421
/*
This file is part of KAddressBook.
This file is part of KAddressBook.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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.
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.
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 CONTACTFIELDS_H
#define CONTACTFIELDS_H
#include <
kabc/a
ddressee
.h
>
#include <
KABC/A
ddressee>
class
ContactFields
{
...
...
contactselectiondialog.cpp
View file @
f4a0c421
/*
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "contactselectiondialog.h"
#include "contactselectionwidget.h"
#include <
kl
ocale
.h
>
#include <
KL
ocale>
ContactSelectionDialog
::
ContactSelectionDialog
(
QItemSelectionModel
*
selectionModel
,
QWidget
*
parent
)
ContactSelectionDialog
::
ContactSelectionDialog
(
QItemSelectionModel
*
selectionModel
,
QWidget
*
parent
)
:
KDialog
(
parent
)
{
setCaption
(
i18n
(
"Select Contacts"
)
);
...
...
contactselectiondialog.h
View file @
f4a0c421
/*
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef CONTACTSELECTIONDIALOG_H
#define CONTACTSELECTIONDIALOG_H
#include <
kabc/a
ddressee
.h
>
#include <
kd
ialog
.h
>
#include <
KABC/A
ddressee>
#include <
KD
ialog>
class
ContactSelectionWidget
;
...
...
@@ -29,7 +29,7 @@ class QItemSelectionModel;
namespace
Akonadi
{
class
Collection
;
class
Collection
;
}
/**
...
...
contactselectionwidget.cpp
View file @
f4a0c421
/*
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "contactselectionwidget.h"
#include <akonadi/collectioncombobox.h>
#include <akonadi/entitytreemodel.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/recursiveitemfetchjob.h>
#include <klocale.h>
#include <Akonadi/CollectionComboBox>
#include <Akonadi/EntityTreeModel>
#include <Akonadi/ItemFetchJob>
#include <Akonadi/ItemFetchScope>
#include <Akonadi/RecursiveItemFetchJob>
#include <KLocale>
#include <QtGui/QButtonGroup>
#include <QtGui/QCheckBox>
...
...
@@ -35,7 +36,8 @@
#include <QtGui/QRadioButton>
#include <QtGui/QVBoxLayout>
ContactSelectionWidget
::
ContactSelectionWidget
(
QItemSelectionModel
*
selectionModel
,
QWidget
*
parent
)
ContactSelectionWidget
::
ContactSelectionWidget
(
QItemSelectionModel
*
selectionModel
,
QWidget
*
parent
)
:
QWidget
(
parent
),
mSelectionModel
(
selectionModel
)
{
initGui
();
...
...
@@ -50,10 +52,11 @@ ContactSelectionWidget::ContactSelectionWidget( QItemSelectionModel *selectionMo
mAddressBookSelectionRecursive
,
SLOT
(
setEnabled
(
bool
))
);
// apply default configuration
if
(
mSelectionModel
->
hasSelection
()
)
if
(
mSelectionModel
->
hasSelection
()
)
{
mSelectedContactsButton
->
setChecked
(
true
);
else
}
else
{
mAllContactsButton
->
setChecked
(
true
);
}
}
void
ContactSelectionWidget
::
setMessageText
(
const
QString
&
message
)
...
...
@@ -68,12 +71,13 @@ void ContactSelectionWidget::setDefaultAddressBook( const Akonadi::Collection &a
KABC
::
Addressee
::
List
ContactSelectionWidget
::
selectedContacts
()
const
{
if
(
mAllContactsButton
->
isChecked
()
)
if
(
mAllContactsButton
->
isChecked
()
)
{
return
collectAllContacts
();
else
if
(
mSelectedContactsButton
->
isChecked
()
)
}
else
if
(
mSelectedContactsButton
->
isChecked
()
)
{
return
collectSelectedContacts
();
else
if
(
mAddressBookContactsButton
->
isChecked
()
)
}
else
if
(
mAddressBookContactsButton
->
isChecked
()
)
{
return
collectAddressBookContacts
();
}
return
KABC
::
Addressee
::
List
();
}
...
...
@@ -121,17 +125,20 @@ void ContactSelectionWidget::initGui()
KABC
::
Addressee
::
List
ContactSelectionWidget
::
collectAllContacts
()
const
{
Akonadi
::
RecursiveItemFetchJob
*
job
=
new
Akonadi
::
RecursiveItemFetchJob
(
Akonadi
::
Collection
::
root
(),
QStringList
()
<<
KABC
::
Addressee
::
mimeType
()
);
Akonadi
::
RecursiveItemFetchJob
*
job
=
new
Akonadi
::
RecursiveItemFetchJob
(
Akonadi
::
Collection
::
root
(),
QStringList
()
<<
KABC
::
Addressee
::
mimeType
()
);
job
->
fetchScope
().
fetchFullPayload
();
KABC
::
Addressee
::
List
contacts
;
if
(
!
job
->
exec
()
)
if
(
!
job
->
exec
()
)
{
return
contacts
;
}
foreach
(
const
Akonadi
::
Item
&
item
,
job
->
items
()
)
{
if
(
item
.
isValid
()
&&
item
.
hasPayload
<
KABC
::
Addressee
>
()
)
if
(
item
.
isValid
()
&&
item
.
hasPayload
<
KABC
::
Addressee
>
()
)
{
contacts
.
append
(
item
.
payload
<
KABC
::
Addressee
>
()
);
}
}
return
contacts
;
...
...
@@ -145,9 +152,11 @@ KABC::Addressee::List ContactSelectionWidget::collectSelectedContacts() const
for
(
int
i
=
0
;
i
<
indexes
.
count
();
++
i
)
{
const
QModelIndex
index
=
indexes
.
at
(
i
);
if
(
index
.
isValid
()
)
{
const
Akonadi
::
Item
item
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
if
(
item
.
isValid
()
&&
item
.
hasPayload
<
KABC
::
Addressee
>
()
)
const
Akonadi
::
Item
item
=
index
.
data
(
Akonadi
::
EntityTreeModel
::
ItemRole
).
value
<
Akonadi
::
Item
>
();
if
(
item
.
isValid
()
&&
item
.
hasPayload
<
KABC
::
Addressee
>
()
)
{
contacts
.
append
(
item
.
payload
<
KABC
::
Addressee
>
()
);
}
}
}
...
...
@@ -164,12 +173,14 @@ KABC::Addressee::List ContactSelectionWidget::collectAddressBookContacts() const
}
if
(
mAddressBookSelectionRecursive
->
isChecked
()
)
{
Akonadi
::
RecursiveItemFetchJob
*
job
=
new
Akonadi
::
RecursiveItemFetchJob
(
collection
,
QStringList
()
<<
KABC
::
Addressee
::
mimeType
()
);
Akonadi
::
RecursiveItemFetchJob
*
job
=
new
Akonadi
::
RecursiveItemFetchJob
(
collection
,
QStringList
()
<<
KABC
::
Addressee
::
mimeType
()
);
job
->
fetchScope
().
fetchFullPayload
();
if
(
!
job
->
exec
()
)
if
(
!
job
->
exec
()
)
{
return
contacts
;
}
foreach
(
const
Akonadi
::
Item
&
item
,
job
->
items
()
)
{
if
(
item
.
hasPayload
<
KABC
::
Addressee
>
()
)
{
...
...
@@ -180,8 +191,9 @@ KABC::Addressee::List ContactSelectionWidget::collectAddressBookContacts() const
Akonadi
::
ItemFetchJob
*
job
=
new
Akonadi
::
ItemFetchJob
(
collection
);
job
->
fetchScope
().
fetchFullPayload
();
if
(
!
job
->
exec
()
)
if
(
!
job
->
exec
()
)
{
return
contacts
;
}
foreach
(
const
Akonadi
::
Item
&
item
,
job
->
items
()
)
{
if
(
item
.
hasPayload
<
KABC
::
Addressee
>
()
)
{
...
...
contactsorter.cpp
View file @
f4a0c421
/*
This file is part of KAddressBook.
This file is part of KAddressBook.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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.
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.
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 "contactsorter.h"
#include <
kabc/a
ddressee
.h
>
#include <
KABC/A
ddressee>
class
ContactSortHelper
{
...
...
@@ -30,29 +30,44 @@ class ContactSortHelper
{
}
inline
bool
operator
()(
const
KABC
::
Addressee
&
contact
,
const
KABC
::
Addressee
&
otherContact
)
const
inline
bool
operator
()(
const
KABC
::
Addressee
&
contact
,
const
KABC
::
Addressee
&
otherContact
)
const
{
int
result
=
QString
::
localeAwareCompare
(
ContactFields
::
value
(
mSortField
,
contact
),
ContactFields
::
value
(
mSortField
,
otherContact
)
);
int
result
=
QString
::
localeAwareCompare
(
ContactFields
::
value
(
mSortField
,
contact
),
ContactFields
::
value
(
mSortField
,
otherContact
)
);
if
(
result
==
0
)
{
int
givenNameResult
=
QString
::
localeAwareCompare
(
ContactFields
::
value
(
ContactFields
::
GivenName
,
contact
),
ContactFields
::
value
(
ContactFields
::
GivenName
,
otherContact
)
);
int
givenNameResult
=
QString
::
localeAwareCompare
(
ContactFields
::
value
(
ContactFields
::
GivenName
,
contact
),
ContactFields
::
value
(
ContactFields
::
GivenName
,
otherContact
)
);
if
(
givenNameResult
==
0
)
{
int
familyNameResult
=
QString
::
localeAwareCompare
(
ContactFields
::
value
(
ContactFields
::
FamilyName
,
contact
),
ContactFields
::
value
(
ContactFields
::
FamilyName
,
otherContact
)
);
int
familyNameResult
=
QString
::
localeAwareCompare
(
ContactFields
::
value
(
ContactFields
::
FamilyName
,
contact
),
ContactFields
::
value
(
ContactFields
::
FamilyName
,
otherContact
)
);
if
(
familyNameResult
==
0
)
{
result
=
QString
::
localeAwareCompare
(
ContactFields
::
value
(
ContactFields
::
FormattedName
,
contact
),
ContactFields
::
value
(
ContactFields
::
FormattedName
,
otherContact
)
);
}
else
result
=
QString
::
localeAwareCompare
(
ContactFields
::
value
(
ContactFields
::
FormattedName
,
contact
),
ContactFields
::
value
(
ContactFields
::
FormattedName
,
otherContact
)
);
}
else
{
result
=
familyNameResult
;
}
else
}
}
else
{
result
=
givenNameResult
;
}
}
bool
lesser
=
result
<
0
;
if
(
mSortOrder
==
Qt
::
DescendingOrder
)
if
(
mSortOrder
==
Qt
::
DescendingOrder
)
{
lesser
=
!
lesser
;
}
return
lesser
;
}
...
...
contactsorter.h
View file @
f4a0c421
/*
This file is part of KAddressBook.
This file is part of KAddressBook.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
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.
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.
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 CONTACTSORTER_H
...
...
@@ -26,7 +26,8 @@
class
ContactSorter
{
public:
explicit
ContactSorter
(
ContactFields
::
Field
field
,
Qt
::
SortOrder
sortOrder
=
Qt
::
AscendingOrder
);
explicit
ContactSorter
(
ContactFields
::
Field
field
,
Qt
::
SortOrder
sortOrder
=
Qt
::
AscendingOrder
);
void
sort
(
QList
<
KABC
::
Addressee
>
&
contacts
)
const
;
...
...
contactswitcher.cpp
View file @
f4a0c421
/*
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "contactswitcher.h"
#include <
kl
ocale
.h
>
#include <
KL
ocale>
#include <QtGui/QAbstractItemView>
#include <QtGui/QHBoxLayout>
...
...
@@ -27,8 +27,7 @@
#include <QtGui/QPushButton>
ContactSwitcher
::
ContactSwitcher
(
QWidget
*
parent
)
:
QWidget
(
parent
),
mView
(
0
)
:
QWidget
(
parent
),
mView
(
0
)
{
QHBoxLayout
*
layout
=
new
QHBoxLayout
(
this
);
...
...
@@ -60,14 +59,16 @@ void ContactSwitcher::setView( QAbstractItemView *view )
void
ContactSwitcher
::
nextClicked
()
{
if
(
!
mView
||
!
mView
->
model
()
)
if
(
!
mView
||
!
mView
->
model
()
)
{
return
;
}
const
QModelIndex
index
=
mView
->
selectionModel
()
->
currentIndex
();
int
row
=
0
;
if
(
index
.
isValid
()
)
if
(
index
.
isValid
()
)
{
row
=
index
.
row
()
+
1
;
}
mView
->
selectionModel
()
->
setCurrentIndex
(
mView
->
model
()
->
index
(
row
,
0
),
QItemSelectionModel
::
Rows
|
...
...
@@ -78,14 +79,16 @@ void ContactSwitcher::nextClicked()
void
ContactSwitcher
::
previousClicked
()
{
if
(
!
mView
||
!
mView
->
model
()
)
if
(
!
mView
||
!
mView
->
model
()
)
{
return
;
}
const
QModelIndex
index
=
mView
->
selectionModel
()
->
currentIndex
();
int
row
=
0
;
if
(
index
.
isValid
()
)
if
(
index
.
isValid
()
)
{
row
=
index
.
row
()
-
1
;