Commit af56dd09 authored by Volker Krause's avatar Volker Krause
Browse files

Remove korgac and use the new shared reminder daemon instead

Depends on akonadi-calendar!12.
parent 0f8a60dd
Pipeline #146266 passed with stage
in 1 minute and 34 seconds
......@@ -131,7 +131,7 @@ endif()
set(KDEPIM_HAVE_X11 ${X11_FOUND})
configure_file(config-korganizer.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-korganizer.h)
include_directories(${korganizer_SOURCE_DIR} ${korganizer_BINARY_DIR} ${korgac_SOURCE_DIR} ${korgac_BINARY_DIR})
include_directories(${korganizer_SOURCE_DIR} ${korganizer_BINARY_DIR})
configure_file(korganizer-version.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/korganizer-version.h @ONLY)
......@@ -151,7 +151,6 @@ endif()
add_subdirectory(src)
add_subdirectory(korgac)
ecm_qt_install_logging_categories(
EXPORT KORGANIZER
......
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: BSD-3-Clause
add_definitions(-DTRANSLATION_DOMAIN=\"korgac\")
add_subdirectory(pixmaps)
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
########### next target ###############
add_executable(korgac)
ecm_qt_declare_logging_category(korgac HEADER koalarmclient_debug.h IDENTIFIER KOALARMCLIENT_LOG CATEGORY_NAME org.kde.pim.koalarmclient
DESCRIPTION "korganizer (koalarmclient)"
OLD_CATEGORY_NAMES log_koalarmclient
EXPORT KORGANIZER
)
set(korganizer_xml ../src/data/org.kde.korganizer.Korganizer.xml)
qt_add_dbus_interface(korgac_SRCS ${korganizer_xml}
korganizer_interface
)
qt_add_dbus_adaptor(korgac_SRCS org.kde.korganizer.KOrgac.xml koalarmclient.h
KOAlarmClient
)
qt_add_dbus_interface(korgac_SRCS org.freedesktop.Notifications.xml notifications_interface)
qt_add_dbus_interface(korgac_SRCS org.freedesktop.DBus.Properties.xml dbusproperties)
file(GLOB ICONS_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/pixmaps/*-apps-korgac.png")
ecm_add_app_icon(korgac_SRCS ICONS ${ICONS_SRCS})
target_sources(korgac PRIVATE
korgacmain.cpp
alarmdialog.cpp
alarmdockwindow.cpp
koalarmclient.cpp
alarmdialog.h
alarmdockwindow.h
koalarmclient.h
${korgac_SRCS}
)
if (COMPILE_WITH_UNITY_CMAKE_SUPPORT)
set_target_properties(korgac PROPERTIES UNITY_BUILD ON)
endif()
if( APPLE )
set_target_properties(korgac PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${korganizer_SOURCE_DIR}/korgac/Info.plist.template
)
set_target_properties(korgac PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER "org.kde.pim.korgac"
)
set_target_properties(korgac PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "KOrganizer Reminder Client"
)
endif()
target_link_libraries(korgac
KF5::AkonadiCalendar
KF5::CalendarSupport
KF5::IncidenceEditor
KF5::AkonadiCore
KF5::CalendarCore
KF5::CalendarUtils
KF5::DBusAddons
Phonon::phonon4qt${QT_MAJOR_VERSION}
KF5::Notifications
KF5::IconThemes
KF5::Service
KF5::KIOCore
KF5::WindowSystem
)
install(TARGETS
korgac ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}
)
install(FILES
autostart-org.kde.korgac.desktop
RENAME org.kde.korgac.desktop
DESTINATION ${KDE_INSTALL_AUTOSTARTDIR}
)
install(FILES
org.kde.korgac.desktop
DESTINATION ${KDE_INSTALL_APPDIR}
)
install(FILES
org.kde.korganizer.KOrgac.xml
DESTINATION ${KDE_INSTALL_DBUSINTERFACEDIR}
)
configure_file(org.kde.korgac.service.in org.kde.korgac.service)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/org.kde.korgac.service
DESTINATION ${KDE_INSTALL_DBUSSERVICEDIR}
)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleGetInfoString</key>
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
<key>CFBundleName</key>
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
<key>CFBundleVersion</key>
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>LSRequiresCarbon</key>
<true/>
<key>LSUIElement</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
</dict>
</plist>
#! /bin/sh
$XGETTEXT `find . -name "*.cpp" -o -name "*.h" | grep -v '/tests/'` -o $podir/korgac.pot
This diff is collapsed.
/*
This file is part of the KDE reminder agent.
SPDX-FileCopyrightText: 2000 Cornelius Schumacher <schumacher@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
*/
#pragma once
#include <Akonadi/ETMCalendar>
#include <QDialog>
#include <QTimer>
class ReminderTreeItem;
namespace Akonadi
{
class Item;
}
namespace CalendarSupport
{
class IncidenceViewer;
}
class QComboBox;
class QSpinBox;
class QTreeWidget;
class QTreeWidgetItem;
class AlarmDialog : public QDialog
{
Q_OBJECT
public:
/**
* The suspend time unit.
*/
enum SuspendUnit {
SuspendInMinutes = 0, ///< Suspend time is in minutes
SuspendInHours = 1, ///< Suspend time is in hours
SuspendInDays = 2, ///< Suspend time is in days
SuspendInWeeks = 3 ///< Suspend time is in weeks
};
Q_ENUM(SuspendUnit)
explicit AlarmDialog(const Akonadi::ETMCalendar::Ptr &calendar, QWidget *parent = nullptr);
~AlarmDialog() override;
void addIncidence(const Akonadi::Item &incidence, const QDateTime &reminderAt, const QString &displayText);
void eventNotification();
public Q_SLOTS:
void slotOk(); // suspend
void slotUser1(); // edit
void slotUser2(); // dismiss all
void slotUser3(); // dismiss selected
void resetSuspend(); // reset the suspend value to the default
void setDefaultSuspend(); // set current suspend value as the default
void slotSave();
void wakeUp();
void show();
void edit();
void suspend();
void suspendAll();
void dismissAll();
void dismissCurrent();
/*reimp*/
void accept() override;
void reject() override;
/**
If an incidence changed, for example in korg, we must update
the date and summary shown in the list view.
*/
void slotCalendarChanged();
Q_SIGNALS:
void reminderCount(int count);
protected:
void keyPressEvent(QKeyEvent *e) override;
void closeEvent(QCloseEvent *) override;
void showEvent(QShowEvent *event) override;
private Q_SLOTS:
void slotDBusNotificationsPropertiesChanged(const QString &interface, const QVariantMap &changedProperties, const QStringList &invalidatedProperties);
private:
void update();
void updateButtons();
using ReminderList = QList<ReminderTreeItem *>;
Q_REQUIRED_RESULT static QDateTime triggerDateForIncidence(const KCalendarCore::Incidence::Ptr &inc, const QDateTime &reminderAt, QString &displayStr);
// Removes each Incidence-X group that has one of the specified uids
void removeFromConfig(const QList<Akonadi::Item::Id> &);
// Opens through dbus, @deprecated
Q_REQUIRED_RESULT bool openIncidenceEditorThroughKOrganizer(const KCalendarCore::Incidence::Ptr &incidence);
// opens directly
Q_REQUIRED_RESULT bool openIncidenceEditorNG(const Akonadi::Item &incidence);
ReminderTreeItem *searchByItem(const Akonadi::Item &incidence);
void setTimer();
void dismiss(const ReminderList &selections);
Q_REQUIRED_RESULT int activeCount();
Q_REQUIRED_RESULT ReminderList selectedItems() const;
void toggleDetails(QTreeWidgetItem *item);
void showDetails(QTreeWidgetItem *item);
Q_REQUIRED_RESULT static bool grabFocus();
Akonadi::ETMCalendar::Ptr mCalendar;
QTreeWidget *mIncidenceTree = nullptr;
CalendarSupport::IncidenceViewer *mDetailView = nullptr;
QRect mRect;
QSpinBox *mSuspendSpin = nullptr;
QComboBox *mSuspendUnit = nullptr;
QTimer mSuspendTimer;
QTreeWidgetItem *mLastItem = nullptr;
QPushButton *mUser1Button = nullptr;
QPushButton *mUser2Button = nullptr;
QPushButton *mUser3Button = nullptr;
QPushButton *mOkButton = nullptr;
};
/*
This file is part of KOrganizer.
This file is part of the KDE reminder agent.
SPDX-FileCopyrightText: 2003 Cornelius Schumacher <schumacher@kde.org>
SPDX-FileCopyrightText: 2008-2009 Allen Winter <winter@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
*/
#include "alarmdockwindow.h"
#include "koalarmclient_debug.h"
#include <KConfigGroup>
#include <KIconEffect>
#include <KIconLoader>
#include <KLocalizedString>
#include <KMessageBox>
#include <KSharedConfig>
#include <QDBusConnection>
#include <QDBusConnectionInterface>
#include <QMenu>
AlarmDockWindow::AlarmDockWindow()
: KStatusNotifierItem(nullptr)
{
// Read the autostart status from the config file
KConfigGroup config(KSharedConfig::openConfig(), "General");
const bool autostartSet = config.hasKey("Autostart");
const bool autostart = config.readEntry("Autostart", true);
const bool grabFocus = config.readEntry("GrabFocus", false);
const bool alarmsEnabled = config.readEntry("Enabled", true);
// Don't mention Daemon here since it's a technical
// term the user doesn't care about
mName = i18nc("@title:window", "KOrganizer Reminders");
setToolTipTitle(mName);
setToolTipIconByName(QStringLiteral("korgac"));
setTitle(mName);
// Set up icons
const QIcon iconEnabled = QIcon::fromTheme(QStringLiteral("korgac"));
KIconLoader loader;
QImage iconDisabled = iconEnabled.pixmap(loader.currentSize(KIconLoader::Panel)).toImage();
KIconEffect::toGray(iconDisabled, 1.0);
mIconDisabled = QIcon(QPixmap::fromImage(iconDisabled));
changeSystrayIcon(alarmsEnabled);
// Set up the context menu
mSuspendAll = contextMenu()->addAction(i18nc("@action:inmenu", "&Suspend All Reminders"), this, &AlarmDockWindow::slotSuspendAll);
mDismissAll = contextMenu()->addAction(i18nc("@action:inmenu", "&Dismiss All Reminders"), this, &AlarmDockWindow::slotDismissAll);
// leave mShow always enabled that way you can get to alarms that are
// suspended and inactive to dismiss them before they go off again
// (as opposed to the other two that are initially disabled)
mShow = contextMenu()->addAction(i18nc("@action:inmenu", "Show &Reminders"), this, &AlarmDockWindow::showReminderSignal);
mSuspendAll->setEnabled(false);
mDismissAll->setEnabled(false);
contextMenu()->addSeparator();
mAlarmsEnabled = contextMenu()->addAction(i18nc("@action:inmenu", "Enable Reminders"));
connect(mAlarmsEnabled, &QAction::toggled, this, &AlarmDockWindow::toggleAlarmsEnabled);
mAlarmsEnabled->setCheckable(true);
mAutostart = contextMenu()->addAction(i18nc("@action:inmenu", "Start Reminder Daemon at Login"));
connect(mAutostart, &QAction::toggled, this, &AlarmDockWindow::toggleAutostart);
mAutostart->setCheckable(true);
mAlarmsEnabled->setChecked(alarmsEnabled);
mAutostart->setChecked(autostart);
mGrabFocus = contextMenu()->addAction(i18nc("@action:inmenu", "Reminder Requests Focus"));
mGrabFocus->setToolTip(i18nc("@info:tooltip",
"When this option is enabled the reminder dialog will "
"automatically receive keyboard focus when it opens."));
connect(mGrabFocus, &QAction::toggled, this, &AlarmDockWindow::toggleGrabFocus);
// ToolTips aren't enabled for menus by default.
contextMenu()->setToolTipsVisible(true);
mGrabFocus->setCheckable(true);
mGrabFocus->setChecked(grabFocus);
// Disable standard quit behaviour. We have to intercept the quit even,
// if the main window is hidden.
QAction *act = action(QStringLiteral("quit"));
if (act) {
disconnect(act, SIGNAL(triggered(bool)), this, SLOT(maybeQuit()));
connect(act, &QAction::triggered, this, &AlarmDockWindow::slotQuit);
} else {
qCDebug(KOALARMCLIENT_LOG) << "No Quit standard action.";
}
mAutostartSet = autostartSet;
}
AlarmDockWindow::~AlarmDockWindow() = default;
void AlarmDockWindow::slotUpdate(int reminders)
{
const bool actif = (reminders > 0);
mSuspendAll->setEnabled(actif);
mDismissAll->setEnabled(actif);
if (actif) {
setToolTip(QStringLiteral("korgac"), mName, i18ncp("@info:status", "There is 1 active reminder.", "There are %1 active reminders.", reminders));
} else {
setToolTip(QStringLiteral("korgac"), mName, i18nc("@info:status", "No active reminders."));
}
}
void AlarmDockWindow::toggleAlarmsEnabled(bool checked)
{
changeSystrayIcon(checked);
KConfigGroup config(KSharedConfig::openConfig(), "General");
config.writeEntry("Enabled", checked);
config.sync();
}
void AlarmDockWindow::toggleAutostart(bool checked)
{
qCDebug(KOALARMCLIENT_LOG);
mAutostartSet = true;
enableAutostart(checked);
}
void AlarmDockWindow::toggleGrabFocus(bool checked)
{
KConfigGroup config(KSharedConfig::openConfig(), "General");
config.writeEntry("GrabFocus", checked);
}
void AlarmDockWindow::slotSuspendAll()
{
Q_EMIT suspendAllSignal();
}
void AlarmDockWindow::slotDismissAll()
{
Q_EMIT dismissAllSignal();
}
void AlarmDockWindow::enableAutostart(bool enable)
{
KConfigGroup config(KSharedConfig::openConfig(), "General");
config.writeEntry("Autostart", enable);
config.sync();
}
void AlarmDockWindow::activate(const QPoint &pos)
{
Q_UNUSED(pos)
QDBusConnection::sessionBus().interface()->startService(QStringLiteral("org.kde.korganizer"));
}
void AlarmDockWindow::slotQuit()
{
if (mAutostartSet == true) {
const int result = KMessageBox::warningContinueCancel(associatedWidget(),
xi18nc("@info",
"Do you want to quit the KOrganizer reminder daemon?<nl/>"
"<note> you will not get calendar reminders unless the daemon is running.</note>"),
i18nc("@title:window", "Close KOrganizer Reminder Daemon"),
KStandardGuiItem::quit());
if (result == KMessageBox::Continue) {
Q_EMIT quitSignal();
}
} else {
const int result = KMessageBox::questionYesNoCancel(associatedWidget(),
xi18nc("@info",
"Do you want to start the KOrganizer reminder daemon at login?<nl/>"
"<note> you will not get calendar reminders unless the daemon is running.</note>"),
i18nc("@title:window", "Close KOrganizer Reminder Daemon"),
KGuiItem(i18nc("@action:button start the reminder daemon", "Start")),
KGuiItem(i18nc("@action:button do not start the reminder daemon", "Do Not Start")),
KStandardGuiItem::cancel(),
QStringLiteral("AskForStartAtLogin"));
bool autostart = true;
if (result == KMessageBox::No) {
autostart = false;
}
enableAutostart(autostart);
if (result != KMessageBox::Cancel) {
Q_EMIT quitSignal();
}
}
}
void AlarmDockWindow::changeSystrayIcon(bool alarmsEnabled)
{
if (alarmsEnabled) {
setIconByName(QStringLiteral("korgac"));
} else {
setIconByPixmap(mIconDisabled.pixmap(22, 22));
}
}
/*
This file is part of the KDE reminder agent.
SPDX-FileCopyrightText: 2003 Cornelius Schumacher <schumacher@kde.org>
SPDX-FileCopyrightText: 2008-2009 Allen Winter <winter@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
*/
#pragma once
#include <KStatusNotifierItem>
#include <QAction>
#include <QIcon>
class AlarmDockWindow : public KStatusNotifierItem
{
Q_OBJECT
public:
AlarmDockWindow();
~AlarmDockWindow() override;
void enableAutostart(bool enabled);
public Q_SLOTS:
void toggleAlarmsEnabled(bool checked);
void toggleAutostart(bool checked);
void toggleGrabFocus(bool checked);
void slotUpdate(int reminders);
Q_SIGNALS:
void quitSignal();
void suspendAllSignal();
void dismissAllSignal();
void showReminderSignal();
protected Q_SLOTS:
void activate(const QPoint &pos) override;
void slotQuit();
void slotSuspendAll();
void slotDismissAll();
private:
void changeSystrayIcon(bool alarmsEnabled);
QIcon mIconDisabled;
QString mName;
QAction *mAlarmsEnabled = nullptr;
QAction *mAutostart = nullptr;
QAction *mSuspendAll = nullptr;
QAction *mDismissAll = nullptr;
// True/Enable if the notify daemon should grab focus (activate window) away
// from the current application. This makes it easy to dismiss, but if the
// user is typing AlarmDialog now gets those keys and space or return will
// dismiss all notifications before the user has a chance to read them.
QAction *mGrabFocus = nullptr;
QAction *mShow = nullptr;
bool mAutostartSet = false;
};
[Desktop Entry]
Name=KOrganizer Reminder Client
Name[af]=KOrganizer herhinner kliënt
Name[ar]=عميل التّذكير لِ‍«منظّمك»
Name[az]=KOrganizer xatırladıcı müştərisi
Name[bg]=Клиент за аларма на KOrganizer
Name[bs]=KOrganizerov Podsjetni klijent
Name[ca]=Client de l'alarma del KOrganizer
Name[ca@valencia]=Client de l'alarma del KOrganizer
Name[cs]=Klient upomínek KOrganizeru
Name[da]=KOrganizer-påmindelsesklient
Name[de]=KOrganizer-Erinnerungsfunktion
Name[el]=Πελάτης υπενθύμισης του KOrganizer
Name[en_GB]=KOrganizer Reminder Client
Name[eo]=Alarmilo por Organizilo
Name[es]=Cliente de recordatorio de KOrganizer
Name[et]=KOrganizeri meeldetuletuse klientprogramm
Name[eu]=KOrganizer-en oroigarrien bezeroa
Name[fa]=کارخواه یادآوری‌کننده KOrganizer
Name[fi]=KOrganizer-muistutusasiakas
Name[fr]=Client de rappels de KOrganizer
Name[fy]=KOrganizer omtinkerdaemon
Name[ga]=Cliant Meabhrúchán KOrganizer
Name[gl]=Cliente de lembranzas de KOrganizer
Name[hr]=Klijent podsjetnik KOrganizer
Name[hu]=KOrganizer-emlékeztető kliens
Name[ia]=Cliente pro rememoration in KOrganizer
Name[is]=Áminningarforrit fyrir KOrganizer
Name[it]=Client degli avvisi di KOrganizer
Name[ja]=KOrganizer リマインダクライアント
Name[ka]=KOrganizer შემხსენებელის კლიენტი
Name[kk]=KOrganizer-дің еске салу клиенті
Name[km]=កម្មវិធី​រំលឹក​របស់ KOrganizer
Name[ko]=KOrganizer 알림 클라이언트
Name[lt]=KOrganizer priminimų klientas
Name[lv]=KOrganizer atgādinātāja klients
Name[mk]=Клиент за потсетување во КОрганизатор
Name[mr]=के-ऑर्गनायझर आठवण देणारा ग्राहक
Name[nb]=KOrganizer klient for påminning
Name[nds]=KOrganizer-Anstöötgever
Name[ne]=केडीई आयोजक रिमाइन्डर क्लाइन्ट
Name[nl]=KOrganizer herinneringsclient
Name[nn]=Alarmklient for KOrganizer
Name[pa]=ਕੇ-ਪਰਬੰਧਕ ਰੀਮਾਈਡਰ ਕਲਾਇਟ
Name[pl]=Klient przypominania KOrganizera
Name[pt]=Cliente de Avisos do KOrganizer
Name[pt_BR]=Cliente de lembretes do KOrganizer
Name[ru]=Служба напоминаний KOrganizer
Name[sk]=Klient pripomienok pre KOrganizer
Name[sl]=Odjemalec za opomnike KOrganizerja
Name[sr]=Клијент подсетника К‑организатора
Name[sr@ijekavian]=Клијент подсјетника К‑организатора
Name[sr@ijekavianlatin]=Klijent podsjetnika K‑organizatora
Name[sr@latin]=Klijent podsetnika K‑organizatora
Name[sv]=Korganizers påminnelseklient
Name[ta]=கேயார்கனைசர் நினைவூட்டல் நிரல்
Name[tr]=KOrganizer Anımsatıcı İstemcisi
Name[uk]=Клієнт нагадувань KOrganizer
Name[wa]=Cliyint do rimimbreu d' KOrganizer
Name[x-test]=xxKOrganizer Reminder Clientxx
Name[zh_CN]=KOrganizer 提醒客户端
Name[zh_TW]=KOrganizer 提醒用戶端程式
Exec=korgac
Icon=korgac
Type=Application
GenericName=KOrganizer Reminder Daemon Client