generic: cleanup

This commit is contained in:
Ivailo Monev 2015-09-25 03:02:05 +00:00
parent 9a34fd6a9e
commit e75ae48e76
542 changed files with 21 additions and 55789 deletions

View file

@ -193,5 +193,3 @@ QObject* KWebKitPlatformPlugin::createExtension(Extension ext) const
Q_EXPORT_PLUGIN2(kwebspellchecker, KWebKitPlatformPlugin)
Q_IMPORT_PLUGIN(kwebspellchecker)

View file

@ -30,11 +30,8 @@
#include <QtGlobal>
#include <QtPlugin>
#include <QWebKitPlatformPlugin>
#include <sonnet/speller.h>
#include "qwebkitplatformplugin.h"
class KWebSpellChecker : public QWebSpellChecker
{

View file

@ -1,201 +0,0 @@
/*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2012 by Lindsay Mathieson <lindsay dot mathieson at gmail dot com>
*
* 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 QWEBKITPLATFORMPLUGIN_H
#define QWEBKITPLATFORMPLUGIN_H
/*
* Warning: The contents of this file is not part of the public QtWebKit API
* and may be changed from version to version or even be completely removed.
*/
#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
#include <QMediaPlayer>
#endif
#include <QtCore/QObject>
#include <QtCore/QRect>
#include <QtCore/QUrl>
#include <QtGui/QColor>
#include <QtGui/QFont>
class QWebSelectData
{
public:
virtual ~QWebSelectData() {}
enum ItemType { Option, Group, Separator };
virtual ItemType itemType(int) const = 0;
virtual QString itemText(int index) const = 0;
virtual QString itemToolTip(int index) const = 0;
virtual bool itemIsEnabled(int index) const = 0;
virtual bool itemIsSelected(int index) const = 0;
virtual int itemCount() const = 0;
virtual bool multiple() const = 0;
virtual QColor backgroundColor() const = 0;
virtual QColor foregroundColor() const = 0;
virtual QColor itemBackgroundColor(int index) const = 0;
virtual QColor itemForegroundColor(int index) const = 0;
};
class QWebSelectMethod : public QObject
{
Q_OBJECT
public:
virtual ~QWebSelectMethod() {}
virtual void show(const QWebSelectData&) = 0;
virtual void hide() = 0;
virtual void setGeometry(const QRect&) = 0;
virtual void setFont(const QFont&) = 0;
Q_SIGNALS:
void selectItem(int index, bool allowMultiplySelections, bool shift);
void didHide();
};
class QWebNotificationData
{
public:
virtual ~QWebNotificationData() {}
virtual const QString title() const = 0;
virtual const QString message() const = 0;
virtual const QUrl iconUrl() const = 0;
virtual const QUrl openerPageUrl() const = 0;
};
class QWebNotificationPresenter : public QObject
{
Q_OBJECT
public:
QWebNotificationPresenter() {}
virtual ~QWebNotificationPresenter() {}
virtual void showNotification(const QWebNotificationData*) = 0;
Q_SIGNALS:
void notificationClosed();
void notificationClicked();
};
class QWebHapticFeedbackPlayer: public QObject
{
Q_OBJECT
public:
QWebHapticFeedbackPlayer() {}
virtual ~QWebHapticFeedbackPlayer() {}
enum HapticStrength
{
None, Weak, Medium, Strong
};
enum HapticEvent
{
Press, Release
};
virtual void playHapticFeedback(const HapticEvent, const QString& hapticType, const HapticStrength) = 0;
};
class QWebTouchModifier : public QObject
{
Q_OBJECT
public:
virtual ~QWebTouchModifier() {}
enum PaddingDirection
{
Up, Right, Down, Left
};
virtual unsigned hitTestPaddingForTouch(const PaddingDirection) const = 0;
};
#if defined(WTF_USE_QT_MULTIMEDIA) && WTF_USE_QT_MULTIMEDIA
class QWebFullScreenVideoHandler : public QObject
{
Q_OBJECT
public:
QWebFullScreenVideoHandler() {}
virtual ~QWebFullScreenVideoHandler() {}
virtual bool requiresFullScreenForVideoPlayback() const = 0;
Q_SIGNALS:
void fullScreenClosed();
public Q_SLOTS:
virtual void enterFullScreen(QMediaPlayer*) = 0;
virtual void exitFullScreen() = 0;
};
#endif
class QWebSpellChecker : public QObject
{
Q_OBJECT
public:
struct GrammarDetail
{
int location;
int length;
QStringList guesses;
QString userDescription;
};
virtual bool isContinousSpellCheckingEnabled() const = 0;
virtual void toggleContinousSpellChecking() = 0;
virtual void learnWord(const QString& word) = 0;
virtual void ignoreWordInSpellDocument(const QString& word) = 0;
virtual void checkSpellingOfString(const QString& word, int* misspellingLocation, int* misspellingLength) = 0;
virtual QString autoCorrectSuggestionForMisspelledWord(const QString& word) = 0;
virtual void guessesForWord(const QString& word, const QString& context, QStringList& guesses) = 0;
virtual bool isGrammarCheckingEnabled() = 0;
virtual void toggleGrammarChecking() = 0;
virtual void checkGrammarOfString(const QString&, QList<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) = 0;
};
class QWebKitPlatformPlugin
{
public:
virtual ~QWebKitPlatformPlugin() {}
enum Extension
{
MultipleSelections,
Notifications,
Haptics,
TouchInteraction,
FullScreenVideoPlayer,
SpellChecker
};
virtual bool supportsExtension(Extension) const = 0;
virtual QObject* createExtension(Extension) const = 0;
};
QT_BEGIN_NAMESPACE
Q_DECLARE_INTERFACE(QWebKitPlatformPlugin, "com.nokia.Qt.WebKit.PlatformPlugin/1.9")
QT_END_NAMESPACE
#endif // QWEBKITPLATFORMPLUGIN_H

View file

@ -42,6 +42,7 @@
#include <kleo/cryptobackendfactory.h>
#include <kdebug.h>
#include <klocale.h>
#include <QDBusConnection>

View file

@ -33,6 +33,8 @@
#include "mainwindow.h"
#include <QApplication>
#include <KGlobal>
#include <KLocale>
int main( int argc, char** argv )
{

View file

@ -37,6 +37,8 @@
#include "configwriter.h"
#include "exception.h"
#include <KLocale>
#include <QFile>
#include <QFileDialog>
#include <QMessageBox>

View file

@ -28,6 +28,7 @@
#include <KAboutData>
#include <KAcceleratorManager>
#include <KComponentData>
#include <KConfigGroup>
KCModule *create_todosummary( QWidget *parent, const char * )
{

View file

@ -28,6 +28,7 @@
#include <KAboutData>
#include <KAcceleratorManager>
#include <KComponentData>
#include <KConfigGroup>
extern "C"
{

View file

@ -0,0 +1 @@
../../multiagendaviewconfigwidget.ui

View file

@ -28,6 +28,7 @@
#include <KDateTimeWidget>
#include <KMessageBox>
#include <KDebug>
#include <KLocale>
class HistoryWidgetDelegate : public QItemDelegate
{

View file

@ -36,6 +36,7 @@
#include <KIcon>
#include <KDebug>
#include <KLocale>
#include <QItemDelegate>
#include <QAbstractTableModel>

View file

@ -1 +0,0 @@
SKIP /tests/

View file

@ -1,19 +0,0 @@
add_definitions( -DKDEPIM_MOBILE_UI )
add_definitions( -DQT_NO_CAST_FROM_ASCII )
add_definitions( -DQT_NO_CAST_TO_ASCII )
add_subdirectory(lib)
add_subdirectory(pics)
include_directories(lib)
add_subdirectory(calendar)
add_subdirectory(contacts)
add_subdirectory(mail)
add_subdirectory(tasks)
add_subdirectory(notes)
add_subdirectory(api)
add_subdirectory(licenses)

View file

@ -1 +0,0 @@
add_subdirectory(mail)

View file

@ -1,37 +0,0 @@
project(mail)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
set(mail_SRCS
mailplugin.cpp
message.cpp
composer.cpp
error.cpp
receivermodel.cpp
)
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${KDE4_INCLUDES}
${CMAKE_SOURCE_DIR}/messagecomposer
${CMAKE_BINARY_DIR}/messagecomposer
${CMAKE_SOURCE_DIR}/libkdepim/
)
qt4_automoc(${mail_SRCS})
kde4_add_library(mailplugin SHARED ${mail_SRCS})
target_link_libraries(mailplugin
${QT_QTCORE_LIBRARY}
${QT_QTDECLARATIVE_LIBRARY}
${KDEPIMLIBS_AKONADI_LIBS}
${KDEPIMLIBS_KMIME_LIBS}
messagecomposer
)
install(TARGETS mailplugin DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/pim/mail)
install(FILES qmldir DESTINATION ${IMPORTS_INSTALL_DIR}/org/kde/pim/mail)

View file

@ -1,185 +0,0 @@
/*
Copyright 2014 Abhijeet Nikam connect08nikam@gmail.com
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 "composer.h"
#include <qdebug.h>
Composer::Composer( QObject *parent )
: QObject( parent )
, m_receiverModel ( new ReceiverModel (this) )
{
}
QString Composer::from() const
{
return m_from;
}
QString Composer::cc() const
{
return m_cc;
}
QString Composer::bcc() const
{
return m_bcc;
}
QString Composer::to() const
{
return m_to;
}
QString Composer::subject() const
{
return m_subject;
}
QString Composer::body() const
{
return m_body;
}
void Composer::setFrom(const QString &from)
{
if ( from != m_from ) {
m_from = from;
emit fromChanged();
}
}
void Composer::setTo(const QString &to)
{
if ( to != m_to ) {
m_to = to;
emit toChanged();
}
}
void Composer::setCC(const QString &cc)
{
if ( cc != m_cc ) {
m_cc = cc;
emit ccChanged();
}
}
void Composer::setBCC(const QString &bcc)
{
if ( bcc != m_bcc ) {
m_bcc = bcc;
emit bccChanged();
}
}
void Composer::setSubject(const QString &subject)
{
if ( subject != m_subject ) {
m_subject = subject;
emit subjectChanged();
}
}
void Composer::setBody(const QString &body)
{
if ( body != m_body ) {
m_body = body;
emit bodyChanged();
}
}
ReceiverModel *Composer::receiverModel() const
{
return m_receiverModel;
}
QByteArray Composer::convert (const QString &body)
{
QTextCodec *codec = QTextCodec::codecForName("UTF-16");
QTextEncoder *encoderWithoutBom = codec->makeEncoder( QTextCodec::IgnoreHeader );
QByteArray bytes = encoderWithoutBom ->fromUnicode( body );
return bytes;
}
void Composer::send()
{
KMime::Message::Ptr m_msg (new KMime::Message);
KMime::Headers::ContentType *ct = m_msg->contentType();
ct->setMimeType( "multipart/mixed" );
ct->setBoundary( KMime::multiPartBoundary() );
ct->setCategory( KMime::Headers::CCcontainer );
m_msg->contentTransferEncoding()->clear();
// Set the headers.
m_msg->from()->fromUnicodeString( m_from , "utf-8" );
m_msg->to()->fromUnicodeString( m_receiverModel->recipientString(MessageComposer::Recipient::To), "utf-8" );
m_msg->cc()->fromUnicodeString( m_receiverModel->recipientString(MessageComposer::Recipient::Cc), "utf-8" );
m_msg->date()->setDateTime( KDateTime::currentLocalDateTime() );
m_msg->subject()->fromUnicodeString( m_subject, "utf-8" );
// Set the first multipart, the body message.
KMime::Content *b = new KMime::Content;
b->contentType()->setMimeType( "text/plain" );
b->setBody( convert (m_body) );
// Add the multipart and assemble
m_msg->addContent( b );
m_msg->assemble();
MessageComposer::AkonadiSender *mSender = new MessageComposer::AkonadiSender (this);
mSender->send(m_msg, MessageComposer::MessageSender::SendImmediate);
}
void Composer::sendLater()
{
}
void Composer::saveDraft()
{
}
void Composer::addRecipient( const QString &email , int type )
{
MessageComposer::Recipient::Ptr rec (new MessageComposer::Recipient);
rec->setEmail ( email );
rec->setType ( MessageComposer::Recipient::idToType(type) );
m_receiverModel->addRecipient ( rec );
}

View file

@ -1,98 +0,0 @@
/*
Copyright 2014 Abhijeet Nikam connect08nikam@gmail.com
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 COMPOSER_H
#define COMPOSER_H
#include <KDE/KDateTime>
#include <KDE/KMime/Message>
#include <QObject>
#include <QTextCodec>
#include <QTextEncoder>
#include "sender/akonadisender.h"
#include "receivermodel.h"
class Composer : public QObject
{
Q_OBJECT
Q_PROPERTY (QString subject READ subject WRITE setSubject NOTIFY subjectChanged)
Q_PROPERTY (QString body READ body WRITE setBody NOTIFY bodyChanged)
Q_PROPERTY (QString cc READ cc WRITE setCC NOTIFY ccChanged)
Q_PROPERTY (QString to READ to WRITE setTo NOTIFY toChanged)
Q_PROPERTY (QString bcc READ bcc WRITE setBCC NOTIFY bccChanged)
Q_PROPERTY (QString from READ from WRITE setFrom NOTIFY fromChanged)
Q_PROPERTY (ReceiverModel* receiverModel READ receiverModel CONSTANT)
public:
explicit Composer( QObject *parent = 0 );
QString cc() const;
QString bcc() const;
QString from() const;
QString to() const;
QString subject() const;
QString body() const;
ReceiverModel *receiverModel() const;
void setFrom( const QString &from );
void setTo( const QString &replyTo );
void setCC( const QString &cc );
void setBCC( const QString &bcc );
void setSubject( const QString &subject );
void setBody ( const QString &body );
QByteArray convert ( const QString &body );
signals:
void subjectChanged();
void bodyChanged();
void fromChanged();
void toChanged();
void bccChanged();
void ccChanged();
public slots:
void send();
void saveDraft();
void sendLater();
void addRecipient( const QString &email , int type );
private:
QString m_subject;
QString m_from;
QString m_body;
QString m_cc;
QString m_to;
QString m_bcc;
ReceiverModel *m_receiverModel;
};
#endif

View file

@ -1,50 +0,0 @@
/*
Copyright 2014 Michael Bohlender michael.bohlender@kdemail.net
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 "error.h"
Error::Error(QObject *parent) : QObject(parent), m_code(0)
{
}
int Error::code() const
{
return m_code;
}
QString Error::text() const
{
return m_text;
}
void Error::setError(int code, const QString &text)
{
if (code != m_code || text != m_text) {
m_code = code;
m_text = text;
emit errorChanged();
}
}
void Error::clear()
{
setError(0, QString());
}

View file

@ -1,51 +0,0 @@
/*
Copyright 2014 Michael Bohlender michael.bohlender@kdemail.net
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 ERROR_H
#define ERROR_H
#include <QObject>
#include <QString>
class Error : public QObject
{
Q_OBJECT
Q_PROPERTY (int code READ code NOTIFY errorChanged)
Q_PROPERTY (QString text READ text NOTIFY errorChanged)
public:
explicit Error( QObject *parent = 0 );
int code() const;
QString text() const;
signals:
void errorChanged();
public slots:
void clear();
void setError( int code, const QString &text );
private:
int m_code;
QString m_text;
};
#endif //ERROR_H

View file

@ -1,40 +0,0 @@
/*
Copyright 2014 Michael Bohlender michael.bohlender@kdemail.net
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 "mailplugin.h"
#include "message.h"
#include "composer.h"
#include "error.h"
#include "receivermodel.h"
#include <qdeclarative.h>
void MailPlugin::registerTypes(const char *uri)
{
Q_ASSERT(uri == "org.kde.pim.mail");
qmlRegisterType<Message>(uri, 0, 1, "Message");
qmlRegisterType<Composer>(uri, 0, 1, "Composer");
qmlRegisterType<Error>(uri, 0, 1, "Error");
qmlRegisterType<ReceiverModel>(uri, 0, 1, "ReceiverModel");
}
Q_EXPORT_PLUGIN2(mailplugin, MailPlugin)

View file

@ -1,36 +0,0 @@
/*
Copyright 2014 Michael Bohlender michael.bohlender@kdemail.net
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 MAILPLUGIN_H
#define MAILPLUGIN_H
#include <QDeclarativeExtensionPlugin>
class MailPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT
public:
void registerTypes(const char *uri);
};
#endif

View file

@ -1,87 +0,0 @@
/*
Copyright 2014 Michael Bohlender michael.bohlender@kdemail.net
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 "message.h"
#include <Akonadi/ItemFetchScope>
#include <KMime/Message>
#include <KMimeType>
Message::Message(QObject *parent) : QObject(parent), m_error(new Error())
{
}
Message::~Message()
{
}
QString Message::subject() const
{
return m_subject;
}
QString Message::from() const
{
return m_from;
}
QString Message::textContent() const
{
return m_textContent;
}
Error *Message::error() const
{
return m_error.data();
}
void Message::loadMessage(const QUrl &url)
{
Akonadi::ItemFetchJob *fetchJob = new Akonadi::ItemFetchJob(Akonadi::Item::fromUrl(url));
fetchJob->fetchScope().fetchFullPayload();
connect(fetchJob, SIGNAL(itemsReceived(Akonadi::Item::List)), this, SLOT(slotItemReceived(Akonadi::Item::List)));
}
void Message::slotItemReceived(const Akonadi::Item::List &itemList)
{
if (itemList.empty()) {
//TODO handle Message not found?
return;
}
Akonadi::Item item = itemList.first();
KMime::Message msg;
msg.setContent(item.payloadData());
msg.setFrozen(true);
msg.parse();
m_subject = msg.subject()->asUnicodeString();
m_from = msg.from()->asUnicodeString();
m_textContent = msg.textContent()->decodedText(true,true);
emit messageChanged();
}

View file

@ -1,68 +0,0 @@
/*
Copyright 2014 Michael Bohlender michael.bohlender@kdemail.net
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 MESSAGE_H
#define MESSAGE_H
#include <QObject>
#include <QString>
#include <QUrl>
#include <QScopedPointer>
#include <Akonadi/ItemFetchJob>
#include "error.h"
class Message : public QObject
{
Q_OBJECT
Q_PROPERTY (QString subject READ subject NOTIFY messageChanged)
Q_PROPERTY (QString from READ from NOTIFY messageChanged)
Q_PROPERTY (QString textContent READ textContent NOTIFY messageChanged)
Q_PROPERTY (Error* error READ error CONSTANT)
public:
explicit Message( QObject *parent = 0 );
~Message();
QString subject() const;
QString from() const;
QString textContent() const;
Error *error() const;
signals:
void messageChanged();
public slots:
void loadMessage(const QUrl &url);
private slots:
void slotItemReceived(const Akonadi::Item::List &itemList);
private:
QString m_subject;
QString m_from;
QString m_textContent;
QScopedPointer<Error> m_error;
};
#endif //MESSAGE_H

View file

@ -1 +0,0 @@
plugin mailplugin

View file

@ -1,155 +0,0 @@
/*
Copyright 2014 Abhijeet Nikam connect08nikam@gmail.com
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 "receivermodel.h"
ReceiverModel::ReceiverModel(QObject *parent) : QAbstractListModel(parent)
{
QHash<int, QByteArray> roles;
roles[Name] = "name";
roles[Email] = "email";
roles[Type] = "type";
setRoleNames (roles);
}
int ReceiverModel::rowCount( const QModelIndex &parent ) const
{
if (parent.isValid()) {
return 0;
}
return mRecipients.count();
}
QVariant ReceiverModel::data( const QModelIndex &index, int role ) const
{
if (!index.isValid()) {
return QVariant();
}
if (index.row() >= mRecipients.size() || index.row() < 0) {
return QVariant();
}
int row = index.row();
switch(role) {
case Name:
return mRecipients[row]->name();
case Email:
return mRecipients[row]->email();
case Type:
return mRecipients[row]->type();
}
return QVariant();
}
bool ReceiverModel::setData( const QModelIndex &index, const QVariant &value, int role )
{
if (index.isValid() && role == Qt::EditRole && !(index.row() >= mRecipients.size() || index.row() < 0)) {
int row = index.row();
switch(role) {
case Name:
mRecipients[row]->setName(value.toString());
break;
case Email:
mRecipients[row]->setEmail(value.toString());
break;
case Type:
mRecipients[row]->setType(MessageComposer::Recipient::idToType (value.toInt()));
break;
default:
return false;
}
emit dataChanged(index, index);
return true;
}
return false;
}
Qt::ItemFlags ReceiverModel::flags( const QModelIndex &index ) const
{
if (!index.isValid()) {
return Qt::ItemIsEnabled;
}
return QAbstractListModel::flags(index) | Qt::ItemIsEditable;
}
bool ReceiverModel::addRecipient( const MessageComposer::Recipient::Ptr &recipient )
{
if ( mRecipients.contains( recipient ) ) {
return false;
}
beginInsertRows( QModelIndex(), rowCount(), rowCount() );
mRecipients.append( recipient );
endInsertRows();
return true;
}
bool ReceiverModel::removeRecipient( const MessageComposer::Recipient::Ptr &recipient )
{
int index = mRecipients.indexOf( recipient );
if ( index < 0 ) {
return false;
}
beginRemoveRows( QModelIndex(), rowCount(), rowCount() );
mRecipients.removeAt( index );
endRemoveRows();
return true;
}
QStringList ReceiverModel::recipientStringList( MessageComposer::Recipient::Type type ) const
{
QStringList selectedRecipients;
foreach ( const MessageComposer::Recipient::Ptr &r, mRecipients ) {
if ( r->type() == type ) {
selectedRecipients << r->email();
}
}
return selectedRecipients;
}
QString ReceiverModel::recipientString( MessageComposer::Recipient::Type type ) const
{
return recipientStringList( type ).join( QLatin1String(", ") );
}

View file

@ -1,60 +0,0 @@
/*
Copyright 2014 Abhijeet Nikam connect08nikam@gmail.com
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 RECEIVERMODEL_H
#define RECEIVERMODEL_H
#include <QAbstractListModel>
#include <QStringList>
#include "recipient/recipient.h"
class ReceiverModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit ReceiverModel(QObject *parent = 0);
enum Roles {
Name = Qt::UserRole + 1,
Email,
Type
};
int rowCount( const QModelIndex &parent = QModelIndex() ) const;
QVariant data( const QModelIndex &index, int role) const;
Qt::ItemFlags flags( const QModelIndex &index ) const;
bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole );
bool addRecipient( const MessageComposer::Recipient::Ptr &recipient );
bool removeRecipient( const MessageComposer::Recipient::Ptr &recipient );
QStringList recipientStringList( MessageComposer::Recipient::Type ) const;
QString recipientString( MessageComposer::Recipient::Type type ) const;
private:
MessageComposer::Recipient::List mRecipients;
};
#endif

View file

@ -1,41 +0,0 @@
/*
Copyright (c) 2010 Volker Krause <vkrause@kde.org>
Copyright (c) 2010 Bertjan Broeksema <broeksema@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.
*/
import QtQuick 1.1
import org.kde 4.5
import org.kde.pim.mobileui 4.5 as KPIM
KPIM.BulkActionScreen {
id : bulkActionScreen
anchors.fill: parent
backgroundImage : backgroundImage.source
actionListWidth : 1/3 * parent.width
multipleText : KDE.i18np("1 calendar", "%1 calendars", collectionView.numSelected)
selectedItemModel : _breadcrumbNavigationFactory.qmlSelectedItemModel();
headerList : EventListView {
showCheckBox : true
id: bulkActionHeaderList
model: itemModel
checkModel : _itemActionModel
anchors.fill : parent
itemHeight: bulkActionScreen.itemHeight
}
}

View file

@ -1,83 +0,0 @@
project(korganizer-mobile)
include_directories(
# This is probably not the correct way to get KCalPrefs in.
${CMAKE_SOURCE_DIR}/calendarsupport/
${CMAKE_BINARY_DIR}/calendarsupport/
${CMAKE_SOURCE_DIR}/calendarviews
${KDEPIMLIBS_INCLUDE_DIR}
${AKONADI_INCLUDE_DIR}
${Boost_INCLUDE_DIR}
)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}" )
set(korganizer_mobile_SRCS
agendaviewitem.cpp
calendarinterface.cpp
configwidget.cpp
declarativewidgetwrapper.cpp
eventlistproxy.cpp
eventsfilterproxymodel.cpp
eventsguistatemanager.cpp
eventsexporthandler.cpp
eventsimporthandler.cpp
mainview.cpp
main.cpp
monthviewitem.cpp
searchwidget.cpp
timelineviewitem.cpp
qmldateedit.cpp
)
qt4_wrap_ui(korganizer_mobile_SRCS configwidget.ui searchwidget.ui)
kde4_add_kcfg_files(korganizer_mobile_SRCS settings.kcfgc)
qt4_add_dbus_adaptor(korganizer_mobile_SRCS ${CMAKE_SOURCE_DIR}/korganizer/org.kde.Korganizer.Calendar.xml calendarinterface.h CalendarInterface )
if (RUNTIME_PLUGINS_STATIC)
add_definitions(-DMAIL_SERIALIZER_PLUGIN_STATIC)
endif ()
kde4_add_app_icon(korganizer_mobile_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/hi*-apps-korganizer-mobile.png")
kde4_add_executable(korganizer-mobile ${korganizer_mobile_SRCS} )
target_link_libraries(korganizer-mobile
${QT_QTDECLARATIVE_LIBRARY}
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDE4_KDECLARATIVE_LIBS}
${KDEPIMLIBS_KCALCORE_LIBS}
${KDEPIMLIBS_KCALUTILS_LIBS}
${KDEPIMLIBS_KHOLIDAYS_LIBS}
${KDEPIMLIBS_AKONADI_LIBS}
${KDEPIMLIBS_AKONADI_CALENDAR_LIBS}
kdepimdbusinterfaces
kdepimmobileui
kdepimmobileuicalendar
incidenceeditorsngmobile
eventviews
calendarsupport
kdepim
)
if (RUNTIME_PLUGINS_STATIC)
target_link_libraries(korganizer-mobile akonadi_serializer_addressee akonadi_serializer_contactgroup akonadi_serializer_kcalcore akonadi_serializer_mail)
endif ()
install(TARGETS korganizer-mobile ${INSTALL_TARGETS_DEFAULT_ARGS})
install(PROGRAMS korganizer-mobile.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
install(FILES
BulkActionComponent.qml
ConfigDialog.qml
korganizer-mobile.qml
KorganizerActions.qml
korganizer-mobile-background.png
EventListView.qml
EventListComponent.qml
MonthViewComponent.qml
TimelineView.qml
DESTINATION ${DATA_INSTALL_DIR}/korganizer-mobile
)
kde4_install_icons( ${ICON_INSTALL_DIR} )

View file

@ -1,106 +0,0 @@
/*
Copyright (c) 2010 Tobias Koenig <tokoe@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.
*/
import QtQuick 1.1 as QML
import org.kde 4.5
import org.kde.pim.mobileui 4.5 as KPIM
import org.kde.akonadi.calendar 4.5 as Calendar
import org.kde.plasma.extras 0.1 as PlasmaExtras
QML.Rectangle {
id: configDialog
anchors.fill: parent
z: 10
color: "white"
visible: guiStateManager.inConfigScreenState
function load()
{
configWidget.load();
}
QML.Connections {
target: configWidget
onShowClockWidget: {
clockWidget.expand()
clockWidget.okEnabled = false
// set the initial values
clockWidget.hours = hour;
clockWidget.minutes = minute;
}
}
QML.Connections {
target: clockWidget
onTimeChanged: {
configWidget.setNewTime( hour, minute );
}
}
KPIM.ClockDialog {
id: clockWidget
anchors.fill: parent
}
PlasmaExtras.ScrollArea {
id: configWidgetBox
anchors {
top: parent.top
topMargin: 25
bottom: parent.bottom
left: parent.left
right: okButton.left
}
QML.Flickable {
contentHeight: configWidget.height;
Calendar.ConfigWidget {
id: configWidget
width: parent.width
}
}
}
KPIM.Button2 {
id: okButton
anchors.top: parent.top
anchors.topMargin: 20
anchors.right: parent.right
width: 150
buttonText: KDE.i18n( "OK" )
onClicked: {
configWidget.save();
guiStateManager.popState()
}
}
KPIM.Button2 {
id: cancelButton
anchors.top: okButton.bottom
anchors.right: parent.right
width: 150
buttonText: KDE.i18n( "Cancel" )
onClicked: {
guiStateManager.popState()
}
}
}

View file

@ -1,91 +0,0 @@
/*
Copyright (c) 2010 Volker Krause <vkrause@kde.org>
Copyright (c) 2010 Bertjan Broeksema <broeksema@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.
*/
import QtQuick 1.1 as QML
import org.kde 4.5
import org.kde.akonadi 4.5 as Akonadi
import org.kde.pim.mobileui 4.5 as KPIM
import "../mobileui/ScreenFunctions.js" as Screen
QML.Rectangle {
id: eventListView
visible: guiStateManager.inViewEventListState
anchors.fill: parent
color: "#D2D1D0" // TODO: make palette work correctly. palette.window
QML.Rectangle {
height: 48
width: 48
z: 5
color: "#00000000"
anchors.right : parent.right
anchors.rightMargin : 70
anchors.bottom : parent.bottom
anchors.bottomMargin : 70
QML.Image {
source : KDE.locate( "data", "mobileui/back-to-list-button.png" );
QML.MouseArea {
anchors.fill : parent;
onClicked : {
_itemActionModel.select(-1, 1)
_itemNavigationModel.select(-1, 1)
guiStateManager.popState();
}
}
}
}
EventListView {
showCheckBox : false
id: eventList
model: itemModel
checkModel : _itemActionModel
anchors.left : parent.left
anchors.top : parent.top
anchors.bottom : filterLineEdit.top
anchors.right : parent.right
anchors.topMargin: 30
anchors.leftMargin: 40
itemHeight: Screen.partition( height, 7 )
navigationModel : _itemNavigationModel
}
Akonadi.FilterLineEdit {
id: filterLineEdit
anchors.left : parent.left
anchors.bottom : parent.bottom
anchors.right : parent.right
anchors.leftMargin: 40
visible : false
height : 0
y : height == 0 ? parent.height : parent.height - height
}
QML.Connections {
target : _itemNavigationModel
onCurrentRowChanged : {
application.setCurrentEventItemId(_itemNavigationModel.currentItemIdHack);
guiStateManager.pushUniqueState( KPIM.GuiStateManager.ViewSingleItemState )
_itemActionModel.select( _itemNavigationModel.currentRow, 3 );
eventView.itemId = _itemNavigationModel.currentItemIdHack;
}
}
}

View file

@ -1,65 +0,0 @@
/*
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.
*/
import QtQuick 1.1 as QML
import org.kde.pim.mobileui 4.5 as KPIM
/** Akonadi Event List View
*/
KPIM.ItemListView {
id : _top
property bool showCheckBox
property variant checkModel
delegate: [
KPIM.ItemListViewDelegate {
id : _delegate
showCheckBox : _top.showCheckBox
checkModel : _top.checkModel
navigationModel : _top.navigationModel
height : _top.itemHeight
summaryContent : [
QML.Text {
id: fromLabel
anchors.top : parent.top
anchors.topMargin : 1
anchors.left : parent.left
anchors.leftMargin : 10
text : KDE.i18n( "%1 (%2)", model.begin, model.duration );
color : "#0C55BB"
font.pixelSize: 16
elide: "ElideRight"
width: parent.width - anchors.leftMargin - anchors.rightMargin
},
QML.Text {
id: subjectLabel
anchors.top : fromLabel.bottom
anchors.topMargin : 1
anchors.left : parent.left
anchors.leftMargin : 10
anchors.right: parent.right
height : 30;
text : model.summary
font.pixelSize: 18
elide: "ElideRight"
}
]
}
]
}

View file

@ -1,213 +0,0 @@
/*
Copyright (C) 2010 Klarälvdalens Datakonsult AB,
a KDAB Group company, info@kdab.net,
author Stephen Kelly <stephen@kdab.com>
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.
*/
import QtQuick 1.1 as QML
import org.kde 4.5
import org.kde.pim.mobileui 4.5
import "../mobileui/ScreenFunctions.js" as Screen
ActionMenuContainer {
menuStyle : true
actionItemHeight: Screen.partition( height, 6 ) - actionItemSpacing
actionItemWidth : 200
actionItemSpacing : 2
ActionList {
category : "home"
name : "home_menu"
text : KDE.i18n( "Home" )
ActionListItem { name : "synchronize_all_items" }
ScriptActionItem { name : "to_selection_screen"; title : KDE.i18n( "Select Multiple Calendars" ) }
ActionListItem { name : "import_events" }
ActionListItem { name : "configure_categories" }
}
FavoriteManager{ model : favoritesList }
AgentInstanceList {
category : "home"
name : "accounts_list"
text : KDE.i18n( "Accounts" )
model : agentInstanceList
}
ActionList {
category : "account"
name : "account_menu"
text : KDE.i18n( "Account" )
ActionListItem { name : "akonadi_resource_synchronize" }
ActionListItem { name : "akonadi_resource_properties" }
ActionListItem { name : "akonadi_collection_properties" }
ActionListItem { name : "akonadi_collection_create" }
ActionListItem { name : "archive_old_entries" }
}
ActionList {
category : "account"
name : "account_view_menu"
text : KDE.i18n( "View" )
ScriptActionItem { name : "add_as_favorite"; title : KDE.i18n( "Add View As Favorite" ) }
ScriptActionItem { name : "start_maintenance"; title : KDE.i18n( "Switch To Editing Mode" ) }
}
ActionList {
category : "single_folder"
name : "single_folder_folder_menu"
text : KDE.i18n( "Folder" )
ActionListItem { name : "akonadi_collection_sync" }
ActionListItem { name : "export_selected_events" }
ActionListItem { name : "archive_old_entries" }
}
ActionList {
category : "single_folder"
name : "single_folder_edit_menu"
text : KDE.i18n( "Edit" )
ActionListItem { name : "akonadi_collection_properties" }
ActionListItem { name : "akonadi_collection_create" }
ActionListItem { name : "akonadi_collection_move_to_dialog" }
ActionListItem { name : "akonadi_collection_copy_to_dialog" }
ActionListItem { name : "akonadi_collection_delete" }
}
ActionList {
category : "single_folder"
name : "single_folder_view_menu"
text : KDE.i18n( "View" )
ScriptActionItem { name : "add_as_favorite"; title : KDE.i18n( "Add View As Favorite" ) }
ScriptActionItem { name : "start_maintenance"; title : KDE.i18n( "Switch To Editing Mode" ) }
}
ActionList {
category : "multiple_folder"
name : "multi_folder_folder_menu"
text : KDE.i18n( "Folders" )
ActionListItem { name : "akonadi_collection_sync" }
ActionListItem { name : "export_selected_events" }
ActionListItem { name : "archive_old_entries" }
}
ActionList {
category : "multiple_folder"
name : "multi_folder_view_menu"
text : KDE.i18n( "View" )
ScriptActionItem { name : "to_selection_screen"; title : KDE.i18n( "Select Calendars" ) }
ScriptActionItem { name : "add_as_favorite"; title : KDE.i18n( "Add View As Favorite" ) }
ScriptActionItem { name : "start_maintenance"; title : KDE.i18n( "Switch To Editing Mode" ) }
}
ActionList {
category : "single_calendar"
name : "single_calendar_calendar_menu"
text : KDE.i18n( "Choice" )
ActionListItem { name : "akonadi_collection_sync" }
ScriptActionItem { name : "show_today"; title : KDE.i18n( "Show Today" ) }
ScriptActionItem { name : "day_layout"; title : KDE.i18n( "Day View" ) }
ScriptActionItem { name : "three_day_layout"; title : KDE.i18n( "Next Three Days View" ) }
ScriptActionItem { name : "week_layout"; title : KDE.i18n( "Week View" ) }
ScriptActionItem { name : "work_week_layout"; title : KDE.i18n( "Work Week View" ) }
ScriptActionItem { name : "month_layout"; title : KDE.i18n( "Month View" ) }
ScriptActionItem { name : "eventlist_layout"; title : KDE.i18n( "Event List View" ) }
ScriptActionItem { name : "timeline_layout"; title : KDE.i18n( "Timeline" ) }
}
ActionList {
category : "single_calendar"
name : "single_calendar_view_menu"
text : KDE.i18n( "View" )
ScriptActionItem { name : "add_as_favorite"; title : KDE.i18n( "Add View As Favorite" ) }
ActionListItem { name : "set_calendar_colour" }
ScriptActionItem { name : "to_selection_screen"; title : KDE.i18n( "Back To Folder Selection" ) }
}
ActionList {
category : "multiple_calendar"
name : "multi_calendar_calendars_menu"
text : KDE.i18n( "Calendars" )
ActionListItem { name : "akonadi_collection_sync" }
ScriptActionItem { name : "show_today"; title : KDE.i18n( "Show Today" ) }
ScriptActionItem { name : "day_layout"; title : KDE.i18n( "Day View" ) }
ScriptActionItem { name : "three_day_layout"; title : KDE.i18n( "Next Three Days View" ) }
ScriptActionItem { name : "week_layout"; title : KDE.i18n( "Week View" ) }
ScriptActionItem { name : "work_week_layout"; title : KDE.i18n( "Work Week View" ) }
ScriptActionItem { name : "month_layout"; title : KDE.i18n( "Month View" ) }
ScriptActionItem { name : "eventlist_layout"; title : KDE.i18n( "Event List View" ) }
ScriptActionItem { name : "timeline_layout"; title : KDE.i18n( "Timeline" ) }
}
ActionList {
category : "multiple_calendar"
name : "multi_calendar_view_menu"
text : KDE.i18n( "View" )
ScriptActionItem { name : "add_as_favorite"; title : KDE.i18n( "Add View As Favorite" ) }
ScriptActionItem { name : "to_selection_screen"; title : KDE.i18n( "Select Calendars" ) }
}
ActionList {
category : "event_viewer"
name : "event_viewer_event_menu"
text : KDE.i18n( "Event" )
ActionListItem { name : "publish_item_information" }
ActionListItem { name : "send_invitations_to_attendees" }
ActionListItem { name : "send_status_update" }
ActionListItem { name : "send_cancellation_to_attendees" }
ActionListItem { name : "request_update" }
/* doesn't do anything useful atm */
/*ActionListItem { name : "request_change" }*/
ActionListItem { name : "send_as_icalendar" }
ActionListItem { name : "mail_freebusy" }
ActionListItem { name : "upload_freebusy" }
}
ActionList {
category : "event_viewer"
name : "event_viewer_attachments_menu"
text : KDE.i18n( "Attachments" )
ActionListItem { name : "save_all_attachments" }
}
ActionList {
category : "event_viewer"
name : "event_viewer_edit_menu"
text : KDE.i18n( "Edit" )
ActionListItem { name : "akonadi_incidence_edit" }
ActionListItem { name : "akonadi_item_copy_to_dialog" }
ActionListItem { name : "akonadi_item_move_to_dialog" }
ActionListItem { name : "akonadi_item_delete" }
}
ApplicationGeneralActions {
category : "standard"
name : "application_menu"
text : KDE.i18n( "Calendar" )
type : "event"
addNewActionName: "akonadi_event_create"
//TODO enable when SearchWidget::query() is implemented
//searchActionTitle: KDE.i18n( "Search For Events" )
configureActionTitle: KDE.i18n( "Configure Calendar" )
}
}

View file

@ -1,5 +0,0 @@
#! /bin/sh
$EXTRACTRC --ignore-no-input `find . \( -name '*.ui' -or -name '*.rc' -or -name '*.kcfg' -or -name '*.kcfg.cmake' \) -and -not -name '*-mobile.rc'` >> rc.cpp || exit 11
$XGETTEXT -ktranslate `find -name '*.cpp' -o -name '*.h'` -o $podir/korganizer-mobile.pot
$XGETTEXT -ktranslate `find . -name '*.qml'` -j -L Java -o $podir/korganizer-mobile.pot
rm -f rc.cpp

View file

@ -1,79 +0,0 @@
/*
Copyright (c) 2010 Volker Krause <vkrause@kde.org>
Copyright (c) 2010 Bertjan Broeksema <broeksema@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.
*/
import QtQuick 1.1 as QML
import org.kde 4.5
import org.kde.akonadi 4.5
import org.kde.pim.mobileui 4.5 as KPIM
import org.kde.calendarviews 4.5 as CalendarViews
import org.kde.akonadi.events 4.5 as Events
QML.Rectangle {
anchors.fill: parent
function showMonth( date )
{
month.showMonth( date );
}
QML.Rectangle {
height: 48
width: 48
z: 5
color: "#00000000"
anchors.right : parent.right
anchors.rightMargin : 70
anchors.bottom : parent.bottom
anchors.bottomMargin : 70
QML.Image {
source : KDE.locate( "data", "mobileui/back-to-list-button.png" );
QML.MouseArea {
anchors.fill : parent;
onClicked : {
_itemActionModel.select(-1, 1)
_itemNavigationModel.select(-1, 1)
guiStateManager.popState();
}
}
}
}
CalendarViews.MonthView {
id: month
anchors { fill: parent; topMargin: 10; leftMargin: 40 }
calendar: calendarModel
swipeLength: 0.2 // Require at least 20% of screenwidth to trigger next or prev
onDateClicked: {
agenda.showRange( date, 0 );
guiStateManager.switchState( Events.EventsGuiStateManager.ViewDayState );
}
onItemSelected: {
if ( selectedItemId > 0 ) {
eventView.itemId = selectedItemId;
eventView.activeDate = activeDate;
application.setCurrentEventItemId(selectedItemId);
guiStateManager.pushUniqueState( KPIM.GuiStateManager.ViewSingleItemState );
}
}
}
}

View file

@ -1,73 +0,0 @@
/*
Copyright (c) 2010 Volker Krause <vkrause@kde.org>
Copyright (c) 2010 Bertjan Broeksema <broeksema@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.
*/
import QtQuick 1.1 as QML
import org.kde 4.5
import org.kde.pim.mobileui 4.5 as KPIM
import org.kde.calendarviews 4.5 as CalendarViews
QML.Rectangle {
visible: guiStateManager.inViewTimelineState
anchors.fill: parent
function showRange( date, range )
{
timeline.showRange( date, range );
}
QML.Rectangle {
height: 48
width: 48
z: 5
color: "#00000000"
anchors.right : parent.right
anchors.rightMargin : 70
anchors.bottom : parent.bottom
anchors.bottomMargin : 70
QML.Image {
source : KDE.locate( "data", "mobileui/back-to-list-button.png" );
QML.MouseArea {
anchors.fill : parent;
onClicked : {
_itemActionModel.select(-1, 1)
_itemNavigationModel.select(-1, 1)
guiStateManager.popState();
}
}
}
}
CalendarViews.TimelineView {
id: timeline
anchors { fill: parent; topMargin: 10; leftMargin: 40 }
calendar: calendarModel
swipeLength: 0.2 // Require at least 20% of screenwidth to trigger next or prev
onItemSelected: {
if ( selectedItemId > 0 ) {
timelineView.itemId = selectedItemId;
timelineView.activeDate = activeDate;
application.setCurrentEventItemId(selectedItemId);
guiStateManager.pushUniqueState( KPIM.GuiStateManager.ViewSingleItemState );
}
}
}
}

View file

@ -1,187 +0,0 @@
/*
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 "agendaviewitem.h"
#include <KGlobal>
#include <KGlobalSettings>
#include <calendarviews/agenda/agendaview.h>
#include <Akonadi/Calendar/ETMCalendar>
#include <KLocale>
using namespace EventViews;
AgendaViewItem::AgendaViewItem(QDeclarativeItem* parent)
: DeclarativeAkonadiItem( parent )
, m_view( new AgendaView( QDate(), QDate(),
false /*interactive*/,
false /*side-by-side*/,
0 /*parent*/) )
, m_currentRange( Week )
{
// start with the oxygen palette (which is not necessarily the default on all platforms)
QPalette pal = KGlobalSettings::createApplicationPalette( KGlobal::config() );
m_view->setPalette( pal );
m_view->setDateRangeSelectionEnabled( false );
connect( m_view, SIGNAL(incidenceSelected(Akonadi::Item,QDate)),
SIGNAL(itemSelected(Akonadi::Item,QDate)) );
connect( this, SIGNAL(nextItemRequest()), SLOT(gotoNext()) );
connect( this, SIGNAL(previousItemRequest()), SLOT(gotoPrevious()) );
setWidget( m_view );
showRange( QDate::currentDate(), Week );
preferences()->readConfig();
}
AgendaViewItem::~AgendaViewItem()
{
preferences()->writeConfig();
delete m_view;
}
QDate AgendaViewItem::startDate() const
{
return QDate( m_view->startDate() );
}
void AgendaViewItem::setStartDate(const QDate& startDate)
{
kDebug() << startDate;
if ( startDate.isValid() )
m_view->showDates( startDate, endDate() );
}
QDate AgendaViewItem::endDate() const
{
return QDate( m_view->endDate() );
}
void AgendaViewItem::setEndDate(const QDate& endDate)
{
kDebug() << endDate;
if ( endDate.isValid() )
m_view->showDates( startDate(), endDate );
}
QObject* AgendaViewItem::calendar() const
{
return m_view->calendar().data();
}
void AgendaViewItem::setCalendar(QObject* calendarObj)
{
Akonadi::ETMCalendar *cal = qobject_cast<Akonadi::ETMCalendar*>( calendarObj );
kDebug() << calendarObj << cal;
if ( cal ) {
m_view->setCalendar( cal->weakPointer().toStrongRef().dynamicCast<Akonadi::ETMCalendar>() );
m_view->updateConfig();
}
}
void AgendaViewItem::showRange( const QDate &date, int range )
{
Q_ASSERT( range >= 0 && range <= LastRange );
m_currentRange = Range( range );
switch( m_currentRange ) {
case Day: {
m_view->showDates( date, date );
break;
}
case Week: {
int weekStartDay = KGlobal::locale()->weekStartDay();
if ( weekStartDay > date.dayOfWeek() )
weekStartDay = weekStartDay - 7;
m_view->showDates( date.addDays( weekStartDay - date.dayOfWeek() ), date.addDays( weekStartDay + 6 - date.dayOfWeek() ) );
break;
}
case WorkWeek: {
int workingWeekStartDay = KGlobal::locale()->workingWeekStartDay();
int workingWeekEndDay = KGlobal::locale()->workingWeekEndDay();
m_view->showDates( date.addDays( workingWeekStartDay - date.dayOfWeek() ), date.addDays( workingWeekEndDay - date.dayOfWeek() ) );
break;
}
case Next3Days: {
m_view->showDates( date, date.addDays( 3 ) );
break;
}
default:;
}
}
void AgendaViewItem::showToday()
{
showRange( QDate::currentDate() , m_currentRange );
}
qint64 AgendaViewItem::selectedItemId() const
{
if ( m_view->selectedIncidences().size() < 1 )
return -1;
return m_view->selectedIncidences().first().id();
}
void AgendaViewItem::clearSelection()
{
m_view->clearSelection();
}
void AgendaViewItem::gotoNext()
{
const QDate start = (m_currentRange == WorkWeek ? startDate().addDays( 7 )
: endDate().addDays( 1 ));
const QDate end = start.addDays( startDate().daysTo( endDate() ) );
m_view->blockSignals( true );
m_view->showDates( start, end );
m_view->clearSelection();
m_view->blockSignals( false );
}
void AgendaViewItem::gotoPrevious()
{
const QDate end = (m_currentRange == WorkWeek ? endDate().addDays( -7 )
: startDate().addDays( -1 ));
const QDate start = end.addDays( - startDate().daysTo( endDate() ) );
m_view->blockSignals( true );
m_view->showDates( start, end );
m_view->clearSelection();
m_view->blockSignals( false );
}
void AgendaViewItem::setPreferences( const PrefsPtr &preferences )
{
m_view->setPreferences( preferences );
}
PrefsPtr AgendaViewItem::preferences() const
{
return m_view->preferences();
}
void AgendaViewItem::updateConfig()
{
m_view->updateConfig();
}

View file

@ -1,103 +0,0 @@
/*
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 CALENDARVIEWS_AGENDAVIEWITEM_H
#define CALENDARVIEWS_AGENDAVIEWITEM_H
#include <QtCore/QDate>
#include "declarativeakonadiitem.h"
#include "calendarviews/prefs.h"
namespace Akonadi {
class Item;
}
namespace EventViews {
class AgendaView;
class AgendaViewItem : public DeclarativeAkonadiItem
{
Q_OBJECT
Q_ENUMS( Range )
Q_PROPERTY( QDate startDate READ startDate WRITE setStartDate )
Q_PROPERTY( QDate endDate READ endDate WRITE setEndDate )
Q_PROPERTY( QObject* calendar READ calendar WRITE setCalendar )
Q_PROPERTY( qint64 selectedItemId READ selectedItemId NOTIFY itemSelected )
Q_PROPERTY( int range READ range )
public:
enum Range {
Day = 0,
Week,
WorkWeek,
Next3Days,
LastRange
};
public:
explicit AgendaViewItem( QDeclarativeItem *parent = 0 );
~AgendaViewItem();
virtual qint64 itemId() const { return -1; }
virtual void setItemId( qint64 /*id*/ ) {}
QDate startDate() const;
void setStartDate( const QDate &startDate );
QDate endDate() const;
void setEndDate( const QDate &endDate );
QObject *calendar() const;
void setCalendar( QObject* calendarObj );
/** Show the appropriate range for given date. */
Q_INVOKABLE void showRange( const QDate &date, /* Range */ int range ); // TODO: Figure out how to export enums to QML
Q_INVOKABLE void showToday();
int range() const { return m_currentRange; }
qint64 selectedItemId() const;
void setPreferences( const PrefsPtr &preferences );
PrefsPtr preferences() const;
public slots:
/** Unselects currently selected incidences */
void clearSelection();
/** Show the following date range of equal length right after the current one. */
void gotoNext();
/** Show the preceding date range. */
void gotoPrevious();
void updateConfig();
signals:
void itemSelected( Akonadi::Item item, const QDate &activeDate );
private:
AgendaView *m_view;
Range m_currentRange;
};
}
#endif // CALENDARVIEWS_AGENDAVIEWITEM_H

View file

@ -1,186 +0,0 @@
/* -*- mode: C++; c-file-style: "gnu" -*-
Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net
Copyright (c) 2010 Andras Mantia <andras@kdab.net>
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 "calendarinterface.h"
#include "mainview.h"
#include <KDebug>
#include <QGraphicsItem>
void CalendarInterface::showDate( const QDate &date )
{
emit showDateSignal(QVariant::fromValue<QDate>( date ) );
}
void CalendarInterface::goDate( const QDate& )
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
}
void CalendarInterface::goDate( const QString& )
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
}
void CalendarInterface::openEventEditor( const QString& )
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
}
void CalendarInterface::openEventEditor( const QString &summary,
const QString &description,
const QStringList &attachments)
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
Q_UNUSED( summary );
Q_UNUSED( description );
Q_UNUSED( attachments );
}
void CalendarInterface::openEventEditor( const QString &summary,
const QString &description,
const QStringList &attachments,
const QStringList &attendees)
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
Q_UNUSED( summary );
Q_UNUSED( description );
Q_UNUSED( attachments );
Q_UNUSED( attendees );
}
void CalendarInterface::openEventEditor( const QString &summary,
const QString &description,
const QString &uri,
const QString &file,
const QStringList &attendees,
const QString &attachmentMimetype)
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
Q_UNUSED( summary );
Q_UNUSED( description );
Q_UNUSED( uri );
Q_UNUSED( file );
Q_UNUSED( attendees );
Q_UNUSED( attachmentMimetype );
}
void CalendarInterface::openEventEditor( const QString &summary,
const QString &description,
const QStringList &attachmentUris,
const QStringList &attendees,
const QStringList &attachmentMimetypes,
bool attachmentIsInline )
{
emit openIncidenceEditorSignal( summary, description, attachmentUris, attendees,
attachmentMimetypes, attachmentIsInline,
KCalCore::Incidence::TypeEvent );
}
void CalendarInterface::openJournalEditor( const QDate & )
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
}
void CalendarInterface::openJournalEditor( const QString &text, const QDate &date )
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
Q_UNUSED( text );
Q_UNUSED( date );
}
void CalendarInterface::openJournalEditor( const QString &text )
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
Q_UNUSED( text );
}
void CalendarInterface::openTodoEditor( const QString& )
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
}
void CalendarInterface::openTodoEditor( const QString &summary,
const QString &description,
const QStringList &attachments )
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
Q_UNUSED( summary );
Q_UNUSED( description );
Q_UNUSED( attachments );
}
void CalendarInterface::openTodoEditor( const QString &summary,
const QString &description,
const QStringList &attachments,
const QStringList &attendees )
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
Q_UNUSED( summary );
Q_UNUSED( description );
Q_UNUSED( attachments );
Q_UNUSED( attendees );
}
void CalendarInterface::openTodoEditor( const QString &summary,
const QString &description,
const QString &uri,
const QString &file,
const QStringList &attendees,
const QString &attachmentMimetype )
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
Q_UNUSED( summary );
Q_UNUSED( description );
Q_UNUSED( uri );
Q_UNUSED( file );
Q_UNUSED( attendees );
Q_UNUSED( attachmentMimetype );
}
void CalendarInterface::openTodoEditor( const QString &summary,
const QString &description,
const QStringList &attachmentUris,
const QStringList &attendees,
const QStringList &attachmentMimetypes,
bool attachmentIsInline )
{
emit openIncidenceEditorSignal( summary, description, attachmentUris, attendees,
attachmentMimetypes, attachmentIsInline,
KCalCore::Incidence::TypeTodo );
}
void CalendarInterface::showEventView()
{
emit showEventViewSignal();
}
void CalendarInterface::showJournalView()
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
}
void CalendarInterface::showTodoView()
{
kWarning() << Q_FUNC_INFO << " is not yet implemented in korganzier-mobile";
}

View file

@ -1,104 +0,0 @@
/* -*- mode: C++; c-file-style: "gnu" -*-
Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net
Copyright (c) 2010 Andras Mantia <andras@kdab.net>
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 CALENDARINTERFACE_H
#define CALENDARINTERFACE_H
#include <QObject>
#include <KCalCore/Incidence>
class QDate;
/** Implement the www.kde.korganizer/Calendar interface for korganizer-mobile */
class CalendarInterface : public QObject
{
Q_OBJECT
public:
explicit CalendarInterface(QObject * parent = 0) :QObject(parent){}
public slots:
void showDate(const QDate& date);
void openEventEditor( const QString &);
void openEventEditor( const QString &summary,
const QString &description,
const QStringList &attachments );
void openEventEditor( const QString &summary,
const QString &description,
const QStringList &attachments,
const QStringList &attendees );
void openEventEditor( const QString &summary,
const QString &description,
const QString &uri,
const QString &file,
const QStringList &attendees,
const QString &attachmentMimetype );
void openEventEditor( const QString &summary,
const QString &description,
const QStringList &attachmentUris,
const QStringList &attendees,
const QStringList &attachmentMimetypes,
bool attachmentIsInline );
void openTodoEditor( const QString &);
void openTodoEditor( const QString &summary,
const QString &description,
const QStringList &attachments );
void openTodoEditor( const QString &summary,
const QString &description,
const QStringList &attachments,
const QStringList &attendees );
void openTodoEditor( const QString &summary,
const QString &description,
const QString &uri,
const QString &file,
const QStringList &attendees,
const QString &attachmentMimetype );
void openTodoEditor( const QString &summary,
const QString &description,
const QStringList &attachmentUris,
const QStringList &attendees,
const QStringList &attachmentMimetypes,
bool attachmentIsInline );
void openJournalEditor( const QDate &date );
void openJournalEditor( const QString &text, const QDate &date );
void openJournalEditor( const QString &text );
void showJournalView();
void showTodoView();
void showEventView();
void goDate( const QDate &);
void goDate( const QString &);
signals:
void showDateSignal(const QVariant& date);
void showEventViewSignal();
void openIncidenceEditorSignal( const QString &summary,
const QString &description,
const QStringList &attachmentUris,
const QStringList &attendees,
const QStringList &attachmentMimetypes,
bool attachmentIsInline,
KCalCore::Incidence::IncidenceType type );
};
#endif // CALENDARINTERFACE_H

