Commit 789f0a40 authored by Allen Winter's avatar Allen Winter

various - cleanup and use camelcase headers. minor styling

parent 72e48c73
set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
include_directories(
../
)
include_directories(${CMAKE_SOURCE_DIR}/src)
set(grant_lib KGantt)
MACRO(IE_UNIT_TESTS)
FOREACH(_testname ${ARGN})
add_executable( ${_testname} ${_testname}.cpp modeltest.cpp )
add_test(NAME ${_testname} COMMAND ${_testname} )
macro(IE_UNIT_TESTS)
foreach(_testname ${ARGN})
add_executable(${_testname} ${_testname}.cpp modeltest.cpp)
add_test(NAME ${_testname} COMMAND ${_testname})
ecm_mark_as_test(${_testname})
target_link_libraries(${_testname} Qt5::Test KF5::AkonadiCore ${grant_lib} KF5::CalendarUtils KF5::CalendarCore KF5::IncidenceEditor KF5::KdepimDBusInterfaces KF5::Libkdepim)
ENDFOREACH(_testname)
ENDMACRO(IE_UNIT_TESTS)
MACRO(IE_EXECUTABLE_TESTS)
FOREACH(_testname ${ARGN})
target_link_libraries(${_testname}
Qt5::Test
KF5::AkonadiCore
${grant_lib}
KF5::CalendarUtils
KF5::CalendarCore
KF5::IncidenceEditor
KF5::KdepimDBusInterfaces
KF5::Libkdepim
)
endforeach()
endmacro()
macro(IE_EXECUTABLE_TESTS)
foreach(_testname ${ARGN})
add_executable(${_testname} NOGUI TEST ${_testname}.cpp modeltest.cpp)
target_link_libraries(${_testname} KF5::CalendarCore Qt5::Test KF5::IncidenceEditor)
ENDFOREACH(_testname)
ENDMACRO(IE_EXECUTABLE_TESTS)
target_link_libraries(${_testname} KF5::CalendarCore Qt5::Test KF5::IncidenceEditor)
endforeach()
endmacro()
IE_UNIT_TESTS(
ie_unit_tests(
conflictresolvertest
testfreebusyganttproxymodel
)
......@@ -35,8 +41,7 @@ add_executable(ktimezonecomboboxtest ${ktimezonecomboboxtest_SRCS})
add_test(NAME ktimezonecomboboxtest COMMAND ktimezonecomboboxtest)
ecm_mark_as_test(ktimezonecomboboxtest)
target_link_libraries(
ktimezonecomboboxtest
target_link_libraries(ktimezonecomboboxtest
KF5::CalendarCore
Qt5::Test
KF5::IncidenceEditor
......
......@@ -19,15 +19,14 @@
*/
#include "conflictresolvertest.h"
#include "../src/conflictresolver.h"
#include "conflictresolver.h"
#include <KCalCore/Event>
#include <KCalCore/Period>
#include <KCalCore/Duration>
#include <QWidget>
#include <qtest.h>
#include <QTest>
using namespace IncidenceEditorNG;
......@@ -97,7 +96,6 @@ void ConflictResolverTest::simpleTest()
//free block doesn't start until
//the next timeslot
QCOMPARE(second.end(), end);
}
void ConflictResolverTest::stillPrettySimpleTest()
......@@ -336,4 +334,3 @@ void ConflictResolverTest::testPeriodEndsAtSametimeAsTimeframe()
}
QTEST_MAIN(ConflictResolverTest)
......@@ -19,17 +19,18 @@
*/
#include "testfreebusyganttproxymodel.h"
#include "freebusyganttproxymodel.h"
#include "modeltest.h"
#include "CalendarSupport/FreeBusyItem"
#include "CalendarSupport/FreeBusyItemModel"
#include "../src/freebusyganttproxymodel.h"
#include <CalendarSupport/FreeBusyItem>
#include <CalendarSupport/FreeBusyItemModel>
#include <KGantt/KGanttGraphicsView>
#include <KCalCore/Attendee>
#include <qtest.h>
#include <QTest>
QTEST_MAIN(FreeBusyGanttProxyModelTest)
using namespace IncidenceEditorNG;
void FreeBusyGanttProxyModelTest::testModelValidity()
......@@ -85,7 +86,6 @@ void FreeBusyGanttProxyModelTest::testModelValidity()
QCOMPARE(parent1.data(), source_parent1.data());
QCOMPARE(parent1.data(KGantt::ItemTypeRole).toInt(), (int) KGantt::TypeMulti);
QModelIndex child0_0 = ganttModel->index(0, 0, parent0);
QModelIndex child0_1 = ganttModel->index(1, 0, parent0);
QVERIFY(child0_0.isValid());
......@@ -105,6 +105,4 @@ void FreeBusyGanttProxyModelTest::testModelValidity()
QCOMPARE(child1_0.data(KGantt::StartTimeRole).value<QDateTime>(), dt3.dateTime());
QCOMPARE(child1_1.data(KGantt::ItemTypeRole).toInt(), (int) KGantt::TypeTask);
QCOMPARE(child1_1.data(KGantt::StartTimeRole).value<QDateTime>(), dt4.dateTime());
}
......@@ -17,11 +17,12 @@ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "../src/individualmaildialog.h"
#include "individualmaildialog.h"
#include <KGuiItem>
#include <QObject>
#include <qtest.h>
#include <QTest>
using namespace IncidenceEditorNG;
......@@ -35,9 +36,12 @@ private Q_SLOTS:
KGuiItem buttonYes = KGuiItem(QStringLiteral("Send Email"));
KGuiItem buttonNo = KGuiItem(QStringLiteral("Do not send"));
KCalCore::Attendee::Ptr attendee1(new KCalCore::Attendee(QStringLiteral("test1"), QStringLiteral("test1@example.com")));
KCalCore::Attendee::Ptr attendee2(new KCalCore::Attendee(QStringLiteral("test2"), QStringLiteral("test2@example.com")));
KCalCore::Attendee::Ptr attendee3(new KCalCore::Attendee(QStringLiteral("test3"), QStringLiteral("test3@example.com")));
KCalCore::Attendee::Ptr attendee1(new KCalCore::Attendee(QStringLiteral("test1"),
QStringLiteral("test1@example.com")));
KCalCore::Attendee::Ptr attendee2(new KCalCore::Attendee(QStringLiteral("test2"),
QStringLiteral("test2@example.com")));
KCalCore::Attendee::Ptr attendee3(new KCalCore::Attendee(QStringLiteral("test3"),
QStringLiteral("test3@example.com")));
attendees << attendee1 << attendee2 << attendee3;
......@@ -48,9 +52,12 @@ private Q_SLOTS:
// Just make sure, that the QCombobox is sorted like we think
QComboBox *first = dialog.mAttendeeDecision[attendees[0]];
QCOMPARE((IndividualMailDialog::Decisions)first->itemData(0, Qt::UserRole).toInt(), IndividualMailDialog::Update);
QCOMPARE((IndividualMailDialog::Decisions)first->itemData(1, Qt::UserRole).toInt(), IndividualMailDialog::NoUpdate);
QCOMPARE((IndividualMailDialog::Decisions)first->itemData(2, Qt::UserRole).toInt(), IndividualMailDialog::Edit);
QCOMPARE((IndividualMailDialog::Decisions)first->itemData(0, Qt::UserRole).toInt(),
IndividualMailDialog::Update);
QCOMPARE((IndividualMailDialog::Decisions)first->itemData(1, Qt::UserRole).toInt(),
IndividualMailDialog::NoUpdate);
QCOMPARE((IndividualMailDialog::Decisions)first->itemData(2, Qt::UserRole).toInt(),
IndividualMailDialog::Edit);
// No update for first attendee, other default
first->setCurrentIndex(1);
......
......@@ -19,11 +19,11 @@
#include "attendeetablemodel.h"
#include <klocalizedstring.h>
#include <KCalCore/Attendee>
#include <KEmailAddress>
#include <KLocalizedString>
using namespace IncidenceEditorNG;
AttendeeTableModel::AttendeeTableModel(const KCalCore::Attendee::List &attendees, QObject *parent)
......
......@@ -22,9 +22,10 @@
#include "incidencedefaults.h"
#include "alarmpresets.h"
#include "incidenceeditor_debug.h"
#include <CalendarSupport/KCalPrefs>
#include <akonadi/calendar/calendarsettings.h>
#include <akonadi/calendar/calendarsettings.h> //krazy:exclude=camelcase this is a generated file
#include <KContacts/Addressee>
......@@ -34,9 +35,9 @@
#include <KCalCore/Alarm>
#include <KEmailAddress>
#include <KIO/Job>
#include <KIO/StoredTransferJob>
#include "incidenceeditor_debug.h"
#include <KLocalizedString>
#include <QUrl>
......@@ -151,8 +152,8 @@ void IncidenceDefaultsPrivate::eventDefaults(const KCalCore::Event::Ptr &event)
}
const QTime defaultDurationTime = KCalPrefs::instance()->defaultDuration().time();
const int defaultDuration = defaultDurationTime.hour() * 3600
+defaultDurationTime.minute() * 60;
const int defaultDuration = (defaultDurationTime.hour() * 3600) +
(defaultDurationTime.minute() * 60);
const KDateTime endDT = mEndDt.isValid() ? mEndDt : startDT.addSecs(defaultDuration);
......@@ -194,8 +195,8 @@ void IncidenceDefaultsPrivate::todoDefaults(const KCalCore::Todo::Ptr &todo) con
todo->setDtStart(mStartDt);
} else if (relatedTodo && !relatedTodo->hasStartDate()) {
todo->setDtStart(KDateTime());
} else if (relatedTodo && relatedTodo->hasStartDate()
&& relatedTodo->dtStart() <= todo->dtDue()) {
} else if (relatedTodo && relatedTodo->hasStartDate() &&
relatedTodo->dtStart() <= todo->dtDue()) {
todo->setDtStart(relatedTodo->dtStart());
todo->setAllDay(relatedTodo->allDay());
} else if (!mEndDt.isValid() || (KDateTime::currentLocalDateTime() < mEndDt)) {
......
......@@ -19,12 +19,13 @@
#include "opencomposerjob.h"
#include <QObject>
#include <QtDBus>
#include <QProcess>
#include <KDBusServiceStarter>
#include <KLocalizedString>
#include <klocalizedstring.h>
#include <kdbusservicestarter.h>
#include <QDBusConnectionInterface>
#include <QDBusInterface>
#include <QProcess>
#include <QTimer>
using namespace IncidenceEditorNG;
......
......@@ -20,10 +20,11 @@
#ifndef INCIDENCEEDITOR_OPENCOMPOSERJOB_H
#define INCIDENCEEDITOR_OPENCOMPOSERJOB_H
#include <KIdentityManagement/Identity>
#include <kmime/kmime_message.h>
#include <KMime/Message>
#include <KIdentityManagement/Identity>
#include <KJob>
namespace IncidenceEditorNG {
// Opens a Composer with a mail with one attachment (costructed my ITIPHandler)
class OpenComposerJob : public KJob
......
......@@ -20,7 +20,7 @@
*/
#include "resourceitem.h"
#include <kldap/ldapserver.h>
#include <KLDAP/LdapServer>
using namespace IncidenceEditorNG;
......@@ -151,9 +151,10 @@ const KLDAP::LdapClient &ResourceItem::ldapClient() const
return mLdapClient;
}
void ResourceItem::slotLDAPResult(const KLDAP::LdapClient & /*client*/,
void ResourceItem::slotLDAPResult(const KLDAP::LdapClient &client,
const KLDAP::LdapObject &obj)
{
Q_UNUSED(client);
mLdapObject = obj;
for (const QString &header : qAsConst(mAttrs)) {
if (!obj.attributes()[header].isEmpty()) {
......
......@@ -22,17 +22,15 @@
#ifndef RESOURCEITEM_H
#define RESOURCEITEM_H
#include <QList>
#include <QMetaType>
#include <Libkdepim/LdapClient>
#include <KLDAP/LdapObject>
#include <QSharedPointer>
#include <QObject>
#include <QStringList>
#include <QVariant>
#include <QVector>
#include <Libkdepim/LdapClient>
#include <kldap/ldapobject.h>
namespace IncidenceEditorNG {
class ResourceItem : public QObject
{
......
......@@ -29,14 +29,17 @@
#include "freebusyganttproxymodel.h"
#include <Akonadi/Calendar/FreeBusyManager>
#include <EventViews/AgendaView>
#include <EventViews/ViewCalendar>
#include <KCalCore/Event>
#include <KCalCore/MemoryCalendar>
#include <KGantt/KGanttGraphicsView>
#include <akonadi/calendar/freebusymanager.h>
#include <kldap/ldapobject.h>
#include <KLDAP/LdapObject>
#include <KLocalizedString>
#include <KSharedConfig>
......@@ -276,10 +279,10 @@ void ResourceManagement::slotOwnerSearchFinished()
const KLDAP::LdapAttrMap &ldapAttrMap = obj.attributes();
for (auto it = ldapAttrMap.cbegin(), end = ldapAttrMap.cend(); it != end; ++it) {
const QString &key = it.key();
if (key == QStringLiteral("objectClass")
|| key == QStringLiteral("owner")
|| key == QStringLiteral("givenname")
|| key == QStringLiteral("sn")) {
if (key == QStringLiteral("objectClass") ||
key == QStringLiteral("owner") ||
key == QStringLiteral("givenname") ||
key == QStringLiteral("sn")) {
continue;
}
QStringList list;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment