Commit 0ca357dc authored by David Jarvie's avatar David Jarvie
Browse files

Remove non-Akonadi files

parent a0ded139
......@@ -8,9 +8,6 @@ add_definitions( -DQT_NO_CAST_TO_ASCII )
set(CMAKE_AUTOMOC_RELAXED_MODE ON)
option(KALARM_USE_AKONADI "Build to use Akonadi" ON)
add_definitions(-DUSE_AKONADI)
if (NOT CMAKE_VERSION VERSION_LESS 2.8.12 AND (CMAKE_VERSION VERSION_LESS 2.8.12.1
OR CMAKE_VERSION VERSION_LESS 2.8.13 # Temporary measure because build.kde.org uses a datestamped CMake version
......@@ -21,7 +18,6 @@ option(KALARM_USE_AKONADI "Build to use Akonadi" ON)
kde_enable_exceptions()
if(KALARM_USE_AKONADI)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/
......@@ -30,21 +26,7 @@ include_directories(
${CMAKE_SOURCE_DIR}/libkdepim/
${Boost_INCLUDE_DIR}
)
else()
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/
${CMAKE_CURRENT_SOURCE_DIR}/lib
${CMAKE_CURRENT_SOURCE_DIR}/resources
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/libkdepim/
${Boost_INCLUDE_DIR}
)
endif()
if(NOT KALARM_USE_AKONADI)
add_subdirectory(resources)
endif()
add_subdirectory(appicons)
add_subdirectory(pixmaps)
add_subdirectory(autostart)
......@@ -126,7 +108,6 @@ set(kalarm_bin_SRCS ${libkalarm_SRCS}
templatemenuaction.cpp
wakedlg.cpp
)
if(KALARM_USE_AKONADI)
set(kalarm_bin_SRCS ${kalarm_bin_SRCS}
akonadimodel.cpp
akonadiresourcecreator.cpp
......@@ -136,16 +117,6 @@ set(kalarm_bin_SRCS ${kalarm_bin_SRCS}
calendarmigrator.cpp
eventid.cpp
)
else()
set(kalarm_bin_SRCS ${kalarm_bin_SRCS}
calendarcompat.cpp
eventlistmodel.cpp
alarmlistfiltermodel.cpp
resourceconfigdialog.cpp
resourcemodelview.cpp
templatelistfiltermodel.cpp
)
endif()
qt5_wrap_ui(kalarm_bin_SRCS
wakedlg.ui
......@@ -157,70 +128,45 @@ if (KMAIL_SUPPORTED)
endif ()
#REACTIVATE qt4_add_dbus_interfaces(kalarm_bin_SRCS ${KDE4_DBUS_INTERFACES_DIR}/org.kde.KSpeech.xml)
if(KALARM_USE_AKONADI)
kcfg_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/kalarmresource.kcfg org.kde.Akonadi.KAlarm.Settings)
qt4_add_dbus_interface(kalarm_bin_SRCS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.Akonadi.KAlarm.Settings.xml kalarmsettings KAlarmSettings)
kcfg_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/kalarmresource.kcfg org.kde.Akonadi.KAlarm.Settings)
qt4_add_dbus_interface(kalarm_bin_SRCS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.Akonadi.KAlarm.Settings.xml kalarmsettings KAlarmSettings)
kcfg_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/kalarmdirresource.kcfg org.kde.Akonadi.KAlarmDir.Settings)
qt4_add_dbus_interface(kalarm_bin_SRCS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.Akonadi.KAlarmDir.Settings.xml kalarmdirsettings KAlarmDirSettings)
kcfg_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/kalarmdirresource.kcfg org.kde.Akonadi.KAlarmDir.Settings)
qt4_add_dbus_interface(kalarm_bin_SRCS ${CMAKE_CURRENT_BINARY_DIR}/org.kde.Akonadi.KAlarmDir.Settings.xml kalarmdirsettings KAlarmDirSettings)
qt4_add_dbus_interfaces(kalarm_bin_SRCS ${AKONADI_DBUS_INTERFACES_DIR}/org.freedesktop.Akonadi.Agent.Control.xml)
# qt5_add_dbus_adaptor(kalarm_bin_SRCS ${AKONADI_DBUS_INTERFACES_DIR}/org.freedesktop.Akonadi.Agent.Control.xml agentbase.h Akonadi::AgentBase controladaptor Akonadi__ControlAdaptor)
endif()
qt4_add_dbus_interfaces(kalarm_bin_SRCS ${AKONADI_DBUS_INTERFACES_DIR}/org.freedesktop.Akonadi.Agent.Control.xml)
#qt5_add_dbus_adaptor(kalarm_bin_SRCS ${AKONADI_DBUS_INTERFACES_DIR}/org.freedesktop.Akonadi.Agent.Control.xml agentbase.h Akonadi::AgentBase controladaptor Akonadi__ControlAdaptor)
kconfig_add_kcfg_files(kalarm_bin_SRCS GENERATE_MOC kalarmconfig.kcfgc)
#if (UNIX)
kde4_add_app_icon(kalarm_bin_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/appicons/ox*-app-kalarm.png")
add_executable(kalarm_bin ${kalarm_bin_SRCS})
if(KALARM_USE_AKONADI)
add_dependencies(kalarm_bin kalarm_resource_xml kalarmdir_resource_xml)
endif()
add_dependencies(kalarm_bin kalarm_resource_xml kalarmdir_resource_xml)
if (KMAIL_SUPPORTED)
add_dependencies(kalarm_bin kmail_xml)
endif ()
set_target_properties(kalarm_bin PROPERTIES OUTPUT_NAME kalarm)
if(KALARM_USE_AKONADI)
target_link_libraries(kalarm_bin
KF5::AlarmCalendar
KF5::CalendarCore
KF5::CalendarUtils
KF5::Abc
KF5::Mime
KF5::PimIdentities
KF5::MailTransport
KF5::AkonadiCore
KF5::AkonadiMime
KF5::AkonadiContact
KF5::Holidays
KF5::PimUtils
kdepim
KF5::KCMUtils
${KDE4_PHONON_LIBS}
${X11_X11_LIB}
)
else()
target_link_libraries(kalarm_bin
kalarm_resources
KF5::AlarmCalendar
${KDEPIMLIBS_KCAL_LIBS}
KF5::Abc
KF5::Mime
KF5::PimIdentities
KF5::MailTransport
KF5::AkonadiCore
KF5::AkonadiMime
KF5::AkonadiContact
KF5::Holidays
KF5::PimUtils
kdepim
KF5::KCMUtils
${KDE4_PHONON_LIBS}
${X11_X11_LIB}
)
endif()
target_link_libraries(kalarm_bin
KF5::AlarmCalendar
KF5::CalendarCore
KF5::CalendarUtils
KF5::Abc
KF5::Mime
KF5::PimIdentities
KF5::MailTransport
KF5::AkonadiCore
KF5::AkonadiMime
KF5::AkonadiContact
KF5::Holidays
KF5::PimUtils
kdepim
KF5::KCMUtils
${KDE4_PHONON_LIBS}
${X11_X11_LIB}
)
install(TARGETS kalarm_bin ${INSTALL_TARGETS_DEFAULT_ARGS})
......
/*
* alarmlistfiltermodel.cpp - proxy model class for lists of alarms
* Program: kalarm
* Copyright © 2007-2011 by David Jarvie <djarvie@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 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 "kalarm.h" //krazy:exclude=includes (kalarm.h must be first)
#include "alarmlistfiltermodel.h"
#include "eventlistmodel.h"
#include <kdebug.h>
using namespace KAlarmCal;
// AlarmListFilterModel provides sorting and filtering for the alarm list model.
AlarmListFilterModel::AlarmListFilterModel(EventListModel* baseModel, QObject* parent)
: EventListFilterModel(baseModel, parent),
mStatusFilter(CalEvent::EMPTY)
{}
void AlarmListFilterModel::setStatusFilter(CalEvent::Types type)
{
if (type != mStatusFilter)
{
mStatusFilter = type;
invalidateFilter();
}
}
bool AlarmListFilterModel::filterAcceptsRow(int sourceRow, const QModelIndex&) const
{
return sourceModel()->data(sourceModel()->index(sourceRow, 0), EventListModel::StatusRole).toInt() & mStatusFilter;
}
bool AlarmListFilterModel::filterAcceptsColumn(int sourceCol, const QModelIndex&) const
{
return (sourceCol != EventListModel::TemplateNameColumn);
}
QModelIndex AlarmListFilterModel::mapFromSource(const QModelIndex& sourceIndex) const
{
if (sourceIndex.column() == EventListModel::TemplateNameColumn)
return QModelIndex();
return EventListFilterModel::mapFromSource(sourceIndex);
}
// vim: et sw=4:
/*
* alarmlistfiltermodel.h - proxy model class for lists of alarms
* Program: kalarm
* Copyright © 2007-2011 by David Jarvie <djarvie@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 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 ALARMLISTFILTERMODEL_H
#define ALARMLISTFILTERMODEL_H
#include "kalarm.h"
#include "eventlistmodel.h"
#include <KAlarmCal/kacalendar.h>
class AlarmListFilterModel : public EventListFilterModel
{
Q_OBJECT
public:
enum { ColumnCount = 6 };
explicit AlarmListFilterModel(EventListModel* baseModel, QObject* parent = 0);
void setStatusFilter(CalEvent::Types);
CalEvent::Types statusFilter() const { return mStatusFilter; }
virtual QModelIndex mapFromSource(const QModelIndex& sourceIndex) const;
protected:
virtual bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const;
virtual bool filterAcceptsColumn(int sourceCol, const QModelIndex& sourceParent) const;
private:
CalEvent::Types mStatusFilter;
};
#endif // ALARMLISTFILTERMODEL_H
// vim: et sw=4:
/*
* calendarcompat.cpp - compatibility for old calendar file formats
* Program: kalarm
* Copyright © 2001-2011 by David Jarvie <djarvie@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 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 "calendarcompat.h"
#include "functions.h"
#include "mainwindow.h"
#include "messagebox.h"
#include <kcal/calendarlocal.h>
#include <kdebug.h>
namespace CalendarCompat
{
/******************************************************************************
* Find the version of KAlarm which wrote the calendar file, and do any
* necessary conversions to the current format. If it is a resource calendar,
* the user is prompted whether to save the conversions. For a local calendar
* file, any conversions will only be saved if changes are made later.
* If the calendar only contains the wrong alarm types, 'wrongType' is set true.
* Reply = true if the calendar file is now in the current format.
*/
KACalendar::Compat fix(KCal::CalendarLocal& calendar, const QString& localFile, AlarmResource* resource,
AlarmResource::FixFunc conv, bool* wrongType)
{
if (wrongType)
*wrongType = false;
QString versionString;
int version = KACalendar::updateVersion(calendar, localFile, versionString);
if (version == KACalendar::IncompatibleFormat)
return KACalendar::Incompatible; // calendar was created by another program, or an unknown version of KAlarm
if (!resource)
return KACalendar::Current; // update non-shared calendars regardless
// Check whether the alarm types in the calendar correspond with the resource's alarm type
if (wrongType)
*wrongType = !resource->checkAlarmTypes(calendar);
if (version == KACalendar::CurrentFormat)
return KACalendar::Current; // calendar is in current KAlarm format
if (resource->ResourceCached::readOnly() || conv == AlarmResource::NO_CONVERT)
return KACalendar::Convertible;
// Update the calendar file now if the user wants it to be read-write
if (conv == AlarmResource::PROMPT || conv == AlarmResource::PROMPT_PART)
{
QString msg = KAlarm::conversionPrompt(resource->resourceName(), versionString, (conv == AlarmResource::PROMPT));
if (KAMessageBox::warningYesNo(MainWindow::mainMainWindow(), msg) != KMessageBox::Yes)
return KACalendar::Convertible;
}
KACalendar::setKAlarmVersion(calendar);
return KACalendar::Converted;
}
} // namespace CalendarCompat
// vim: et sw=4:
/*
* calendarcompat.h - compatibility for old calendar file formats
* Program: kalarm
* Copyright © 2005-2011 by David Jarvie <djarvie@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 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 CALENDARCOMPAT_H
#define CALENDARCOMPAT_H
#ifndef USE_AKONADI
#include "alarmresource.h"
#include <KAlarmCal/kacalendar.h>
namespace KCal { class CalendarLocal; }
namespace CalendarCompat
{
KACalendar::Compat fix(KCal::CalendarLocal&, const QString& localFile,
AlarmResource* = 0, AlarmResource::FixFunc = AlarmResource::PROMPT, bool* wrongType = 0);
}
#endif
#endif // CALENDARCOMPAT_H
// vim: et sw=4:
This diff is collapsed.
/*
* eventlistmodel.h - model class for lists of alarms or templates
* Program: kalarm
* Copyright © 2007-2012 by David Jarvie <djarvie@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 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 EVENTLISTMODEL_H
#define EVENTLISTMODEL_H
#include "kalarm.h"
#include "alarmresources.h"
#include <KAlarmCal/kacalendar.h>
#include <KAlarmCal/kaevent.h>
#include <QAbstractTableModel>
#include <QSortFilterProxyModel>
#include <QSize>
class QPixmap;
namespace KCal { class Event; }
using namespace KAlarmCal;
class EventListModel : public QAbstractTableModel
{
Q_OBJECT
public:
enum { // data columns
TimeColumn, TimeToColumn, RepeatColumn, ColourColumn, TypeColumn, TextColumn,
TemplateNameColumn,
ColumnCount
};
enum { // additional roles
StatusRole = Qt::UserRole, // return ACTIVE/ARCHIVED
ValueRole, // return numeric value
SortRole, // return the value to use for sorting
EnabledRole // return true for enabled alarm, false for disabled
};
static EventListModel* alarms();
static EventListModel* templates();
~EventListModel();
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
virtual int columnCount(const QModelIndex& parent = QModelIndex()) const;
virtual QModelIndex index(int row, int column = 0, const QModelIndex& parent = QModelIndex()) const;
virtual QVariant data(const QModelIndex&, int role = Qt::DisplayRole) const;
virtual bool setData(const QModelIndex&, const QVariant& value, int role = Qt::EditRole);
virtual QVariant headerData(int section, Qt::Orientation, int role = Qt::DisplayRole) const;
virtual Qt::ItemFlags flags(const QModelIndex&) const;
static int iconWidth() { return mIconSize.width(); }
QModelIndex eventIndex(const KAEvent*) const;
QModelIndex eventIndex(const QString& eventId) const;
void addEvent(KAEvent*);
void addEvents(const KAEvent::List&);
bool updateEvent(KAEvent* event) { return updateEvent(mEvents.indexOf(event)); }
bool updateEvent(const QString& eventId) { return updateEvent(findEvent(eventId)); }
bool updateEvent(const QString& oldId, KAEvent* newEvent);
void removeEvent(const KAEvent* event) { removeEvent(mEvents.indexOf(const_cast<KAEvent*>(event))); }
void removeEvent(const QString& eventId) { removeEvent(findEvent(eventId)); }
void removeResource(AlarmResource*);
KAEvent* event(int row) const;
static KAEvent* event(const QModelIndex&);
void updateCommandError(const QString& eventId);
bool haveEvents() const { return mHaveEvents; }
static void resourceStatusChanged(AlarmResource*, AlarmResources::Change);
public slots:
void reload();
signals:
void haveEventsStatus(bool have);
private slots:
void slotUpdateTimeTo();
void slotUpdateArchivedColour(const QColor&);
void slotUpdateDisabledColour(const QColor&);
void slotUpdateHolidays();
void slotUpdateWorkingHours();
void slotResourceLoaded(AlarmResource*, bool active);
void slotResourceStatusChanged(AlarmResource*, AlarmResources::Change);
private:
explicit EventListModel(CalEvent::Types, QObject* parent = 0);
bool updateEvent(int row);
void removeEvent(int row);
int findEvent(const QString& eventId) const;
void updateHaveEvents(bool have) { mHaveEvents = have; emit haveEventsStatus(have); }
QString repeatText(const KAEvent*) const;
QString repeatOrder(const KAEvent*) const;
QPixmap* eventIcon(const KAEvent*) const;
QString whatsThisText(int column) const;
static EventListModel* mAlarmInstance; // the instance containing all alarms
static EventListModel* mTemplateInstance; // the instance containing all templates
static QPixmap* mTextIcon;
static QPixmap* mFileIcon;
static QPixmap* mCommandIcon;
static QPixmap* mEmailIcon;
static QPixmap* mAudioIcon;
static QSize mIconSize; // maximum size of any icon
static int mTimeHourPos; // position of hour within time string, or -1 if leading zeroes included
KAEvent::List mEvents;
CalEvent::Types mStatus; // types of events contained in this model
bool mHaveEvents;// there are events in this model
using QObject::event; // prevent "hidden" warning
};
class EventListFilterModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
explicit EventListFilterModel(EventListModel* baseModel, QObject* parent = 0);
KAEvent* event(int row) const;
KAEvent* event(const QModelIndex&) const;
QModelIndex eventIndex(const KAEvent*) const;
QModelIndex eventIndex(const QString& eventId) const;
private slots:
void slotDataChanged(const QModelIndex&, const QModelIndex&);
private:
using QObject::event; // prevent "hidden" warning
};
#endif // EVENTLISTMODEL_H
// vim: et sw=4:
/*
* resourceconfigdialog.cpp - KAlarm resource configuration dialog
* Program: kalarm
* Copyright © 2006-2011 by David Jarvie <djarvie@kde.org>
* Based on configdialog.cpp in kdelibs/kresources,
* Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
* Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
* Copyright (c) 2003 Cornelius Schumacher <schumacher@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 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 "alarmresource.h"
#include "resourceconfigdialog.moc"
#include "messagebox.h"
#include <kresources/factory.h>
#include <klocale.h>
#include <klineedit.h>
#include <QGroupBox>
#include <QLabel>
#include <QCheckBox>
#include <QVBoxLayout>
#include <QGridLayout>
using namespace KRES;
ResourceConfigDialog::ResourceConfigDialog(QWidget* parent, AlarmResource* resource)
: KDialog(parent), mResource(resource)
{
Factory* factory = Factory::self(QLatin1String("alarms"));
QFrame* main = new QFrame(this);
setMainWidget(main);
setCaption(i18nc("@title:window", "Calendar Configuration"));
setButtons(Ok | Cancel);
setDefaultButton(Ok);
setModal(true);
QVBoxLayout* mainLayout = new QVBoxLayout(main);
mainLayout->setSpacing(spacingHint());
QGroupBox* generalGroupBox = new QGroupBox(main);
QGridLayout* gbLayout = new QGridLayout;
gbLayout->setSpacing(spacingHint());
generalGroupBox->setLayout(gbLayout);
generalGroupBox->setTitle(i18nc("@title:group", "General Settings"));
gbLayout->addWidget(new QLabel(i18nc("@label:textbox Calendar name", "Name:"), generalGroupBox), 0, 0);
mName = new KLineEdit();
gbLayout->addWidget(mName, 0, 1);
mReadOnly = new QCheckBox(i18nc("@option:check", "Read-only"), generalGroupBox);
gbLayout->addWidget(mReadOnly, 1, 0, 1, 2);
mName->setText(mResource->resourceName());
mReadOnly->setChecked(mResource->readOnly());
mainLayout->addWidget(generalGroupBox);
QGroupBox* resourceGroupBox = new QGroupBox(main);
QGridLayout* resourceLayout = new QGridLayout;
resourceLayout->setSpacing(spacingHint());
resourceGroupBox->setLayout(resourceLayout);
resourceGroupBox->setTitle(i18nc("@title:group", "<resource>%1</resource> Calendar Settings",
factory->typeName(resource->type())));
mainLayout->addWidget(resourceGroupBox);