View file

@ -1,294 +0,0 @@
/*
Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
Copyright (c) 2010 Tobias Koenig <tobias.koenig@kdab.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "configwidget.h"
#include "settings.h"
#include "stylesheetloader.h"
#include "ui_configwidget.h"
#include <calendarsupport/kcalprefs.h>
#include <kconfigdialogmanager.h>
#include <kholidays/holidays.h>
#include <qplatformdefs.h>
using namespace CalendarSupport;
ConfigWidget::ConfigWidget( QWidget *parent )
: QWidget( parent )
{
mUi = new Ui_ConfigWidget;
mUi->setupUi( this );
mUi->kcfg_DayBegins->setProperty( "kcfg_property", QByteArray( "dateTime" ) );
mUi->kcfg_DailyStartingHour->setProperty( "kcfg_property", QByteArray( "dateTime" ) );
mUi->kcfg_DailyEndingHour->setProperty( "kcfg_property", QByteArray( "dateTime" ) );
mUi->kcfg_DefaultAppointmentTime->setProperty( "kcfg_property", QByteArray( "dateTime" ) );
mUi->kcfg_AgendaViewColorUsage->addItem( i18n( "Category inside, calendar outside" ) );
mUi->kcfg_AgendaViewColorUsage->addItem( i18n( "Calendar inside, category outside" ) );
mUi->kcfg_AgendaViewColorUsage->addItem( i18n( "Only category" ) );
mUi->kcfg_AgendaViewColorUsage->addItem( i18n( "Only calendar" ) );
mUi->kcfg_MonthViewColorUsage->addItem( i18n( "Category inside, calendar outside" ) );
mUi->kcfg_MonthViewColorUsage->addItem( i18n( "Calendar inside, category outside" ) );
mUi->kcfg_MonthViewColorUsage->addItem( i18n( "Only category" ) );
mUi->kcfg_MonthViewColorUsage->addItem( i18n( "Only calendar" ) );
mHolidayCombo = mUi->kcfg_HolidayRegion;
mWorkDays << mUi->workingPeriodMonday;
mWorkDays << mUi->workingPeriodTuesday;
mWorkDays << mUi->workingPeriodWednesday;
mWorkDays << mUi->workingPeriodThursday;
mWorkDays << mUi->workingPeriodFriday;
mWorkDays << mUi->workingPeriodSaturday;
mWorkDays << mUi->workingPeriodSunday;
mManager = new KConfigDialogManager( this, Settings::self() );
// fill holiday combobox
const QStringList regions = KHolidays::HolidayRegion::regionCodes();
QMap<QString, QString> regionsMap;
foreach ( const QString & regionCode, regions ) {
const QString name = KHolidays::HolidayRegion::name( regionCode );
const QString languageName = KGlobal::locale()->languageCodeToName( KHolidays::HolidayRegion::languageCode( regionCode ) );
QString label;
if ( languageName.isEmpty() ) {
label = name;
} else {
label = i18nc( "Holday region, region language", "%1 (%2)", name, languageName );
}
regionsMap.insert( label, regionCode );
}
mHolidayCombo->addItem( i18nc( "No holiday region", "None"), QString() );
QMapIterator<QString, QString> it( regionsMap );
while ( it.hasNext() ) {
it.next();
mHolidayCombo->addItem( it.key(), it.value() );
}
mUi->kcfg_DayBegins->installEventFilter( this );
mUi->kcfg_DailyStartingHour->installEventFilter( this );
mUi->kcfg_DailyEndingHour->installEventFilter( this );
mUi->kcfg_DefaultAppointmentTime->installEventFilter( this );
connect( this, SIGNAL(dayBeginsFocus(QObject*)), SLOT(showClock(QObject*)) );
connect( this, SIGNAL(dailyStartingHourFocus(QObject*)), SLOT(showClock(QObject*)) );
connect( this, SIGNAL(dailyEndingHourFocus(QObject*)), SLOT(showClock(QObject*)) );
connect( this, SIGNAL(defaultAppointmentTimeFocus(QObject*)), SLOT(showClock(QObject*)) );
}
ConfigWidget::~ConfigWidget()
{
delete mUi;
}
void ConfigWidget::setPreferences( const EventViews::PrefsPtr &preferences )
{
mViewPrefs = preferences;
load();
}
void ConfigWidget::load()
{
loadFromExternalSettings();
mManager->updateWidgets();
if ( !Settings::self()->holidayRegion().isEmpty() )
mHolidayCombo->setCurrentIndex( mHolidayCombo->findData( Settings::self()->holidayRegion() ) );
else
mHolidayCombo->setCurrentIndex( 0 );
for ( int i = 0; i < 7; ++i ) {
mWorkDays[ i ]->setChecked( ( 1 << i ) & ( Settings::self()->workWeekMask() ) );
}
}
void ConfigWidget::save()
{
mManager->updateSettings();
Settings::self()->setHolidayRegion( mHolidayCombo->itemData( mHolidayCombo->currentIndex() ).toString() );
int mask = 0;
for ( int i = 0; i < 7; ++i ) {
if ( mWorkDays[ i ]->isChecked() ) {
mask = mask | ( 1 << i );
}
}
Settings::self()->setWorkWeekMask( mask );
saveToExternalSettings();
}
void ConfigWidget::loadFromExternalSettings()
{
// Date and Time
Settings::self()->setHolidayRegion( KCalPrefs::instance()->holidays() );
Settings::self()->setExcludeHolidays( KCalPrefs::instance()->excludeHolidays() );
Settings::self()->setWorkWeekMask( KCalPrefs::instance()->workWeekMask() );
Settings::self()->setDefaultAppointmentTime( KCalPrefs::instance()->startTime() );
Settings::self()->setDefaultAppointmentDuration( KCalPrefs::instance()->defaultDuration() );
Settings::self()->setRemindersForNewEvents( KCalPrefs::instance()->defaultEventReminders() );
Settings::self()->setReminderDefaultTime( KCalPrefs::instance()->reminderTime() );
Settings::self()->setReminderDefaultUnit( KCalPrefs::instance()->reminderTimeUnits() );
Settings::self()->setDayBegins( mViewPrefs->dayBegins() );
Settings::self()->setDailyStartingHour( mViewPrefs->workingHoursStart() );
Settings::self()->setDailyEndingHour( mViewPrefs->workingHoursEnd() );
// Views
Settings::self()->setTodosUseCategoryColors( mViewPrefs->todosUseCategoryColors() );
Settings::self()->setHourSize( mViewPrefs->hourSize() );
Settings::self()->setShowIconsInAgendaView( mViewPrefs->enableAgendaItemIcons() );
Settings::self()->setShowTodosInAgendaView( mViewPrefs->showTodosAgendaView() );
Settings::self()->setShowCurrentTimeLine( mViewPrefs->marcusBainsEnabled() );
Settings::self()->setAgendaViewColorUsage( mViewPrefs->agendaViewColors() );
Settings::self()->setColorBusyDaysInAgendaView( mViewPrefs->colorAgendaBusyDays() );
Settings::self()->setShowTodosInMonthView( mViewPrefs->showTodosMonthView() );
Settings::self()->setMonthViewColorUsage( mViewPrefs->monthViewColors() );
Settings::self()->setColorBusyDaysInMonthView( mViewPrefs->colorMonthBusyDays() );
// Colors
Settings::self()->setHolidayColor( mViewPrefs->holidayColor() );
Settings::self()->setAgendaViewBackgroundColor( mViewPrefs->agendaViewBackgroundColor() );
Settings::self()->setBusyDaysBackgroundColor( mViewPrefs->viewBgBusyColor() );
Settings::self()->setAgendaViewTimeLineColor( mViewPrefs->agendaMarcusBainsLineLineColor() );
Settings::self()->setWorkingHoursColor( mViewPrefs->workingHoursColor() );
Settings::self()->setTodoDueColor( mViewPrefs->todoDueTodayColor() );
Settings::self()->setTodoOverdueColor( mViewPrefs->todoOverdueColor() );
// Group scheduling
Settings::self()->setUseGroupwareCommunication( KCalPrefs::instance()->useGroupwareCommunication() );
}
void ConfigWidget::saveToExternalSettings()
{
// Date and Time
KCalPrefs::instance()->setHolidays( Settings::self()->holidayRegion() );
KCalPrefs::instance()->setExcludeHolidays( Settings::self()->excludeHolidays() );
KCalPrefs::instance()->setWorkWeekMask( Settings::self()->workWeekMask() );
KCalPrefs::instance()->setStartTime( Settings::self()->defaultAppointmentTime() );
KCalPrefs::instance()->setDefaultDuration( Settings::self()->defaultAppointmentDuration() );
KCalPrefs::instance()->setDefaultEventReminders( Settings::self()->remindersForNewEvents() );
KCalPrefs::instance()->setReminderTime( Settings::self()->reminderDefaultTime() );
KCalPrefs::instance()->setReminderTimeUnits( Settings::self()->reminderDefaultUnit() );
mViewPrefs->setDayBegins( Settings::self()->dayBegins() );
mViewPrefs->setWorkingHoursStart( Settings::self()->dailyStartingHour() );
mViewPrefs->setWorkingHoursEnd( Settings::self()->dailyEndingHour() );
// Views
mViewPrefs->setTodosUseCategoryColors( Settings::self()->todosUseCategoryColors() );
mViewPrefs->setHourSize( Settings::self()->hourSize() );
mViewPrefs->setEnableAgendaItemIcons( Settings::self()->showIconsInAgendaView() );
mViewPrefs->setShowTodosAgendaView( Settings::self()->showTodosInAgendaView() );
mViewPrefs->setMarcusBainsEnabled( Settings::self()->showCurrentTimeLine() );
mViewPrefs->setAgendaViewColors( Settings::self()->agendaViewColorUsage() );
mViewPrefs->setColorAgendaBusyDays( Settings::self()->colorBusyDaysInAgendaView() );
mViewPrefs->setShowTodosMonthView( Settings::self()->showTodosInMonthView() );
mViewPrefs->setMonthViewColors( Settings::self()->monthViewColorUsage() );
mViewPrefs->setColorMonthBusyDays( Settings::self()->colorBusyDaysInMonthView() );
// Colors
mViewPrefs->setHolidayColor( Settings::self()->holidayColor() );
mViewPrefs->setAgendaViewBackgroundColor( Settings::self()->agendaViewBackgroundColor() );
mViewPrefs->setViewBgBusyColor( Settings::self()->busyDaysBackgroundColor() );
mViewPrefs->setAgendaMarcusBainsLineLineColor( Settings::self()->agendaViewTimeLineColor() );
mViewPrefs->setWorkingHoursColor( Settings::self()->workingHoursColor() );
mViewPrefs->setTodoDueTodayColor( Settings::self()->todoDueColor() );
mViewPrefs->setTodoOverdueColor( Settings::self()->todoOverdueColor() );
// Group scheduling
KCalPrefs::instance()->setUseGroupwareCommunication( Settings::self()->useGroupwareCommunication() );
Settings::self()->writeConfig();
KCalPrefs::instance()->writeConfig();
mViewPrefs->writeConfig();
}
void ConfigWidget::showClock( QObject *object )
{
setFocus();
mFocusedTimeWidget = qobject_cast<KTimeComboBox*>( object );
if ( !mFocusedTimeWidget )
return;
const QTime time = mFocusedTimeWidget->time();
emit showClockWidget( time.hour(), time.minute() );
}
void ConfigWidget::setNewTime( int hour, int minute )
{
if ( mFocusedTimeWidget == 0 )
return;
mFocusedTimeWidget->setTime( QTime( hour, minute ) );
}
bool ConfigWidget::eventFilter( QObject *object, QEvent *event )
{
if ( event->type() == QEvent::FocusIn ) {
if ( object == mUi->kcfg_DayBegins ) {
emit dayBeginsFocus( object );
} else if ( object == mUi->kcfg_DailyStartingHour ) {
emit dailyStartingHourFocus( object );
} else if ( object == mUi->kcfg_DailyEndingHour ) {
emit dailyEndingHourFocus( object );
} else if ( object == mUi->kcfg_DefaultAppointmentTime ) {
emit defaultAppointmentTimeFocus( object );
}
return true;
} else {
// standard event processing
return QObject::eventFilter( object, event );
}
}
DeclarativeConfigWidget::DeclarativeConfigWidget( QGraphicsItem *parent )
: DeclarativeWidgetBase< ConfigWidget, MainView, &MainView::setConfigWidget>( parent )
{
connect( this, SIGNAL(configChanged()), widget(), SIGNAL(configChanged()) );
connect( widget(), SIGNAL(showClockWidget(int,int)), this, SIGNAL(showClockWidget(int,int)) );
}
DeclarativeConfigWidget::~DeclarativeConfigWidget()
{
}
void DeclarativeConfigWidget::load()
{
widget()->load();
}
void DeclarativeConfigWidget::save()
{
widget()->save();
emit configChanged();
}
void DeclarativeConfigWidget::setNewTime( int hour, int minute )
{
widget()->setNewTime( hour, minute );
}

View file

@ -1,105 +0,0 @@
/*
Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
Copyright (c) 2010 Tobias Koenig <tobias.koenig@kdab.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CONFIGWIDGET_H
#define CONFIGWIDGET_H
#include "declarativewidgetbase.h"
#include "mainview.h"
#include "calendarviews/eventview.h"
#include "calendarviews/prefs.h"
#include <QGraphicsProxyWidget>
#include <QWidget>
class KComboBox;
class KConfigDialogManager;
class KTimeComboBox;
class QCheckBox;
class Ui_ConfigWidget;
class ConfigWidget : public QWidget
{
Q_OBJECT
public:
explicit ConfigWidget( QWidget *parent = 0 );
~ConfigWidget();
void setPreferences( const EventViews::PrefsPtr &preferences );
public Q_SLOTS:
void load();
void save();
void setNewTime( int hour, int minute );
Q_SIGNALS:
void configChanged();
void showClockWidget( int hour, int minute );
void dayBeginsFocus( QObject *object );
void dailyStartingHourFocus( QObject *object );
void dailyEndingHourFocus( QObject *object );
void defaultAppointmentTimeFocus( QObject *object );
protected:
bool eventFilter( QObject *object, QEvent *event );
private Q_SLOTS:
void showClock( QObject *object );
private:
void loadFromExternalSettings();
void saveToExternalSettings();
Ui_ConfigWidget *mUi;
KConfigDialogManager *mManager;
KComboBox *mHolidayCombo;
QVector<QCheckBox*> mWorkDays;
EventViews::PrefsPtr mViewPrefs;
KTimeComboBox *mFocusedTimeWidget;
};
class DeclarativeConfigWidget :
#ifndef Q_MOC_RUN
public DeclarativeWidgetBase<ConfigWidget, MainView, &MainView::setConfigWidget>
#else
public QGraphicsProxyWidget
#endif
{
Q_OBJECT
public:
explicit DeclarativeConfigWidget( QGraphicsItem *parent = 0 );
~DeclarativeConfigWidget();
public Q_SLOTS:
void load();
void save();
void setNewTime( int hour, int minute );
Q_SIGNALS:
void configChanged();
void showClockWidget( int hour, int minute );
};
#endif

View file

@ -1,580 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigWidget</class>
<widget class="QWidget" name="ConfigWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>501</width>
<height>1132</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Time and Date</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="dayBeginsAtLabel">
<property name="text">
<string>Day begins at:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KTimeComboBox" name="kcfg_DayBegins"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="useHolidayRegionLabel">
<property name="text">
<string>Use holiday region:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="kcfg_HolidayRegion"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="workingPeriodLabel">
<property name="text">
<string>Working Period:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QWidget" name="workingPeriodWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="workingPeriodMonday">
<property name="text">
<string>Monday</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="workingPeriodTuesday">
<property name="text">
<string>Tuesday</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="workingPeriodWednesday">
<property name="text">
<string>Wednesday</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="workingPeriodThursday">
<property name="text">
<string>Thursday</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="workingPeriodFriday">
<property name="text">
<string>Friday</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="workingPeriodSaturday">
<property name="text">
<string>Saturday</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="workingPeriodSunday">
<property name="text">
<string>Sunday</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="1">
<widget class="KTimeComboBox" name="kcfg_DailyStartingHour"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="dailyStartingHourLabel">
<property name="text">
<string>Daily starting hour:</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="dailyEndingHourLabel">
<property name="text">
<string>Daily ending hour:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="KTimeComboBox" name="kcfg_DailyEndingHour"/>
</item>
</layout>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="kcfg_ExcludeHolidays">
<property name="text">
<string>Exclude holidays</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_5" columnstretch="0,1">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_12">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>New Events</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="defaultAppointmentTimeLabel">
<property name="text">
<string>Default appointment time:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KTimeComboBox" name="kcfg_DefaultAppointmentTime"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="defaultDurationOfNewAppointmentLabel">
<property name="text">
<string>Default duration:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QTimeEdit" name="kcfg_DefaultAppointmentDuration">
<property name="displayFormat">
<string>hh:mm</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="defaultReminderTimeLabel">
<property name="text">
<string>Default reminder time:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QWidget" name="defaultReminderTimeWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QSpinBox" name="kcfg_ReminderDefaultTime"/>
</item>
<item>
<widget class="QComboBox" name="kcfg_ReminderDefaultUnit">
<item>
<property name="text">
<string>minute(s)</string>
</property>
</item>
<item>
<property name="text">
<string>hour(s)</string>
</property>
</item>
<item>
<property name="text">
<string>day(s)</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="kcfg_RemindersForNewEvents">
<property name="text">
<string>Enable reminders for new appointments</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Views</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="kcfg_TodosUseCategoryColors">
<property name="text">
<string>To-dos use category colors</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="hourSizeLabel">
<property name="text">
<string>Hour size:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="kcfg_HourSize">
<property name="suffix">
<string> pixels</string>
</property>
<property name="minimum">
<number>4</number>
</property>
<property name="maximum">
<number>30</number>
</property>
<property name="value">
<number>10</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="kcfg_ShowIconsInAgendaView">
<property name="text">
<string>Show icons in agenda view</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="kcfg_ShowTodosInAgendaView">
<property name="text">
<string>Show to-dos in agenda view</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="kcfg_ShowCurrentTimeLine">
<property name="text">
<string>Show current time line</string>
</property>
</widget>
</item>
<item row="6" column="1">
<layout class="QFormLayout" name="formLayout_4">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="1">
<widget class="KComboBox" name="kcfg_AgendaViewColorUsage"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="agendaViewColorOptionsLabel">
<property name="text">
<string>Agenda view color usage:</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="1">
<widget class="QCheckBox" name="kcfg_ColorBusyDaysInAgendaView">
<property name="text">
<string>Color busy days in agenda view</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QCheckBox" name="kcfg_ShowTodosInMonthView">
<property name="text">
<string>Show to-dos in month view</string>
</property>
</widget>
</item>
<item row="9" column="1">
<layout class="QFormLayout" name="formLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="monthViewColorUsageLabel">
<property name="text">
<string>Month view color usage:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="kcfg_MonthViewColorUsage"/>
</item>
</layout>
</item>
<item row="10" column="1">
<widget class="QCheckBox" name="kcfg_ColorBusyDaysInMonthView">
<property name="text">
<string>Color busy days in month view</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,1">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Colors</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QFormLayout" name="formLayout_6">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Holiday color:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KPIM::KColorCombo" name="kcfg_HolidayColor"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Agenda view background color:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KPIM::KColorCombo" name="kcfg_AgendaViewBackgroundColor"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Busy days background color:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KPIM::KColorCombo" name="kcfg_BusyDaysBackgroundColor"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Agenda view current time line color:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="KPIM::KColorCombo" name="kcfg_AgendaViewTimeLineColor"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Working hours color:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="KPIM::KColorCombo" name="kcfg_WorkingHoursColor"/>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>To-do due today color:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="KPIM::KColorCombo" name="kcfg_TodoDueColor"/>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>To-do overdue color:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="KPIM::KColorCombo" name="kcfg_TodoOverdueColor"/>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_4" columnstretch="0,1">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_11">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Group Scheduling</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="kcfg_UseGroupwareCommunication">
<property name="text">
<string>Use Groupware communication</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KTimeComboBox</class>
<extends>QComboBox</extends>
<header>ktimecombobox.h</header>
</customwidget>
<customwidget>
<class>KPIM::KColorCombo</class>
<extends>QComboBox</extends>
<header>kcolorcombo.h</header>
</customwidget>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,41 +0,0 @@
/*
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 "declarativewidgetwrapper.h"
#include <QGraphicsProxyWidget>
using namespace Qt;
DeclarativeWidgetWrapperBase::DeclarativeWidgetWrapperBase(QWidget* widget, QDeclarativeItem* parent) :
QDeclarativeItem(parent),
m_proxy( new QGraphicsProxyWidget( this ) )
{
m_proxy->setWidget( widget );
QPalette pal = widget->palette();
pal.setColor( QPalette::Background, QColor( 0, 0, 0, 0 ) );
widget->setPalette( pal );
}
void DeclarativeWidgetWrapperBase::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry)
{
QDeclarativeItem::geometryChanged( newGeometry, oldGeometry );
m_proxy->resize( newGeometry.size() );
}

View file

@ -1,63 +0,0 @@
/*
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 DECLARATIVEWIDGETWRAPPER_H
#define DECLARATIVEWIDGETWRAPPER_H
#include <qdeclarativeitem.h>
#include <stylesheetloader.h>
class QGraphicsProxyWidget;
namespace Qt {
class DeclarativeWidgetWrapperBase : public QDeclarativeItem
{
Q_OBJECT
public:
DeclarativeWidgetWrapperBase( QWidget *widget, QDeclarativeItem *parent );
protected:
void geometryChanged( const QRectF &newGeometry, const QRectF &oldGeometry );
virtual QWidget* widget() const = 0;
private:
QGraphicsProxyWidget *m_proxy;
};
template <typename WidgetT>
class DeclarativeWidgetWrapper : public DeclarativeWidgetWrapperBase
{
public:
explicit DeclarativeWidgetWrapper( QDeclarativeItem* parent ) :
DeclarativeWidgetWrapperBase( m_widget = new WidgetT, parent )
{
StyleSheetLoader::applyStyle( m_widget );
}
protected:
WidgetT* widget() const { return m_widget; }
WidgetT* m_widget;
};
}
#endif // DECLARATIVEWIDGETWRAPPER_H

View file

@ -1,165 +0,0 @@
/*
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 "eventlistproxy.h"
#include <akonadi/item.h>
#include <KCalCore/Event>
#include <KCalCore/Todo>
#include <KCalUtils/IncidenceFormatter>
#include <KGlobal>
#include <KLocale>
#include <KSystemTimeZones>
#include <QItemSelection>
EventListProxy::EventListProxy(QObject* parent) : ListProxy(parent)
{
setDynamicSortFilter( true );
sort( 0, Qt::DescendingOrder );
mCurrentDateTimeReference = QDateTime::currentMSecsSinceEpoch();
mToday = KDateTime::currentLocalDateTime();
}
QVariant EventListProxy::data(const QModelIndex& index, int role) const
{
const Akonadi::Item item = QSortFilterProxyModel::data( index, Akonadi::EntityTreeModel::ItemRole ).value<Akonadi::Item>();
if ( item.isValid() && item.hasPayload<KCalCore::Incidence::Ptr>() ) {
const KCalCore::Incidence::Ptr incidence = item.payload<KCalCore::Incidence::Ptr>();
switch ( role ) {
case SummaryRole:
return incidence->summary();
case BeginRole:
return KGlobal::locale()->formatDateTime( incidence->dtStart(), KLocale::FancyShortDate );
case DurationRole:
return KCalUtils::IncidenceFormatter::durationString( incidence );
}
}
return QSortFilterProxyModel::data(index, role);
}
void EventListProxy::setSourceModel( QAbstractItemModel *model )
{
if ( sourceModel() )
disconnect( sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(dataChanged(QModelIndex,QModelIndex)) );
ListProxy::setSourceModel( model );
connect( sourceModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)),
this, SLOT(dataChanged(QModelIndex,QModelIndex)) );
QHash<int, QByteArray> names = roleNames();
names.insert( Akonadi::EntityTreeModel::ItemIdRole, "itemId" );
names.insert( SummaryRole, "summary" );
names.insert( BeginRole, "begin" );
names.insert( DurationRole, "duration" );
setRoleNames( names );
}
KDateTime EventListProxy::startDateTimeForItem( const Akonadi::Item &item ) const
{
const QHash<Akonadi::Item::Id, DateTimeHashEntry>::const_iterator it = mDateTimeHash.constFind( item.id() );
if ( it != mDateTimeHash.constEnd() )
return (*it).startDateTime;
const KCalCore::Event::Ptr event = item.payload<KCalCore::Event::Ptr>();
DateTimeHashEntry entry;
entry.startDateTime = event->dtStart();
entry.endDateTime = event->dtEnd();
mDateTimeHash.insert( item.id(), entry );
return entry.startDateTime;
}
KDateTime EventListProxy::endDateTimeForItem( const Akonadi::Item &item ) const
{
const QHash<Akonadi::Item::Id, DateTimeHashEntry>::const_iterator it = mDateTimeHash.constFind( item.id() );
if ( it != mDateTimeHash.constEnd() )
return (*it).endDateTime;
const KCalCore::Event::Ptr event = item.payload<KCalCore::Event::Ptr>();
DateTimeHashEntry entry;
entry.startDateTime = event->dtStart();
entry.endDateTime = event->dtEnd();
mDateTimeHash.insert( item.id(), entry );
return entry.endDateTime;
}
bool EventListProxy::lessThan(const QModelIndex& left, const QModelIndex& right) const
{
const Akonadi::Item leftItem = left.data( Akonadi::EntityTreeModel::ItemRole ).value<Akonadi::Item>();
const Akonadi::Item rightItem = right.data( Akonadi::EntityTreeModel::ItemRole ).value<Akonadi::Item>();
if ( !leftItem.hasPayload<KCalCore::Event::Ptr>() || !rightItem.hasPayload<KCalCore::Event::Ptr>() )
return leftItem.id() < rightItem.id();
const KDateTime leftDateTimeStart = startDateTimeForItem( leftItem );
const KDateTime leftDateTimeEnd = endDateTimeForItem( leftItem );
const KDateTime rightDateTimeStart = startDateTimeForItem( rightItem );
const KDateTime rightDateTimeEnd = endDateTimeForItem( rightItem );
if ( leftDateTimeStart == rightDateTimeStart )
return leftItem.id() < rightItem.id();
if ( (mCurrentDateTimeReference + 60000) < QDateTime::currentMSecsSinceEpoch() ) {
mCurrentDateTimeReference = QDateTime::currentMSecsSinceEpoch();
mToday = KDateTime::currentLocalDateTime();
}
const bool leftIsFuture = (leftDateTimeEnd >= mToday);
const bool rightIsFuture = (rightDateTimeEnd >= mToday);
if ( leftIsFuture != rightIsFuture ) {
return !leftIsFuture;
}
if ( leftIsFuture )
return leftDateTimeStart > rightDateTimeStart;
else
return leftDateTimeStart < rightDateTimeStart;
}
void EventListProxy::dataChanged( const QModelIndex &topLeft, const QModelIndex &bottomRight )
{
QItemSelection selection;
selection.select( topLeft, bottomRight );
foreach ( const QModelIndex &index, selection.indexes() ) {
const Akonadi::Item item = index.data( Akonadi::EntityTreeModel::ItemRole ).value<Akonadi::Item>();
if ( !item.hasPayload<KCalCore::Event::Ptr>() )
continue;
const KCalCore::Event::Ptr event = item.payload<KCalCore::Event::Ptr>();
DateTimeHashEntry entry;
entry.startDateTime = event->dtStart();
entry.endDateTime = event->dtEnd();
mDateTimeHash.insert( item.id(), entry );
}
}

View file

@ -1,63 +0,0 @@
/*
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 EVENTLISTPROXY_H
#define EVENTLISTPROXY_H
#include "listproxy.h"
#include <akonadi/entitytreemodel.h>
#include <kdatetime.h>
/** Proxy model to provide roles for accessing KMime::Message properties from QML. */
class EventListProxy : public ListProxy
{
Q_OBJECT
public:
explicit EventListProxy(QObject* parent = 0);
enum Role {
SummaryRole = Akonadi::EntityTreeModel::UserRole,
BeginRole,
DurationRole
};
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
void setSourceModel(QAbstractItemModel* sourceModel);
bool lessThan(const QModelIndex& left, const QModelIndex& right) const;
private Q_SLOTS:
void dataChanged( const QModelIndex&, const QModelIndex& );
private:
KDateTime startDateTimeForItem( const Akonadi::Item &item ) const;
KDateTime endDateTimeForItem( const Akonadi::Item &item ) const;
struct DateTimeHashEntry
{
KDateTime startDateTime;
KDateTime endDateTime;
};
mutable QHash<Akonadi::Item::Id, DateTimeHashEntry> mDateTimeHash;
mutable qint64 mCurrentDateTimeReference;
mutable KDateTime mToday;
};
#endif // EVENTLISTPROXY_H

