Commit e4c277cc authored by Laurent Montel's avatar Laurent Montel 😁

It was moved to kdepim-addons

parent 1a428aa0
......@@ -248,8 +248,6 @@ add_subdirectory(kontact)
add_subdirectory(akonadiconsole)
add_subdirectory(console)
add_subdirectory(plugins) # Must be after KMail
add_subdirectory(accountwizard)
# doc must be a subdir of kdepim or packagers will kill us
......
......@@ -23,5 +23,4 @@ TODO:
-----
move doc in each subdirectory
move grantlee-extractor-pot-scripts too
plugins (move in korganizer ?)
......@@ -38,7 +38,6 @@ log_headerthemeeditor kdepim (headerthemeeditor)
log_contactthemeeditor kdepim (contactthemeeditor)
log_kmail_plugin kdepim (kmail kontact plugins)
log_kaddressbook_plugin kdepim (kaddressbook kontact plugins)
log_text_calendar kdepim (messageviewer calendar plugins)
log_ktnefapps kdepim (ktnef apps)
log_mailfilteragent kdepim (mailfilter agent)
log_notesagentagent kdepim (note agent)
......
add_definitions( -DQT_NO_CAST_FROM_ASCII )
add_definitions( -DQT_NO_CAST_TO_ASCII )
add_subdirectory(messageviewer)
add_subdirectory(bodypartformatter)
add_definitions(-DTRANSLATION_DOMAIN=\"messageviewer_text_calendar_plugin\")
set(messageviewer_bodypartformatter_text_calendar_PART_SRCS text_calendar.cpp delegateselector.cpp attendeeselector.cpp memorycalendarmemento.cpp syncitiphandler.cpp)
ecm_qt_declare_logging_category(messageviewer_bodypartformatter_text_calendar_PART_SRCS HEADER text_calendar_debug.h IDENTIFIER TEXT_CALENDAR_LOG CATEGORY_NAME log_text_calendar)
qt5_add_dbus_interfaces(messageviewer_bodypartformatter_text_calendar_PART_SRCS
korganizer/org.kde.Korganizer.Calendar.xml
)
ki18n_wrap_ui(messageviewer_bodypartformatter_text_calendar_PART_SRCS attendeeselector.ui)
add_library(messageviewer_bodypartformatter_text_calendar MODULE ${messageviewer_bodypartformatter_text_calendar_PART_SRCS})
target_link_libraries(messageviewer_bodypartformatter_text_calendar
KF5::Codecs
Qt5::Core
KF5::CalendarCore
KF5::CalendarUtils
KF5::Mime
KF5::IdentityManagement
KF5::MailTransport
KF5::AkonadiMime
KF5::CalendarSupport
KF5::Libkdepim
KF5::MessageViewer
KF5::IncidenceEditor
)
install(TARGETS messageviewer_bodypartformatter_text_calendar DESTINATION ${KDE_INSTALL_PLUGINDIR})
install(FILES text_calendar.desktop DESTINATION ${KDE_INSTALL_DATADIR}/messageviewer/plugins/bodypartformatter)
#! /bin/sh
$EXTRACTRC *.ui >> rc.cpp
$XGETTEXT *.cpp -o $podir/messageviewer_text_calendar_plugin.pot
/*
Copyright (c) 2007 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 "attendeeselector.h"
#include <Libkdepim/AddresseeLineEdit>
#include <KEmailAddress>
#include <KLocalizedString>
#include <QPushButton>
#include <KGuiItem>
#include <KStandardGuiItem>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QVBoxLayout>
AttendeeSelector::AttendeeSelector(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18n("Select Attendees"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
mOkButton = buttonBox->button(QDialogButtonBox::Ok);
mOkButton->setDefault(true);
mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &AttendeeSelector::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &AttendeeSelector::reject);
mainLayout->addWidget(buttonBox);
ui.setupUi(mainWidget);
KGuiItem::assign(ui.addButton, KStandardGuiItem::add());
connect(ui.addButton, &QPushButton::clicked, this, &AttendeeSelector::addClicked);
KGuiItem::assign(ui.removeButton, KStandardGuiItem::remove());
connect(ui.removeButton, &QPushButton::clicked, this, &AttendeeSelector::removeClicked);
ui.attendeeEdit->setPlaceholderText(i18n("Click to add a new attendee"));
connect(ui.attendeeEdit, &KPIM::AddresseeLineEdit::textChanged, this, &AttendeeSelector::textChanged);
connect(ui.attendeeEdit, &KPIM::AddresseeLineEdit::returnPressed, this, &AttendeeSelector::addClicked);
connect(ui.attendeeList, &QListWidget::itemSelectionChanged, this, &AttendeeSelector::selectionChanged);
mOkButton->setEnabled(false);
}
QStringList AttendeeSelector::attendees() const
{
QStringList rv;
const int numberOfAttendee(ui.attendeeList->count());
for (int i = 0; i < numberOfAttendee; ++i) {
const QString addr = ui.attendeeList->item(i)->text();
// Build a nice address for this attendee including the CN.
QString tname, temail;
KEmailAddress::extractEmailAddressAndName(addr, temail, tname); // ignore return value
// which is always false
rv << temail;
}
return rv;
}
void AttendeeSelector::addClicked()
{
if (!ui.attendeeEdit->text().isEmpty()) {
ui.attendeeList->addItem(ui.attendeeEdit->text());
}
ui.attendeeEdit->clear();
mOkButton->setEnabled(true);
}
void AttendeeSelector::removeClicked()
{
delete ui.attendeeList->takeItem(ui.attendeeList->currentRow());
mOkButton->setEnabled((ui.attendeeList->count() > 0));
}
void AttendeeSelector::textChanged(const QString &text)
{
ui.addButton->setEnabled(!text.isEmpty());
}
void AttendeeSelector::selectionChanged()
{
ui.removeButton->setEnabled(ui.attendeeList->currentItem());
}
/*
Copyright (c) 2007 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 ATTENDEESELECTOR_H_H
#define ATTENDEESELECTOR_H_H
#include <QDialog>
#include <QPushButton>
#include "ui_attendeeselector.h"
/**
Dialog to select a set off attendees.
*/
class AttendeeSelector : public QDialog
{
Q_OBJECT
public:
explicit AttendeeSelector(QWidget *parent = Q_NULLPTR);
QStringList attendees() const;
private Q_SLOTS:
void addClicked();
void removeClicked();
void textChanged(const QString &text);
void selectionChanged();
private:
Ui::AttendeeSelectorWidget ui;
QPushButton *mOkButton;
};
#endif
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<author>Volker Krause &lt;vkrause@kde.org&gt;</author>
<class>AttendeeSelectorWidget</class>
<widget class="QWidget" name="AttendeeSelectorWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>354</width>
<height>238</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="KPIM::AddresseeLineEdit" name="attendeeEdit"/>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="addButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item row="1" column="0" rowspan="2">
<widget class="QListWidget" name="attendeeList"/>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="removeButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>140</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KPIM::AddresseeLineEdit</class>
<extends>KLineEdit</extends>
<header>Libkdepim/AddresseeLineEdit</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
</customwidgets>
<includes>
<include location="local">Libkdepim/AddresseeLineEdit</include>
</includes>
<resources/>
<connections/>
</ui>
/*
Copyright (c) 2007 Volker Krause <vkrause@kde.org>
Copyright (c) 2012 Laurent Montel <montel@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 "delegateselector.h"
#include <Libkdepim/AddresseeLineEdit>
#include <QHBoxLayout>
#include <KLocalizedString>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
DelegateSelector::DelegateSelector(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(i18n("Select delegate"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mOkButton = buttonBox->button(QDialogButtonBox::Ok);
mOkButton->setDefault(true);
mOkButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &DelegateSelector::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &DelegateSelector::reject);
mOkButton->setDefault(true);
QWidget *delegateBox = new QWidget(this);
QHBoxLayout *delegateBoxHBoxLayout = new QHBoxLayout(delegateBox);
delegateBoxHBoxLayout->setMargin(0);
new QLabel(i18n("Delegate:"), delegateBox);
mDelegate = new KPIM::AddresseeLineEdit(delegateBox);
connect(mDelegate, &KPIM::AddresseeLineEdit::textChanged, this, &DelegateSelector::slotTextChanged);
mRsvp = new QCheckBox(i18n("Keep me informed about status changes of this incidence."), this);
mRsvp->setChecked(true);
mainLayout->addWidget(delegateBox);
mainLayout->addWidget(mRsvp);
mainLayout->addWidget(buttonBox);
mOkButton->setEnabled(false);
}
void DelegateSelector::slotTextChanged(const QString &text)
{
mOkButton->setEnabled(!text.isEmpty());
}
QString DelegateSelector::delegate() const
{
return mDelegate->text();
}
bool DelegateSelector::rsvp() const
{
return mRsvp->isChecked();
}
/*
Copyright (c) 2007 Volker Krause <vkrause@kde.org>
Copyright (C) 2012-2016 Laurent Montel <montel@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 DELEGATESELECTOR_H
#define DELEGATESELECTOR_H
#include <QDialog>
class QPushButton;
namespace KPIM
{
class AddresseeLineEdit;
}
class QCheckBox;
/**
Selection dialog for a delegate.
*/
class DelegateSelector : public QDialog
{
Q_OBJECT
public:
explicit DelegateSelector(QWidget *parent = Q_NULLPTR);
QString delegate() const;
bool rsvp() const;
public Q_SLOTS:
void slotTextChanged(const QString &text);
private:
KPIM::AddresseeLineEdit *mDelegate;
QCheckBox *mRsvp;
QPushButton *mOkButton;
};
#endif
/* Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
Author: Sérgio Martins <sergio.martins@kdab.com>
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) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
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, see <http://www.gnu.org/licenses/>.
*/
#include "memorycalendarmemento.h"
#include <CalendarSupport/CalendarSingleton>
#include <Akonadi/Calendar/FetchJobCalendar>
#include <Akonadi/Calendar/ETMCalendar>
#include "text_calendar_debug.h"
using namespace MessageViewer;
using namespace Akonadi;
MemoryCalendarMemento::MemoryCalendarMemento()
: QObject(0), mFinished(false)
{
Akonadi::ETMCalendar::Ptr etmCalendar = CalendarSupport::calendarSingleton(/*createIfNull=*/false);
if (etmCalendar && etmCalendar->isLoaded()) {
// Good, either korganizer or kontact summary view are already running, so reuse ETM to save memory
mCalendar = etmCalendar;
QMetaObject::invokeMethod(this, "finalize", Qt::QueuedConnection);
} else {
FetchJobCalendar::Ptr calendar = FetchJobCalendar::Ptr(new FetchJobCalendar(this));
mCalendar = calendar;
connect(calendar.data(), &FetchJobCalendar::loadFinished,
this, &MemoryCalendarMemento::slotCalendarLoaded);
}
}
void MemoryCalendarMemento::slotCalendarLoaded(bool success, const QString &errorMessage)
{
qCDebug(TEXT_CALENDAR_LOG);
if (!success) {
qCWarning(TEXT_CALENDAR_LOG) << "Unable to fetch incidences:" << errorMessage;
}
finalize();
}
void MemoryCalendarMemento::finalize()
{
mFinished = true;
Q_EMIT update(MimeTreeParser::Delayed);
}
bool MemoryCalendarMemento::finished() const
{
return mFinished;
}
KCalCore::MemoryCalendar::Ptr MemoryCalendarMemento::calendar() const
{
Q_ASSERT(mFinished);
return mCalendar;
}
void MemoryCalendarMemento::detach()
{
disconnect(this, &MemoryCalendarMemento::update, 0, 0);
}
/* Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
Author: Sérgio Martins <sergio.martins@kdab.com>
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) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
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, see <http://www.gnu.org/licenses/>.
*/
#ifndef MEMORYCALENDARMEMENTO_H
#define MEMORYCALENDARMEMENTO_H
#include <MimeTreeParser/BodyPart>
#include <MimeTreeParser/Enums>
#include <KCalCore/MemoryCalendar>
#include <QObject>
class KJob;
namespace MessageViewer
{
class MemoryCalendarMemento : public QObject, public MimeTreeParser::Interface::BodyPartMemento
{
Q_OBJECT
public:
MemoryCalendarMemento();
bool finished() const;
KCalCore::MemoryCalendar::Ptr calendar() const;
void detach() Q_DECL_OVERRIDE;
Q_SIGNALS:
// TODO: Factor our update and detach into base class
void update(MimeTreeParser::UpdateMode);
private Q_SLOTS:
void slotCalendarLoaded(bool success, const QString &errorMessage);
void finalize();
private:
bool mFinished;
KCalCore::MemoryCalendar::Ptr mCalendar;
};
}
#endif
/*
This file is part of kdepim.
Copyright (c) 2013 Sérgio Martins <iamsergio@gmail.com>
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
In addition, as a special exception, the copyright holders give
permission to link the code of this program with any edition of
the Qt library by Trolltech AS, Norway (or with modified versions
of Qt that use the same license as Qt), and distribute linked
combinations including the two. You must obey the GNU General
Public License in all respects for all of the code used other than
Qt. If you modify this file, you may extend this exception to
your version of the file, but you are not obligated to do so. If
you do not wish to do so, delete this exception statement from
your version.
*/
#include "syncitiphandler.h"