Commit 57ac3213 authored by Allen Winter's avatar Allen Winter
Browse files

minor coding style

more camelcase headers
minor comment fixes
parent 10bcd816
/*
This file is part of the KOrganizer reminder daemon.
This file is part of the KDE reminder agent.
Copyright (c) 2000,2003 Cornelius Schumacher <schumacher@kde.org>
Copyright (c) 2008-2009 Allen Winter <winter@kde.org>
......
/*
This file is part of the KDE reminder daemon.
This file is part of the KDE reminder agent.
Copyright (c) 2000 Cornelius Schumacher <schumacher@kde.org>
......@@ -21,8 +21,8 @@
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef ALARMDIALOG_H
#define ALARMDIALOG_H
#ifndef KORGAC_ALARMDIALOG_H
#define KORGAC_ALARMDIALOG_H
#include <Akonadi/Item>
......@@ -54,7 +54,6 @@ class QVBoxLayout;
class AlarmDialog : public KDialog
{
Q_OBJECT
public:
explicit AlarmDialog( CalendarSupport::Calendar *calendar, QWidget *parent = 0 );
......@@ -97,7 +96,7 @@ class AlarmDialog : public KDialog
protected:
void keyPressEvent( QKeyEvent *e );
void closeEvent( QCloseEvent * );
private:
static KDateTime triggerDateForIncidence( const KCalCore::Incidence::Ptr &inc,
const QDateTime &reminderAt,
......
/*
This file is part of KOrganizer.
This file is part of the KDE reminder agent.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
Copyright (c) 2008-2009 Allen Winter <winter@kde.org>
......
/*
This file is part of KOrganizer.
This file is part of the KDE reminder agent.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
Copyright (c) 2008-2009 Allen Winter <winter@kde.org>
......@@ -22,8 +22,8 @@
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef ALARMDOCKWINDOW_H
#define ALARMDOCKWINDOW_H
#ifndef KORGAC_ALARMDOCKWINDOW_H
#define KORGAC_ALARMDOCKWINDOW_H
#include <KStatusNotifierItem>
......
/*
KOrganizer Alarm Daemon Client.
This file is part of KOrganizer.
This file is part of the KDE reminder agent.
Copyright (c) 2002,2003 Cornelius Schumacher <schumacher@kde.org>
......@@ -34,18 +32,18 @@
#endif
#include "korgacadaptor.h"
#include <calendarsupport/calendar.h>
#include <calendarsupport/calendarmodel.h>
#include <calendarsupport/utils.h>
#include <Akonadi/Item>
#include <Akonadi/ChangeRecorder>
#include <Akonadi/Session>
#include <Akonadi/Collection>
#include <Akonadi/ItemFetchScope>
#include <akonadi/dbusconnectionpool.h>
#include <akonadi/dbusconnectionpool.h> // fix when forwarding header is there
#include <calendarsupport/calendar.h>
#include <calendarsupport/calendarmodel.h>
#include <calendarsupport/utils.h>
#include <kcalcore/calendar.h>
#include <KCalCore/Calendar>
#include <KApplication>
#include <KConfig>
......@@ -83,7 +81,9 @@ KOAlarmClient::KOAlarmClient( QObject *parent )
monitor->itemFetchScope().fetchFullPayload( true );
monitor->setCollectionMonitored( Akonadi::Collection::root() );
monitor->fetchCollection( true );
monitor->setMimeTypeMonitored( "text/calendar", true ); // FIXME: this one should not be needed, in fact it might cause the inclusion of free/busy, notes or other unwanted stuff
monitor->setMimeTypeMonitored( "text/calendar", true ); // FIXME: this one should not be needed,
// in fact it might cause the inclusion of
// free/busy, notes or other unwanted junk
monitor->setMimeTypeMonitored( KCalCore::Event::eventMimeType(), true );
monitor->setMimeTypeMonitored( KCalCore::Todo::todoMimeType(), true );
monitor->setMimeTypeMonitored( KCalCore::Journal::journalMimeType(), true );
......@@ -93,14 +93,19 @@ KOAlarmClient::KOAlarmClient( QObject *parent )
KDescendantsProxyModel *flattener = new KDescendantsProxyModel(this);
flattener->setSourceModel( mCalendarModel );
mCalendar = new CalendarSupport::Calendar( mCalendarModel, flattener,
zone.isValid() ? KDateTime::Spec( zone ) : KDateTime::ClockTime );
mCalendar =
new CalendarSupport::Calendar( mCalendarModel, flattener,
zone.isValid() ?
KDateTime::Spec( zone ) :
KDateTime::ClockTime );
mCalendar->setObjectName( "KOrgac's calendar" );
connect( &mCheckTimer, SIGNAL(timeout()), SLOT(checkAlarms()) );
connect( mCalendarModel, SIGNAL(collectionPopulated(Akonadi::Collection::Id)), SLOT(checkAlarms()) );
connect( mCalendarModel, SIGNAL(collectionTreeFetched(Akonadi::Collection::List)), SLOT(checkAlarms()) );
connect( mCalendarModel, SIGNAL(collectionPopulated(Akonadi::Collection::Id)),
SLOT(checkAlarms()) );
connect( mCalendarModel, SIGNAL(collectionTreeFetched(Akonadi::Collection::List)),
SLOT(checkAlarms()) );
KConfigGroup alarmGroup( KGlobal::config(), "Alarms" );
const int interval = alarmGroup.readEntry( "Interval", 60 );
......@@ -129,7 +134,8 @@ KOAlarmClient::KOAlarmClient( QObject *parent )
if ( akonadiItemId >= 0 ) {
const QDateTime dt = incGroup.readEntry( "RemindAt", QDateTime() );
Akonadi::Item i = mCalendar->incidence( Akonadi::Item::fromUrl( url ).id() );
if ( CalendarSupport::hasIncidence( i ) && !CalendarSupport::incidence( i )->alarms().isEmpty() ) {
if ( CalendarSupport::hasIncidence( i ) &&
!CalendarSupport::incidence( i )->alarms().isEmpty() ) {
createReminder( mCalendar, i, dt, QString() );
}
}
......@@ -167,8 +173,8 @@ void KOAlarmClient::checkAlarms()
return;
}
// We do not want to miss any reminders, so don't perform check unless the list of collections is available.
// We do not want to miss any reminders, so don't perform check unless
// the list of collections is available.
if ( !mCalendarModel->isCollectionTreeFetched() ) {
kDebug(5891) << "CollectionTree has not been fetched yet; aborting check.";
return;
......@@ -179,13 +185,14 @@ void KOAlarmClient::checkAlarms()
for ( int row = 0; row < rowCount; ++row ) {
static const int column = 0;
const QModelIndex index = mCalendarModel->index( row, column );
if ( !mCalendarModel->data( index, CalendarSupport::CalendarModel::IsPopulatedRole ).toBool() ) {
bool haveData =
mCalendarModel->data( index, CalendarSupport::CalendarModel::IsPopulatedRole ).toBool();
if ( !haveData ) {
kDebug(5891) << "Collections have not been populated yet; aborting check.";
return;
}
}
QDateTime from = mLastChecked.addSecs( 1 );
mLastChecked = QDateTime::currentDateTime();
......@@ -193,7 +200,7 @@ void KOAlarmClient::checkAlarms()
const Alarm::List alarms = mCalendar->alarms( KDateTime( from, KDateTime::LocalZone ),
KDateTime( mLastChecked, KDateTime::LocalZone ),
true /* exclude blocked alarms */ );
true /* exclude blocked alarms */);
foreach ( const Alarm::Ptr &alarm, alarms ) {
const QString uid = alarm->parentUid();
......@@ -238,7 +245,7 @@ void KOAlarmClient::createReminder( CalendarSupport::Calendar *calendar,
#if defined(Q_WS_MAEMO_5)
QMaemo5InformationBox::information( 0, incidence->summary(), QMaemo5InformationBox::NoTimeout );
#else
KNotification *notify = new KNotification( "reminder", 0L, KNotification::Persistent );
KNotification *notify = new KNotification( "reminder", 0, KNotification::Persistent );
notify->setText( incidence->summary() );
notify->sendEvent();
#endif
......@@ -303,9 +310,10 @@ QStringList KOAlarmClient::dumpAlarms()
end.toString();
Alarm::List alarms = mCalendar->alarms( start, end );
foreach( Alarm::Ptr a, alarms ) {
foreach ( Alarm::Ptr a, alarms ) {
const Akonadi::Item::Id itemId = mCalendar->itemIdForIncidenceUid( a->parentUid() );
const Incidence::Ptr parentIncidence = CalendarSupport::incidence( mCalendar->incidence( itemId ) );
const Incidence::Ptr parentIncidence =
CalendarSupport::incidence( mCalendar->incidence( itemId ) );
lst << QString( " " ) + parentIncidence->summary() + " (" + a->time().toString() + ')';
}
......
/*
KOrganizer Alarm Daemon Client.
This file is part of KOrganizer.
This file is part of the KDE reminder agent.
Copyright (c) 2002,2003 Cornelius Schumacher <schumacher@kde.org>
......@@ -23,8 +21,8 @@
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOALARMCLIENT_H
#define KOALARMCLIENT_H
#ifndef KORGAC_KOALARMCLIENT_H
#define KORGAC_KOALARMCLIENT_H
#ifndef _WIN32_WCE
#include <KSessionManager>
......
/*
Copyright (c) 2010 Volker Krause <vkrause@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.
This file is part of the KDE reminder agent.
Copyright (c) 2010 Volker Krause <vkrause@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 "korgacagent.h"
#include "koalarmclient.h"
#include <akonadi/agentfactory.h>
#include <Akonadi/AgentFactory>
#include <KLocale>
using namespace Akonadi;
KorgacAgent::KorgacAgent(const QString& id) :
AgentBase(id),
m_alarmClient( new KOAlarmClient )
KorgacAgent::KorgacAgent( const QString &id )
: AgentBase( id ),
m_alarmClient( new KOAlarmClient )
{
KGlobal::locale()->insertCatalog( "korganizer" );
}
......
/*
Copyright (c) 2010 Volker Krause <vkrause@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.
This file is part of the KDE reminder agent.
Copyright (c) 2010 Volker Krause <vkrause@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.
*/
#ifndef AKONADI_KORGAC_AGENT_H
#define AKONADI_KORGAC_AGENT_H
#ifndef KORGAC_KORGACAGENT_H
#define KORGAC_KORGACAGENT_H
#include <akonadi/agentbase.h>
#include <Akonadi/AgentBase>
class KOAlarmClient;
......@@ -31,11 +33,11 @@ class KorgacAgent : public AgentBase, public AgentBase::ObserverV2
Q_OBJECT
public:
KorgacAgent(const QString& id);
KorgacAgent( const QString &id );
~KorgacAgent();
private:
KOAlarmClient* m_alarmClient;
KOAlarmClient *m_alarmClient;
};
......
/*
This file is part of the KOrganizer alarm client.
This file is part of the KDE reminder agent.
Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
......
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