View file

@ -1,72 +0,0 @@
/*
Copyright (c) 2010 Tobias Koenig <tokoe@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 "eventsexporthandler.h"
#include <kcalcore/event.h>
#include <kcalcore/filestorage.h>
#include <kcalcore/icalformat.h>
#include <kcalcore/memorycalendar.h>
#include <kfiledialog.h>
#include <klocale.h>
QString EventsExportHandler::dialogText() const
{
return i18n( "Which events shall be exported?" );
}
QString EventsExportHandler::dialogAllText() const
{
return i18n( "All Events" );
}
QString EventsExportHandler::dialogLocalOnlyText() const
{
return i18n( "Events in current folder" );
}
QStringList EventsExportHandler::mimeTypes() const
{
return QStringList( KCalCore::Event::eventMimeType() );
}
bool EventsExportHandler::exportItems( const Akonadi::Item::List &items )
{
const QString fileName = KFileDialog::getSaveFileName( KUrl( "calendar.ics" ), QLatin1String( "*.ics" ) );
if ( fileName.isEmpty() )
return true;
KCalCore::MemoryCalendar::Ptr calendar( new KCalCore::MemoryCalendar( QLatin1String( "UTC" ) ) );
calendar->startBatchAdding();
foreach ( const Akonadi::Item &item, items ) {
if ( item.hasPayload<KCalCore::Event::Ptr>() )
calendar->addIncidence( item.payload<KCalCore::Event::Ptr>() );
}
calendar->endBatchAdding();
KCalCore::FileStorage::Ptr storage( new KCalCore::FileStorage( calendar, fileName, new KCalCore::ICalFormat() ) );
if ( storage->open() ) {
storage->save();
storage->close();
} else
return false;
return true;
}

View file

@ -1,37 +0,0 @@
/*
Copyright (c) 2010 Tobias Koenig <tokoe@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 EVENTSEXPORTHANDLER_H
#define EVENTSEXPORTHANDLER_H
#include "../lib/exporthandlerbase.h"
class EventsExportHandler : public ExportHandlerBase
{
protected:
virtual QString dialogText() const;
virtual QString dialogAllText() const;
virtual QString dialogLocalOnlyText() const;
virtual QStringList mimeTypes() const;
virtual bool exportItems( const Akonadi::Item::List &items );
};
#endif // EVENTSEXPORTHANDLER_H

View file

@ -1,80 +0,0 @@
/*
Copyright (c) 2010 Tobias Koenig <tokoe@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 "eventsfilterproxymodel.h"
#include <akonadi/entitytreemodel.h>
#include <KCalCore/Event>
static bool eventMatchesFilter( const KCalCore::Event::Ptr &event, const QString &filterString );
using namespace Akonadi;
class EventsFilterProxyModel::Private
{
public:
QString mFilter;
};
EventsFilterProxyModel::EventsFilterProxyModel( QObject *parent )
: QSortFilterProxyModel( parent ), d( new Private )
{
setSortLocaleAware( true );
setDynamicSortFilter( true );
}
EventsFilterProxyModel::~EventsFilterProxyModel()
{
delete d;
}
void EventsFilterProxyModel::setFilterString( const QString &filter )
{
d->mFilter = filter;
invalidateFilter();
}
bool EventsFilterProxyModel::filterAcceptsRow( int row, const QModelIndex &parent ) const
{
if ( d->mFilter.isEmpty() )
return true;
const QModelIndex index = sourceModel()->index( row, 0, parent );
const Akonadi::Item item = index.data( Akonadi::EntityTreeModel::ItemRole ).value<Akonadi::Item>();
if ( item.hasPayload<KCalCore::Event::Ptr>() ) {
const KCalCore::Event::Ptr event = item.payload<KCalCore::Event::Ptr>();
return eventMatchesFilter( event, d->mFilter );
}
return true;
}
static bool eventMatchesFilter( const KCalCore::Event::Ptr &event, const QString &filterString )
{
if ( event->summary().contains( filterString, Qt::CaseInsensitive ) )
return true;
if ( event->description().contains( filterString, Qt::CaseInsensitive ) )
return true;
return false;
}

View file

@ -1,89 +0,0 @@
/*
Copyright (c) 2010 Tobias Koenig <tokoe@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_EVENTSFILTERPROXYMODEL_H
#define AKONADI_EVENTSFILTERPROXYMODEL_H
#include <QSortFilterProxyModel>
namespace Akonadi {
/**
* @short A proxy model for \a EntityTreeModel based event models.
*
* This class provides a filter proxy model for an EntityTreeModel.
* The list of shown events can be limited by setting a filter pattern.
* Only events that contain this pattern as part of their data will be listed.
*
* Example:
*
* @code
*
* Akonadi::EventsFilterProxyModel *filter = new Akonadi::EventsFilterProxyModel;
* filter->setSourceModel( model );
*
* Akonadi::EntityTreeView *view = new Akonadi::EntityTreeView;
* view->setModel( filter );
*
* QLineEdit *filterEdit = new QLineEdit;
* connect( filterEdit, SIGNAL( textChanged( const QString& ) ),
* filter, SLOT( setFilterString( const QString& ) ) );
*
* @endcode
*
* @author Tobias Koenig <tokoe@kde.org>
*/
class EventsFilterProxyModel : public QSortFilterProxyModel
{
Q_OBJECT
public:
/**
* Creates a new events filter proxy model.
*
* @param parent The parent object.
*/
explicit EventsFilterProxyModel( QObject *parent = 0 );
/**
* Destroys the events filter proxy model.
*/
~EventsFilterProxyModel();
public Q_SLOTS:
/**
* Sets the @p filter that is used to filter for matching events.
*/
void setFilterString( const QString &filter );
protected:
//@cond PRIVATE
virtual bool filterAcceptsRow( int row, const QModelIndex &parent ) const;
//@endcond
private:
//@cond PRIVATE
class Private;
Private* const d;
//@endcond
};
}
#endif // AKONADI_EVENTSFILTERPROXYMODEL_H

View file

@ -1,53 +0,0 @@
/*
Copyright (c) 2010 Tobias Koenig <tokoe@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 "eventsguistatemanager.h"
bool EventsGuiStateManager::inViewDayState() const
{
return (currentState() == ViewDayState);
}
bool EventsGuiStateManager::inViewWeekState() const
{
return (currentState() == ViewWeekState);
}
bool EventsGuiStateManager::inViewMonthState() const
{
return (currentState() == ViewMonthState);
}
bool EventsGuiStateManager::inViewEventListState() const
{
return (currentState() == ViewEventListState);
}
bool EventsGuiStateManager::inViewTimelineState() const
{
return (currentState() == ViewTimelineState);
}
void EventsGuiStateManager::emitChangedSignal()
{
GuiStateManager::emitChangedSignal();
emit guiStateChanged();
}

View file

@ -1,78 +0,0 @@
/*
Copyright (c) 2010 Tobias Koenig <tokoe@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 EVENTSGUISTATEMANAGER_H
#define EVENTSGUISTATEMANAGER_H
#include "../lib/guistatemanager.h"
class EventsGuiStateManager : public GuiStateManager
{
Q_OBJECT
Q_PROPERTY( bool inViewDayState READ inViewDayState NOTIFY guiStateChanged )
Q_PROPERTY( bool inViewWeekState READ inViewWeekState NOTIFY guiStateChanged )
Q_PROPERTY( bool inViewMonthState READ inViewMonthState NOTIFY guiStateChanged )
Q_PROPERTY( bool inViewEventListState READ inViewEventListState NOTIFY guiStateChanged )
Q_PROPERTY( bool inViewTimelineState READ inViewTimelineState NOTIFY guiStateChanged )
Q_ENUMS( GuiState )
public:
enum GuiState {
ViewDayState = GuiStateManager::UserState,
ViewWeekState,
ViewMonthState,
ViewEventListState,
ViewTimelineState
};
/**
* Returns whether the current state is the view day state.
*/
bool inViewDayState() const;
/**
* Returns whether the current state is the view week state.
*/
bool inViewWeekState() const;
/**
* Returns whether the current state is the view month state.
*/
bool inViewMonthState() const;
/**
* Returns whether the current state is the view event list state.
*/
bool inViewEventListState() const;
/**
* Returns whether the current state is the view timeline state.
*/
bool inViewTimelineState() const;
Q_SIGNALS:
void guiStateChanged();
protected:
virtual void emitChangedSignal();
};
#endif

View file

@ -1,106 +0,0 @@
/*
Copyright (c) 2010 Tobias Koenig <tokoe@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 "eventsimporthandler.h"
#include <kcalcore/event.h>
#include <kcalcore/filestorage.h>
#include <kcalcore/icalformat.h>
#include <kcalcore/memorycalendar.h>
#include <klocale.h>
#include <kmessagebox.h>
QString EventsImportHandler::fileDialogNameFilter() const
{
return QLatin1String( "*.ics|iCals" );
}
QString EventsImportHandler::fileDialogTitle() const
{
return i18n( "Select iCal to Import" );
}
QString EventsImportHandler::collectionDialogText() const
{
return i18n( "Select the calendar the imported event(s) shall be saved in:" );
}
QString EventsImportHandler::collectionDialogTitle() const
{
return i18n( "Select Calendar" );
}
QString EventsImportHandler::importDialogText( int count, const QString &collectionName ) const
{
return i18np( "Importing one event to %2", "Importing %1 events to %2", count, collectionName );
}
QString EventsImportHandler::importDialogTitle() const
{
return i18n( "Import Events" );
}
QStringList EventsImportHandler::mimeTypes() const
{
return QStringList( KCalCore::Event::eventMimeType() );
}
Akonadi::Item::List EventsImportHandler::createItems( const QStringList &fileNames, bool *ok )
{
*ok = true;
Akonadi::Item::List items;
KCalCore::Event::List events;
foreach ( const QString &fileName, fileNames ) {
KCalCore::MemoryCalendar::Ptr calendar( new KCalCore::MemoryCalendar( QLatin1String( "UTC" ) ) );
KCalCore::FileStorage::Ptr storage( new KCalCore::FileStorage( calendar, fileName, new KCalCore::ICalFormat() ) );
if ( storage->load() ) {
events << calendar->events();
} else {
const QString caption( i18n( "iCal Import Failed" ) );
const QString msg = i18nc( "@info",
"<para>Error when trying to read the iCal <filename>%1</filename>:</para>",
fileName );
KMessageBox::error( 0, msg, caption );
*ok = false;
}
}
if ( events.isEmpty() ) {
if ( !(*ok) && fileNames.count() > 1 )
KMessageBox::information( 0, i18n( "No events were imported, due to errors with the iCals." ) );
else if ( *ok )
KMessageBox::information( 0, i18n( "The iCal does not contain any events." ) );
return items; // nothing to import
}
foreach ( const KCalCore::Event::Ptr &event, events ) {
Akonadi::Item item;
item.setPayload<KCalCore::Event::Ptr>( event );
item.setMimeType( KCalCore::Event::eventMimeType() );
items << item;
}
return items;
}

View file

@ -1,39 +0,0 @@
/*
Copyright (c) 2010 Tobias Koenig <tokoe@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 EVENTSIMPORTHANDLER_H
#define EVENTSIMPORTHANDLER_H
#include "../lib/importhandlerbase.h"
class EventsImportHandler : public ImportHandlerBase
{
protected:
virtual QString fileDialogNameFilter() const;
virtual QString fileDialogTitle() const;
virtual QString collectionDialogText() const;
virtual QString collectionDialogTitle() const;
virtual QString importDialogText( int count, const QString &collectionName ) const;
virtual QString importDialogTitle() const;
virtual QStringList mimeTypes() const;
virtual Akonadi::Item::List createItems( const QStringList &fileNames, bool *ok );
};
#endif // EVENTSIMPORTHANDLER_H

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 606 KiB

View file

@ -1,130 +0,0 @@
[Desktop Entry]
Version=1.0
Name=Calendar
Name[af]=Kalender
Name[ar]=التقويم
Name[bg]=Calendar
Name[br]=Deiziadur
Name[bs]=Kalendar
Name[ca]=Calendari
Name[ca@valencia]=Calendari
Name[cs]=Kalendář
Name[cy]=Calendr
Name[da]=Kalender
Name[de]=Kalender
Name[el]=Ημερολόγιο
Name[en_GB]=Calendar
Name[eo]=Kalendaro
Name[es]=Calendario
Name[et]=Kalender
Name[eu]=Egutegia
Name[fa]=تقویم
Name[fi]=Kalenteri
Name[fr]=Calendrier
Name[fy]=Aginda
Name[ga]=Féilire
Name[gl]=Calendario
Name[he]=לוח שנה
Name[hu]=Naptár
Name[ia]=Calendario
Name[is]=Dagatal
Name[it]=Calendario
Name[ja]=
Name[ka]=
Name[kk]=Күнтізбе
Name[km]=
Name[ko]=
Name[lt]=Kalendorius
Name[lv]=Kalendārs
Name[mai]=
Name[mk]=Календар
Name[mr]=िि
Name[ms]=Kalendar
Name[nb]=Kalender
Name[nds]=Kalenner
Name[ne]=
Name[nl]=Agenda
Name[nn]=Kalender
Name[oc]=Calendièr
Name[pa]=
Name[pl]=Kalendarz
Name[pt]=Calendário
Name[pt_BR]=Calendário
Name[ro]=Calendar
Name[ru]=Календарь
Name[se]=Kaleandar
Name[sk]=Kalendár
Name[sl]=Koledar
Name[sr]=Календар
Name[sr@ijekavian]=Календар
Name[sr@ijekavianlatin]=Kalendar
Name[sr@latin]=Kalendar
Name[sv]=Kalender
Name[ta]=ி
Name[tg]=Тақвим
Name[th]=
Name[tr]=Takvim
Name[ug]=يىلنامە
Name[uk]=Календар
Name[uz]=Kalendar
Name[uz@cyrillic]=Календар
Name[wa]=Calindrî
Name[x-test]=xxCalendarxx
Name[zh_CN]=
Name[zh_TW]=
Exec=korganizer-mobile
Icon=korganizer-mobile
Type=Application
MimeType=text/calendar;
Categories=Qt;KDE;Office;Calendar;
X-KDE-ServiceTypes=DBUS/Organizer
X-KDE-StartupNotify=true
X-DBUS-StartupType=Unique
X-DBUS-ServiceName=org.kde.korganizer
Keywords=mobile
Keywords[bs]=mobilni
Keywords[ca]=mòbil
Keywords[ca@valencia]=mòbil
Keywords[cs]=mobilní
Keywords[da]=mobil
Keywords[de]=Mobil
Keywords[el]=κινητό
Keywords[en_GB]=mobile
Keywords[es]=móvil
Keywords[et]=mobiil
Keywords[fi]=mobile
Keywords[fr]=mobile
Keywords[ga]=móibíleach, soghluaiste
Keywords[gl]=móbil
Keywords[hu]=mobil
Keywords[ia]=mobile
Keywords[it]=mobile
Keywords[ja]=
Keywords[kk]=mobile
Keywords[km]=
Keywords[lt]=mobilus
Keywords[mr]=
Keywords[nb]=mobil
Keywords[nds]=mobil
Keywords[nl]=mobiel
Keywords[pa]=
Keywords[pl]=telefon komórkowy
Keywords[pt]=móvel
Keywords[pt_BR]=móvel
Keywords[ro]=mobil
Keywords[ru]=mobile
Keywords[sk]=mobil
Keywords[sl]=mobilno
Keywords[sr]=мобилни
Keywords[sr@ijekavian]=мобилни
Keywords[sr@ijekavianlatin]=mobilni
Keywords[sr@latin]=mobilni
Keywords[sv]=mobil
Keywords[tr]=mobil
Keywords[ug]=يان تېلېفون
Keywords[uk]=мобільний
Keywords[wa]=axhlåve
Keywords[x-test]=xxmobilexx
Keywords[zh_CN]=mobile,
Keywords[zh_TW]=

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

View file

@ -1,599 +0,0 @@
/*
Copyright (c) 2010 Volker Krause <vkrause@kde.org>
Copyright (c) 2010 Bertjan Broeksema <broeksema@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.
*/
import QtQuick 1.1
import org.qt 4.7 // Qt widget wrappers
import org.kde 4.5
import org.kde.akonadi 4.5
import org.kde.pim.mobileui 4.5 as KPIM
import org.kde.kcal 4.5 as KCal
import org.kde.calendarviews 4.5 as CalendarViews
import org.kde.akonadi.events 4.5 as Events
import org.kde.akonadi.calendar 4.5 as Calendar
import "../mobileui/ScreenFunctions.js" as Screen
KPIM.MainView {
id: korganizerMobile
Connections {
target: guiStateManager
onGuiStateChanged: { updateContextActionStates() }
}
Component.onCompleted : updateContextActionStates();
function updateContextActionStates()
{
if ( guiStateManager.inHomeScreenState ) {
korganizerActions.showOnlyCategory( "home" )
} else if ( guiStateManager.inAccountScreenState ) {
korganizerActions.showOnlyCategory( "account" )
} else if ( guiStateManager.inSingleFolderScreenState ) {
korganizerActions.showOnlyCategory( "single_folder" )
} else if ( guiStateManager.inMultipleFolderScreenState || guiStateManager.inSearchResultScreenState ) {
korganizerActions.showOnlyCategory( "multiple_folder" )
} else if ( guiStateManager.inViewSingleItemState ) {
korganizerActions.showOnlyCategory( "event_viewer" )
} else if ( guiStateManager.inViewDayState || guiStateManager.inViewWeekState || guiStateManager.inViewMonthState|| guiStateManager.inViewTimelineState || guiStateManager.inViewEventListState ) {
if ( collectionView.numSelected > 1 )
korganizerActions.showOnlyCategory( "multiple_calendar" )
else
korganizerActions.showOnlyCategory( "single_calendar" )
}
}
function showDate(date)
{
agenda.showRange( date, 0 /* "Day" */ );
guiStateManager.pushState( Events.EventsGuiStateManager.ViewDayState );
application.bringToFront();
}
KCal.IncidenceView {
id: eventView
anchors { fill: parent; topMargin: 40; leftMargin: 40 }
visible: guiStateManager.inViewSingleItemState
z: 0
itemId: -1
swipeLength: 0.2 // Require at least 20% of screenwidth to trigger next or prev
onNextItemRequest: {
// Only go to the next message when currently a valid item is set.
if ( eventView.itemId >= 0 )
{
itemList.nextItem();
application.setCurrentEventItemId(eventView.itemId);
}
}
onPreviousItemRequest: {
// Only go to the previous message when currently a valid item is set.
if ( eventView.itemId >= 0 )
{
itemList.previousItem();
application.setCurrentEventItemId(eventView.itemId);
}
}
KPIM.ItemEditButton {
actionName: "akonadi_incidence_edit"
anchors.bottom: backButton.top
anchors.right: parent.right
anchors.margins: 12
onClicked: {
application.editIncidence( parent.item, parent.activeDate );
guiStateManager.popState();
}
}
KPIM.Button {
id: backButton
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.margins: 12
width: 70
height: 70
icon: KDE.locate( "data", "mobileui/back-to-list-button.png" );
onClicked: {
_itemActionModel.select(-1, 1)
_itemNavigationModel.select(-1, 1)
guiStateManager.popState();
}
}
}
Loader {
anchors.fill: parent
source: guiStateManager.inViewMonthState ? "MonthViewComponent.qml" : ""
onLoaded: {
item.showMonth( dateEdit.date );
}
}
Rectangle {
id: agendaView
visible: guiStateManager.inViewDayState || guiStateManager.inViewWeekState
anchors.fill: parent
color: "#D2D1D0" // TODO: make palette work correctly. palette.window
Rectangle {
id : backToMessageListButton
height: 48
width: 48
z: 5
color: "#00000000"
anchors.right : parent.right
anchors.rightMargin : 70
anchors.bottom : parent.bottom
anchors.bottomMargin : 70
Image {
source : KDE.locate( "data", "mobileui/back-to-list-button.png" );
MouseArea {
anchors.fill : parent;
onClicked : {
_itemActionModel.select(-1, 1)
_itemNavigationModel.select(-1, 1)
guiStateManager.popState();
}
}
}
}
CalendarViews.AgendaView {
id: agenda
anchors { fill: parent; topMargin: 10; leftMargin: 40 }
calendar: calendarModel
swipeLength: 0.2 // Require at least 20% of screenwidth to trigger next or prev
onItemSelected: {
if ( selectedItemId > 0 ) {
eventView.itemId = selectedItemId;
eventView.activeDate = activeDate;
application.setCurrentEventItemId(selectedItemId);
guiStateManager.pushUniqueState( KPIM.GuiStateManager.ViewSingleItemState );
clearSelection();
}
}
}
}
Loader {
anchors.fill: parent
source: guiStateManager.inViewTimelineState ? "TimelineView.qml" : ""
onLoaded: { item.showRange( dateEdit.date, 4 /* Next 7 days */ ); }
}
Loader {
anchors.fill: parent
source: guiStateManager.inViewEventListState ? "EventListComponent.qml" : ""
}
Item {
id : mainWorkView
visible: { guiStateManager.inHomeScreenState ||
guiStateManager.inAccountScreenState ||
guiStateManager.inSingleFolderScreenState ||
guiStateManager.inMultipleFolderScreenState
}
anchors.top: parent.top
anchors.topMargin : 12
anchors.bottom: parent.bottom
anchors.left: parent.left
width: 1/3 * parent.width
Image {
id: backgroundImage
x: 0
y: 0
// FIXME: too big, costs about 1.5Mb RAM
// source: "korganizer-mobile-background.png"
}
AkonadiBreadcrumbNavigationView {
id : collectionView
anchors.top: parent.top
anchors.bottom : selectButton.top
anchors.left: parent.left
anchors.right: parent.right
itemHeight: Screen.partition( height, 7 )
breadcrumbComponentFactory : _breadcrumbNavigationFactory
multipleSelectionText : KDE.i18nc("%1 is e.g. 3 folders, %2 is e.g. from 2 accounts, %3 is e.g. 9 events",
"You have selected \n%1\n%2\n%3",
KDE.i18np("1 folder","%1 folders",collectionView.numSelected),
KDE.i18np("from 1 account","from %1 accounts",application.numSelectedAccounts),
KDE.i18np("1 event","%1 events", calendarModel.incidencesCount))
onSelectedClicked : {
guiStateManager.pushState( KPIM.GuiStateManager.BulkActionScreenState );
}
KPIM.AgentStatusIndicator {
anchors { top: parent.top; right: parent.right; rightMargin: 10; topMargin: 10 }
}
}
KPIM.Button2 {
id : selectButton
anchors.left: collectionView.left
anchors.right: collectionView.right
anchors.bottom : parent.bottom
anchors.bottomMargin : collectionView.hasSelection ? -selectButton.height : 0
buttonText : KDE.i18n("Select")
opacity : collectionView.hasSelection ? 0 : 1
onClicked : {
application.persistCurrentSelection("preFavSelection");
guiStateManager.pushState( KPIM.GuiStateManager.MultipleFolderSelectionScreenState );
}
}
}
KPIM.StartCanvas {
id: homePage
anchors.left: mainWorkView.right
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.topMargin: 12
visible: mainWorkView.visible && !collectionView.hasSelection
showAccountsList : false
favoritesModel : favoritesList
contextActions : [
Column {
anchors.fill: parent
height : 70
KPIM.Button2 {
id: newAppointmentButton2
width: 2/3 * parent.width
anchors.horizontalCenter: parent.horizontalCenter
buttonText: KDE.i18n( "New Appointment" )
// TODO: Make sure that the correct default calendar is selected in
// the incidence editor.
onClicked : { application.newEvent(); }
}
}
]
}
Item {
id : calendarPage
anchors.left: mainWorkView.right
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
visible: mainWorkView.visible && collectionView.hasSelection
Column {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: parent.height
spacing: 10
Row {
height: 480 / 6
width: parent.width
QmlDateEdit {
id: dateEdit
width: parent.width
height: 480 / 6
// MM.dd.yyyy
displayFormat: KDE.i18n( "yyyy-MM-dd" )
}
}
Row {
spacing: 2
width: parent.width - 5
KPIM.Button2 {
id: dayButton
buttonText: KDE.i18n( "Day view" )
width: parent.width / 4
onClicked: {
agenda.showRange( dateEdit.date, 0 /* "Day" */ );
guiStateManager.pushState( Events.EventsGuiStateManager.ViewDayState );
}
}
KPIM.Button2 {
id: weekButton
buttonText: KDE.i18n( "Week view" )
width: parent.width / 4
onClicked: {
agenda.showRange( dateEdit.date, 1 /* "Week" */ );
guiStateManager.pushState( Events.EventsGuiStateManager.ViewWeekState );
}
}
KPIM.Button2 {
id: monthButton
buttonText: KDE.i18n( "Month view" )
width: parent.width / 4
onClicked: {
guiStateManager.pushState( Events.EventsGuiStateManager.ViewMonthState );
}
}
KPIM.Button2 {
id: timelineButton
buttonText: KDE.i18n( "Timeline" )
width: parent.width / 4
onClicked: {
guiStateManager.pushState( Events.EventsGuiStateManager.ViewTimelineState );
}
}
}
KPIM.Button2 {
id: newAppointmentButton
width: 2/3 * parent.width
anchors.horizontalCenter: parent.horizontalCenter
buttonText: KDE.i18n( "New Appointment" )
// TODO: Make sure that the correct default calendar is selected in
// the incidence editor.
onClicked : { application.newEventWithDate( dateEdit.date ); }
}
}
}
SlideoutPanelContainer {
anchors.fill: parent
z: 100
visible: !guiStateManager.inBulkActionScreenState &&
!guiStateManager.inMultipleFolderSelectionScreenState &&
!guiStateManager.inConfigScreenState &&
!guiStateManager.inSearchScreenState
SlideoutPanel {
id: actionPanel
titleText: KDE.i18n( "Actions" )
handlePosition : 125
handleHeight: 150
anchors.fill : parent
Component.onCompleted: {
actionPanel.expanded.connect( korganizerActions, korganizerActions.refresh );
}
content : [
KorganizerActions {
id : korganizerActions
anchors.fill : parent
scriptActions : [
KPIM.ScriptAction {
name : "show_about_dialog"
script : {
actionPanel.collapse();
aboutDialog.visible = true
}
},
KPIM.ScriptAction {
name : "configure"
script : {
actionPanel.collapse();
guiStateManager.pushState( KPIM.GuiStateManager.ConfigScreenState );
}
},
//TODO enable when SearchWidget::query() is implemented
// KPIM.ScriptAction {
// name : "search_event"
// script : {
// actionPanel.collapse();
// guiStateManager.pushState( KPIM.GuiStateManager.SearchScreenState );
// }
// },
KPIM.ScriptAction {
name : "to_selection_screen"
script : {
actionPanel.collapse();
guiStateManager.pushState( KPIM.GuiStateManager.MultipleFolderSelectionScreenState );
}
},
KPIM.ScriptAction {
name : "add_as_favorite"
script : {
actionPanel.collapse();
application.saveFavorite();
}
},
KPIM.ScriptAction {
name : "day_layout"
script: {
guiStateManager.switchState( Events.EventsGuiStateManager.ViewWeekState );
agenda.showRange( dateEdit.date, 0 /* "Day" */ );
actionPanel.collapse();
}
},
KPIM.ScriptAction {
name : "three_day_layout"
script : {
guiStateManager.switchState( Events.EventsGuiStateManager.ViewWeekState );
agenda.showRange( dateEdit.date, 3 /** 3 days*/ );
actionPanel.collapse();
}
},
KPIM.ScriptAction {
name : "week_layout"
script: {
guiStateManager.switchState( Events.EventsGuiStateManager.ViewWeekState );
agenda.showRange( dateEdit.date, 1 /* "Week" */ );
actionPanel.collapse();
}
},
KPIM.ScriptAction {
name : "work_week_layout"
script: {
guiStateManager.switchState( Events.EventsGuiStateManager.ViewWeekState );
agenda.showRange( dateEdit.date, 2 /* "WorkWeek" */ );
actionPanel.collapse();
}
},
KPIM.ScriptAction {
name : "month_layout"
script: {
guiStateManager.switchState( Events.EventsGuiStateManager.ViewMonthState );
actionPanel.collapse();
}
},
KPIM.ScriptAction {
name : "eventlist_layout"
script: {
guiStateManager.switchState( Events.EventsGuiStateManager.ViewEventListState );
actionPanel.collapse();
}
},
KPIM.ScriptAction {
name : "timeline_layout"
script: {
guiStateManager.switchState( Events.EventsGuiStateManager.ViewTimelineState );
actionPanel.collapse();
}
},
KPIM.ScriptAction {
name : "show_today"
script : {
agenda.showToday();
guiStateManager.switchState( Events.EventsGuiStateManager.ViewDayState );
actionPanel.collapse();
}
},
KPIM.ScriptAction {
name : "start_maintenance"
script : {
actionPanel.collapse();
guiStateManager.pushState( KPIM.GuiStateManager.BulkActionScreenState );
}
}
]
onDoCollapse : actionPanel.collapse();
}
]
}
SlideoutPanel {
anchors.fill: parent
handlePosition : actionPanel.handlePosition + actionPanel.handleHeight
id: attachmentPanel
visible: (eventView.attachmentModel.attachmentCount >= 1) && guiStateManager.inViewSingleItemState
titleIcon: KDE.iconPath( "mail-attachment", 48 );
handleHeight: parent.height - actionPanel.handlePosition - actionPanel.handleHeight - anchors.topMargin - anchors.bottomMargin
content: [
KPIM.AttachmentList {
id: attachmentView
model: eventView.attachmentModel
anchors.fill: parent
onOpenAttachment: {
application.openAttachment(url, mimeType);
}
onSaveAttachment: {
application.saveAttachment(url, fileName);
}
}
]
}
}
Loader {
anchors.fill: parent
source: guiStateManager.inMultipleFolderSelectionScreenState ? KDE.locate( "module", "imports/org/kde/pim/mobileui/MultipleSelectionScreen.qml" ) : ""
onLoaded: { item.backgroundImage = backgroundImage.source; }
}
Loader {
anchors.fill: parent
source: guiStateManager.inBulkActionScreenState ? "BulkActionComponent.qml" : ""
onLoaded: {
item.backgroundImage = backgroundImage.source
item.itemHeight = Screen.partition( item.height, 7 )
}
}
KPIM.SearchResultScreen {
id : searchResultScreen
anchors.top: parent.top
anchors.topMargin : 12
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right : parent.right
itemView: EventListView {
id: searchEventListView
model: itemModel
checkModel : _itemActionModel
navigationModel : _itemNavigationModel
anchors.fill : parent
itemHeight: Screen.partition( height, 7 )
}
resultText: KDE.i18np( "One event found", "%1 events found", searchEventListView.count )
}
Connections {
target: homePage
onAccountSelected : {
application.setSelectedAccount(row);
}
}
Connections {
target: homePage
onFavoriteSelected : {
application.loadFavorite(favName);
}
}
Connections {
target: eventView
onIncidenceRemoved : {
if ( guiStateManager.inViewSingleItemState ) {
guiStateManager.popState();
}
}
}
Loader {
id : aboutDialog
anchors.fill: parent
visible: false
source: visible ? KDE.locate( "module", "imports/org/kde/pim/mobileui/AboutDialog.qml" ) : ""
onLoaded: { item.backgroundSource = backgroundImage.source; }
}
Loader {
anchors.fill: parent
source: guiStateManager.inConfigScreenState ? "ConfigDialog.qml" : ""
onLoaded: item.load();
}
KPIM.SearchDialog {
id: searchDialog
searchWidget: Calendar.SearchWidget {
anchors.fill: parent
}
}
}

View file

@ -1 +0,0 @@
KORGANIZER_MOBILE_ICON ICON "korganizer-mobile.ico"

View file

@ -1,63 +0,0 @@
/*
* 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 Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include <kdeclarativeapplication.h>
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <incidenceeditor-ng/korganizereditorconfig.h>
#include "mainview.h"
#ifdef MAIL_SERIALIZER_PLUGIN_STATIC
#include <QtPlugin>
Q_IMPORT_PLUGIN(akonadi_serializer_mail)
Q_IMPORT_PLUGIN(akonadi_serializer_addressee)
Q_IMPORT_PLUGIN(akonadi_serializer_contactgroup)
Q_IMPORT_PLUGIN(akonadi_serializer_kcalcore)
#endif
using namespace Akonadi;
using namespace CalendarSupport;
using namespace IncidenceEditorNG;
int main( int argc, char **argv )
{
const QByteArray& ba = QByteArray( "korganizer-mobile" );
const KLocalizedString name = ki18n( "Kontact Touch Calendar" );
// NOTE: This is necessary to avoid a crash, but will result in an empty config.
// To make this really configurable do something like KOrganizerEditorConfig
// in incidinceeditors/groupwareintegration.cpp
EditorConfig::setEditorConfig( new KOrganizerEditorConfig );
KAboutData aboutData( ba, ba, name, ba, name );
aboutData.setProductName( "KOrganizer Mobile/calendar" ); //has to match the bugzilla product name
KCmdLineArgs::init( argc, argv, &aboutData );
KDeclarativeApplication<MainView> app;
KGlobal::locale()->insertCatalog( QLatin1String("libkcalutils") );
KGlobal::locale()->insertCatalog( QLatin1String("libincidenceeditors") );
KGlobal::locale()->insertCatalog( QLatin1String("calendarsupport") );
return app.exec();
}

View file

@ -1,762 +0,0 @@
/*
* Copyright (c) 2010 Volker Krause <vkrause@kde.org>
* Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
* Copyright (c) 2010 Andras Mantia <andras@kdab.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include "mainview.h"
#include "actionhelper.h"
#include "agendaviewitem.h"
#include "calendaradaptor.h"
#include "calendarinterface.h"
#include "calendar/clockhelper.h"
#include "calendar/groupwareuidelegate.h"
#include "calendar/incidenceview.h"
#include "calendar/kcalitembrowseritem.h"
#include "configwidget.h"
#include "eventlistproxy.h"
#include "eventsexporthandler.h"
#include "eventsfilterproxymodel.h"
#include "eventsguistatemanager.h"
#include "eventsimporthandler.h"
#include "monthviewitem.h"
#include "searchwidget.h"
#include "settings.h"
#include "timelineviewitem.h"
#include "qmldateedit.h"
#include <akonadi/agentactionmanager.h>
#include <akonadi/calendar/standardcalendaractionmanager.h>
#include <Akonadi/Calendar/IncidenceChanger>
#include <Akonadi/Calendar/ITIPHandler>
#include <akonadi/calendar/freebusymanager.h>
#include <akonadi/calendar/calendarsettings.h>
#include <akonadi/collectionmodel.h>
#include <akonadi/collectionpropertiesdialog.h>
#include <akonadi/entitytreemodel.h>
#include <akonadi/itemfetchjob.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/standardactionmanager.h>
#include <calendarsupport/archivedialog.h>
#include <calendarsupport/categoryconfig.h>
#include <calendarsupport/collectiongeneralpage.h>
#include <calendarsupport/collectionselection.h>
#include <calendarsupport/identitymanager.h>
#include <calendarsupport/kcalprefs.h>
#include <calendarsupport/utils.h>
#include <calendarviews/eventview.h>
#include <calendarviews/agenda/agendaview.h>
#include <calendarviews/month/monthview.h>
#include <kaction.h>
#include <kactioncollection.h>
#include <kcalcore/event.h>
#include <kcalcore/todo.h>
#include <kcolorcombo.h>
#include <kcolordialog.h>
#include <kmessagebox.h>
#include <ksystemtimezone.h>
#include <incidenceeditor-ng/categoryeditdialog.h>
#include <incidenceeditor-ng/editorconfig.h>
#include <incidenceeditor-ng/incidencedefaults.h>
#include <libkdepimdbusinterfaces/reminderclient.h>
#include <QtCore/QTimer>
#include <QtDBus/QDBusConnection>
#include <QDeclarativeEngine>
#include <QDeclarativeContext>
#include <QGraphicsItem>
Q_DECLARE_METATYPE(KCalCore::iTIPMethod)
using namespace Akonadi;
using CalendarSupport::KCalPrefs;
QML_DECLARE_TYPE( CalendarSupport::KCal::KCalItemBrowserItem )
QML_DECLARE_TYPE( DeclarativeConfigWidget )
QML_DECLARE_TYPE( DeclarativeSearchWidget )
QML_DECLARE_TYPE( Qt::QmlDateEdit )
QML_DECLARE_TYPE( EventsGuiStateManager )
QML_DECLARE_TYPE( EventViews::AgendaViewItem )
QML_DECLARE_TYPE( EventViews::MonthViewItem )
QML_DECLARE_TYPE( EventViews::TimelineViewItem )
EventViews::PrefsPtr MainView::m_calendarPrefs;
MainView::MainView( QWidget* parent )
: KDeclarativeMainView( QLatin1String("korganizer-mobile"), new EventListProxy, parent ),
m_identityManager( 0 ),
m_changer( 0 ),
mActionManager( 0 )
{
m_calendarPrefs = EventViews::PrefsPtr( new EventViews::Prefs );
m_calendarPrefs->readConfig();
mITIPHandler = new Akonadi::ITIPHandler( this );
Akonadi::CollectionPropertiesDialog::registerPage( new CalendarSupport::CollectionGeneralPageFactory );
}
MainView::~MainView()
{
m_calendarPrefs->writeConfig();
m_calendar->deleteLater();
delete m_identityManager;
}
EventViews::PrefsPtr MainView::preferences()
{
return m_calendarPrefs;
}
void MainView::doDelayedInit()
{
setWindowTitle( i18n( "Calendar" ) );
addMimeType( KCalCore::Event::eventMimeType() );
addMimeType( KCalCore::Todo::todoMimeType() );
itemFetchScope().fetchFullPayload();
qmlRegisterType<CalendarSupport::KCal::KCalItemBrowserItem>( "org.kde.kcal", 4, 5, "IncidenceView" );
qmlRegisterType<DeclarativeConfigWidget>( "org.kde.akonadi.calendar", 4, 5, "ConfigWidget" );
qmlRegisterType<DeclarativeSearchWidget>( "org.kde.akonadi.calendar", 4, 5, "SearchWidget" );
qmlRegisterType<EventViews::AgendaViewItem>( "org.kde.calendarviews", 4, 5, "AgendaView" );
qmlRegisterType<EventViews::MonthViewItem>( "org.kde.calendarviews", 4, 5, "MonthView" );
qmlRegisterType<EventViews::TimelineViewItem>( "org.kde.calendarviews", 4, 5, "TimelineView" );
qmlRegisterType<Qt::QmlDateEdit>( "org.qt", 4, 7, "QmlDateEdit" );
qmlRegisterType<ClockHelper>( "ClockHelper", 4, 5, "ClockHelper" );
qmlRegisterUncreatableType<EventsGuiStateManager>( "org.kde.akonadi.events", 4, 5, "EventsGuiStateManager", QLatin1String( "This type is only exported for its enums" ) );
m_calendar = Akonadi::ETMCalendar::Ptr( new Akonadi::ETMCalendar() );
m_calendar->setWeakPointer( m_calendar );
engine()->rootContext()->setContextProperty( QLatin1String("calendarModel"), QVariant::fromValue( static_cast<QObject*>( m_calendar.data() ) ) );
Akonadi::FreeBusyManager::self()->setCalendar( m_calendar );
// TODO: set a groupware delegate to handle counter proposals
m_changer = new Akonadi::IncidenceChanger( this );
m_identityManager = new CalendarSupport::IdentityManager;
// FIXME: My suspicion is that this is wrong. I.e. the collection selection is
// not correct resulting in no items showing up in the monthview.
CalendarSupport::CollectionSelection *collectionselection;
collectionselection = new CalendarSupport::CollectionSelection( regularSelectionModel(), this );
EventViews::EventView::setGlobalCollectionSelection( collectionselection );
QDBusConnection::sessionBus().registerService( QLatin1String("org.kde.korganizer") ); //register also as the real korganizer, so kmail can communicate with it
KAction *action = new KAction( i18n( "Import Events" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(importItems()) );
actionCollection()->addAction( QLatin1String( "import_events" ), action );
action = new KAction( i18n( "Export Events From This Account" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(exportItems()) );
actionCollection()->addAction( QLatin1String( "export_account_events" ), action );
action = new KAction( i18n( "Export Displayed Events" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(exportItems()) );
actionCollection()->addAction( QLatin1String( "export_selected_events" ), action );
action = new KAction( i18n( "Archive Old Events" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(archiveOldEntries()) );
actionCollection()->addAction( QLatin1String( "archive_old_entries" ), action );
action = new KAction( i18n( "Publish Item Information" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(publishItemInformation()) );
actionCollection()->addAction( QLatin1String( "publish_item_information" ), action );
action = new KAction( i18n( "Send Invitations To Attendees" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(sendInvitation()) );
actionCollection()->addAction( QLatin1String( "send_invitations_to_attendees" ), action );
action = new KAction( i18n( "Send Status Update" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(sendStatusUpdate()) );
actionCollection()->addAction( QLatin1String( "send_status_update" ), action );
action = new KAction( i18n( "Send Cancellation To Attendees" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(sendCancellation()) );
actionCollection()->addAction( QLatin1String( "send_cancellation_to_attendees" ), action );
action = new KAction( i18n( "Request Update" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(requestUpdate()) );
actionCollection()->addAction( QLatin1String( "request_update" ), action );
action = new KAction( i18n( "Request Change" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(requestChange()) );
actionCollection()->addAction( QLatin1String( "request_change" ), action );
action = new KAction( i18n( "Send As ICalendar" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(sendAsICalendar()) );
actionCollection()->addAction( QLatin1String( "send_as_icalendar" ), action );
action = new KAction( i18n( "Mail Free Busy Information" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(mailFreeBusy()) );
actionCollection()->addAction( QLatin1String( "mail_freebusy" ), action );
action = new KAction( i18n( "Upload Free Busy Information" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(uploadFreeBusy()) );
actionCollection()->addAction( QLatin1String( "upload_freebusy" ), action );
action = new KAction( i18n( "Save All" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(saveAllAttachments()) );
actionCollection()->addAction( QLatin1String( "save_all_attachments" ), action );
action = new KAction( i18n( "Set Color Of Calendar" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(changeCalendarColor()) );
actionCollection()->addAction( QLatin1String( "set_calendar_colour" ), action );
action = new KAction( i18n( "Configure Categories" ), this );
connect( action, SIGNAL(triggered(bool)), SLOT(configureCategories()) );
actionCollection()->addAction( QLatin1String( "configure_categories" ), action );
connect( this, SIGNAL(statusChanged(QDeclarativeView::Status)),
this, SLOT(qmlLoadingStateChanged(QDeclarativeView::Status)) );
//register DBUS interface
m_calendarIface = new CalendarInterface( this );
new CalendarAdaptor( m_calendarIface );
QDBusConnection::sessionBus().registerObject( QLatin1String("/Calendar"), m_calendarIface );
KPIM::ReminderClient::startDaemon();
}
void MainView::qmlLoadingStateChanged( QDeclarativeView::Status status )
{
if ( status != Ready ) // We wait until the QML is completely loaded
return;
connect( m_calendarIface, SIGNAL(showDateSignal(QVariant)),
rootObject(), SLOT(showDate(QVariant)) );
connect( m_calendarIface, SIGNAL(openIncidenceEditorSignal(QString,QString,QStringList,QStringList,QStringList,bool,KCalCore::Incidence::IncidenceType)),
this, SLOT(openIncidenceEditor(QString,QString,QStringList,QStringList,QStringList,bool,KCalCore::Incidence::IncidenceType)) );
// setup the shared settings object
EventViews::AgendaViewItem *agendaViewItem = rootObject()->findChild<EventViews::AgendaViewItem*>();
Q_ASSERT( agendaViewItem );
if ( agendaViewItem )
agendaViewItem->setPreferences( m_calendarPrefs );
}
void MainView::setConfigWidget(ConfigWidget* configWidget)
{
Q_ASSERT( configWidget );
configWidget->setPreferences( m_calendarPrefs );
EventViews::AgendaViewItem *agendaViewItem = rootObject()->findChild<EventViews::AgendaViewItem*>();
if ( agendaViewItem )
connect( configWidget, SIGNAL(configChanged()), agendaViewItem, SLOT(updateConfig()) );
EventViews::MonthViewItem *monthViewItem = rootObject()->findChild<EventViews::MonthViewItem*>();
if ( monthViewItem )
connect( configWidget, SIGNAL(configChanged()), monthViewItem, SLOT(updateConfig()) );
}
void MainView::finishEdit( QObject *editor )
{
m_openItemEditors.remove( editor );
}
void MainView::showRegularCalendar()
{
//m_calendar->setUnfilteredModel( itemModel() );
}
void MainView::setCurrentEventItemId( qint64 id )
{
const QModelIndexList list = EntityTreeModel::modelIndexesForItem(itemSelectionModel()->model(), Item(id));
if (list.isEmpty())
return;
const QModelIndex idx = list.first();
itemSelectionModel()->select( QItemSelection(idx, idx), QItemSelectionModel::ClearAndSelect );
itemActionModel()->select( QItemSelection( idx, idx ), QItemSelectionModel::ClearAndSelect );
}
void MainView::newEvent()
{
newEventWithDate( QDate::currentDate() );
}
void MainView::newEventWithDate( const QDate &date )
{
IncidenceView *editor = new IncidenceView;
editor->setWindowTitle( i18n( "Kontact Touch Calendar" ) );
Item item;
item.setMimeType( KCalCore::Event::eventMimeType() );
KCalCore::Event::Ptr event( new KCalCore::Event );
IncidenceEditorNG::IncidenceDefaults defaults;
{
KDateTime dateTime = KDateTime::currentLocalDateTime();
dateTime.setDate( date );
defaults.setStartDateTime( dateTime );
}
// Set the full emails manually here, to avoid that we get dependencies on
// KCalPrefs all over the place.
defaults.setFullEmails( CalendarSupport::KCalPrefs::instance()->fullEmails() );
// NOTE: At some point this should be generalized. That is, we now use the
// freebusy url as a hack, but this assumes that the user has only one
// groupware account. Which doesn't have to be the case necessarily.
// This method should somehow depend on the calendar selected to which
// the incidence is added.
if ( KCalPrefs::instance()->useGroupwareCommunication() )
defaults.setGroupWareDomain( KUrl( Akonadi::CalendarSettings::self()->freeBusyRetrieveUrl() ).host() );
defaults.setDefaults( event );
item.setPayload<KCalCore::Event::Ptr>( event );
editor->load( item );
if ( regularSelectionModel()->hasSelection() ) {
const QModelIndex index = regularSelectionModel()->selectedIndexes().first();
const Akonadi::Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value<Akonadi::Collection>();
if ( collection.isValid() )
editor->setDefaultCollection( collection );
}
editor->show();
}
void MainView::newTodo()
{
IncidenceView *editor = new IncidenceView;
editor->setWindowTitle( i18n( "Kontact Touch Calendar" ) );
Item item;
item.setMimeType( KCalCore::Todo::todoMimeType() );
KCalCore::Todo::Ptr todo( new KCalCore::Todo );
// make it due one day from now
todo->setDtStart( KDateTime::currentLocalDateTime() );
todo->setDtDue( KDateTime::currentLocalDateTime().addDays( 1 ) );
item.setPayload<KCalCore::Todo::Ptr>( todo );
editor->load( item );
if ( regularSelectionModel()->hasSelection() ) {
const QModelIndex index = regularSelectionModel()->selectedIndexes().first();
const Akonadi::Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value<Akonadi::Collection>();
if ( collection.isValid() )
editor->setDefaultCollection( collection );
}
editor->show();
}
void MainView::openIncidenceEditor( const QString &summary,
const QString &description,
const QStringList &attachmentUris,
const QStringList &attendees,
const QStringList &attachmentMimeTypes,
bool attachmentsAreInline,
KCalCore::Incidence::IncidenceType type )
{
kDebug();
IncidenceEditorNG::IncidenceDefaults defaults = IncidenceEditorNG::IncidenceDefaults::minimalIncidenceDefaults( attachmentsAreInline );
// if attach or attendee list is empty, these methods don't do anything, so
// it's safe to call them in every case
defaults.setAttachments( attachmentUris, attachmentMimeTypes, QStringList(), attachmentsAreInline );
defaults.setAttendees( attendees );
KCalCore::Incidence::Ptr incidence;
if ( type == KCalCore::Incidence::TypeTodo ) {
incidence = KCalCore::Incidence::Ptr( new KCalCore::Todo );
} else if ( type == KCalCore::Incidence::TypeEvent ) {
incidence = KCalCore::Incidence::Ptr( new KCalCore::Event );
} else {
Q_ASSERT_X( false, "openIncidenceEditor", "Unexpected incidence type" );
return;
}
defaults.setDefaults( incidence );
incidence->setSummary( summary );
incidence->setDescription( description );
Akonadi::Item item;
item.setPayload( incidence );
item.setMimeType( incidence->mimeType() );
IncidenceView *editor = new IncidenceView;
editor->setWindowTitle( i18n( "Kontact Touch Calendar" ) );
editor->load( item );
editor->show();
}
void MainView::editIncidence()
{
const CalendarSupport::KCal::KCalItemBrowserItem *eventView = rootObject()->findChild<CalendarSupport::KCal::KCalItemBrowserItem*>();
Q_ASSERT( eventView );
if ( eventView )
editIncidence( eventView->item(), eventView->activeDate() );
}
void MainView::editIncidence( const Akonadi::Item &item, const QDate &date )
{
if ( m_openItemEditors.values().contains( item.id() ) )
return; // An editor for this item is already open.
IncidenceView *editor = new IncidenceView;
editor->setWindowTitle( i18n( "Kontact Touch Calendar" ) );
editor->load( item, date );
m_openItemEditors.insert( editor, item.id() );
connect( editor, SIGNAL(destroyed(QObject*)), SLOT(finishEdit(QObject*)) );
editor->show();
}
void MainView::deleteIncidence()
{
const QModelIndexList indexes = itemActionModel()->selectedRows();
if ( indexes.isEmpty() )
return;
const Akonadi::Item item = indexes.first().data( Akonadi::EntityTreeModel::ItemRole ).value<Akonadi::Item>();
deleteIncidence( item );
}
void MainView::deleteIncidence( const Akonadi::Item &item )
{
m_changer->deleteIncidence( item );
}
void MainView::setupStandardActionManager( QItemSelectionModel *collectionSelectionModel,
QItemSelectionModel *itemSelectionModel )
{
mActionManager = new Akonadi::StandardCalendarActionManager( actionCollection(), this );
mActionManager->setCollectionSelectionModel( collectionSelectionModel );
mActionManager->setItemSelectionModel( itemSelectionModel );
mActionManager->createAllActions();
mActionManager->interceptAction( Akonadi::StandardActionManager::CreateResource );
mActionManager->interceptAction( Akonadi::StandardActionManager::DeleteItems );
mActionManager->interceptAction( Akonadi::StandardCalendarActionManager::CreateEvent );
mActionManager->interceptAction( Akonadi::StandardCalendarActionManager::CreateTodo );
mActionManager->interceptAction( Akonadi::StandardCalendarActionManager::EditIncidence );
connect( mActionManager->action( Akonadi::StandardActionManager::CreateResource ), SIGNAL(triggered(bool)),
this, SLOT(launchAccountWizard()) );
connect( mActionManager->action( Akonadi::StandardActionManager::DeleteItems ), SIGNAL(triggered(bool)),
this, SLOT(deleteIncidence()) );
connect( mActionManager->action( Akonadi::StandardCalendarActionManager::CreateEvent ), SIGNAL(triggered(bool)),
this, SLOT(newEvent()) );
connect( mActionManager->action( Akonadi::StandardCalendarActionManager::CreateTodo ), SIGNAL(triggered(bool)),
this, SLOT(newTodo()) );
connect( mActionManager->action( Akonadi::StandardCalendarActionManager::EditIncidence ), SIGNAL(triggered(bool)),
this, SLOT(editIncidence()) );
connect( mActionManager, SIGNAL(actionStateUpdated()), SLOT(updateActionTexts()) );
ActionHelper::adaptStandardActionTexts( mActionManager );
mActionManager->action( Akonadi::StandardCalendarActionManager::CreateEvent )->setText( i18n( "New Event" ) );
mActionManager->action( StandardActionManager::CollectionProperties )->setText( i18n( "Calendar Properties" ) );
mActionManager->action( StandardActionManager::CreateCollection )->setText( i18n( "New Sub Calendar" ) );
mActionManager->action( StandardActionManager::CreateCollection )->setProperty( "ContentMimeTypes", QStringList( KCalCore::Event::eventMimeType() ) );
mActionManager->setActionText( StandardActionManager::SynchronizeCollections, ki18np( "Synchronize This Calendar", "Synchronize These Calendars" ) );
mActionManager->setActionText( StandardActionManager::DeleteCollections, ki18np( "Delete Calendar", "Delete Calendars" ) );
mActionManager->action( StandardActionManager::MoveCollectionToDialog )->setText( i18n( "Move Calendar To" ) );
mActionManager->action( StandardActionManager::CopyCollectionToDialog )->setText( i18n( "Copy Calendar To" ) );
actionCollection()->action( QLatin1String("synchronize_all_items") )->setText( i18n( "Synchronize All Accounts" ) );
const QStringList pages = QStringList() << QLatin1String( "CalendarSupport::CollectionGeneralPage" )
<< QLatin1String( "Akonadi::CachePolicyPage" );
mActionManager->setCollectionPropertiesPageNames( pages );
}
void MainView::updateActionTexts()
{
const Akonadi::Item::List items = mActionManager->selectedItems();
if ( items.count() < 1 )
return;
const int itemCount = items.count();
const Akonadi::Item item = items.first();
const QString mimeType = item.mimeType();
if ( mimeType == KCalCore::Event::eventMimeType() ) {
actionCollection()->action( QLatin1String("akonadi_item_copy") )->setText( ki18np( "Copy Event", "Copy %1 Events" ).subs( itemCount ).toString() );
actionCollection()->action( QLatin1String("akonadi_item_copy_to_dialog") )->setText( i18n( "Copy Event To" ) );
actionCollection()->action( QLatin1String("akonadi_item_delete") )->setText( ki18np( "Delete Event", "Delete %1 Events" ).subs( itemCount ).toString() );
actionCollection()->action( QLatin1String("akonadi_item_move_to_dialog") )->setText( i18n( "Move Event To" ) );
actionCollection()->action( QLatin1String("akonadi_incidence_edit") )->setText( i18n( "Edit Event" ) );
} else if ( mimeType == KCalCore::Todo::todoMimeType() ) {
actionCollection()->action( QLatin1String("akonadi_item_copy") )->setText( ki18np( "Copy Task", "Copy %1 Tasks" ).subs( itemCount ).toString() );
actionCollection()->action(QLatin1String( "akonadi_item_copy_to_dialog") )->setText( i18n( "Copy Task To" ) );
actionCollection()->action( QLatin1String("akonadi_item_delete") )->setText( ki18np( "Delete Task", "Delete %1 Tasks" ).subs( itemCount ).toString() );
actionCollection()->action( QLatin1String("akonadi_item_move_to_dialog") )->setText( i18n( "Move Task To" ) );
actionCollection()->action( QLatin1String("akonadi_incidence_edit") )->setText( i18n( "Edit Task" ) );
} else if ( mimeType == KCalCore::Journal::journalMimeType() ) {
actionCollection()->action( QLatin1String("akonadi_item_copy") )->setText( ki18np( "Copy Journal", "Copy %1 Journals" ).subs( itemCount ).toString() );
actionCollection()->action( QLatin1String("akonadi_item_copy_to_dialog") )->setText( i18n( "Copy Journal To" ) );
actionCollection()->action( QLatin1String("akonadi_item_delete") )->setText( ki18np( "Delete Journal", "Delete %1 Journals" ).subs( itemCount ).toString() );
actionCollection()->action( QLatin1String("akonadi_item_move_to_dialog" ))->setText( i18n( "Move Journal To" ) );
actionCollection()->action( QLatin1String("akonadi_incidence_edit") )->setText( i18n( "Edit Journal" ) );
}
}
void MainView::setupAgentActionManager( QItemSelectionModel *selectionModel )
{
Akonadi::AgentActionManager *manager = createAgentActionManager( selectionModel );
manager->setContextText( Akonadi::AgentActionManager::CreateAgentInstance, Akonadi::AgentActionManager::DialogTitle,
i18nc( "@title:window", "New Account" ) );
manager->setContextText( Akonadi::AgentActionManager::CreateAgentInstance, Akonadi::AgentActionManager::ErrorMessageText,
ki18n( "Could not create account: %1" ) );
manager->setContextText( Akonadi::AgentActionManager::CreateAgentInstance, Akonadi::AgentActionManager::ErrorMessageTitle,
i18n( "Account creation failed" ) );
manager->setContextText( Akonadi::AgentActionManager::DeleteAgentInstance, Akonadi::AgentActionManager::MessageBoxTitle,
i18nc( "@title:window", "Delete Account?" ) );
manager->setContextText( Akonadi::AgentActionManager::DeleteAgentInstance, Akonadi::AgentActionManager::MessageBoxText,
i18n( "Do you really want to delete the selected account?" ) );
}
void MainView::configureCategories()
{
CalendarSupport::CategoryConfig config( IncidenceEditorNG::EditorConfig::instance()->config(), 0 );
IncidenceEditorNG::CategoryEditDialog dialog( &config, 0 );
if ( dialog.exec() )
config.writeConfig();
}
QAbstractProxyModel* MainView::createItemFilterModel() const
{
return new EventsFilterProxyModel();
}
ImportHandlerBase* MainView::importHandler() const
{
return new EventsImportHandler();
}
ExportHandlerBase* MainView::exportHandler() const
{
return new EventsExportHandler();
}
GuiStateManager* MainView::createGuiStateManager() const
{
return new EventsGuiStateManager();
}
bool MainView::useFilterLineEditInCurrentState() const
{
return (guiStateManager()->currentState() == EventsGuiStateManager::ViewEventListState);
}
void MainView::uploadFreeBusy()
{
Akonadi::FreeBusyManager::self()->publishFreeBusy( this );
}
void MainView::mailFreeBusy()
{
Akonadi::FreeBusyManager::self()->mailFreeBusy( 30, this );
}
void MainView::sendAsICalendar()
{
const QModelIndexList list = itemSelectionModel()->selectedIndexes();
if ( list.isEmpty() )
return;
const Akonadi::Item item( list.first().data( EntityTreeModel::ItemIdRole ).toInt() );
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( item, this );
job->fetchScope().fetchFullPayload();
connect( job, SIGNAL(result(KJob*)), this, SLOT(fetchForSendICalDone(KJob*)) );
}
void MainView::fetchForSendICalDone( KJob *job )
{
if ( job->error() ) {
kDebug() << "Error trying to fetch item";
//###: review error string
KMessageBox::sorry( this,
i18n( "Cannot fetch calendar item." ),
i18n( "Item Fetch Error" ) );
return;
}
const Akonadi::Item item = static_cast<Akonadi::ItemFetchJob*>( job )->items().first();
KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
if ( incidence )
mITIPHandler->sendAsICalendar( incidence, this );
}
void MainView::publishItemInformation()
{
const QModelIndexList list = itemSelectionModel()->selectedIndexes();
if ( list.isEmpty() )
return;
const Akonadi::Item item( list.first().data( EntityTreeModel::ItemIdRole ).toInt() );
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( item, this );
job->fetchScope().fetchFullPayload();
connect( job, SIGNAL(result(KJob*)), this, SLOT(fetchForPublishItemDone(KJob*)) );
}
void MainView::fetchForPublishItemDone( KJob *job )
{
if ( job->error() ) {
kDebug() << "Error trying to fetch item";
//###: review error string
KMessageBox::sorry( this,
i18n( "Cannot fetch calendar item." ),
i18n( "Item Fetch Error" ) );
return;
}
const Akonadi::Item item = static_cast<Akonadi::ItemFetchJob*>( job )->items().first();
KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
if ( incidence )
mITIPHandler->publishInformation( incidence, this );
}
void MainView::sendInvitation()
{
scheduleiTIPMethod( KCalCore::iTIPRequest );
}
void MainView::sendStatusUpdate()
{
scheduleiTIPMethod( KCalCore::iTIPReply );
}
void MainView::sendCancellation()
{
scheduleiTIPMethod( KCalCore::iTIPCancel );
}
void MainView::requestUpdate()
{
scheduleiTIPMethod( KCalCore::iTIPRefresh );
}
void MainView::requestChange()
{
scheduleiTIPMethod( KCalCore::iTIPCounter );
}
void MainView::scheduleiTIPMethod( KCalCore::iTIPMethod method )
{
const QModelIndexList list = itemSelectionModel()->selectedIndexes();
if ( list.isEmpty() )
return;
const Akonadi::Item item( list.first().data( EntityTreeModel::ItemIdRole ).toInt() );
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( item, this );
job->fetchScope().fetchFullPayload();
job->setProperty( "iTIPmethod", QVariant::fromValue<KCalCore::iTIPMethod>( method ) );
connect( job, SIGNAL(result(KJob*)), this, SLOT(fetchForiTIPMethodDone(KJob*)) );
}
void MainView::fetchForiTIPMethodDone( KJob *job )
{
if ( job->error() ) {
kDebug() << "Error trying to fetch item";
//###: review error string
KMessageBox::sorry( this,
i18n( "Cannot fetch calendar item." ),
i18n( "Item Fetch Error" ) );
return;
}
const Akonadi::Item item = static_cast<Akonadi::ItemFetchJob*>( job )->items().first();
const KCalCore::iTIPMethod method = job->property( "iTIPmethod" ).value<KCalCore::iTIPMethod>();
const KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item );
if ( incidence )
mITIPHandler->sendiTIPMessage( method, incidence, this );
}
void MainView::saveAllAttachments()
{
const QModelIndexList list = itemSelectionModel()->selectedIndexes();
if ( list.isEmpty() )
return;
const Akonadi::Item item( list.first().data( EntityTreeModel::ItemIdRole ).toInt() );
Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( item, this );
job->fetchScope().fetchFullPayload();
connect( job, SIGNAL(result(KJob*)), this, SLOT(fetchForSaveAllAttachmentsDone(KJob*)) );
}
void MainView::fetchForSaveAllAttachmentsDone( KJob *job )
{
if ( job->error() ) {
kDebug() << "Error trying to fetch item";
//###: review error string
KMessageBox::sorry( this,
i18n( "Cannot fetch calendar item." ),
i18n( "Item Fetch Error" ) );
return;
}
const Akonadi::Item item = static_cast<Akonadi::ItemFetchJob*>( job )->items().first();
CalendarSupport::saveAttachments( item, this );
}
void MainView::archiveOldEntries()
{
CalendarSupport::ArchiveDialog archiveDialog( m_calendar, m_changer, this );
archiveDialog.exec();
}
void MainView::changeCalendarColor()
{
EventViews::AgendaViewItem *agendaItem = rootObject()->findChild<EventViews::AgendaViewItem*>();
if ( !agendaItem )
return; //something is fishy
const QItemSelectionModel *collectionSelectionModel = regularSelectionModel();
if ( collectionSelectionModel->selection().indexes().isEmpty() )
return;
const QModelIndexList selectedIndexes = collectionSelectionModel->selection().indexes();
const Collection collection = selectedIndexes.first().data( CollectionModel::CollectionRole ).value<Collection>();
QString id = QString::number( collection.id() );
QColor calendarColor = agendaItem->preferences()->resourceColor( id );
QColor myColor;
const int result = KColorDialog::getColor( myColor, calendarColor );
if ( result == KDialog::Accepted && myColor != calendarColor ) {
agendaItem->preferences()->setResourceColor( id, myColor );
agendaItem->updateConfig();
EventViews::MonthViewItem *monthItem = rootObject()->findChild<EventViews::MonthViewItem*>();
if ( monthItem ) {
monthItem->preferences()->setResourceColor( id, myColor );
monthItem->updateConfig();
}
}
}

View file

@ -1,135 +0,0 @@
/*
* Copyright (c) 2010 Volker Krause <vkrause@kde.org>
* Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
* Copyright (c) 2010 Andras Mantia <andras@kdab.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef MAINVIEW_H
#define MAINVIEW_H
#include "kdeclarativemainview.h"
#include <Akonadi/Calendar/ETMCalendar>
#include <Akonadi/Entity>
#include <KCalCore/ScheduleMessage>
#include <calendarviews/eventview.h>
#include <calendarviews/prefs.h>
#include <KCalCore/Incidence>
namespace Akonadi {
class StandardCalendarActionManager;
class IncidenceChanger;
class ITIPHandler;
}
namespace KPIMIdentities {
class IdentityManager;
}
class CalendarInterface;
class KJob;
class QDate;
class ConfigWidget;
class MainView : public KDeclarativeMainView
{
Q_OBJECT
public:
explicit MainView( QWidget* parent = 0 );
~MainView();
void setConfigWidget( ConfigWidget *configWidget );
static EventViews::PrefsPtr preferences();
public Q_SLOTS:
void showRegularCalendar();
void setCurrentEventItemId( qint64 id );
void newEvent();
void newEventWithDate( const QDate &date );
void newTodo();
void openIncidenceEditor( const QString &summary,
const QString &description,
const QStringList &attachmentUris,
const QStringList &attendees,
const QStringList &atttachmentMimeTypes,
bool attachmentIsInline,
KCalCore::Incidence::IncidenceType type );
void editIncidence();
void editIncidence( const Akonadi::Item &item, const QDate &date );
void deleteIncidence();
void deleteIncidence( const Akonadi::Item &item );
void uploadFreeBusy();
void mailFreeBusy();
void sendAsICalendar();
void publishItemInformation();
void sendInvitation();
void sendStatusUpdate();
void sendCancellation();
void requestUpdate();
void requestChange();
void saveAllAttachments();
void archiveOldEntries();
void changeCalendarColor();
protected Q_SLOTS:
void qmlLoadingStateChanged( QDeclarativeView::Status status );
private Q_SLOTS:
void finishEdit( QObject *editor );
void fetchForSendICalDone( KJob *job );
void fetchForPublishItemDone( KJob *job );
void fetchForiTIPMethodDone( KJob *job );
void fetchForSaveAllAttachmentsDone( KJob *job );
void updateActionTexts();
void configureCategories();
protected:
void doDelayedInit();
virtual void setupStandardActionManager( QItemSelectionModel *collectionSelectionModel,
QItemSelectionModel *itemSelectionModel );
virtual void setupAgentActionManager( QItemSelectionModel *selectionModel );
virtual QAbstractProxyModel* createItemFilterModel() const;
virtual ImportHandlerBase* importHandler() const;
virtual ExportHandlerBase* exportHandler() const;
virtual GuiStateManager* createGuiStateManager() const;
virtual bool useFilterLineEditInCurrentState() const;
void scheduleiTIPMethod( KCalCore::iTIPMethod method );
private:
Akonadi::ETMCalendar::Ptr m_calendar;
CalendarInterface* m_calendarIface;
QHash<QObject*, Akonadi::Entity::Id> m_openItemEditors;
KPIMIdentities::IdentityManager* m_identityManager;
Akonadi::IncidenceChanger *m_changer;
static EventViews::PrefsPtr m_calendarPrefs;
Akonadi::StandardCalendarActionManager *mActionManager;
Akonadi::ITIPHandler *mITIPHandler;
};
#endif // MAINVIEW_H

View file

@ -1,104 +0,0 @@
/*
Copyright (c) 2010 Bertjan Broeksema <broeksema@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 "monthviewitem.h"
#include "mainview.h"
#include <Akonadi/Calendar/ETMCalendar>
#include <calendarviews/month/monthview.h>
#include <KGlobal>
#include <KGlobalSettings>
using namespace EventViews;
MonthViewItem::MonthViewItem( QDeclarativeItem* parent )
: DeclarativeAkonadiItem( parent )
, mView( new MonthView( MonthView::Hidden ) )
{
// start with the oxygen palette (which is not necessarily the default on all platforms)
QPalette pal = KGlobalSettings::createApplicationPalette( KGlobal::config() );
mView->setPalette( pal );
setWidget( mView );
connect( this, SIGNAL(previousItemRequest()),
mView, SLOT(moveBackMonth()) );
connect( this, SIGNAL(nextItemRequest()),
mView, SLOT(moveFwdMonth()) );
connect( mView, SIGNAL(newEventSignal()),
SLOT(emitDateClicked()));
connect( mView, SIGNAL(incidenceSelected(Akonadi::Item,QDate)),
SLOT(emitItemSelected(Akonadi::Item,QDate)) );
setPreferences( MainView::preferences() );
}
MonthViewItem::~MonthViewItem()
{
mView->preferences()->writeConfig();
delete mView;
}
void MonthViewItem::emitDateClicked()
{
emit dateClicked( mView->selectionStart().date() );
}
void MonthViewItem::emitItemSelected( const Akonadi::Item &item, const QDate &activeDate )
{
emit itemSelected( item.id(), activeDate );
}
QObject* MonthViewItem::calendar() const
{
return mView->calendar().data();
}
void MonthViewItem::setCalendar( QObject* calendarObj )
{
Akonadi::ETMCalendar* cal = qobject_cast<Akonadi::ETMCalendar*>( calendarObj );
kDebug() << calendarObj << cal;
if ( cal ) {
mView->setCalendar( cal->weakPointer().toStrongRef().dynamicCast<Akonadi::ETMCalendar>() );
mView->updateConfig();
}
}
void MonthViewItem::showMonth( const QDate &date )
{
const KDateTime start( QDate( date.year(), date.month(), 1 ) );
const KDateTime end( QDate( date.year(), date.month(), date.daysInMonth() ) );
mView->setDateRange( start, end );
}
void MonthViewItem::setPreferences( const PrefsPtr &preferences )
{
mView->setPreferences( preferences );
}
PrefsPtr MonthViewItem::preferences() const
{
return mView->preferences();
}
void MonthViewItem::updateConfig()
{
mView->updateConfig();
}

View file

@ -1,68 +0,0 @@
/*
Copyright (c) 2010 Bertjan Broeksema <broeksema@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 MONTHVIEWITEM_H
#define MONTHVIEWITEM_H
#include "declarativeakonadiitem.h"
#include "calendarviews/prefs.h"
namespace EventViews {
class MonthView;
class MonthViewItem : public DeclarativeAkonadiItem
{
Q_OBJECT
Q_PROPERTY( QObject* calendar READ calendar WRITE setCalendar )
public:
explicit MonthViewItem( QDeclarativeItem *parent = 0 );
virtual ~MonthViewItem();
virtual qint64 itemId() const { return -1; }
virtual void setItemId( qint64 /*id*/ ) {}
QObject *calendar() const;
void setCalendar( QObject* calendarObj );
/// Show the month from @param date.
Q_INVOKABLE void showMonth( const QDate &date );
void setPreferences( const PrefsPtr &preferences );
PrefsPtr preferences() const;
Q_SIGNALS:
void dateClicked( const QDate &date );
void itemSelected( qint64 selectedItemId, const QDate &activeDate );
public Q_SLOTS:
void updateConfig();
private Q_SLOTS:
void emitDateClicked();
void emitItemSelected( const Akonadi::Item &item, const QDate &activeDate );
private:
MonthView *mView;
};
}
#endif // MONTHVIEWITEM_H

View file

@ -1,50 +0,0 @@
/*
Copyright (c) 2010 Bertjan Broeksema <broeksema@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 "qmldateedit.h"
namespace Qt {
QmlDateEdit::QmlDateEdit( QDeclarativeItem *parent )
: DeclarativeWidgetWrapper< QDateEdit >( parent )
{
m_widget->setDate( QDate::currentDate() );
}
QDate QmlDateEdit::date() const
{
return m_widget->date();
}
void QmlDateEdit::setDate(const QDate& date)
{
m_widget->setDate( date );
}
QString QmlDateEdit::displayFormat() const
{
return m_widget->displayFormat();
}
void QmlDateEdit::setDisplayFormat( const QString &format )
{
m_widget->setDisplayFormat( format );
}
}

View file

@ -1,47 +0,0 @@
/*
Copyright (c) 2010 Bertjan Broeksema <broeksema@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 QMLDATEEDIT_H
#define QMLDATEEDIT_H
#include <QtCore/QDate>
#include <QDateEdit>
#include "declarativewidgetwrapper.h"
namespace Qt {
class QmlDateEdit : public DeclarativeWidgetWrapper<QDateEdit>
{
Q_OBJECT
Q_PROPERTY( QDate date READ date WRITE setDate )
Q_PROPERTY( QString displayFormat READ displayFormat WRITE setDisplayFormat )
public:
explicit QmlDateEdit( QDeclarativeItem *parent = 0 );
QDate date() const;
void setDate( const QDate &date );
QString displayFormat() const;
void setDisplayFormat( const QString &format );
};
}
#endif // QMLDATEEDIT_H

View file

@ -1,71 +0,0 @@
/*
Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
Copyright (c) 2010 Tobias Koenig <tobias.koenig@kdab.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "searchwidget.h"
#include "stylesheetloader.h"
#include <kcalcore/event.h>
#include <kcalcore/todo.h>
#include <QtCore/QDate>
#include <qplatformdefs.h>
SearchWidget::SearchWidget( QWidget *parent )
: QWidget( parent )
{
mUi.setupUi( this );
// set defaults
mUi.inSummaries->setChecked( true );
mUi.inDescriptions->setChecked( true );
mUi.includeTodosWithoutDueDate->setChecked( true );
mUi.startDate->setDate( QDate::currentDate() );
mUi.endDate->setDate( QDate::currentDate().addYears( 1 ) );
mUi.collectionCombo->setMimeTypeFilter( QStringList() << KCalCore::Event::eventMimeType()
<< KCalCore::Todo::todoMimeType() );
}
QString SearchWidget::query() const
{
//TODO create search query from dialog
return QString();
}
DeclarativeSearchWidget::DeclarativeSearchWidget( QGraphicsItem *parent )
: QGraphicsProxyWidget( parent ), mSearchWidget( new SearchWidget )
{
QPalette palette = mSearchWidget->palette();
palette.setColor( QPalette::Window, QColor( 0, 0, 0, 0 ) );
mSearchWidget->setPalette( palette );
StyleSheetLoader::applyStyle( mSearchWidget );
setWidget( mSearchWidget );
setFocusPolicy( Qt::StrongFocus );
}
DeclarativeSearchWidget::~DeclarativeSearchWidget()
{
}
QString DeclarativeSearchWidget::query() const
{
return mSearchWidget->query();
}

View file

@ -1,58 +0,0 @@
/*
Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
Copyright (c) 2010 Tobias Koenig <tobias.koenig@kdab.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SEARCHWIDGET_H
#define SEARCHWIDGET_H
#include "ui_searchwidget.h"
#include <QGraphicsProxyWidget>
#include <QWidget>
class SearchWidget : public QWidget
{
Q_OBJECT
public:
explicit SearchWidget( QWidget *parent = 0 );
QString query() const;
private:
Ui_SearchWidget mUi;
};
class DeclarativeSearchWidget : public QGraphicsProxyWidget
{
Q_OBJECT
Q_PROPERTY( QString query READ query )
public:
explicit DeclarativeSearchWidget( QGraphicsItem *parent = 0 );
~DeclarativeSearchWidget();
public Q_SLOTS:
QString query() const;
private:
SearchWidget *mSearchWidget;
};
#endif

View file

@ -1,223 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SearchWidget</class>
<widget class="QWidget" name="SearchWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>430</width>
<height>278</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Search for:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KLineEdit" name="searchText">
<property name="showClearButton" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>In:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QWidget" name="widget" native="true">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QCheckBox" name="inSummaries">
<property name="text">
<string>Summaries</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="inDescriptions">
<property name="text">
<string>Descriptions</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="inCategories">
<property name="text">
<string>Categories</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="inLocations">
<property name="text">
<string>Locations</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Between:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,1">
<item>
<widget class="KDateComboBox" name="startDate">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>and</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="KDateComboBox" name="endDate">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="includeDateRange">
<property name="text">
<string>Include events within the specified date range</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="includeTodosWithoutDueDate">
<property name="text">
<string>Include To-Dos without a due date</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Located in:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QWidget" name="widget_2" native="true">
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QRadioButton" name="locatedInAnyCollection">
<property name="text">
<string>any folder</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="locatedInSpecificCollection">
<property name="text">
<string>only in folder</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Akonadi::CollectionComboBox" name="collectionCombo">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KDateComboBox</class>
<extends>QComboBox</extends>
<header>kdatecombobox.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
<customwidget>
<class>Akonadi::CollectionComboBox</class>
<extends>QComboBox</extends>
<header location="global">akonadi/collectioncombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>locatedInSpecificCollection</sender>
<signal>toggled(bool)</signal>
<receiver>collectionCombo</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>138</x>
<y>235</y>
</hint>
<hint type="destinationlabel">
<x>217</x>
<y>239</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -1,72 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<include>kglobalsettings.h</include>
<kcfgfile name="korganizer-mobilerc" />
<group name="DateAndTime">
<entry name="DayBegins" type="DateTime">
<default>QDateTime(QDate(1752,1,1), QTime(7,0))</default>
</entry>
<entry name="HolidayRegion" type="String" />
<entry name="WorkWeekMask" type="Int" />
<entry name="DailyStartingHour" type="DateTime">
<default>QDateTime(QDate(1752,1,1), QTime(8,0))</default>
</entry>
<entry name="DailyEndingHour" type="DateTime">
<default>QDateTime(QDate(1752,1,1), QTime(17,0))</default>
</entry>
<entry name="ExcludeHolidays" type="Bool" />
<entry name="DefaultAppointmentTime" type="DateTime" />
<entry name="DefaultAppointmentDuration" type="DateTime" />
<entry name="ReminderDefaultTime" type="Int" />
<entry name="ReminderDefaultUnit" type="Int" />
<entry name="RemindersForNewEvents" type="Bool" />
</group>
<group name="Views">
<entry name="TodosUseCategoryColors" type="Bool" />
<entry name="HourSize" type="Int" />
<entry name="ShowIconsInAgendaView" type="Bool" />
<entry name="ShowTodosInAgendaView" type="Bool" />
<entry name="ShowCurrentTimeLine" type="Bool" />
<entry name="AgendaViewColorUsage" type="Enum">
<choices>
<choice name="CategoryInsideResourceOutside" />
<choice name="ResourceInsideCategoryOutside" />
<choice name="CategoryOnly" />
<choice name="ResourceOnly" />
</choices>
<default>CategoryInsideResourceOutside</default>
</entry>
<entry name="ColorBusyDaysInAgendaView" type="Bool" />
<entry name="ShowTodosInMonthView" type="Bool" />
<entry name="MonthViewColorUsage" type="Enum">
<choices>
<choice name="MonthItemCategoryInsideResourceOutside" />
<choice name="MonthItemResourceInsideCategoryOutside" />
<choice name="MonthItemCategoryOnly" />
<choice name="MonthItemResourceOnly" />
</choices>
<default>MonthItemCategoryInsideResourceOutside</default>
</entry>
<entry name="ColorBusyDaysInMonthView" type="Bool" />
</group>
<group name="Colors">
<entry name="HolidayColor" type="Color" />
<entry name="AgendaViewBackgroundColor" type="Color" />
<entry name="BusyDaysBackgroundColor" type="Color" />
<entry name="AgendaViewTimeLineColor" type="Color" />
<entry name="WorkingHoursColor" type="Color" />
<entry name="TodoDueColor" type="Color" />
<entry name="TodoOverdueColor" type="Color" />
</group>
<group name="GroupScheduling">
<entry name="UseGroupwareCommunication" type="Bool"/>
<default>true</default>
</group>
</kcfg>

View file

@ -1,6 +0,0 @@
File=settings.kcfg
ClassName=Settings
Mutators=true
Singleton=true
ItemAccessors=true
SetUserTexts=true

View file

@ -1,170 +0,0 @@
/*
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 "timelineviewitem.h"
#include "stylesheetloader.h"
#include <KGlobal>
#include <KGlobalSettings>
#include <Akonadi/Calendar/ETMCalendar>
#include <calendarviews/timeline/timelineview.h>
#include <KLocale>
#include <QLayout>
using namespace EventViews;
// TODO: reuse code with AgendaViewItem and MonthViewItem once the dust has settled
TimelineViewItem::TimelineViewItem(QDeclarativeItem* parent)
: DeclarativeAkonadiItem( parent )
, m_view( new TimelineView() )
, m_currentRange( Week )
{
// start with the oxygen palette (which is not necessarily the default on all platforms)
QPalette pal = KGlobalSettings::createApplicationPalette( KGlobal::config() );
StyleSheetLoader::applyStyle( m_view );
m_view->setPalette( pal );
m_view->setDateRangeSelectionEnabled( false );
m_view->layout()->setMargin( 0 );
connect( m_view, SIGNAL(incidenceSelected(Akonadi::Item,QDate)),
SIGNAL(itemSelected()) );
connect( m_view, SIGNAL(incidenceSelected(Akonadi::Item,QDate)),
SIGNAL(itemSelected(Akonadi::Item,QDate)) );
connect( this, SIGNAL(nextItemRequest()), SLOT(gotoNext()) );
connect( this, SIGNAL(previousItemRequest()), SLOT(gotoPrevious()) );
setWidget( m_view );
showRange( QDate::currentDate(), Week );
}
TimelineViewItem::~TimelineViewItem()
{
delete m_view;
}
QDate TimelineViewItem::startDate() const
{
return QDate( m_view->startDate() );
}
void TimelineViewItem::setStartDate(const QDate& startDate)
{
kDebug() << startDate;
if ( startDate.isValid() )
m_view->showDates( startDate, endDate() );
}
QDate TimelineViewItem::endDate() const
{
return QDate( m_view->endDate() );
}
void TimelineViewItem::setEndDate(const QDate& endDate)
{
kDebug() << endDate;
if ( endDate.isValid() )
m_view->showDates( startDate(), endDate );
}
QObject* TimelineViewItem::calendar() const
{
return m_view->calendar().data();
}
void TimelineViewItem::setCalendar(QObject* calendarObj)
{
Akonadi::ETMCalendar* cal = qobject_cast<Akonadi::ETMCalendar*>( calendarObj );
kDebug() << calendarObj << cal;
if ( cal ) {
m_view->setCalendar( cal->weakPointer().toStrongRef().dynamicCast<Akonadi::ETMCalendar>() );
m_view->updateConfig();
}
}
void TimelineViewItem::showRange( const QDate &date, int range )
{
if ( !m_view->calendar() ) return;
Q_ASSERT( range >= 0 && range <= LastRange );
m_currentRange = Range( range );
switch( m_currentRange ) {
case Day: {
m_view->showDates( date, date );
break;
}
case Week: {
int weekStartDay = KGlobal::locale()->weekStartDay();
if ( weekStartDay > date.dayOfWeek() )
weekStartDay = weekStartDay - 7;
m_view->showDates( date.addDays( weekStartDay - date.dayOfWeek() ), date.addDays( weekStartDay + 6 - date.dayOfWeek() ) );
break;
}
case WorkWeek: {
int workingWeekStartDay = KGlobal::locale()->workingWeekStartDay();
int workingWeekEndDay = KGlobal::locale()->workingWeekEndDay();
m_view->showDates( date.addDays( workingWeekStartDay - date.dayOfWeek() ), date.addDays( workingWeekEndDay - date.dayOfWeek() ) );
break;
}
case Next3Days: {
m_view->showDates( date, date.addDays( 3 ) );
break;
}
case Next7Days: {
m_view->showDates( date, date.addDays( 7 ) );
break;
}
default:;
}
}
qint64 TimelineViewItem::selectedItemId() const
{
if ( m_view->selectedIncidences().size() < 1 )
return -1;
return m_view->selectedIncidences().first().id();
}
void TimelineViewItem::clearSelection()
{
m_view->clearSelection();
}
void TimelineViewItem::gotoNext()
{
const QDate start = endDate().addDays( 1 );
const QDate end = start.addDays( startDate().daysTo( endDate() ) );
m_view->blockSignals( true );
m_view->showDates( start, end );
m_view->clearSelection();
m_view->blockSignals( false );
}
void TimelineViewItem::gotoPrevious()
{
const QDate end = startDate().addDays( - 1 );
const QDate start = end.addDays( - startDate().daysTo( endDate() ) );
m_view->blockSignals( true );
m_view->showDates( start, end );
m_view->clearSelection();
m_view->blockSignals( false );
}

View file

@ -1,95 +0,0 @@
/*
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 CALENDARVIEWS_TIMELINEVIEWITEM_H
#define CALENDARVIEWS_TIMELINEVIEWITEM_H
#include <QtCore/QDate>
#include "declarativeakonadiitem.h"
namespace Akonadi {
class Item;
}
namespace EventViews {
class TimelineView;
class TimelineViewItem : public DeclarativeAkonadiItem
{
Q_OBJECT
Q_ENUMS( Range )
Q_PROPERTY( QDate startDate READ startDate WRITE setStartDate )
Q_PROPERTY( QDate endDate READ endDate WRITE setEndDate )
Q_PROPERTY( QObject* calendar READ calendar WRITE setCalendar )
Q_PROPERTY( qint64 selectedItemId READ selectedItemId NOTIFY itemSelected )
Q_PROPERTY( int range READ range )
public:
enum Range {
Day = 0,
Week,
WorkWeek,
Next3Days,
Next7Days,
LastRange
};
public:
explicit TimelineViewItem( QDeclarativeItem *parent = 0 );
~TimelineViewItem();
virtual qint64 itemId() const { return -1; }
virtual void setItemId( qint64 /*id*/ ) {}
QDate startDate() const;
void setStartDate( const QDate &startDate );
QDate endDate() const;
void setEndDate( const QDate &endDate );
QObject *calendar() const;
void setCalendar( QObject* calendarObj );
/** Show the appropriate range for given date. */
Q_INVOKABLE void showRange( const QDate &date, /* Range */ int range ); // TODO: Figure out how to export enums to QML
int range() const { return m_currentRange; }
qint64 selectedItemId() const;
public slots:
/** Unselects currently selected incidences */
void clearSelection();
/** Show the following date range of equal length right after the current one. */
void gotoNext();
/** Show the preceding date range. */
void gotoPrevious();
signals:
void itemSelected( Akonadi::Item item, const QDate &activeDate );
private:
TimelineView *m_view;
Range m_currentRange;
};
}
#endif // CALENDARVIEWS_AGENDAVIEWITEM_H

View file

@ -1,50 +0,0 @@
/*
Copyright (c) 2010 Volker Krause <vkrause@kde.org>
Copyright (c) 2010 Bertjan Broeksema <broeksema@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.
*/
import QtQuick 1.1 as QML
import org.kde 4.5
import org.kde.pim.mobileui 4.5 as KPIM
KPIM.BulkActionScreen {
id: bulkActionScreen
anchors.fill: parent
property bool initialized: false
actionListWidth: 1/3 * parent.width
multipleText: KDE.i18np("1 folder", "%1 folders", collectionView.numSelected)
selectedItemModel: _breadcrumbNavigationFactory.qmlSelectedItemModel();
headerList: ContactListView {
id: bulkActionContactList
anchors.fill: parent
showCheckBox: true
model: itemModel
checkModel: _itemActionModel
itemHeight: bulkActionScreen.itemHeight
}
QML.Component.onCompleted: {
if ( initialized == false ) {
bulkActionScreen.actionModel.append( {"action": "send_mail_to"} )
initialized = true;
}
}
}

View file

@ -1,100 +0,0 @@
project( kaddressbook-mobile )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}" )
include_directories(
${CMAKE_SOURCE_DIR}/libkleo/
${CMAKE_SOURCE_DIR}/libkdepim/
${Boost_INCLUDE_DIR}
)
set(kab_mobile_srcs
mainview.cpp
main.cpp
configwidget.cpp
contactviewitem.cpp
contactgroupviewitem.cpp
contactcompletionmodel.cpp
contacteditorview.cpp
contactgroupeditorview.cpp
contactlistproxy.cpp
contactsexporthandler.cpp
contactsguistatemanager.cpp
contactsimporthandler.cpp
customfieldeditordialog.cpp
customfieldeditwidget.cpp
customfieldmanager.cpp
customfields.cpp
displaynameeditwidget.cpp
editorbase.cpp
editorbusiness.cpp
editorcontactgroup.cpp
editorcrypto.cpp
editorgeneral.cpp
editorlocation.cpp
editormore.cpp
imagewidget.cpp
kwidgetlister.cpp
locationmodel.cpp
namepartseditwidget.cpp
mobilelineedit.cpp
phonetypecombo.cpp
searchwidget.cpp
)
kde4_add_ui_files(kab_mobile_srcs
editorbusiness.ui
editorcontactgroup.ui
editorcrypto.ui
editorgeneral.ui
editorlocation.ui
editormore.ui
editormore_categoriespage.ui
editormore_customfieldspage.ui
editormore_namepage.ui
editormore_internetpage.ui
editormore_personalpage.ui
)
qt4_wrap_ui(kab_mobile_srcs configwidget.ui searchwidget.ui)
kde4_add_kcfg_files(kab_mobile_srcs settings.kcfgc)
if (RUNTIME_PLUGINS_STATIC)
add_definitions(-DMAIL_SERIALIZER_PLUGIN_STATIC)
endif ()
kde4_add_app_icon(kab_mobile_srcs "${CMAKE_CURRENT_SOURCE_DIR}/hi*-apps-kaddressbook-mobile.png")
kde4_add_executable(kaddressbook-mobile ${kab_mobile_srcs} )
target_link_libraries(kaddressbook-mobile
${QT_QTDECLARATIVE_LIBRARY}
${KDEPIMLIBS_AKONADI_CONTACTS_LIBRARY}
${KDEPIMLIBS_KABC_LIBS}
${KDEPIMLIBS_AKONADI_LIBS}
${KDE4_KCMUTILS_LIBS}
kdepim
kdepimmobileui
kleo
incidenceeditorsngmobile
calendarsupport
)
if (RUNTIME_PLUGINS_STATIC)
target_link_libraries(kaddressbook-mobile akonadi_serializer_addressee akonadi_serializer_contactgroup)
endif ()
install(TARGETS kaddressbook-mobile ${INSTALL_TARGETS_DEFAULT_ARGS})
install(PROGRAMS kaddressbook-mobile.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
install(FILES
BulkActionComponent.qml
ConfigDialog.qml
contact-editor.qml
contactgroup-editor.qml
kaddressbook-mobile.qml
KAddressBookActions.qml
kaddressbook-mobile-background.png
ContactListView.qml
DESTINATION ${DATA_INSTALL_DIR}/kaddressbook-mobile
)
kde4_install_icons( ${ICON_INSTALL_DIR} )

View file

@ -1,88 +0,0 @@
/*
Copyright (c) 2010 Tobias Koenig <tokoe@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.
*/
import QtQuick 1.1 as QML
import org.kde 4.5
import org.kde.pim.mobileui 4.5 as KPIM
import org.kde.akonadi.contacts 4.5 as Contacts
import org.kde.plasma.extras 0.1 as PlasmaExtras
QML.Rectangle {
id: configDialog
anchors.fill: parent
z: 10
color: "white"
visible: guiStateManager.inConfigScreenState
function load() {
configWidget.load();
}
PlasmaExtras.ScrollArea {
id: configWidgetBox
anchors {
top: parent.top
topMargin: 25
bottom: parent.bottom
left: parent.left
right: okButton.left
}
flickableItem: QML.Flickable {
contentHeight: configWidget.height;
Contacts.ConfigWidget {
id: configWidget
width: parent.width
}
}
}
KPIM.Button2 {
id: okButton
anchors {
top: parent.top
topMargin: 20
right: parent.right
}
width: 150
buttonText: KDE.i18n( "OK" )
onClicked: {
configWidget.save();
guiStateManager.popState()
}
}
KPIM.Button2 {
id: cancelButton
anchors {
top: okButton.bottom
right: parent.right
}
width: 150
buttonText: KDE.i18n( "Cancel" )
onClicked: {
guiStateManager.popState()
}
}
}

View file

@ -1,62 +0,0 @@
/*
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.
*/
import QtQuick 1.1 as QML
import org.kde 4.5
import org.kde.pim.mobileui 4.5 as KPIM
KPIM.ItemListView {
id: _top
property bool showCheckBox
property variant checkModel
delegate: [
KPIM.ItemListViewDelegate {
navigationModel: _top.navigationModel
showCheckBox: _top.showCheckBox
checkModel: _top.checkModel
height: _top.itemHeight
summaryContent: [
QML.Image {
anchors {
left: parent.left
top: parent.top
margins: 4
}
source: model.picture
scale: (parent.height - 2 * anchors.margins) / Math.max( width, height )
transformOrigin: "TopLeft"
},
QML.Text {
anchors {
top: parent.top
margins: 4
}
x: parent.height + anchors.margins
text: model.name
}
]
}
]
}

View file

@ -1,140 +0,0 @@
/*
Copyright (C) 2010 Klarälvdalens Datakonsult AB,
a KDAB Group company, info@kdab.net,
author Tobias Koenig <tokoe@kdab.com>
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.
*/
import QtQuick 1.1 as QML
import org.kde 4.5
import org.kde.pim.mobileui 4.5
import "../mobileui/ScreenFunctions.js" as Screen
ActionMenuContainer {
menuStyle : true
actionItemHeight : Screen.partition( height, 6 ) - actionItemSpacing
actionItemWidth : 200
actionItemSpacing : 2
ActionList {
category : "home"
name : "home_menu"
text : KDE.i18n( "Home" )
ActionListItem { name : "synchronize_all_items" }
ScriptActionItem { name : "to_selection_screen"; title : KDE.i18n( "Select Multiple Address Books" ) }
ActionListItem { name : "import_vcards" }
ActionListItem { name : "configure_categories" }
}
FavoriteManager{ model : favoritesList }
AgentInstanceList {
category : "home"
name : "accounts_list"
text : KDE.i18n( "Accounts" )
model : agentInstanceList
}
ActionList {
category : "account"
name : "account_menu"
text : KDE.i18n( "Account" )
ActionListItem { name : "akonadi_resource_synchronize" }
ActionListItem { name : "akonadi_resource_properties" }
ActionListItem { name : "akonadi_collection_create" }
ActionListItem { name : "export_account_vcards" }
}
ActionList {
category : "single_folder"
name : "single_folder_folder_menu"
text : KDE.i18n( "Folder" )
ActionListItem { name : "akonadi_collection_sync" }
ActionListItem { name : "export_selected_vcards" }
}
ActionList {
category : "single_folder"
name : "single_folder_edit_menu"
text : KDE.i18n( "Edit" )
ActionListItem { name : "akonadi_collection_properties" }
ActionListItem { name : "akonadi_collection_create" }
ActionListItem { name : "akonadi_collection_move_to_dialog" }
ActionListItem { name : "akonadi_collection_copy_to_dialog" }
ActionListItem { name : "akonadi_collection_delete" }
}
ActionList {
category : "single_folder"
name : "single_folder_view_menu"
text : KDE.i18n( "View" )
ScriptActionItem { name : "add_as_favorite"; title : KDE.i18n( "Add View As Favorite" ) }
ScriptActionItem { name : "start_maintenance"; title : KDE.i18n( "Switch To Editing Mode" ) }
}
ActionList {
category : "multiple_folder"
name : "multi_folder_folder_menu"
text : KDE.i18n( "Folders" )
ActionListItem { name : "akonadi_collection_sync" }
ActionListItem { name : "export_selected_vcards" }
}
ActionList {
category : "multiple_folder"
name : "multi_folder_view_menu"
text : KDE.i18n( "View" )
ScriptActionItem { name : "add_as_favorite"; title : KDE.i18n( "Add View As Favorite" ); visible: !guiStateManager.inSearchResultScreenState }
ScriptActionItem { name : "to_selection_screen"; title : KDE.i18n( "Select Address Books" ) }
ScriptActionItem { name : "start_maintenance"; title : KDE.i18n( "Switch To Editing Mode" ) }
}
/*ActionList {
category : "contact_viewer"
name : "contact_viewer_contact_menu"
text : KDE.i18n( "Contact" )
}*/
ActionList {
category : "contact_viewer"
name : "contact_viewer_edit_menu"
text : KDE.i18n( "Edit" )
ActionListItem { name : "akonadi_contact_item_edit" }
ActionListItem { name : "akonadi_item_copy_to_dialog" }
ActionListItem { name : "akonadi_item_move_to_dialog" }
ActionListItem { name : "akonadi_item_delete" }
ActionListItem { name : "export_single_contact_vcard" }
}
ApplicationGeneralActions {
name : "application_menu"
category : "standard"
text : KDE.i18n( "Contacts" )
type : "contact"
addNewActionName: "akonadi_contact_create"
//TODO enable when SearchWidget::query() is implemented
//searchActionTitle: KDE.i18n( "Search For Contacts" )
configureActionTitle: KDE.i18n( "Configure Contacts" )
ActionListItem { name : "akonadi_contact_group_create" }
ActionListItem { name : "search_ldap" }
}
}

View file

@ -1,4 +0,0 @@
#! /bin/sh
$EXTRACTRC --ignore-no-input `find . \( -name '*.ui' -or -name '*.rc' -or -name '*.kcfg' -or -name '*.kcfg.cmake' \) -and -not -name '*-mobile.rc'` >> rc.cpp || exit 11
$XGETTEXT -ktranslate `find -name '*.cpp' -o -name '*.h' -o -name '*.qml'` -o $podir/kaddressbook-mobile.pot
rm -f rc.cpp

View file

@ -1,100 +0,0 @@
/*
Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
Copyright (c) 2010 Tobias Koenig <tobias.koenig@kdab.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "configwidget.h"
#include "settings.h"
#include "stylesheetloader.h"
#include "ui_configwidget.h"
#include <kcmoduleproxy.h>
#include <kconfigdialogmanager.h>
#include <klocale.h>
ConfigWidget::ConfigWidget( QWidget *parent )
: QWidget( parent )
{
Ui_ConfigWidget ui;
ui.setupUi( this );
mLdapConfigWidget = new KCModuleProxy( QLatin1String( "kcmldap" ) );
ui.ldapServerSettingsLayout->addWidget( mLdapConfigWidget, 1, 1 );
mMapServiceBox = ui.kcfg_MapService;
mManager = new KConfigDialogManager( this, Settings::self() );
mMapServiceBox->addItem( i18n( "None" ), QString() );
mMapServiceBox->addItem( i18n( "OpenStreetMap" ), QLatin1String( "http://open.mapquestapi.com/nominatim/v1/search.php?q=%s,+%z+%l,+%c" ) );
mMapServiceBox->addItem( i18n( "Google Maps" ), QLatin1String( "http://maps.google.com/maps?q=%n,%l,%s" ) );
}
void ConfigWidget::load()
{
KConfig config( QLatin1String("akonadi_contactrc") );
const KConfigGroup group( &config, "Show Address Settings" );
const QString addressUrl = group.readEntry( "AddressUrl", QString::fromLatin1( "http://open.mapquestapi.com/nominatim/v1/search.php?q=%s,+%z+%l,+%c" ) );
Settings::self()->setMapService( mMapServiceBox->findData( addressUrl ) );
mManager->updateWidgets();
mLdapConfigWidget->load();
}
void ConfigWidget::save()
{
mManager->updateSettings();
const QString addressUrl = mMapServiceBox->itemData( Settings::self()->mapService() ).toString();
KConfig config( QLatin1String("akonadi_contactrc") );
KConfigGroup group( &config, "Show Address Settings" );
group.writeEntry( "AddressUrl", addressUrl );
config.sync();
mLdapConfigWidget->save();
}
DeclarativeConfigWidget::DeclarativeConfigWidget( QGraphicsItem *parent )
: QGraphicsProxyWidget( parent ), mConfigWidget( new ConfigWidget )
{
QPalette palette = mConfigWidget->palette();
palette.setColor( QPalette::Window, QColor( 0, 0, 0, 0 ) );
mConfigWidget->setPalette( palette );
StyleSheetLoader::applyStyle( mConfigWidget );
setWidget( mConfigWidget );
setFocusPolicy( Qt::StrongFocus );
}
DeclarativeConfigWidget::~DeclarativeConfigWidget()
{
}
void DeclarativeConfigWidget::load()
{
mConfigWidget->load();
}
void DeclarativeConfigWidget::save()
{
mConfigWidget->save();
}

View file

@ -1,63 +0,0 @@
/*
Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
Copyright (c) 2010 Tobias Koenig <tobias.koenig@kdab.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CONFIGWIDGET_H
#define CONFIGWIDGET_H
#include <QGraphicsProxyWidget>
#include <QWidget>
class KCModuleProxy;
class KComboBox;
class KConfigDialogManager;
class ConfigWidget : public QWidget
{
Q_OBJECT
public:
explicit ConfigWidget( QWidget *parent = 0 );
public Q_SLOTS:
void load();
void save();
private:
KConfigDialogManager *mManager;
KComboBox *mMapServiceBox;
KCModuleProxy *mLdapConfigWidget;
};
class DeclarativeConfigWidget : public QGraphicsProxyWidget
{
Q_OBJECT
public:
explicit DeclarativeConfigWidget( QGraphicsItem *parent = 0 );
~DeclarativeConfigWidget();
public Q_SLOTS:
void load();
void save();
private:
ConfigWidget *mConfigWidget;
};
#endif

View file

@ -1,105 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigWidget</class>
<widget class="QWidget" name="ConfigWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>241</width>
<height>117</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Contact Actions</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="showAddressOnLabel">
<property name="text">
<string>Show address on:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="kcfg_MapService"/>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="ldapServerSettingsLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>LDAP Servers</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -1,143 +0,0 @@
/*
Copyright (c) 2010 Kevin Krammer <kevin.krammer@gmx.at>
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.
*/
import QtQuick 1.1
import org.kde 4.5
import org.kde.pim.mobileui 4.5 as KPIM
import org.kde.contacteditors 4.5 as ContactEditors
import org.kde.plasma.extras 0.1 as PlasmaExtras
KPIM.MainView {
PlasmaExtras.ScrollArea {
anchors {
fill: parent
topMargin: 40
leftMargin: 40
rightMargin: 4
}
flickableItem: Flickable {
contentHeight: editorGeneral.height;
ContactEditors.ContactEditorGeneral {
id: editorGeneral;
width: parent.width;
}
}
}
SlideoutPanelContainer {
anchors.fill: parent
z: 50
SlideoutPanel {
id: businessPanel
anchors.fill: parent
titleText: KDE.i18n( "Business" )
handlePosition: 30
handleHeight: 120
content: [
PlasmaExtras.ScrollArea {
anchors.fill: parent
flickableItem: Flickable {
contentHeight: editorBusiness.height
ContactEditors.ContactEditorBusiness {
id: editorBusiness
width: parent.width
}
}
}
]
}
SlideoutPanel {
id: locationPanel
anchors.fill: parent
titleText: KDE.i18n( "Location" )
handlePosition: 30 + 120
handleHeight: 120
content: [
PlasmaExtras.ScrollArea {
anchors.fill: parent
flickableItem: Flickable {
contentHeight: editorLocation.height
ContactEditors.ContactEditorLocation {
id: editorLocation
width: parent.width
}
}
}
]
}
SlideoutPanel {
id: cryptoPanel
anchors.fill: parent
titleText: KDE.i18n( "Crypto" )
handlePosition: 30 + 120 + 120
handleHeight: 100
content: [
PlasmaExtras.ScrollArea {
anchors.fill: parent
flickableItem: Flickable {
contentHeight: editorCrypto.height
ContactEditors.ContactEditorCrypto {
id: editorCrypto
width: parent.width
}
}
}
]
}
SlideoutPanel {
id: morePanel
anchors.fill: parent
titleText: KDE.i18n( "More" )
handlePosition: 30 + 120 + 120 + 100
handleHeight: 100
content: [
PlasmaExtras.ScrollArea {
anchors.fill: parent
flickableItem: Flickable {
contentHeight: editorMore.height
ContactEditors.ContactEditorMore {
id: editorMore
width: parent.width
}
}
}
]
}
}
}

View file

@ -1,131 +0,0 @@
/*
This file is part of Akonadi Contact.
Copyright (c) 2009 Tobias Koenig <tokoe@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 "contactcompletionmodel_p.h"
#include <akonadi/changerecorder.h>
#include <akonadi/entitymimetypefiltermodel.h>
#include <akonadi/itemfetchscope.h>
#include <akonadi/session.h>
#include <kabc/addressee.h>
using namespace Akonadi;
QAbstractItemModel* ContactCompletionModel::mSelf = 0;
QAbstractItemModel* ContactCompletionModel::self()
{
if ( mSelf )
return mSelf;
ChangeRecorder *monitor = new ChangeRecorder;
monitor->fetchCollection( true );
monitor->itemFetchScope().fetchFullPayload();
monitor->setCollectionMonitored( Akonadi::Collection::root() );
monitor->setMimeTypeMonitored( KABC::Addressee::mimeType() );
ContactCompletionModel *model = new ContactCompletionModel( monitor );
EntityMimeTypeFilterModel *filter = new Akonadi::EntityMimeTypeFilterModel( model );
filter->setSourceModel( model );
filter->addMimeTypeExclusionFilter( Akonadi::Collection::mimeType() );
filter->setHeaderGroup( Akonadi::EntityTreeModel::ItemListHeaders );
mSelf = filter;
return mSelf;
}
ContactCompletionModel::ContactCompletionModel( ChangeRecorder *monitor, QObject *parent )
: EntityTreeModel( monitor, parent )
{
setCollectionFetchStrategy( InvisibleCollectionFetch );
}
ContactCompletionModel::~ContactCompletionModel()
{
}
QVariant ContactCompletionModel::entityData( const Item &item, int column, int role ) const
{
if ( !item.hasPayload<KABC::Addressee>() ) {
// Pass modeltest
if ( role == Qt::DisplayRole )
return item.remoteId();
return QVariant();
}
if ( role == Qt::DisplayRole || role == Qt::EditRole ) {
const KABC::Addressee contact = item.payload<KABC::Addressee>();
switch ( column ) {
case NameColumn:
if ( !contact.formattedName().isEmpty() )
return contact.formattedName();
else
return contact.assembledName();
break;
case NameAndEmailColumn:
{
QString name = QString::fromLatin1( "%1 %2" ).arg( contact.givenName() )
.arg( contact.familyName() ).simplified();
if ( name.isEmpty() )
name = contact.organization().simplified();
if ( name.isEmpty() )
return QString();
const QString email = contact.preferredEmail().simplified();
if ( email.isEmpty() )
return QString();
return QString::fromLatin1( "%1 <%2>" ).arg( name ).arg( email );
}
break;
case EmailColumn:
return contact.preferredEmail();
break;
}
}
return EntityTreeModel::entityData( item, column, role );
}
QVariant ContactCompletionModel::entityData( const Collection &collection, int column, int role ) const
{
return EntityTreeModel::entityData( collection, column, role );
}
int ContactCompletionModel::columnCount( const QModelIndex &parent ) const
{
if ( !parent.isValid() )
return 3;
else
return 0;
}
int ContactCompletionModel::entityColumnCount( HeaderGroup ) const
{
return 3;
}
#include "moc_contactcompletionmodel_p.cpp"

View file

@ -1,57 +0,0 @@
/*
This file is part of Akonadi Contact.
Copyright (c) 2009 Tobias Koenig <tokoe@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_CONTACTCOMPLETIONMODEL_P_H
#define AKONADI_CONTACTCOMPLETIONMODEL_P_H
#include <akonadi/entitytreemodel.h>
namespace Akonadi {
class ContactCompletionModel : public EntityTreeModel
{
Q_OBJECT
public:
enum Columns
{
NameColumn, ///< The name of the contact.
NameAndEmailColumn, ///< The name and the email of the contact.
EmailColumn ///< The preferred email of the contact.
};
explicit ContactCompletionModel( ChangeRecorder *monitor, QObject *parent = 0 );
virtual ~ContactCompletionModel();
virtual QVariant entityData( const Item &item, int column, int role = Qt::DisplayRole ) const;
virtual QVariant entityData( const Collection &collection, int column, int role = Qt::DisplayRole ) const;
virtual int columnCount( const QModelIndex &parent ) const;
virtual int entityColumnCount( HeaderGroup ) const;
static QAbstractItemModel* self();
private:
static QAbstractItemModel* mSelf;
};
}
#endif

View file

@ -1,318 +0,0 @@
/*
Copyright (c) 2010 Kevin Krammer <kevin.krammer@gmx.at>
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 "contacteditorview.h"
#include "contactmetadata_p.h"
#include "editorgeneral.h"
#include "editorbusiness.h"
#include "editorlocation.h"
#include "editorcrypto.h"
#include "editormore.h"
#include "declarativewidgetbase.h"
#include <incidenceeditor-ng/editoritemmanager.h>
#include <Akonadi/Collection>
#include <Akonadi/Item>
#include <Akonadi/ItemFetchScope>
#include <KABC/Addressee>
#include <KLocalizedString>
#include <QDeclarativeItem>
using namespace Akonadi;
typedef DeclarativeWidgetBase<EditorGeneral, ContactEditorView, &ContactEditorView::setEditorGeneral> DeclarativeEditorGeneral;
typedef DeclarativeWidgetBase<EditorBusiness, ContactEditorView, &ContactEditorView::setEditorBusiness> DeclarativeEditorBusiness;
typedef DeclarativeWidgetBase<EditorLocation, ContactEditorView, &ContactEditorView::setEditorLocation> DeclarativeEditorLocation;
typedef DeclarativeWidgetBase<EditorCrypto, ContactEditorView, &ContactEditorView::setEditorCrypto> DeclarativeEditorCrypto;
typedef DeclarativeWidgetBase<EditorMore, ContactEditorView, &ContactEditorView::setEditorMore> DeclarativeEditorMore;
class ContactEditorView::Private : public IncidenceEditorNG::ItemEditorUi
{
ContactEditorView *const q;
public:
explicit Private( ContactEditorView *parent )
: q( parent ), mItemManager( new IncidenceEditorNG::EditorItemManager( this ) ),
mEditorBusiness( 0 ), mEditorGeneral( 0 ), mEditorMore( 0 )
{
}
~Private()
{
delete mItemManager;
}
void addDetailEditor( EditorBase *editor );
public: // slots
void saveFinished();
void saveFailed( IncidenceEditorNG::EditorItemManager::SaveAction, const QString &errorMessage );
void collectionChanged( const Akonadi::Collection &collection );
public: // ItemEditorGeneralUi interface
bool containsPayloadIdentifiers( const QSet<QByteArray> &partIdentifiers ) const
{
return partIdentifiers.contains( Item::FullPayload );
}
bool hasSupportedPayload( const Item &item ) const
{
return item.hasPayload<KABC::Addressee>();
}
bool isDirty() const
{
return true;
}
bool isValid() const
{
return selectedCollection().isValid();
}
void load( const Item &item );
Item save( const Item &item );
Collection selectedCollection() const;
void reject( RejectReason reason, const QString &errorMessage = QString() );
public:
Item mItem;
ContactMetaData mContactMetaData;
Collection mCollection;
Collection mDefaultCollection;
IncidenceEditorNG::EditorItemManager *mItemManager;
EditorBusiness *mEditorBusiness;
EditorGeneral *mEditorGeneral;
EditorMore *mEditorMore;
QList<EditorBase*> mDetailEditors;
};
void ContactEditorView::Private::addDetailEditor( EditorBase *editor )
{
if ( editor != 0 ) {
mDetailEditors << editor;
if ( mItem.hasPayload<KABC::Addressee>() ) {
const KABC::Addressee contact = mItem.payload<KABC::Addressee>();
// tokoe: enable when ContactMetaData is part of public API
// mContactMetaData.load( mItem );
editor->loadContact( contact, mContactMetaData );
}
}
}
void ContactEditorView::Private::saveFinished()
{
kDebug();
q->deleteLater();
}
void ContactEditorView::Private::saveFailed( IncidenceEditorNG::EditorItemManager::SaveAction, const QString &errorMessage )
{
kError() << errorMessage;
}
void ContactEditorView::Private::load( const Item &item )
{
Q_ASSERT( item.hasPayload<KABC::Addressee>() );
mItem = item;
mCollection = item.parentCollection();
const KABC::Addressee contact = mItem.payload<KABC::Addressee>();
// tokoe: enable when ContactMetaData is part of public API
// mContactMetaData.load( mItem );
if ( mEditorGeneral != 0 ) {
mEditorGeneral->setDefaultCollection( mCollection );
mEditorGeneral->loadContact( contact, mContactMetaData );
}
Q_FOREACH( EditorBase *editor, mDetailEditors ) {
editor->loadContact( contact, mContactMetaData );
}
}
Item ContactEditorView::Private::save( const Item &item )
{
Item result = item;
result.setMimeType( KABC::Addressee::mimeType() );
KABC::Addressee contact;
if ( mEditorGeneral != 0 ) {
mEditorGeneral->saveContact( contact, mContactMetaData );
}
Q_FOREACH( EditorBase *editor, mDetailEditors ) {
editor->saveContact( contact, mContactMetaData );
}
result.setPayload<KABC::Addressee>( contact );
// tokoe: enable when ContactMetaData is part of public API
// mContactMetaData.store( result );
return result;
}
void ContactEditorView::Private::collectionChanged( const Akonadi::Collection &collection )
{
mCollection = collection;
}
Collection ContactEditorView::Private::selectedCollection() const
{
return ( !mCollection.isValid() && mEditorGeneral != 0 ? mEditorGeneral->selectedCollection() : mCollection );
}
void ContactEditorView::Private::reject( RejectReason reason, const QString &errorMessage )
{
switch ( reason ) {
case ItemFetchFailed:
kWarning() << "Item Fetch Failed:" << errorMessage;
break;
case ItemHasInvalidPayload:
kWarning() << "Item has Invalid Payload:" << errorMessage;
break;
}
q->deleteLater();
}
ContactEditorView::ContactEditorView( QWidget *parent )
: KDeclarativeFullScreenView( QLatin1String( "contact-editor" ), parent ),
d( new Private( this ) )
{
setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle( i18n( "Kontact Touch Contacts" ) );
}
void ContactEditorView::doDelayedInit()
{
qmlRegisterType<DeclarativeEditorGeneral>( "org.kde.contacteditors", 4, 5, "ContactEditorGeneral" );
qmlRegisterType<DeclarativeEditorBusiness>( "org.kde.contacteditors", 4, 5, "ContactEditorBusiness" );
qmlRegisterType<DeclarativeEditorLocation>( "org.kde.contacteditors", 4, 5, "ContactEditorLocation" );
qmlRegisterType<DeclarativeEditorCrypto>( "org.kde.contacteditors", 4, 5, "ContactEditorCrypto" );
qmlRegisterType<DeclarativeEditorMore>( "org.kde.contacteditors", 4, 5, "ContactEditorMore" );
connect( d->mItemManager, SIGNAL(itemSaveFinished(IncidenceEditorNG::EditorItemManager::SaveAction)),
SLOT(saveFinished()) );
connect( d->mItemManager, SIGNAL(itemSaveFailed(IncidenceEditorNG::EditorItemManager::SaveAction,QString)),
SLOT(saveFailed(IncidenceEditorNG::EditorItemManager::SaveAction,QString)) );
}
ContactEditorView::~ContactEditorView()
{
delete d;
}
void ContactEditorView::setEditorGeneral( EditorGeneral *editor )
{
d->mEditorGeneral = editor;
if ( d->mEditorGeneral != 0 ) {
if ( d->mDefaultCollection.isValid() ) {
d->mEditorGeneral->setDefaultCollection( d->mDefaultCollection );
}
if ( d->mCollection.isValid() ) {
d->mEditorGeneral->setDefaultCollection( d->mCollection );
}
connect( d->mEditorGeneral, SIGNAL(saveClicked()), SLOT(save()) );
connect( d->mEditorGeneral, SIGNAL(cancelClicked()), SLOT(cancel()) );
connect( d->mEditorGeneral, SIGNAL(collectionChanged(Akonadi::Collection)),
SLOT(collectionChanged(Akonadi::Collection)) );
connect( d->mEditorGeneral, SIGNAL(requestLaunchAccountWizard()),
this, SIGNAL(requestLaunchAccountWizard()) );
}
}
void ContactEditorView::setEditorBusiness( EditorBusiness *editor )
{
d->addDetailEditor( editor );
d->mEditorBusiness = editor;
}
void ContactEditorView::setEditorLocation( EditorLocation *editor )
{
d->addDetailEditor( editor );
}
void ContactEditorView::setEditorCrypto( EditorCrypto *editor )
{
d->addDetailEditor( editor );
}
void ContactEditorView::setEditorMore( EditorMore *editor )
{
d->addDetailEditor( editor );
d->mEditorMore = editor;
if ( d->mEditorBusiness ) {
connect( d->mEditorBusiness, SIGNAL(organizationChanged(QString)),
d->mEditorMore, SLOT(updateOrganization(QString)) );
} else {
qWarning( "No business editor set!" );
}
connect( d->mEditorGeneral, SIGNAL(nameChanged(KABC::Addressee)),
d->mEditorMore, SLOT(updateName(KABC::Addressee)) );
connect( d->mEditorMore, SIGNAL(nameChanged(KABC::Addressee)),
d->mEditorGeneral, SLOT(updateName(KABC::Addressee)) );
}
void ContactEditorView::setDefaultCollection( const Akonadi::Collection &collection )
{
d->mDefaultCollection = collection;
}
void ContactEditorView::loadContact( const Item &item )
{
if ( !d->mEditorGeneral ) {
// the editor is not fully loaded yet, so try later again
QMetaObject::invokeMethod( this, "loadContact", Qt::QueuedConnection, Q_ARG( Akonadi::Item, item ) );
} else {
d->mItemManager->load( item );
}
}
void ContactEditorView::save()
{
d->mItemManager->save();
}
void ContactEditorView::cancel()
{
deleteLater();
}
void ContactEditorView::closeEvent( QCloseEvent *event )
{
Q_UNUSED( event );
cancel();
}
#include "moc_contacteditorview.cpp"

Some files were not shown because too many files have changed in this diff Show more