diff --git a/kdepim/blogilo/src/ui/addeditblogbase.ui b/kdepim/blogilo/src/addeditblogbase.ui similarity index 100% rename from kdepim/blogilo/src/ui/addeditblogbase.ui rename to kdepim/blogilo/src/addeditblogbase.ui diff --git a/kdepim/blogilo/src/ui/advancedsettingsbase.ui b/kdepim/blogilo/src/advancedsettingsbase.ui similarity index 100% rename from kdepim/blogilo/src/ui/advancedsettingsbase.ui rename to kdepim/blogilo/src/advancedsettingsbase.ui diff --git a/kdepim/blogilo/src/ui/blogsettingsbase.ui b/kdepim/blogilo/src/blogsettingsbase.ui similarity index 100% rename from kdepim/blogilo/src/ui/blogsettingsbase.ui rename to kdepim/blogilo/src/blogsettingsbase.ui diff --git a/kdepim/blogilo/src/ui/editorsettingsbase.ui b/kdepim/blogilo/src/editorsettingsbase.ui similarity index 100% rename from kdepim/blogilo/src/ui/editorsettingsbase.ui rename to kdepim/blogilo/src/editorsettingsbase.ui diff --git a/kdepim/blogilo/src/ui/entriescountdialogbase.ui b/kdepim/blogilo/src/entriescountdialogbase.ui similarity index 100% rename from kdepim/blogilo/src/ui/entriescountdialogbase.ui rename to kdepim/blogilo/src/entriescountdialogbase.ui diff --git a/kdepim/blogilo/src/ui/sendtoblogbase.ui b/kdepim/blogilo/src/sendtoblogbase.ui similarity index 100% rename from kdepim/blogilo/src/ui/sendtoblogbase.ui rename to kdepim/blogilo/src/sendtoblogbase.ui diff --git a/kdepim/blogilo/src/ui/settingsbase.ui b/kdepim/blogilo/src/settingsbase.ui similarity index 100% rename from kdepim/blogilo/src/ui/settingsbase.ui rename to kdepim/blogilo/src/settingsbase.ui diff --git a/kdepim/blogilo/src/ui/toolboxbase.ui b/kdepim/blogilo/src/toolboxbase.ui similarity index 100% rename from kdepim/blogilo/src/ui/toolboxbase.ui rename to kdepim/blogilo/src/toolboxbase.ui diff --git a/kdepim/blogilo/src/ui/uploadmediabase.ui b/kdepim/blogilo/src/uploadmediabase.ui similarity index 100% rename from kdepim/blogilo/src/ui/uploadmediabase.ui rename to kdepim/blogilo/src/uploadmediabase.ui diff --git a/kdepim/blogilo/src/ui/waitwidgetbase.ui b/kdepim/blogilo/src/waitwidgetbase.ui similarity index 100% rename from kdepim/blogilo/src/ui/waitwidgetbase.ui rename to kdepim/blogilo/src/waitwidgetbase.ui diff --git a/kdepim/composereditor-ng/CMakeLists.txt b/kdepim/composereditor-ng/CMakeLists.txt index 6d8b3e18..0e648d6c 100644 --- a/kdepim/composereditor-ng/CMakeLists.txt +++ b/kdepim/composereditor-ng/CMakeLists.txt @@ -34,8 +34,8 @@ set(libcomposereditor_ng_SRCS list/composerlistdialog.cpp helper/tablehelper.cpp helper/listhelper.cpp - spellplugin/kspellplugin.cpp - widgets/domtreewidget.cpp + spellplugin/kspellplugin.cpp + widgets/domtreewidget.cpp widgets/findreplacebar.cpp ) diff --git a/kdepim/composereditor-ng/ui/pagecolorbackgroundwidget.ui b/kdepim/composereditor-ng/pagecolor/pagecolorbackgroundwidget.ui similarity index 100% rename from kdepim/composereditor-ng/ui/pagecolorbackgroundwidget.ui rename to kdepim/composereditor-ng/pagecolor/pagecolorbackgroundwidget.ui diff --git a/kdepim/composereditor-ng/spellplugin/kspellplugin.cpp b/kdepim/composereditor-ng/spellplugin/kspellplugin.cpp index 910a2fad..ccd56c08 100644 --- a/kdepim/composereditor-ng/spellplugin/kspellplugin.cpp +++ b/kdepim/composereditor-ng/spellplugin/kspellplugin.cpp @@ -193,5 +193,3 @@ QObject* KWebKitPlatformPlugin::createExtension(Extension ext) const Q_EXPORT_PLUGIN2(kwebspellchecker, KWebKitPlatformPlugin) Q_IMPORT_PLUGIN(kwebspellchecker) - - diff --git a/kdepim/composereditor-ng/spellplugin/kspellplugin.h b/kdepim/composereditor-ng/spellplugin/kspellplugin.h index 7d9b4c8c..f7f3bba9 100644 --- a/kdepim/composereditor-ng/spellplugin/kspellplugin.h +++ b/kdepim/composereditor-ng/spellplugin/kspellplugin.h @@ -30,11 +30,8 @@ #include #include +#include #include -#include "qwebkitplatformplugin.h" - - - class KWebSpellChecker : public QWebSpellChecker { diff --git a/kdepim/composereditor-ng/spellplugin/qwebkitplatformplugin.h b/kdepim/composereditor-ng/spellplugin/qwebkitplatformplugin.h deleted file mode 100644 index 62ab4209..00000000 --- a/kdepim/composereditor-ng/spellplugin/qwebkitplatformplugin.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * Copyright (C) 2012 by Lindsay Mathieson - * - * 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 -#endif -#include -#include -#include -#include -#include - -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&, 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 diff --git a/kdepim/kleopatra/conf/smimevalidationconfigurationwidget.cpp b/kdepim/kleopatra/conf/smimevalidationconfigurationwidget.cpp index f76e7275..443e9ebc 100644 --- a/kdepim/kleopatra/conf/smimevalidationconfigurationwidget.cpp +++ b/kdepim/kleopatra/conf/smimevalidationconfigurationwidget.cpp @@ -42,6 +42,7 @@ #include #include +#include #include diff --git a/kdepim/kleopatra/kgpgconf/main.cpp b/kdepim/kleopatra/kgpgconf/main.cpp index bdd8b743..cb5977bf 100644 --- a/kdepim/kleopatra/kgpgconf/main.cpp +++ b/kdepim/kleopatra/kgpgconf/main.cpp @@ -33,6 +33,8 @@ #include "mainwindow.h" #include +#include +#include int main( int argc, char** argv ) { diff --git a/kdepim/kleopatra/kgpgconf/mainwindow.cpp b/kdepim/kleopatra/kgpgconf/mainwindow.cpp index 90e772ed..3a83faba 100644 --- a/kdepim/kleopatra/kgpgconf/mainwindow.cpp +++ b/kdepim/kleopatra/kgpgconf/mainwindow.cpp @@ -37,6 +37,8 @@ #include "configwriter.h" #include "exception.h" +#include + #include #include #include diff --git a/kdepim/kontact/plugins/korganizer/kcmtodosummary.cpp b/kdepim/kontact/plugins/korganizer/kcmtodosummary.cpp index e766fa4a..30bd26ac 100644 --- a/kdepim/kontact/plugins/korganizer/kcmtodosummary.cpp +++ b/kdepim/kontact/plugins/korganizer/kcmtodosummary.cpp @@ -28,6 +28,7 @@ #include #include #include +#include KCModule *create_todosummary( QWidget *parent, const char * ) { diff --git a/kdepim/kontact/plugins/specialdates/kcmsdsummary.cpp b/kdepim/kontact/plugins/specialdates/kcmsdsummary.cpp index 3b9c5a4f..f61e8ce5 100644 --- a/kdepim/kontact/plugins/specialdates/kcmsdsummary.cpp +++ b/kdepim/kontact/plugins/specialdates/kcmsdsummary.cpp @@ -28,6 +28,7 @@ #include #include #include +#include extern "C" { diff --git a/kdepim/korganizer/views/multiagendaview/multiagendaviewconfigwidget.ui b/kdepim/korganizer/views/multiagendaview/multiagendaviewconfigwidget.ui new file mode 120000 index 00000000..38f23ef1 --- /dev/null +++ b/kdepim/korganizer/views/multiagendaview/multiagendaviewconfigwidget.ui @@ -0,0 +1 @@ +../../multiagendaviewconfigwidget.ui \ No newline at end of file diff --git a/kdepim/ktimetracker/historydialog.cpp b/kdepim/ktimetracker/historydialog.cpp index 91b4b304..19023e7d 100644 --- a/kdepim/ktimetracker/historydialog.cpp +++ b/kdepim/ktimetracker/historydialog.cpp @@ -28,6 +28,7 @@ #include #include #include +#include class HistoryWidgetDelegate : public QItemDelegate { diff --git a/kdepim/libkleo/ui/directoryserviceswidget.cpp b/kdepim/libkleo/ui/directoryserviceswidget.cpp index 931f73f5..60626da6 100644 --- a/kdepim/libkleo/ui/directoryserviceswidget.cpp +++ b/kdepim/libkleo/ui/directoryserviceswidget.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include diff --git a/kdepim/mobile/.krazy b/kdepim/mobile/.krazy deleted file mode 100644 index 0b16e7f7..00000000 --- a/kdepim/mobile/.krazy +++ /dev/null @@ -1 +0,0 @@ -SKIP /tests/ diff --git a/kdepim/mobile/CMakeLists.txt b/kdepim/mobile/CMakeLists.txt deleted file mode 100644 index aca765df..00000000 --- a/kdepim/mobile/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/kdepim/mobile/api/CMakeLists.txt b/kdepim/mobile/api/CMakeLists.txt deleted file mode 100644 index f7e6f1d6..00000000 --- a/kdepim/mobile/api/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(mail) diff --git a/kdepim/mobile/api/mail/CMakeLists.txt b/kdepim/mobile/api/mail/CMakeLists.txt deleted file mode 100644 index d280d620..00000000 --- a/kdepim/mobile/api/mail/CMakeLists.txt +++ /dev/null @@ -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) \ No newline at end of file diff --git a/kdepim/mobile/api/mail/composer.cpp b/kdepim/mobile/api/mail/composer.cpp deleted file mode 100644 index dc750e8a..00000000 --- a/kdepim/mobile/api/mail/composer.cpp +++ /dev/null @@ -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 - - -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 ); -} diff --git a/kdepim/mobile/api/mail/composer.h b/kdepim/mobile/api/mail/composer.h deleted file mode 100644 index b7312875..00000000 --- a/kdepim/mobile/api/mail/composer.h +++ /dev/null @@ -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 -#include -#include -#include -#include - -#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 \ No newline at end of file diff --git a/kdepim/mobile/api/mail/error.cpp b/kdepim/mobile/api/mail/error.cpp deleted file mode 100644 index 38e1a2b2..00000000 --- a/kdepim/mobile/api/mail/error.cpp +++ /dev/null @@ -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()); -} - diff --git a/kdepim/mobile/api/mail/error.h b/kdepim/mobile/api/mail/error.h deleted file mode 100644 index bb9723e3..00000000 --- a/kdepim/mobile/api/mail/error.h +++ /dev/null @@ -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 - -#include - -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 \ No newline at end of file diff --git a/kdepim/mobile/api/mail/mailplugin.cpp b/kdepim/mobile/api/mail/mailplugin.cpp deleted file mode 100644 index 1ba270f9..00000000 --- a/kdepim/mobile/api/mail/mailplugin.cpp +++ /dev/null @@ -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 . - -*/ - -#include "mailplugin.h" - -#include "message.h" -#include "composer.h" -#include "error.h" -#include "receivermodel.h" - -#include - -void MailPlugin::registerTypes(const char *uri) -{ - Q_ASSERT(uri == "org.kde.pim.mail"); - qmlRegisterType(uri, 0, 1, "Message"); - qmlRegisterType(uri, 0, 1, "Composer"); - qmlRegisterType(uri, 0, 1, "Error"); - qmlRegisterType(uri, 0, 1, "ReceiverModel"); -} - -Q_EXPORT_PLUGIN2(mailplugin, MailPlugin) diff --git a/kdepim/mobile/api/mail/mailplugin.h b/kdepim/mobile/api/mail/mailplugin.h deleted file mode 100644 index 3aa482c7..00000000 --- a/kdepim/mobile/api/mail/mailplugin.h +++ /dev/null @@ -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 . - -*/ - -#ifndef MAILPLUGIN_H -#define MAILPLUGIN_H - -#include - -class MailPlugin : public QDeclarativeExtensionPlugin -{ - Q_OBJECT - -public: - void registerTypes(const char *uri); -}; - -#endif - diff --git a/kdepim/mobile/api/mail/message.cpp b/kdepim/mobile/api/mail/message.cpp deleted file mode 100644 index 3d0f275a..00000000 --- a/kdepim/mobile/api/mail/message.cpp +++ /dev/null @@ -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 . - -*/ - -#include "message.h" - -#include -#include - -#include - -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(); -} - - diff --git a/kdepim/mobile/api/mail/message.h b/kdepim/mobile/api/mail/message.h deleted file mode 100644 index 67779c86..00000000 --- a/kdepim/mobile/api/mail/message.h +++ /dev/null @@ -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 . - -*/ - -#ifndef MESSAGE_H -#define MESSAGE_H - -#include -#include -#include -#include - -#include - -#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 m_error; -}; - - -#endif //MESSAGE_H \ No newline at end of file diff --git a/kdepim/mobile/api/mail/qmldir b/kdepim/mobile/api/mail/qmldir deleted file mode 100644 index e3ba373d..00000000 --- a/kdepim/mobile/api/mail/qmldir +++ /dev/null @@ -1 +0,0 @@ -plugin mailplugin \ No newline at end of file diff --git a/kdepim/mobile/api/mail/receivermodel.cpp b/kdepim/mobile/api/mail/receivermodel.cpp deleted file mode 100644 index 9bc69e82..00000000 --- a/kdepim/mobile/api/mail/receivermodel.cpp +++ /dev/null @@ -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 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(", ") ); -} - diff --git a/kdepim/mobile/api/mail/receivermodel.h b/kdepim/mobile/api/mail/receivermodel.h deleted file mode 100644 index b0818aa5..00000000 --- a/kdepim/mobile/api/mail/receivermodel.h +++ /dev/null @@ -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 -#include - -#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 \ No newline at end of file diff --git a/kdepim/mobile/calendar/BulkActionComponent.qml b/kdepim/mobile/calendar/BulkActionComponent.qml deleted file mode 100644 index 385aef43..00000000 --- a/kdepim/mobile/calendar/BulkActionComponent.qml +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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 - } -} diff --git a/kdepim/mobile/calendar/CMakeLists.txt b/kdepim/mobile/calendar/CMakeLists.txt deleted file mode 100644 index 0d53bb95..00000000 --- a/kdepim/mobile/calendar/CMakeLists.txt +++ /dev/null @@ -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} ) diff --git a/kdepim/mobile/calendar/ConfigDialog.qml b/kdepim/mobile/calendar/ConfigDialog.qml deleted file mode 100644 index 4c09ec4d..00000000 --- a/kdepim/mobile/calendar/ConfigDialog.qml +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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() - } - } -} diff --git a/kdepim/mobile/calendar/EventListComponent.qml b/kdepim/mobile/calendar/EventListComponent.qml deleted file mode 100644 index 90a741a1..00000000 --- a/kdepim/mobile/calendar/EventListComponent.qml +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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; - } - } -} diff --git a/kdepim/mobile/calendar/EventListView.qml b/kdepim/mobile/calendar/EventListView.qml deleted file mode 100644 index e9c119da..00000000 --- a/kdepim/mobile/calendar/EventListView.qml +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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" - } - ] - } - ] -} diff --git a/kdepim/mobile/calendar/KorganizerActions.qml b/kdepim/mobile/calendar/KorganizerActions.qml deleted file mode 100644 index 7dda169b..00000000 --- a/kdepim/mobile/calendar/KorganizerActions.qml +++ /dev/null @@ -1,213 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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" ) - } -} diff --git a/kdepim/mobile/calendar/Messages.sh b/kdepim/mobile/calendar/Messages.sh deleted file mode 100644 index 7d5b2629..00000000 --- a/kdepim/mobile/calendar/Messages.sh +++ /dev/null @@ -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 diff --git a/kdepim/mobile/calendar/MonthViewComponent.qml b/kdepim/mobile/calendar/MonthViewComponent.qml deleted file mode 100644 index d054dda0..00000000 --- a/kdepim/mobile/calendar/MonthViewComponent.qml +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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 ); - } - } - } -} - diff --git a/kdepim/mobile/calendar/TimelineView.qml b/kdepim/mobile/calendar/TimelineView.qml deleted file mode 100644 index fd949865..00000000 --- a/kdepim/mobile/calendar/TimelineView.qml +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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 ); - } - } - } -} - diff --git a/kdepim/mobile/calendar/agendaviewitem.cpp b/kdepim/mobile/calendar/agendaviewitem.cpp deleted file mode 100644 index ea0c02a9..00000000 --- a/kdepim/mobile/calendar/agendaviewitem.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 -#include - -#include -#include -#include - -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( calendarObj ); - - kDebug() << calendarObj << cal; - if ( cal ) { - m_view->setCalendar( cal->weakPointer().toStrongRef().dynamicCast() ); - 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(); -} - - diff --git a/kdepim/mobile/calendar/agendaviewitem.h b/kdepim/mobile/calendar/agendaviewitem.h deleted file mode 100644 index 50219855..00000000 --- a/kdepim/mobile/calendar/agendaviewitem.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 - -#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 diff --git a/kdepim/mobile/calendar/calendarinterface.cpp b/kdepim/mobile/calendar/calendarinterface.cpp deleted file mode 100644 index a2cd7f9a..00000000 --- a/kdepim/mobile/calendar/calendarinterface.cpp +++ /dev/null @@ -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 - - 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 -#include - -void CalendarInterface::showDate( const QDate &date ) -{ - emit showDateSignal(QVariant::fromValue( 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"; -} - diff --git a/kdepim/mobile/calendar/calendarinterface.h b/kdepim/mobile/calendar/calendarinterface.h deleted file mode 100644 index fa0711f9..00000000 --- a/kdepim/mobile/calendar/calendarinterface.h +++ /dev/null @@ -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 - - 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 -#include - -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 diff --git a/kdepim/mobile/calendar/configwidget.cpp b/kdepim/mobile/calendar/configwidget.cpp deleted file mode 100644 index 26baef35..00000000 --- a/kdepim/mobile/calendar/configwidget.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 -#include -#include -#include - -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 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 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( 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 ); -} - diff --git a/kdepim/mobile/calendar/configwidget.h b/kdepim/mobile/calendar/configwidget.h deleted file mode 100644 index 47c93158..00000000 --- a/kdepim/mobile/calendar/configwidget.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 -#include - -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 mWorkDays; - EventViews::PrefsPtr mViewPrefs; - KTimeComboBox *mFocusedTimeWidget; -}; - -class DeclarativeConfigWidget : -#ifndef Q_MOC_RUN -public DeclarativeWidgetBase -#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 diff --git a/kdepim/mobile/calendar/configwidget.ui b/kdepim/mobile/calendar/configwidget.ui deleted file mode 100644 index 943bfbf7..00000000 --- a/kdepim/mobile/calendar/configwidget.ui +++ /dev/null @@ -1,580 +0,0 @@ - - - ConfigWidget - - - - 0 - 0 - 501 - 1132 - - - - - - - - - - 75 - true - - - - Time and Date - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Day begins at: - - - - - - - - - - Use holiday region: - - - - - - - - - - Working Period: - - - - - - - - 0 - - - - - Monday - - - - - - - Tuesday - - - - - - - Wednesday - - - - - - - Thursday - - - - - - - Friday - - - - - - - Saturday - - - - - - - Sunday - - - - - - - - - - - - - Daily starting hour: - - - - - - - Daily ending hour: - - - - - - - - - - - - Exclude holidays - - - - - - - - - - - - 75 - true - - - - New Events - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - Default appointment time: - - - - - - - - - - Default duration: - - - - - - - hh:mm - - - - - - - Default reminder time: - - - - - - - - 0 - - - - - - - - - minute(s) - - - - - hour(s) - - - - - day(s) - - - - - - - - - - - - - Enable reminders for new appointments - - - - - - - - - - - - 75 - true - - - - Views - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - To-dos use category colors - - - - - - - - - Hour size: - - - - - - - pixels - - - 4 - - - 30 - - - 10 - - - - - - - - - Show icons in agenda view - - - - - - - Show to-dos in agenda view - - - - - - - Show current time line - - - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - - - - Agenda view color usage: - - - - - - - - - Color busy days in agenda view - - - - - - - Show to-dos in month view - - - - - - - - - Month view color usage: - - - - - - - - - - - - Color busy days in month view - - - - - - - - - - - - 75 - true - - - - Colors - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - Holiday color: - - - - - - - - - - Agenda view background color: - - - - - - - - - - Busy days background color: - - - - - - - - - - Agenda view current time line color: - - - - - - - - - - Working hours color: - - - - - - - - - - To-do due today color: - - - - - - - - - - To-do overdue color: - - - - - - - - - - - - - - - - - 75 - true - - - - Group Scheduling - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - Use Groupware communication - - - - - - - - - - KTimeComboBox - QComboBox -
ktimecombobox.h
-
- - KPIM::KColorCombo - QComboBox -
kcolorcombo.h
-
- - KComboBox - QComboBox -
kcombobox.h
-
-
- - -
diff --git a/kdepim/mobile/calendar/declarativewidgetwrapper.cpp b/kdepim/mobile/calendar/declarativewidgetwrapper.cpp deleted file mode 100644 index 2d4487df..00000000 --- a/kdepim/mobile/calendar/declarativewidgetwrapper.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 - -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() ); -} - diff --git a/kdepim/mobile/calendar/declarativewidgetwrapper.h b/kdepim/mobile/calendar/declarativewidgetwrapper.h deleted file mode 100644 index acd844cd..00000000 --- a/kdepim/mobile/calendar/declarativewidgetwrapper.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 -#include - -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 -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 - diff --git a/kdepim/mobile/calendar/eventlistproxy.cpp b/kdepim/mobile/calendar/eventlistproxy.cpp deleted file mode 100644 index fe578cee..00000000 --- a/kdepim/mobile/calendar/eventlistproxy.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 - -#include -#include -#include - -#include -#include -#include - -#include - -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(); - if ( item.isValid() && item.hasPayload() ) { - const KCalCore::Incidence::Ptr incidence = item.payload(); - 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 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::const_iterator it = mDateTimeHash.constFind( item.id() ); - if ( it != mDateTimeHash.constEnd() ) - return (*it).startDateTime; - - const KCalCore::Event::Ptr event = item.payload(); - - 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::const_iterator it = mDateTimeHash.constFind( item.id() ); - if ( it != mDateTimeHash.constEnd() ) - return (*it).endDateTime; - - const KCalCore::Event::Ptr event = item.payload(); - - 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(); - const Akonadi::Item rightItem = right.data( Akonadi::EntityTreeModel::ItemRole ).value(); - if ( !leftItem.hasPayload() || !rightItem.hasPayload() ) - 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(); - if ( !item.hasPayload() ) - continue; - - const KCalCore::Event::Ptr event = item.payload(); - - DateTimeHashEntry entry; - entry.startDateTime = event->dtStart(); - entry.endDateTime = event->dtEnd(); - - mDateTimeHash.insert( item.id(), entry ); - } -} - diff --git a/kdepim/mobile/calendar/eventlistproxy.h b/kdepim/mobile/calendar/eventlistproxy.h deleted file mode 100644 index d053ecdd..00000000 --- a/kdepim/mobile/calendar/eventlistproxy.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 -#include - -/** 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 mDateTimeHash; - mutable qint64 mCurrentDateTimeReference; - mutable KDateTime mToday; -}; - -#endif // EVENTLISTPROXY_H diff --git a/kdepim/mobile/calendar/eventsexporthandler.cpp b/kdepim/mobile/calendar/eventsexporthandler.cpp deleted file mode 100644 index 72b6ff6c..00000000 --- a/kdepim/mobile/calendar/eventsexporthandler.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 -#include -#include -#include -#include -#include - -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() ) - calendar->addIncidence( item.payload() ); - } - 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; -} diff --git a/kdepim/mobile/calendar/eventsexporthandler.h b/kdepim/mobile/calendar/eventsexporthandler.h deleted file mode 100644 index 936fd844..00000000 --- a/kdepim/mobile/calendar/eventsexporthandler.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 - diff --git a/kdepim/mobile/calendar/eventsfilterproxymodel.cpp b/kdepim/mobile/calendar/eventsfilterproxymodel.cpp deleted file mode 100644 index d77651df..00000000 --- a/kdepim/mobile/calendar/eventsfilterproxymodel.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 -#include - -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(); - - if ( item.hasPayload() ) { - const KCalCore::Event::Ptr event = item.payload(); - 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; -} - diff --git a/kdepim/mobile/calendar/eventsfilterproxymodel.h b/kdepim/mobile/calendar/eventsfilterproxymodel.h deleted file mode 100644 index aee36178..00000000 --- a/kdepim/mobile/calendar/eventsfilterproxymodel.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 - -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 - */ -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 diff --git a/kdepim/mobile/calendar/eventsguistatemanager.cpp b/kdepim/mobile/calendar/eventsguistatemanager.cpp deleted file mode 100644 index c5a0dada..00000000 --- a/kdepim/mobile/calendar/eventsguistatemanager.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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(); -} - diff --git a/kdepim/mobile/calendar/eventsguistatemanager.h b/kdepim/mobile/calendar/eventsguistatemanager.h deleted file mode 100644 index ff5b3e47..00000000 --- a/kdepim/mobile/calendar/eventsguistatemanager.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 diff --git a/kdepim/mobile/calendar/eventsimporthandler.cpp b/kdepim/mobile/calendar/eventsimporthandler.cpp deleted file mode 100644 index f0fb3ad4..00000000 --- a/kdepim/mobile/calendar/eventsimporthandler.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 -#include -#include -#include -#include -#include - -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", - "Error when trying to read the iCal %1:", - 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( event ); - item.setMimeType( KCalCore::Event::eventMimeType() ); - - items << item; - } - - return items; -} diff --git a/kdepim/mobile/calendar/eventsimporthandler.h b/kdepim/mobile/calendar/eventsimporthandler.h deleted file mode 100644 index 7a97334c..00000000 --- a/kdepim/mobile/calendar/eventsimporthandler.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 diff --git a/kdepim/mobile/calendar/hi48-apps-korganizer-mobile.png b/kdepim/mobile/calendar/hi48-apps-korganizer-mobile.png deleted file mode 100644 index 088c8044..00000000 Binary files a/kdepim/mobile/calendar/hi48-apps-korganizer-mobile.png and /dev/null differ diff --git a/kdepim/mobile/calendar/hi64-apps-korganizer-mobile.png b/kdepim/mobile/calendar/hi64-apps-korganizer-mobile.png deleted file mode 100644 index 6237e024..00000000 Binary files a/kdepim/mobile/calendar/hi64-apps-korganizer-mobile.png and /dev/null differ diff --git a/kdepim/mobile/calendar/hi80-apps-korganizer-mobile-harmattan.png b/kdepim/mobile/calendar/hi80-apps-korganizer-mobile-harmattan.png deleted file mode 100644 index d1589743..00000000 Binary files a/kdepim/mobile/calendar/hi80-apps-korganizer-mobile-harmattan.png and /dev/null differ diff --git a/kdepim/mobile/calendar/korganizer-mobile-background.png b/kdepim/mobile/calendar/korganizer-mobile-background.png deleted file mode 100644 index d9332734..00000000 Binary files a/kdepim/mobile/calendar/korganizer-mobile-background.png and /dev/null differ diff --git a/kdepim/mobile/calendar/korganizer-mobile.desktop b/kdepim/mobile/calendar/korganizer-mobile.desktop deleted file mode 100644 index 65659c3d..00000000 --- a/kdepim/mobile/calendar/korganizer-mobile.desktop +++ /dev/null @@ -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]=行動版 diff --git a/kdepim/mobile/calendar/korganizer-mobile.ico b/kdepim/mobile/calendar/korganizer-mobile.ico deleted file mode 100644 index a406ec3e..00000000 Binary files a/kdepim/mobile/calendar/korganizer-mobile.ico and /dev/null differ diff --git a/kdepim/mobile/calendar/korganizer-mobile.qml b/kdepim/mobile/calendar/korganizer-mobile.qml deleted file mode 100644 index 501143d8..00000000 --- a/kdepim/mobile/calendar/korganizer-mobile.qml +++ /dev/null @@ -1,599 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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 - } - } -} diff --git a/kdepim/mobile/calendar/korganizer-mobile.rc b/kdepim/mobile/calendar/korganizer-mobile.rc deleted file mode 100644 index 4105c5b0..00000000 --- a/kdepim/mobile/calendar/korganizer-mobile.rc +++ /dev/null @@ -1 +0,0 @@ -KORGANIZER_MOBILE_ICON ICON "korganizer-mobile.ico" diff --git a/kdepim/mobile/calendar/main.cpp b/kdepim/mobile/calendar/main.cpp deleted file mode 100644 index ddd029b7..00000000 --- a/kdepim/mobile/calendar/main.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* -* Copyright (c) 2010 Volker Krause -* -* 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 -#include -#include - -#include - -#include "mainview.h" - -#ifdef MAIL_SERIALIZER_PLUGIN_STATIC -#include - -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 app; - - KGlobal::locale()->insertCatalog( QLatin1String("libkcalutils") ); - KGlobal::locale()->insertCatalog( QLatin1String("libincidenceeditors") ); - KGlobal::locale()->insertCatalog( QLatin1String("calendarsupport") ); - - return app.exec(); -} - diff --git a/kdepim/mobile/calendar/mainview.cpp b/kdepim/mobile/calendar/mainview.cpp deleted file mode 100644 index 93a1289e..00000000 --- a/kdepim/mobile/calendar/mainview.cpp +++ /dev/null @@ -1,762 +0,0 @@ -/* -* Copyright (c) 2010 Volker Krause -* Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com -* Copyright (c) 2010 Andras Mantia -* -* 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -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( "org.kde.kcal", 4, 5, "IncidenceView" ); - qmlRegisterType( "org.kde.akonadi.calendar", 4, 5, "ConfigWidget" ); - qmlRegisterType( "org.kde.akonadi.calendar", 4, 5, "SearchWidget" ); - qmlRegisterType( "org.kde.calendarviews", 4, 5, "AgendaView" ); - qmlRegisterType( "org.kde.calendarviews", 4, 5, "MonthView" ); - qmlRegisterType( "org.kde.calendarviews", 4, 5, "TimelineView" ); - qmlRegisterType( "org.qt", 4, 7, "QmlDateEdit" ); - qmlRegisterType( "ClockHelper", 4, 5, "ClockHelper" ); - qmlRegisterUncreatableType( "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( 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(); - 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(); - if ( agendaViewItem ) - connect( configWidget, SIGNAL(configChanged()), agendaViewItem, SLOT(updateConfig()) ); - EventViews::MonthViewItem *monthViewItem = rootObject()->findChild(); - 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( event ); - editor->load( item ); - - if ( regularSelectionModel()->hasSelection() ) { - const QModelIndex index = regularSelectionModel()->selectedIndexes().first(); - const Akonadi::Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - 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( todo ); - editor->load( item ); - - if ( regularSelectionModel()->hasSelection() ) { - const QModelIndex index = regularSelectionModel()->selectedIndexes().first(); - const Akonadi::Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - 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(); - 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(); - 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( 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( 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( 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( job )->items().first(); - - const KCalCore::iTIPMethod method = job->property( "iTIPmethod" ).value(); - 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( 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(); - - 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(); - 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(); - - if ( monthItem ) { - monthItem->preferences()->setResourceColor( id, myColor ); - monthItem->updateConfig(); - } - } -} - - - - diff --git a/kdepim/mobile/calendar/mainview.h b/kdepim/mobile/calendar/mainview.h deleted file mode 100644 index ea677679..00000000 --- a/kdepim/mobile/calendar/mainview.h +++ /dev/null @@ -1,135 +0,0 @@ -/* -* Copyright (c) 2010 Volker Krause -* Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com -* Copyright (c) 2010 Andras Mantia -* -* 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 -#include -#include - -#include -#include - -#include - -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 m_openItemEditors; - KPIMIdentities::IdentityManager* m_identityManager; - Akonadi::IncidenceChanger *m_changer; - static EventViews::PrefsPtr m_calendarPrefs; - Akonadi::StandardCalendarActionManager *mActionManager; - Akonadi::ITIPHandler *mITIPHandler; -}; - -#endif // MAINVIEW_H diff --git a/kdepim/mobile/calendar/monthviewitem.cpp b/kdepim/mobile/calendar/monthviewitem.cpp deleted file mode 100644 index 2f8d58a6..00000000 --- a/kdepim/mobile/calendar/monthviewitem.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 -#include - -#include -#include - -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( calendarObj ); - kDebug() << calendarObj << cal; - if ( cal ) { - mView->setCalendar( cal->weakPointer().toStrongRef().dynamicCast() ); - 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(); -} - diff --git a/kdepim/mobile/calendar/monthviewitem.h b/kdepim/mobile/calendar/monthviewitem.h deleted file mode 100644 index b276a674..00000000 --- a/kdepim/mobile/calendar/monthviewitem.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 diff --git a/kdepim/mobile/calendar/qmldateedit.cpp b/kdepim/mobile/calendar/qmldateedit.cpp deleted file mode 100644 index 595914c8..00000000 --- a/kdepim/mobile/calendar/qmldateedit.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 ); -} - -} - diff --git a/kdepim/mobile/calendar/qmldateedit.h b/kdepim/mobile/calendar/qmldateedit.h deleted file mode 100644 index 40e2f71e..00000000 --- a/kdepim/mobile/calendar/qmldateedit.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 -#include -#include "declarativewidgetwrapper.h" - - -namespace Qt { - -class QmlDateEdit : public DeclarativeWidgetWrapper -{ - 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 diff --git a/kdepim/mobile/calendar/searchwidget.cpp b/kdepim/mobile/calendar/searchwidget.cpp deleted file mode 100644 index 53c95404..00000000 --- a/kdepim/mobile/calendar/searchwidget.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 -#include - -#include -#include - -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(); -} - diff --git a/kdepim/mobile/calendar/searchwidget.h b/kdepim/mobile/calendar/searchwidget.h deleted file mode 100644 index 52321477..00000000 --- a/kdepim/mobile/calendar/searchwidget.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 -#include - -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 diff --git a/kdepim/mobile/calendar/searchwidget.ui b/kdepim/mobile/calendar/searchwidget.ui deleted file mode 100644 index d249f148..00000000 --- a/kdepim/mobile/calendar/searchwidget.ui +++ /dev/null @@ -1,223 +0,0 @@ - - - SearchWidget - - - - 0 - 0 - 430 - 278 - - - - - - - Search for: - - - - - - - true - - - - - - - In: - - - - - - - - 0 - - - 3 - - - 0 - - - 3 - - - - - Summaries - - - - - - - Descriptions - - - - - - - Categories - - - - - - - Locations - - - - - - - - - - Between: - - - - - - - - - true - - - - - - - - 0 - 0 - - - - and - - - Qt::AlignCenter - - - - - - - true - - - - - - - - - Include events within the specified date range - - - - - - - Include To-Dos without a due date - - - - - - - Located in: - - - - - - - - 0 - - - 3 - - - 0 - - - 3 - - - - - any folder - - - true - - - - - - - only in folder - - - - - - - false - - - - - - - - - - - KDateComboBox - QComboBox -
kdatecombobox.h
-
- - KLineEdit - QLineEdit -
klineedit.h
-
- - Akonadi::CollectionComboBox - QComboBox -
akonadi/collectioncombobox.h
-
-
- - - - locatedInSpecificCollection - toggled(bool) - collectionCombo - setEnabled(bool) - - - 138 - 235 - - - 217 - 239 - - - - -
diff --git a/kdepim/mobile/calendar/settings.kcfg b/kdepim/mobile/calendar/settings.kcfg deleted file mode 100644 index 76a628c8..00000000 --- a/kdepim/mobile/calendar/settings.kcfg +++ /dev/null @@ -1,72 +0,0 @@ - - - - kglobalsettings.h - - - - - QDateTime(QDate(1752,1,1), QTime(7,0)) - - - - - QDateTime(QDate(1752,1,1), QTime(8,0)) - - - QDateTime(QDate(1752,1,1), QTime(17,0)) - - - - - - - - - - - - - - - - - - - - - - - CategoryInsideResourceOutside - - - - - - - - - - - MonthItemCategoryInsideResourceOutside - - - - - - - - - - - - - - - - - true - - diff --git a/kdepim/mobile/calendar/settings.kcfgc b/kdepim/mobile/calendar/settings.kcfgc deleted file mode 100644 index 734c1668..00000000 --- a/kdepim/mobile/calendar/settings.kcfgc +++ /dev/null @@ -1,6 +0,0 @@ -File=settings.kcfg -ClassName=Settings -Mutators=true -Singleton=true -ItemAccessors=true -SetUserTexts=true diff --git a/kdepim/mobile/calendar/timelineviewitem.cpp b/kdepim/mobile/calendar/timelineviewitem.cpp deleted file mode 100644 index 719f56ac..00000000 --- a/kdepim/mobile/calendar/timelineviewitem.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 -#include - -#include -#include -#include -#include - -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( calendarObj ); - kDebug() << calendarObj << cal; - if ( cal ) { - m_view->setCalendar( cal->weakPointer().toStrongRef().dynamicCast() ); - 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 ); -} - diff --git a/kdepim/mobile/calendar/timelineviewitem.h b/kdepim/mobile/calendar/timelineviewitem.h deleted file mode 100644 index 77e9d2be..00000000 --- a/kdepim/mobile/calendar/timelineviewitem.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 - -#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 diff --git a/kdepim/mobile/contacts/BulkActionComponent.qml b/kdepim/mobile/contacts/BulkActionComponent.qml deleted file mode 100644 index cab34578..00000000 --- a/kdepim/mobile/contacts/BulkActionComponent.qml +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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; - } - } -} diff --git a/kdepim/mobile/contacts/CMakeLists.txt b/kdepim/mobile/contacts/CMakeLists.txt deleted file mode 100644 index 77532068..00000000 --- a/kdepim/mobile/contacts/CMakeLists.txt +++ /dev/null @@ -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} ) diff --git a/kdepim/mobile/contacts/ConfigDialog.qml b/kdepim/mobile/contacts/ConfigDialog.qml deleted file mode 100644 index 1767d699..00000000 --- a/kdepim/mobile/contacts/ConfigDialog.qml +++ /dev/null @@ -1,88 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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() - } - } -} diff --git a/kdepim/mobile/contacts/ContactListView.qml b/kdepim/mobile/contacts/ContactListView.qml deleted file mode 100644 index 964a6e10..00000000 --- a/kdepim/mobile/contacts/ContactListView.qml +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 - } - ] - } - ] -} diff --git a/kdepim/mobile/contacts/KAddressBookActions.qml b/kdepim/mobile/contacts/KAddressBookActions.qml deleted file mode 100644 index 67f1212f..00000000 --- a/kdepim/mobile/contacts/KAddressBookActions.qml +++ /dev/null @@ -1,140 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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" } - } -} diff --git a/kdepim/mobile/contacts/Messages.sh b/kdepim/mobile/contacts/Messages.sh deleted file mode 100644 index a2afa3f0..00000000 --- a/kdepim/mobile/contacts/Messages.sh +++ /dev/null @@ -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 diff --git a/kdepim/mobile/contacts/configwidget.cpp b/kdepim/mobile/contacts/configwidget.cpp deleted file mode 100644 index df5d9629..00000000 --- a/kdepim/mobile/contacts/configwidget.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 -#include -#include - -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(); -} - diff --git a/kdepim/mobile/contacts/configwidget.h b/kdepim/mobile/contacts/configwidget.h deleted file mode 100644 index 32b4d4e3..00000000 --- a/kdepim/mobile/contacts/configwidget.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 -#include - -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 diff --git a/kdepim/mobile/contacts/configwidget.ui b/kdepim/mobile/contacts/configwidget.ui deleted file mode 100644 index ed6a9fed..00000000 --- a/kdepim/mobile/contacts/configwidget.ui +++ /dev/null @@ -1,105 +0,0 @@ - - - ConfigWidget - - - - 0 - 0 - 241 - 117 - - - - - - - - - - 75 - true - - - - Contact Actions - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - Show address on: - - - - - - - - - - - - - - - - - 75 - true - - - - LDAP Servers - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
-
- - -
diff --git a/kdepim/mobile/contacts/contact-editor.qml b/kdepim/mobile/contacts/contact-editor.qml deleted file mode 100644 index e971e617..00000000 --- a/kdepim/mobile/contacts/contact-editor.qml +++ /dev/null @@ -1,143 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 - } - } - } - ] - } - } -} diff --git a/kdepim/mobile/contacts/contactcompletionmodel.cpp b/kdepim/mobile/contacts/contactcompletionmodel.cpp deleted file mode 100644 index a5acb5f7..00000000 --- a/kdepim/mobile/contacts/contactcompletionmodel.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2009 Tobias Koenig - - 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 -#include -#include -#include - -#include - -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() ) { - // Pass modeltest - if ( role == Qt::DisplayRole ) - return item.remoteId(); - - return QVariant(); - } - - if ( role == Qt::DisplayRole || role == Qt::EditRole ) { - const KABC::Addressee contact = item.payload(); - - 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" diff --git a/kdepim/mobile/contacts/contactcompletionmodel_p.h b/kdepim/mobile/contacts/contactcompletionmodel_p.h deleted file mode 100644 index e836a0d3..00000000 --- a/kdepim/mobile/contacts/contactcompletionmodel_p.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2009 Tobias Koenig - - 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 - -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 diff --git a/kdepim/mobile/contacts/contacteditorview.cpp b/kdepim/mobile/contacts/contacteditorview.cpp deleted file mode 100644 index 4e665422..00000000 --- a/kdepim/mobile/contacts/contacteditorview.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 - -#include -#include -#include - -#include -#include - -#include - -using namespace Akonadi; - -typedef DeclarativeWidgetBase DeclarativeEditorGeneral; -typedef DeclarativeWidgetBase DeclarativeEditorBusiness; -typedef DeclarativeWidgetBase DeclarativeEditorLocation; -typedef DeclarativeWidgetBase DeclarativeEditorCrypto; -typedef DeclarativeWidgetBase 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 &partIdentifiers ) const - { - return partIdentifiers.contains( Item::FullPayload ); - } - - bool hasSupportedPayload( const Item &item ) const - { - return item.hasPayload(); - } - - 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 mDetailEditors; -}; - -void ContactEditorView::Private::addDetailEditor( EditorBase *editor ) -{ - if ( editor != 0 ) { - mDetailEditors << editor; - - if ( mItem.hasPayload() ) { - const KABC::Addressee contact = mItem.payload(); - // 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() ); - - mItem = item; - mCollection = item.parentCollection(); - - const KABC::Addressee contact = mItem.payload(); - // 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( 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( "org.kde.contacteditors", 4, 5, "ContactEditorGeneral" ); - qmlRegisterType( "org.kde.contacteditors", 4, 5, "ContactEditorBusiness" ); - qmlRegisterType( "org.kde.contacteditors", 4, 5, "ContactEditorLocation" ); - qmlRegisterType( "org.kde.contacteditors", 4, 5, "ContactEditorCrypto" ); - qmlRegisterType( "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" diff --git a/kdepim/mobile/contacts/contacteditorview.h b/kdepim/mobile/contacts/contacteditorview.h deleted file mode 100644 index abf8b183..00000000 --- a/kdepim/mobile/contacts/contacteditorview.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 CONTACTEDITORVIEW_H -#define CONTACTEDITORVIEW_H - -#include "kdeclarativefullscreenview.h" - -namespace Akonadi { - class Collection; - class Item; -} - -class EditorBusiness; -class EditorCrypto; -class EditorGeneral; -class EditorLocation; -class EditorMore; - -class ContactEditorView : public KDeclarativeFullScreenView -{ - Q_OBJECT - - public: - explicit ContactEditorView( QWidget *parent = 0 ); - - ~ContactEditorView(); - - void setEditorGeneral( EditorGeneral *editor ); - - void setEditorBusiness( EditorBusiness *editor ); - - void setEditorLocation( EditorLocation *editor ); - - void setEditorCrypto( EditorCrypto *editor ); - - void setEditorMore( EditorMore *editor ); - - void setDefaultCollection( const Akonadi::Collection &collection ); - - public Q_SLOTS: - void loadContact( const Akonadi::Item &item ); - - void save(); - void cancel(); - - Q_SIGNALS: - void requestLaunchAccountWizard(); - - protected: - void closeEvent( QCloseEvent *event ); - virtual void doDelayedInit(); - - private: - class Private; - Private *const d; - - Q_PRIVATE_SLOT( d, void saveFinished() ) - Q_PRIVATE_SLOT( d, void saveFailed( IncidenceEditorNG::EditorItemManager::SaveAction, - const QString & ) ) - Q_PRIVATE_SLOT( d, void collectionChanged( const Akonadi::Collection & ) ) -}; - -#endif diff --git a/kdepim/mobile/contacts/contactgroup-editor.qml b/kdepim/mobile/contacts/contactgroup-editor.qml deleted file mode 100644 index c0e1c17f..00000000 --- a/kdepim/mobile/contacts/contactgroup-editor.qml +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 - - anchors.topMargin: 40 - anchors.leftMargin: 40; - anchors.rightMargin: 4; - - flickableItem: Flickable { - contentHeight: editor.height; - - ContactEditors.ContactGroupEditor { - id: editor; - width: parent.width; - } - } - } -} diff --git a/kdepim/mobile/contacts/contactgroupeditorview.cpp b/kdepim/mobile/contacts/contactgroupeditorview.cpp deleted file mode 100644 index 9030cd96..00000000 --- a/kdepim/mobile/contacts/contactgroupeditorview.cpp +++ /dev/null @@ -1,236 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 "contactgroupeditorview.h" - -#include "editorcontactgroup.h" -#include "declarativewidgetbase.h" - -#include - -#include -#include - -#include -#include - -#include - -using namespace Akonadi; - -typedef DeclarativeWidgetBase DeclarativeEditorContactGroup; - -class ContactGroupEditorView::Private : public IncidenceEditorNG::ItemEditorUi -{ - ContactGroupEditorView *const q; - - public: - explicit Private( ContactGroupEditorView *parent ) - : q( parent ), mItemManager( new IncidenceEditorNG::EditorItemManager( this ) ), mEditor( 0 ) - { - } - - ~Private() - { - delete mItemManager; - } - - public: // slots - void saveFinished(); - void saveFailed( IncidenceEditorNG::EditorItemManager::SaveAction, const QString &errorMessage ); - void collectionChanged( const Akonadi::Collection &collection ); - - public: // ItemEditorUi interface - bool containsPayloadIdentifiers( const QSet &partIdentifiers ) const - { - return partIdentifiers.contains( Item::FullPayload ); - } - - bool hasSupportedPayload( const Item &item ) const - { - return item.hasPayload(); - } - - bool isDirty() const - { - return true; - } - - bool isValid() const - { - return true; - } - - void load( const Item &item ); - Item save( const Item &item ); - Collection selectedCollection() const; - void reject( RejectReason reason, const QString &errorMessage = QString() ); - - public: - Item mItem; - Collection mCollection; - Collection mDefaultCollection; - - IncidenceEditorNG::EditorItemManager *mItemManager; - - EditorContactGroup *mEditor; -}; - -void ContactGroupEditorView::Private::saveFinished() -{ - kDebug(); - q->deleteLater(); -} - -void ContactGroupEditorView::Private::saveFailed( IncidenceEditorNG::EditorItemManager::SaveAction, const QString &errorMessage ) -{ - kError() << errorMessage; -} - -void ContactGroupEditorView::Private::load( const Item &item ) -{ - Q_ASSERT( item.hasPayload() ); - - mItem = item; - mCollection = item.parentCollection(); - - const KABC::ContactGroup contactGroup = mItem.payload(); - - if ( mEditor != 0 ) { - mEditor->setDefaultCollection( mCollection ); - mEditor->loadContactGroup( contactGroup ); - } -} - -Item ContactGroupEditorView::Private::save( const Item &item ) -{ - Item result = item; - - result.setMimeType( KABC::ContactGroup::mimeType() ); - - KABC::ContactGroup contactGroup; - if ( mEditor != 0 ) { - mEditor->saveContactGroup( contactGroup ); - } - - result.setPayload( contactGroup ); - - return result; -} - -void ContactGroupEditorView::Private::collectionChanged( const Akonadi::Collection &collection ) -{ - mCollection = collection; -} - -Collection ContactGroupEditorView::Private::selectedCollection() const -{ - return ( !mCollection.isValid() && mEditor != 0 ? mEditor->selectedCollection() : mCollection ); -} - -void ContactGroupEditorView::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(); -} - -ContactGroupEditorView::ContactGroupEditorView( QWidget *parent ) - : KDeclarativeFullScreenView( QLatin1String( "contactgroup-editor" ), parent ), - d( new Private( this ) ) -{ - setAttribute(Qt::WA_DeleteOnClose); - setWindowTitle( i18n( "Kontact Touch Contacts" ) ); -} - -void ContactGroupEditorView::doDelayedInit() -{ - qmlRegisterType( "org.kde.contacteditors", 4, 5, "ContactGroupEditor" ); - - 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)) ); -} - -ContactGroupEditorView::~ContactGroupEditorView() -{ - delete d; -} - -void ContactGroupEditorView::setEditor( EditorContactGroup *editor ) -{ - d->mEditor = editor; - - if ( d->mEditor != 0 ) { - if ( d->mDefaultCollection.isValid() ) { - d->mEditor->setDefaultCollection( d->mDefaultCollection ); - } - if ( d->mCollection.isValid() ) { - d->mEditor->setDefaultCollection( d->mCollection ); - } - connect( d->mEditor, SIGNAL(cancelClicked()) , SLOT(close()) ); - connect( d->mEditor, SIGNAL(saveClicked()), SLOT(save()) ); - connect( d->mEditor, SIGNAL(collectionChanged(Akonadi::Collection)), - SLOT(collectionChanged(Akonadi::Collection)) ); - connect( d->mEditor, SIGNAL(requestLaunchAccountWizard()), - this, SIGNAL(requestLaunchAccountWizard()) ); - } -} - -void ContactGroupEditorView::setDefaultCollection( const Collection &collection ) -{ - d->mDefaultCollection = collection; -} - -void ContactGroupEditorView::loadContactGroup( const Item &item ) -{ - if ( !d->mEditor ) { - // the editor is not fully loaded yet, so try later again - QMetaObject::invokeMethod( this, "loadContactGroup", Qt::QueuedConnection, Q_ARG( Akonadi::Item, item ) ); - } else { - d->mItemManager->load( item ); - } -} - -void ContactGroupEditorView::save() -{ - d->mItemManager->save(); -} - -void ContactGroupEditorView::cancel() -{ - deleteLater(); -} - -void ContactGroupEditorView::closeEvent( QCloseEvent *event ) -{ - Q_UNUSED( event ); - cancel(); -} - -#include "moc_contactgroupeditorview.cpp" diff --git a/kdepim/mobile/contacts/contactgroupeditorview.h b/kdepim/mobile/contacts/contactgroupeditorview.h deleted file mode 100644 index b8a82772..00000000 --- a/kdepim/mobile/contacts/contactgroupeditorview.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 CONTACTGROUPEDITORVIEW_H -#define CONTACTGROUPEDITORVIEW_H - -#include "kdeclarativefullscreenview.h" - -namespace Akonadi { - class Collection; - class Item; -} - -class EditorContactGroup; - -class ContactGroupEditorView : public KDeclarativeFullScreenView -{ - Q_OBJECT - - public: - explicit ContactGroupEditorView( QWidget *parent = 0 ); - - ~ContactGroupEditorView(); - - void setEditor( EditorContactGroup *editor ); - - void setDefaultCollection( const Akonadi::Collection &collection ); - - public Q_SLOTS: - void loadContactGroup( const Akonadi::Item &item ); - - void save(); - void cancel(); - - Q_SIGNALS: - void requestLaunchAccountWizard(); - - protected: - void closeEvent( QCloseEvent *event ); - virtual void doDelayedInit(); - - private: - class Private; - Private *const d; - - Q_PRIVATE_SLOT( d, void saveFinished() ) - Q_PRIVATE_SLOT( d, void saveFailed( IncidenceEditorNG::EditorItemManager::SaveAction, - const QString & ) ) - Q_PRIVATE_SLOT( d, void collectionChanged( const Akonadi::Collection & ) ) -}; - -#endif diff --git a/kdepim/mobile/contacts/contactgroupviewitem.cpp b/kdepim/mobile/contacts/contactgroupviewitem.cpp deleted file mode 100644 index 81c60cb7..00000000 --- a/kdepim/mobile/contacts/contactgroupviewitem.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "contactgroupviewitem.h" - -#include - -using namespace Akonadi; -using namespace Akonadi::Contact; - -ExtendedContactGroupViewer::ExtendedContactGroupViewer( QWidget *parent ) - : ContactGroupViewer( parent ) -{ -} - -void ExtendedContactGroupViewer::itemRemoved() -{ - emit contactGroupRemoved(); -} - - -ContactGroupViewItem::ContactGroupViewItem(QDeclarativeItem* parent) - : DeclarativeAkonadiItem( parent ) -{ - m_viewer = new ExtendedContactGroupViewer( 0 ); - connect( m_viewer, SIGNAL(contactGroupRemoved()), SIGNAL(contactGroupRemoved()) ); - - setWidget( m_viewer ); -} - -ContactGroupViewItem::~ContactGroupViewItem() -{ - delete m_viewer; -} - -qint64 ContactGroupViewItem::itemId() const -{ - return m_viewer->contactGroup().id(); -} - -void ContactGroupViewItem::setItemId(qint64 id) -{ - if ( itemId() != id ) - m_viewer->setContactGroup( Akonadi::Item( id ) ); -} - diff --git a/kdepim/mobile/contacts/contactgroupviewitem.h b/kdepim/mobile/contacts/contactgroupviewitem.h deleted file mode 100644 index c65fa680..00000000 --- a/kdepim/mobile/contacts/contactgroupviewitem.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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_CONTACT_CONTACTGROUPVIEWITEM_H -#define AKONADI_CONTACT_CONTACTGROUPVIEWITEM_H - -#include "declarativeakonadiitem.h" - -#include - -namespace Akonadi { - -namespace Contact { - -/** - * @short A wrapper class to make the 'removed' signal available. - */ -class ExtendedContactGroupViewer : public ContactGroupViewer -{ - Q_OBJECT - - public: - explicit ExtendedContactGroupViewer( QWidget *parent = 0 ); - - Q_SIGNALS: - void contactGroupRemoved(); - - private: - virtual void itemRemoved(); -}; - -class ContactGroupViewItem : public DeclarativeAkonadiItem -{ - Q_OBJECT - - public: - explicit ContactGroupViewItem( QDeclarativeItem *parent = 0 ); - ~ContactGroupViewItem(); - - qint64 itemId() const; - void setItemId( qint64 id ); - - Q_SIGNALS: - void contactGroupRemoved(); - - private: - ExtendedContactGroupViewer *m_viewer; -}; - -} -} - -#endif diff --git a/kdepim/mobile/contacts/contactlistproxy.cpp b/kdepim/mobile/contacts/contactlistproxy.cpp deleted file mode 100644 index 6373653b..00000000 --- a/kdepim/mobile/contacts/contactlistproxy.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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 "contactlistproxy.h" - -#include -#include -#include -#include -#include -#include - -ContactImageProvider::ContactImageProvider() - : QDeclarativeImageProvider( QDeclarativeImageProvider::Pixmap ), mModel( 0 ) -{ -} - -QPixmap ContactImageProvider::requestPixmap( const QString &id, QSize *size, const QSize &requestedSize ) -{ - int width = 50; - int height = 50; - if ( requestedSize.isValid() ) { - width = requestedSize.width(); - height = requestedSize.height(); - } - - if ( size ) - *size = QSize( width, height ); - - const Akonadi::Item item( id.toLongLong() ); - const QModelIndexList indexes = Akonadi::EntityTreeModel::modelIndexesForItem( mModel, item ); - if ( indexes.isEmpty() || !indexes.first().isValid() ) - return QPixmap(); - - const QModelIndex index = indexes.first(); - - const Akonadi::Item contactItem = index.data( Akonadi::EntityTreeModel::ItemRole ).value(); - if ( !contactItem.isValid() ) - return QPixmap(); - - if ( contactItem.hasPayload() ) { - const KABC::Addressee addressee = contactItem.payload(); - if ( addressee.photo().isEmpty() ) { - const QIcon icon = KIconLoader::global()->loadIcon( QLatin1String("user-identity"), KIconLoader::Dialog, KIconLoader::SizeHuge ); - return icon.pixmap( width, height ); - } - - return QPixmap::fromImage( addressee.photo().data().scaled( width, height, Qt::KeepAspectRatio, Qt::SmoothTransformation ) ); - } else if ( contactItem.hasPayload() ) { - const QIcon icon = KIconLoader::global()->loadIcon( QLatin1String("x-mail-distribution-list"), KIconLoader::Dialog, KIconLoader::SizeHuge ); - return icon.pixmap( width, height ); - } - - return QPixmap(); -} - -void ContactImageProvider::setModel( QAbstractItemModel *model ) -{ - mModel = model; -} - -ContactListProxy::ContactListProxy(QObject* parent) : ListProxy( parent ) -{ - setDynamicSortFilter( true ); - sort( 0, Qt::AscendingOrder ); -} - -QVariant ContactListProxy::data(const QModelIndex& index, int role) const -{ - const Akonadi::Item item = QSortFilterProxyModel::data( index, Akonadi::EntityTreeModel::ItemRole ).value(); - if ( item.isValid() && item.hasPayload() ) { - const KABC::Addressee addressee = item.payload(); - switch ( role ) { - case NameRole: - return addressee.realName(); - case PictureRole: - return QString::fromLatin1( "image://contact_images/%1" ).arg( item.id() ); - case TypeRole: - return QLatin1String( "contact" ); - } - } else if ( item.isValid() && item.hasPayload() ) { - const KABC::ContactGroup group = item.payload(); - switch( role ) { - case NameRole: - return group.name(); - case PictureRole: - return QString::fromLatin1( "image://contact_images/%1" ).arg( item.id() ); - case TypeRole: - return QLatin1String( "group" ); - } - } else { - if ( role == TypeRole ) - return QString(); - } - - return QSortFilterProxyModel::data( index, role ); -} - -void ContactListProxy::setSourceModel(QAbstractItemModel* sourceModel) -{ - ListProxy::setSourceModel(sourceModel); - QHash names = roleNames(); - names.insert( Akonadi::EntityTreeModel::ItemIdRole, "itemId" ); - names.insert( NameRole, "name" ); - names.insert( PictureRole, "picture" ); - setRoleNames( names ); -} - -static QString nameForItem( const Akonadi::Item &item ) -{ - if ( item.hasPayload() ) - return item.payload().realName(); - - if ( item.hasPayload() ) - return item.payload().name(); - - return QString(); -} - -bool ContactListProxy::lessThan( const QModelIndex& left, const QModelIndex& right ) const -{ - const Akonadi::Item leftItem = left.data( Akonadi::EntityTreeModel::ItemRole ).value(); - const Akonadi::Item rightItem = right.data( Akonadi::EntityTreeModel::ItemRole ).value(); - - const QString leftName = nameForItem( leftItem ); - const QString rightName = nameForItem( rightItem ); - - return (QString::localeAwareCompare( leftName, rightName ) < 0); -} - -QString ContactListProxy::typeForIndex(int row) const -{ - return index( row, 0 ).data( TypeRole ).toString(); -} - diff --git a/kdepim/mobile/contacts/contactlistproxy.h b/kdepim/mobile/contacts/contactlistproxy.h deleted file mode 100644 index 353e2a6f..00000000 --- a/kdepim/mobile/contacts/contactlistproxy.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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 CONTACTLISTPROXY_H -#define CONTACTLISTPROXY_H - -#include "listproxy.h" - -#include -#include - -class ContactImageProvider : public QDeclarativeImageProvider -{ - public: - ContactImageProvider(); - - QPixmap requestPixmap( const QString &id, QSize *size, const QSize &requestedSize ); - - void setModel( QAbstractItemModel *model ); - - private: - QAbstractItemModel *mModel; -}; - -/** Adaptor proxy for contact access from QML. */ -class ContactListProxy : public ListProxy -{ - Q_OBJECT - public: - enum Role { - NameRole = Akonadi::EntityTreeModel::UserRole + 1, - PictureRole, - TypeRole - }; - - explicit ContactListProxy( QObject* parent = 0 ); - - QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const; - void setSourceModel(QAbstractItemModel* sourceModel); - bool lessThan(const QModelIndex& left, const QModelIndex& right) const; - - public slots: - QString typeForIndex( int row ) const; -}; - -#endif /* CONTACTLISTPROXY_H */ diff --git a/kdepim/mobile/contacts/contactmetadata_p.h b/kdepim/mobile/contacts/contactmetadata_p.h deleted file mode 100644 index 311fd39d..00000000 --- a/kdepim/mobile/contacts/contactmetadata_p.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2009 Tobias Koenig - - 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_CONTACTMETADATA_P_H -#define AKONADI_CONTACTMETADATA_P_H - -#include -#include - -namespace Akonadi -{ - -class Item; - -/** - * @short A dummy class until we can access the ContactMetaData class from kdepimlibs - */ -class ContactMetaData -{ - public: - /** - * Creates a contact meta data object. - */ -#ifdef KDEPIM_STATIC_LIBS - ContactMetaData(); -#else - ContactMetaData() {} -#endif - - /** - * Destroys the contact meta data object. - */ -#ifdef KDEPIM_STATIC_LIBS - ~ContactMetaData(); -#else - ~ContactMetaData() {} -#endif - - /** - * Loads the meta data for the given @p contact. - */ -#ifdef KDEPIM_STATIC_LIBS - void load( const Akonadi::Item &contact ); -#else - void load( const Akonadi::Item &contact ) {} -#endif - - /** - * Stores the meta data to the given @p contact. - */ -#ifdef KDEPIM_STATIC_LIBS - void store( Akonadi::Item &contact ); -#else - void store( Akonadi::Item &contact ) {} -#endif - - /** - * Sets the mode that is used for the display - * name of that contact. - */ -#ifdef KDEPIM_STATIC_LIBS - void setDisplayNameMode( int mode ); -#else - void setDisplayNameMode( int mode ) {} -#endif - - /** - * Returns the mode that is used for the display - * name of that contact. - */ -#ifdef KDEPIM_STATIC_LIBS - int displayNameMode() const; -#else - int displayNameMode() const { return 0; } -#endif - - /** - * Sets the @p descriptions of the custom fields of that contact. - * - * The description list contains a QVariantMap for each custom field - * with the following keys: - * - key (string) The identifier of the field - * - title (string) The i18n'ed title of the field - * - type (string) The type description of the field - * Possible values for type description are - * - text - * - numeric - * - boolean - * - date - * - time - * - datetime - */ -#ifdef KDEPIM_STATIC_LIBS - void setCustomFieldDescriptions( const QVariantList &descriptions ); -#else - void setCustomFieldDescriptions( const QVariantList &descriptions ) {} -#endif - - /** - * Returns the descriptions of the custom fields of the contact. - */ -#ifdef KDEPIM_STATIC_LIBS - QVariantList customFieldDescriptions() const; -#else - QVariantList customFieldDescriptions() const { return QVariantList(); } -#endif -}; - -} - -#endif diff --git a/kdepim/mobile/contacts/contactsexporthandler.cpp b/kdepim/mobile/contacts/contactsexporthandler.cpp deleted file mode 100644 index e56fb064..00000000 --- a/kdepim/mobile/contacts/contactsexporthandler.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "contactsexporthandler.h" - -#include -#include -#include -#include -#include - -#include - -static QString contactFileName( const KABC::Addressee &contact ) -{ - if ( !contact.givenName().isEmpty() && !contact.familyName().isEmpty() ) - return QString::fromLatin1( "%1_%2" ).arg( contact.givenName() ).arg( contact.familyName() ); - - if ( !contact.familyName().isEmpty() ) - return contact.familyName(); - - if ( !contact.givenName().isEmpty() ) - return contact.givenName(); - - if ( !contact.organization().isEmpty() ) - return contact.organization(); - - return contact.uid(); -} - -static bool exportVCard( const QString &fileName, const QByteArray &data ) -{ - KUrl url( fileName ); - if ( url.isLocalFile() && QFileInfo( url.toLocalFile() ).exists() ) { - if ( KMessageBox::questionYesNo( 0, i18n( "Do you want to overwrite file \"%1\"?", url.toLocalFile() ) ) == KMessageBox::No ) - return false; - } - - QFile file( fileName ); - if ( !file.open( QIODevice::WriteOnly ) ) - return false; - - file.write( data ); - file.close(); - - return true; -} - -QString ContactsExportHandler::dialogText() const -{ - return i18n( "Which contacts shall be exported?" ); -} - -QString ContactsExportHandler::dialogAllText() const -{ - return i18n( "All Contacts" ); -} - -QString ContactsExportHandler::dialogLocalOnlyText() const -{ - return i18n( "Contacts in current folder" ); -} - -QStringList ContactsExportHandler::mimeTypes() const -{ - return QStringList( KABC::Addressee::mimeType() ); -} - -bool ContactsExportHandler::exportItems( const Akonadi::Item::List &items ) -{ - KABC::Addressee::List contacts; - - foreach ( const Akonadi::Item &item, items ) { - if ( item.hasPayload() ) - contacts << item.payload(); - } - - KABC::VCardConverter converter; - QString fileName; - - bool ok = true; - if ( contacts.count() == 1 ) { - fileName = KFileDialog::getSaveFileName( QString(contactFileName( contacts.first() ) + QLatin1String( ".vcf" )), QLatin1String( "*.vcf" ) ); - if ( fileName.isEmpty() ) // user canceled export - return true; - - ok = exportVCard( fileName, converter.createVCards( contacts, KABC::VCardConverter::v3_0 ) ); - } else { - const QString msg = i18n( "You have selected a list of contacts, shall they be " - "exported to several files?" ); - - switch ( KMessageBox::questionYesNo( 0, msg, QString(), KGuiItem(i18n( "Export to Several Files" ) ), - KGuiItem( i18n( "Export to One File" ) ) ) ) { - case KMessageBox::Yes: - { - const QString path = KFileDialog::getExistingDirectory(); - if ( path.isEmpty() ) - return true; // user canceled export - - foreach ( const KABC::Addressee &contact, contacts ) { - fileName = path + QDir::separator() + contactFileName( contact ) + QLatin1String( ".vcf" ); - - const bool tmpOk = exportVCard( fileName, converter.createVCard( contact, KABC::VCardConverter::v3_0 ) ); - - ok = ok && tmpOk; - } - } - break; - case KMessageBox::No: // fall through - default: - { - fileName = KFileDialog::getSaveFileName( KUrl( "addressbook.vcf" ), QLatin1String( "*.vcf" ) ); - if ( fileName.isEmpty() ) - return true; // user canceled export - - ok = exportVCard( fileName, converter.createVCards( contacts, KABC::VCardConverter::v3_0 ) ); - } - } - } - - return ok; -} diff --git a/kdepim/mobile/contacts/contactsexporthandler.h b/kdepim/mobile/contacts/contactsexporthandler.h deleted file mode 100644 index 9af3440c..00000000 --- a/kdepim/mobile/contacts/contactsexporthandler.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 CONTACTSEXPORTHANDLER_H -#define CONTACTSEXPORTHANDLER_H - -#include "../lib/exporthandlerbase.h" - -class ContactsExportHandler : 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 diff --git a/kdepim/mobile/contacts/contactsguistatemanager.cpp b/kdepim/mobile/contacts/contactsguistatemanager.cpp deleted file mode 100644 index cd5d2762..00000000 --- a/kdepim/mobile/contacts/contactsguistatemanager.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "contactsguistatemanager.h" - -bool ContactsGuiStateManager::inViewContactState() const -{ - return (currentState() == ViewContactState); -} - -bool ContactsGuiStateManager::inViewContactGroupState() const -{ - return (currentState() == ViewContactGroupState); -} - -void ContactsGuiStateManager::emitChangedSignal() -{ - GuiStateManager::emitChangedSignal(); - - emit guiStateChanged(); -} - diff --git a/kdepim/mobile/contacts/contactsguistatemanager.h b/kdepim/mobile/contacts/contactsguistatemanager.h deleted file mode 100644 index 377a506e..00000000 --- a/kdepim/mobile/contacts/contactsguistatemanager.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 CONTACTSGUISTATEMANAGER_H -#define CONTACTSGUISTATEMANAGER_H - -#include "../lib/guistatemanager.h" - -class ContactsGuiStateManager : public GuiStateManager -{ - Q_OBJECT - - Q_PROPERTY( bool inViewContactState READ inViewContactState NOTIFY guiStateChanged ) - Q_PROPERTY( bool inViewContactGroupState READ inViewContactGroupState NOTIFY guiStateChanged ) - - Q_ENUMS( GuiState ) - - public: - enum GuiState { - ViewContactState = GuiStateManager::UserState, - ViewContactGroupState - }; - - /** - * Returns whether the current state is the view contact state. - */ - bool inViewContactState() const; - - /** - * Returns whether the current state is the view contact group state. - */ - bool inViewContactGroupState() const; - - Q_SIGNALS: - void guiStateChanged(); - - protected: - virtual void emitChangedSignal(); -}; - -#endif diff --git a/kdepim/mobile/contacts/contactsimporthandler.cpp b/kdepim/mobile/contacts/contactsimporthandler.cpp deleted file mode 100644 index 9217d73e..00000000 --- a/kdepim/mobile/contacts/contactsimporthandler.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "contactsimporthandler.h" - -#include -#include -#include -#include - -#include - -QString ContactsImportHandler::fileDialogNameFilter() const -{ - return QLatin1String( "*.vcf|vCards" ); -} - -QString ContactsImportHandler::fileDialogTitle() const -{ - return i18n( "Select vCard to Import" ); -} - -QString ContactsImportHandler::collectionDialogText() const -{ - return i18n( "Select the address book the imported contact(s) shall be saved in:" ); -} - -QString ContactsImportHandler::collectionDialogTitle() const -{ - return i18n( "Select Address Book" ); -} - -QString ContactsImportHandler::importDialogText( int count, const QString &collectionName ) const -{ - return i18np( "Importing one contact to %2", "Importing %1 contacts to %2", count, collectionName ); -} - -QString ContactsImportHandler::importDialogTitle() const -{ - return i18n( "Import Contacts" ); -} - -QStringList ContactsImportHandler::mimeTypes() const -{ - return QStringList( KABC::Addressee::mimeType() ); -} - -Akonadi::Item::List ContactsImportHandler::createItems( const QStringList &fileNames, bool *ok ) -{ - *ok = true; - - Akonadi::Item::List items; - - KABC::VCardConverter converter; - KABC::Addressee::List contacts; - - foreach ( const QString &fileName, fileNames ) { - QFile file( fileName ); - - if ( file.open( QIODevice::ReadOnly ) ) { - const QByteArray data = file.readAll(); - file.close(); - if ( data.size() > 0 ) { - contacts += converter.parseVCards( data ); - } - } else { - const QString caption( i18n( "vCard Import Failed" ) ); - const QString msg = i18nc( "@info", - "When trying to read the vCard, there was an error opening the file %1:" - "%2", - fileName, - i18nc( "QFile", file.errorString().toLatin1() ) ); - KMessageBox::error( 0, msg, caption ); - *ok = false; - } - } - - if ( contacts.isEmpty() ) { - if ( !(*ok) && fileNames.count() > 1 ) - KMessageBox::information( 0, i18n( "No contacts were imported, due to errors with the vCards." ) ); - else if ( *ok ) - KMessageBox::information( 0, i18n( "The vCard does not contain any contacts." ) ); - - return items; // nothing to import - } - - foreach ( const KABC::Addressee &contact, contacts ) { - Akonadi::Item item; - item.setPayload( contact ); - item.setMimeType( KABC::Addressee::mimeType() ); - - items << item; - } - - return items; -} diff --git a/kdepim/mobile/contacts/contactsimporthandler.h b/kdepim/mobile/contacts/contactsimporthandler.h deleted file mode 100644 index 87e21920..00000000 --- a/kdepim/mobile/contacts/contactsimporthandler.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 CONTACTSIMPORTHANDLER_H -#define CONTACTSIMPORTHANDLER_H - -#include "../lib/importhandlerbase.h" - -class ContactsImportHandler : 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 diff --git a/kdepim/mobile/contacts/contactviewitem.cpp b/kdepim/mobile/contacts/contactviewitem.cpp deleted file mode 100644 index f9bc623a..00000000 --- a/kdepim/mobile/contacts/contactviewitem.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "contactviewitem.h" - -#include -#include - -using namespace Akonadi; -using namespace Akonadi::Contact; - -ExtendedContactViewer::ExtendedContactViewer( QWidget *parent ) - : ContactViewer( parent ) -{ -} - -void ExtendedContactViewer::itemRemoved() -{ - emit contactRemoved(); -} - - -ContactViewItem::ContactViewItem(QDeclarativeItem* parent) - : DeclarativeAkonadiItem( parent ) -{ - m_viewer = new ExtendedContactViewer( 0 ); - connect( m_viewer, SIGNAL(contactRemoved()), SIGNAL(contactRemoved()) ); - - ContactDefaultActions *actions = new ContactDefaultActions( this ); - actions->connectToView( m_viewer ); - setWidget( m_viewer ); -} - -ContactViewItem::~ContactViewItem() -{ - delete m_viewer; -} - -qint64 ContactViewItem::itemId() const -{ - return m_viewer->contact().id(); -} - -void ContactViewItem::setItemId(qint64 id) -{ - if ( itemId() != id ) - m_viewer->setContact( Akonadi::Item( id ) ); -} - diff --git a/kdepim/mobile/contacts/contactviewitem.h b/kdepim/mobile/contacts/contactviewitem.h deleted file mode 100644 index 93ca038f..00000000 --- a/kdepim/mobile/contacts/contactviewitem.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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_CONTACT_CONTACTVIEWITEM_H -#define AKONADI_CONTACT_CONTACTVIEWITEM_H - -#include "declarativeakonadiitem.h" - -#include - -namespace Akonadi { - -namespace Contact { - -/** - * @short A wrapper class to make the 'removed' signal available. - */ -class ExtendedContactViewer : public ContactViewer -{ - Q_OBJECT - - public: - explicit ExtendedContactViewer( QWidget *parent = 0 ); - - Q_SIGNALS: - void contactRemoved(); - - private: - virtual void itemRemoved(); -}; - -class ContactViewItem : public DeclarativeAkonadiItem -{ - Q_OBJECT - - public: - explicit ContactViewItem( QDeclarativeItem *parent = 0 ); - ~ContactViewItem(); - - qint64 itemId() const; - void setItemId( qint64 id ); - - Q_SIGNALS: - void contactRemoved(); - - private: - ExtendedContactViewer *m_viewer; -}; - -} -} - -#endif diff --git a/kdepim/mobile/contacts/customfieldeditordialog.cpp b/kdepim/mobile/contacts/customfieldeditordialog.cpp deleted file mode 100644 index 9ccadff3..00000000 --- a/kdepim/mobile/contacts/customfieldeditordialog.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2010 Tobias Koenig - - 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 "customfieldeditordialog.h" - -#include -#include -#include - -#include -#include -#include - -CustomFieldEditorDialog::CustomFieldEditorDialog( QWidget *parent ) - : KDialog( parent ) -{ - setCaption( i18n( "Edit Custom Field" ) ); - setButtons( Ok | Cancel | Details ); - - QWidget *widget = new QWidget( this ); - setMainWidget( widget ); - - QFormLayout *layout = new QFormLayout( widget ); - - mKey = new KLineEdit; - mTitle = new KLineEdit; - mType = new KComboBox; - mScope = new QCheckBox( i18n( "Use field for all contacts" ) ); - - layout->addRow( i18nc( "The title of a custom field", "Title" ), mTitle ); - layout->addRow( i18nc( "The type of a custom field", "Type" ), mType ); - layout->addRow( QString(), mScope ); - - QWidget *detailsWidget = new QWidget; - QFormLayout *detailsLayout = new QFormLayout( detailsWidget ); - detailsLayout->addRow( i18n( "Key" ), mKey ); - - setDetailsWidget( detailsWidget ); - setButtonText( Details, i18nc( "@label Opens the advanced dialog", "Advanced" ) ); - - mType->addItem( i18n( "Text" ), CustomField::TextType ); - mType->addItem( i18n( "Numeric" ), CustomField::NumericType ); - mType->addItem( i18n( "Boolean" ), CustomField::BooleanType ); - mType->addItem( i18n( "Date" ), CustomField::DateType ); - mType->addItem( i18n( "Time" ), CustomField::TimeType ); - mType->addItem( i18n( "DateTime" ), CustomField::DateTimeType ); - - mKey->setValidator( new QRegExpValidator( QRegExp( QLatin1String( "[a-zA-Z0-9\\-]+" ) ), this ) ); -} - -void CustomFieldEditorDialog::setCustomField( const CustomField &field ) -{ - mCustomField = field; - - mKey->setText( mCustomField.key() ); - mTitle->setText( mCustomField.title() ); - mType->setCurrentIndex( mType->findData( mCustomField.type() ) ); - mScope->setChecked( (mCustomField.scope() == CustomField::GlobalScope) ); -} - -CustomField CustomFieldEditorDialog::customField() const -{ - CustomField customField( mCustomField ); - - customField.setKey( mKey->text() ); - customField.setTitle( mTitle->text() ); - customField.setType( static_cast( mType->itemData( mType->currentIndex() ).toInt() ) ); - - if ( customField.scope() != CustomField::ExternalScope ) { - // do not change the scope for externally defined custom fields - customField.setScope( mScope->isChecked() ? CustomField::GlobalScope : CustomField::LocalScope ); - } - - return customField; -} diff --git a/kdepim/mobile/contacts/customfieldeditordialog.h b/kdepim/mobile/contacts/customfieldeditordialog.h deleted file mode 100644 index 55f39a0d..00000000 --- a/kdepim/mobile/contacts/customfieldeditordialog.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2010 Tobias Koenig - - 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 CUSTOMFIELDEDITORDIALOG_H -#define CUSTOMFIELDEDITORDIALOG_H - -#include - -#include "customfields_p.h" - -class KComboBox; -class KLineEdit; -class QCheckBox; - -class CustomFieldEditorDialog : public KDialog -{ - Q_OBJECT - - public: - explicit CustomFieldEditorDialog( QWidget *parent = 0 ); - - void setCustomField( const CustomField &field ); - CustomField customField() const; - - private: - KLineEdit *mTitle; - KComboBox *mType; - QCheckBox *mScope; - KLineEdit *mKey; - CustomField mCustomField; -}; - -#endif diff --git a/kdepim/mobile/contacts/customfieldeditwidget.cpp b/kdepim/mobile/contacts/customfieldeditwidget.cpp deleted file mode 100644 index d0d626ab..00000000 --- a/kdepim/mobile/contacts/customfieldeditwidget.cpp +++ /dev/null @@ -1,147 +0,0 @@ - -#include "customfieldeditwidget.h" - -#include "customfieldeditordialog.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -CustomFieldEditWidget::CustomFieldEditWidget( QWidget *parent ) - : QWidget( parent ), mEditor( 0 ) -{ - mLayout = new QGridLayout( this ); - - mName = new QLabel; - mLayout->addWidget( mName, 0, 0 ); - - QToolButton *editButton = new QToolButton; - editButton->setText( i18n( "Edit" ) ); - mLayout->addWidget( editButton, 0, 2 ); - - QToolButton *deleteButton = new QToolButton; - deleteButton->setText( i18n( "Delete" ) ); - mLayout->addWidget( deleteButton, 0, 3 ); - - connect( editButton, SIGNAL(clicked()), SLOT(edit()) ); - connect( deleteButton, SIGNAL(clicked()), SLOT(remove()) ); -} - -void CustomFieldEditWidget::setCustomField( const CustomField &field ) -{ - mCustomField = field; - - mName->setText( mCustomField.title() + QLatin1Char(':') ); - - delete mEditor; - switch ( mCustomField.type() ) { - case CustomField::TextType: - mTextEditor = new QLineEdit; - mEditor = mTextEditor; - break; - case CustomField::NumericType: - mNumericEditor = new QSpinBox; - mEditor = mNumericEditor; - break; - case CustomField::BooleanType: - mBooleanEditor = new QCheckBox; - mEditor = mBooleanEditor; - break; - case CustomField::DateType: - mDateEditor = new QDateEdit; - mEditor = mDateEditor; - break; - case CustomField::TimeType: - mTimeEditor = new QTimeEdit; - mEditor = mTimeEditor; - break; - case CustomField::DateTimeType: - mDateTimeEditor = new QDateTimeEdit; - mEditor = mDateTimeEditor; - break; - } - - mLayout->addWidget( mEditor, 1, 0, 1, 4 ); - - setValue( mCustomField.value() ); -} - -CustomField CustomFieldEditWidget::customField() const -{ - mCustomField.setValue( value() ); - - return mCustomField; -} - -void CustomFieldEditWidget::setValue( const QString &value ) -{ - switch ( mCustomField.type() ) { - case CustomField::TextType: - mTextEditor->setText( value ); - break; - case CustomField::NumericType: - mNumericEditor->setValue( value.toInt() ); - break; - case CustomField::BooleanType: - mBooleanEditor->setChecked( value == QLatin1String( "true" ) ); - break; - case CustomField::DateType: - mDateEditor->setDate( QDate::fromString( value, Qt::ISODate ) ); - break; - case CustomField::TimeType: - mTimeEditor->setTime( QTime::fromString( value, Qt::ISODate ) ); - break; - case CustomField::DateTimeType: - mDateTimeEditor->setDateTime( QDateTime::fromString( value, Qt::ISODate ) ); - break; - } -} - -QString CustomFieldEditWidget::value() const -{ - switch ( mCustomField.type() ) { - case CustomField::TextType: - return mTextEditor->text(); - break; - case CustomField::NumericType: - return QString::number( mNumericEditor->value() ); - break; - case CustomField::BooleanType: - return (mBooleanEditor->isChecked() ? QLatin1String( "true" ) : QLatin1String( "false" ) ); - break; - case CustomField::DateType: - return mDateEditor->date().toString( Qt::ISODate ); - break; - case CustomField::TimeType: - return mTimeEditor->time().toString( Qt::ISODate ); - break; - case CustomField::DateTimeType: - return mDateTimeEditor->dateTime().toString( Qt::ISODate ); - break; - default: - return QString(); - break; - } -} - -void CustomFieldEditWidget::remove() -{ - emit remove( this ); -} - -void CustomFieldEditWidget::edit() -{ - CustomFieldEditorDialog dlg; - dlg.setCustomField( mCustomField ); - if ( dlg.exec() ) - setCustomField( dlg.customField() ); -} - diff --git a/kdepim/mobile/contacts/customfieldeditwidget.h b/kdepim/mobile/contacts/customfieldeditwidget.h deleted file mode 100644 index a0f95ffa..00000000 --- a/kdepim/mobile/contacts/customfieldeditwidget.h +++ /dev/null @@ -1,52 +0,0 @@ - -#ifndef CUSTOMFIELDEDITWIDGET_H -#define CUSTOMFIELDEDITWIDGET_H - -#include - -#include "customfields_p.h" - -class QCheckBox; -class QDateEdit; -class QDateTimeEdit; -class QGridLayout; -class QLabel; -class QLineEdit; -class QSpinBox; -class QTimeEdit; - -class CustomFieldEditWidget : public QWidget -{ - Q_OBJECT - - public: - explicit CustomFieldEditWidget( QWidget *parent = 0 ); - - void setCustomField( const CustomField &field ); - CustomField customField() const; - - void setValue( const QString &value ); - QString value() const; - - Q_SIGNALS: - void remove( QWidget *widget ); - - private Q_SLOTS: - void remove(); - void edit(); - - private: - mutable CustomField mCustomField; - - QGridLayout *mLayout; - QLabel *mName; - QWidget *mEditor; - QLineEdit *mTextEditor; - QSpinBox *mNumericEditor; - QCheckBox *mBooleanEditor; - QDateEdit *mDateEditor; - QTimeEdit *mTimeEditor; - QDateTimeEdit *mDateTimeEditor; -}; - -#endif diff --git a/kdepim/mobile/contacts/customfieldmanager.cpp b/kdepim/mobile/contacts/customfieldmanager.cpp deleted file mode 100644 index 003f7735..00000000 --- a/kdepim/mobile/contacts/customfieldmanager.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2010 Tobias Koenig - - 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 "customfieldmanager_p.h" - -#include -#include - -void CustomFieldManager::setGlobalCustomFieldDescriptions( const CustomField::List &customFields ) -{ - KConfig config( QLatin1String( "akonadi_contactrc" ) ); - KConfigGroup group( &config, QLatin1String( "GlobalCustomFields" ) ); - - group.deleteGroup(); - foreach ( const CustomField &field, customFields ) { - const QString key = field.key(); - const QString value = CustomField::typeToString( field.type() ) + QLatin1Char( ':' ) + field.title(); - - group.writeEntry( key, value ); - } -} - -CustomField::List CustomFieldManager::globalCustomFieldDescriptions() -{ - KConfig config( QLatin1String( "akonadi_contactrc" ) ); - const KConfigGroup group( &config, QLatin1String( "GlobalCustomFields" ) ); - - CustomField::List customFields; - - const QStringList keys = group.keyList(); - foreach ( const QString &key, keys ) { - CustomField field; - field.setKey( key ); - field.setScope( CustomField::GlobalScope ); - - const QString value = group.readEntry( key, QString() ); - const int pos = value.indexOf( QLatin1Char( ':' ) ); - if ( pos != -1 ) { - field.setType( CustomField::stringToType( value.left( pos - 1 ) ) ); - field.setTitle( value.mid( pos + 1 ) ); - } - - customFields << field; - } - - return customFields; -} diff --git a/kdepim/mobile/contacts/customfieldmanager_p.h b/kdepim/mobile/contacts/customfieldmanager_p.h deleted file mode 100644 index 4de66a23..00000000 --- a/kdepim/mobile/contacts/customfieldmanager_p.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2010 Tobias Koenig - - 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 CUSTOMFIELDMANAGER_P_H -#define CUSTOMFIELDMANAGER_P_H - -#include "customfields_p.h" - -/** - * @short A class that manages the descriptions of all custom fields with global scope. - */ -class CustomFieldManager -{ - public: - static void setGlobalCustomFieldDescriptions( const CustomField::List &customFields ); - static CustomField::List globalCustomFieldDescriptions(); -}; - -#endif diff --git a/kdepim/mobile/contacts/customfields.cpp b/kdepim/mobile/contacts/customfields.cpp deleted file mode 100644 index 54f4c95d..00000000 --- a/kdepim/mobile/contacts/customfields.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2010 Tobias Koenig - - 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 "customfields_p.h" - -CustomField::CustomField() - : mType( TextType ), mScope( LocalScope ) -{ -} - -CustomField::CustomField( const QString &key, const QString &title, Type type, Scope scope ) - : mKey( key ), mTitle( title ), mType( type ), mScope( scope ) -{ -} - -CustomField CustomField::fromVariantMap( const QVariantMap &map, Scope scope ) -{ - return CustomField( map.value( QLatin1String( "key" ) ).toString(), - map.value( QLatin1String( "title" ) ).toString(), - stringToType( map.value( QLatin1String( "type" ) ).toString() ), - scope ); -} - -void CustomField::setKey( const QString &key ) -{ - mKey = key; -} - -QString CustomField::key() const -{ - return mKey; -} - -void CustomField::setTitle( const QString &title ) -{ - mTitle = title; -} - -QString CustomField::title() const -{ - return mTitle; -} - -void CustomField::setType( Type type ) -{ - mType = type; -} - -CustomField::Type CustomField::type() const -{ - return mType; -} - -void CustomField::setScope( Scope scope ) -{ - mScope = scope; -} - -CustomField::Scope CustomField::scope() const -{ - return mScope; -} - -void CustomField::setValue( const QString &value ) -{ - mValue = value; -} - -QString CustomField::value() const -{ - return mValue; -} - -QVariantMap CustomField::toVariantMap() const -{ - QVariantMap map; - map.insert( QLatin1String( "key" ), mKey ); - map.insert( QLatin1String( "title" ), mTitle ); - map.insert( QLatin1String( "type" ), typeToString( mType ) ); - - return map; -} - -CustomField::Type CustomField::stringToType( const QString &type ) -{ - if ( type == QLatin1String( "text" ) ) - return CustomField::TextType; - if ( type == QLatin1String( "numeric" ) ) - return CustomField::NumericType; - if ( type == QLatin1String( "boolean" ) ) - return CustomField::BooleanType; - if ( type == QLatin1String( "date" ) ) - return CustomField::DateType; - if ( type == QLatin1String( "time" ) ) - return CustomField::TimeType; - if ( type == QLatin1String( "datetime" ) ) - return CustomField::DateTimeType; - - return CustomField::TextType; -} - -QString CustomField::typeToString( CustomField::Type type ) -{ - switch ( type ) { - case CustomField::TextType: - default: - return QLatin1String( "text" ); - break; - case CustomField::NumericType: - return QLatin1String( "numeric" ); - break; - case CustomField::BooleanType: - return QLatin1String( "boolean" ); - break; - case CustomField::DateType: - return QLatin1String( "date" ); - break; - case CustomField::TimeType: - return QLatin1String( "time" ); - break; - case CustomField::DateTimeType: - return QLatin1String( "datetime" ); - break; - } -} diff --git a/kdepim/mobile/contacts/customfields_p.h b/kdepim/mobile/contacts/customfields_p.h deleted file mode 100644 index 1d6af486..00000000 --- a/kdepim/mobile/contacts/customfields_p.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2010 Tobias Koenig - - 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 CUSTOMFIELDS_P_H -#define CUSTOMFIELDS_P_H - -#include -#include -#include - -/** - * @short A class that represents non-standard contact fields. - * - * There exists three scopes of fields. To the local scope belong all - * custom fields that are defined by the user and that exists only for one - * contact. The description for these fields are stored inside ContactMetaData - * as custom attribute of the Akonadi item that represents the contact. - * To the global scope belong all custom fields that are defined by the user but - * shall be available in all contacts of the address book. Their description - * is stored by CustomFieldManager in $HOME/.kde/share/config/akonadi_contactrc. - * All other custom fields belong to the external scope, they come with import - * of contacts from other PIM applications (e.g. further X- entries in vCards). - * Their description is created on the fly when editing the custom fields. - * - * The description of a custom field covers the key, title and type. - */ -class CustomField -{ - public: - typedef QList List; - - enum Type - { - TextType, - NumericType, - BooleanType, - DateType, - TimeType, - DateTimeType - }; - - enum Scope - { - LocalScope, ///< Field has been defined by user for one contact - GlobalScope, ///< Field has been defined by user for all contacts - ExternalScope ///< Field has been defined by the external data source (e.g. vCard) - }; - - CustomField(); - CustomField( const QString &key, const QString &title, Type type, Scope scope ); - - static CustomField fromVariantMap( const QVariantMap &map, Scope scope ); - - void setKey( const QString &key ); - QString key() const; - - void setTitle( const QString &title ); - QString title() const; - - void setType( Type type ); - Type type() const; - - void setScope( Scope scope ); - Scope scope() const; - - void setValue( const QString &value ); - QString value() const; - - QVariantMap toVariantMap() const; - - static QString typeToString( Type type ); - static Type stringToType( const QString &type ); - - private: - QString mKey; - QString mTitle; - Type mType; - Scope mScope; - QString mValue; -}; - -#endif diff --git a/kdepim/mobile/contacts/displaynameeditwidget.cpp b/kdepim/mobile/contacts/displaynameeditwidget.cpp deleted file mode 100644 index 9fb37055..00000000 --- a/kdepim/mobile/contacts/displaynameeditwidget.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2009 Tobias Koenig - - 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 "displaynameeditwidget.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -// Tries to guess the display type that is used for the passed contact -static DisplayNameEditWidget::DisplayType guessedDisplayType( const KABC::Addressee &contact ) -{ - if ( contact.formattedName() == (contact.givenName() + QLatin1Char( ' ' ) + contact.familyName()) ) - return DisplayNameEditWidget::SimpleName; - else if ( contact.formattedName() == contact.assembledName() ) - return DisplayNameEditWidget::FullName; - else if ( contact.formattedName() == (contact.familyName() + QLatin1String( ", " ) + contact.givenName()) ) - return DisplayNameEditWidget::ReverseNameWithComma; - else if ( contact.formattedName() == (contact.familyName() + QLatin1Char( ' ' ) + contact.givenName()) ) - return DisplayNameEditWidget::ReverseName; - else if ( contact.formattedName() == contact.organization() ) - return DisplayNameEditWidget::Organization; - else - return DisplayNameEditWidget::CustomName; -} - -class DisplayNameDelegate : public QStyledItemDelegate -{ - public: - DisplayNameDelegate( QAbstractItemView *view, QObject *parent = 0 ) - : QStyledItemDelegate( parent ), mMaxDescriptionWidth( 0 ) - { - mDescriptions.append( i18n( "Short Name" ) ); - mDescriptions.append( i18n( "Full Name" ) ); - mDescriptions.append( i18n( "Reverse Name with Comma" ) ); - mDescriptions.append( i18n( "Reverse Name" ) ); - mDescriptions.append( i18n( "Organization" ) ); - mDescriptions.append( i18nc( "@item:inlistbox A custom name format", "Custom" ) ); - - QFont font = view->font(); - font.setStyle( QFont::StyleItalic ); - QFontMetrics metrics( font ); - foreach ( const QString &description, mDescriptions ) - mMaxDescriptionWidth = qMax( mMaxDescriptionWidth, metrics.width( description ) ); - - mMaxDescriptionWidth += 3; - } - - int maximumDescriptionWidth() const - { - return mMaxDescriptionWidth; - } - - virtual void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const - { - QStyledItemDelegate::paint( painter, option, index ); - const QRect rect( option.rect.width() - mMaxDescriptionWidth, option.rect.y(), mMaxDescriptionWidth, option.rect.height() ); - painter->save(); - QFont font( painter->font() ); - font.setStyle( QFont::StyleItalic ); - painter->setFont( font ); - if ( option.state & QStyle::State_Selected ) - painter->setPen( option.palette.color( QPalette::Normal, QPalette::BrightText ) ); - else - painter->setPen( option.palette.color( QPalette::Disabled, QPalette::Text ) ); - painter->drawText( rect, Qt::AlignLeft, mDescriptions.at( index.row() ) ); - painter->restore(); - } - - QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const - { - QSize size = QStyledItemDelegate::sizeHint( option, index ); - size.setWidth( size.width() + mMaxDescriptionWidth ); - - return size; - } - - private: - QStringList mDescriptions; - int mMaxDescriptionWidth; -}; - -DisplayNameEditWidget::DisplayNameEditWidget( QWidget *parent ) - : QWidget( parent ), - mDisplayType( FullName ) -{ - QHBoxLayout *layout = new QHBoxLayout( this ); - layout->setMargin( 0 ); - layout->setSpacing( KDialog::spacingHint() ); - - mView = new KComboBox( this ); - mView->addItems( QStringList() << QString() << QString() << QString() - << QString() << QString() << QString() ); - - layout->addWidget( mView ); - - connect( mView, SIGNAL(activated(int)), SLOT(displayTypeChanged(int)) ); - - DisplayNameDelegate *delegate = new DisplayNameDelegate( mView->view() ); - mView->view()->setItemDelegate( delegate ); - - mAdditionalPopupWidth = delegate->maximumDescriptionWidth(); - - mViewport = mView->view()->viewport(); - mViewport->installEventFilter( this ); -} - -DisplayNameEditWidget::~DisplayNameEditWidget() -{ -} - -void DisplayNameEditWidget::setReadOnly( bool readOnly ) -{ - mView->setEnabled( !readOnly ); -} - -void DisplayNameEditWidget::setDisplayType( DisplayType type ) -{ - if ( type == -1 ) { - // guess the used display type - mDisplayType = guessedDisplayType( mContact ); - } else - mDisplayType = type; - - updateView(); -} - -DisplayNameEditWidget::DisplayType DisplayNameEditWidget::displayType() const -{ - return mDisplayType; -} - -void DisplayNameEditWidget::loadContact( const KABC::Addressee &contact ) -{ - mContact = contact; - - mDisplayType = guessedDisplayType( mContact ); - - updateView(); -} - -void DisplayNameEditWidget::storeContact( KABC::Addressee &contact ) const -{ - contact.setFormattedName( mView->currentText() ); -} - -void DisplayNameEditWidget::changeName( const KABC::Addressee &contact ) -{ - const QString organization = mContact.organization(); - mContact = contact; - mContact.setOrganization( organization ); - if ( mDisplayType == CustomName ) - mContact.setFormattedName( mView->currentText() ); - - updateView(); -} - -void DisplayNameEditWidget::changeOrganization( const QString &organization ) -{ - mContact.setOrganization( organization ); - - updateView(); -} - -void DisplayNameEditWidget::displayTypeChanged( int type ) -{ - mDisplayType = (DisplayType)type; - - updateView(); -} - -bool DisplayNameEditWidget::eventFilter( QObject *object, QEvent *event ) -{ - if ( object == mViewport ) { - if ( event->type() == QEvent::Show ) { - // retrieve the widget that contains the popup view - QWidget *parentWidget = mViewport->parentWidget()->parentWidget(); - - int maxWidth = 0; - QFontMetrics metrics( mView->font() ); - for ( int i = 0; i < mView->count(); ++i ) - maxWidth = qMax( maxWidth, metrics.width( mView->itemText( i ) ) ); - - // resize it to show the complete content - parentWidget->resize( maxWidth + mAdditionalPopupWidth + 20, parentWidget->height() ); - } - return false; - } - - return eventFilter( object, event ); -} - -void DisplayNameEditWidget::updateView() -{ - // SimpleName: - mView->setItemText( 0, mContact.givenName() + QLatin1Char( ' ' ) + mContact.familyName() ); - - // FullName: - mView->setItemText( 1, mContact.assembledName() ); - - // ReverseNameWithComma: - mView->setItemText( 2, mContact.familyName() + QLatin1String( ", " ) + mContact.givenName() ); - - // ReverseName: - mView->setItemText( 3, mContact.familyName() + QLatin1Char( ' ' ) + mContact.givenName() ); - - // Organization: - mView->setItemText( 4, mContact.organization() ); - - // CustomName: - mView->setItemText( 5, mContact.formattedName() ); - - mView->setEditable( mDisplayType == CustomName ); - - mView->setCurrentIndex( (int)mDisplayType ); -} - diff --git a/kdepim/mobile/contacts/displaynameeditwidget.h b/kdepim/mobile/contacts/displaynameeditwidget.h deleted file mode 100644 index 56988905..00000000 --- a/kdepim/mobile/contacts/displaynameeditwidget.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2009 Tobias Koenig - - 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 DISPLAYNAMEEDITWIDGET_H -#define DISPLAYNAMEEDITWIDGET_H - -#include - -#include - -class KComboBox; - -/** - * @short A widget for editing the display name of a contact. - * - * The widget will either use a predefined schema for formatting - * the name or a custom one. - */ -class DisplayNameEditWidget : public QWidget -{ - Q_OBJECT - - public: - /** - * Describes what the display name should look like. - */ - enum DisplayType - { - SimpleName, ///< A name of the form: givenName familyName - FullName, ///< A name of the form: prefix givenName additionalName familyName suffix - ReverseNameWithComma, ///< A name of the form: familyName, givenName - ReverseName, ///< A name of the form: familyName givenName - Organization, ///< The organization name - CustomName ///< Let the user input a display name - }; - - explicit DisplayNameEditWidget( QWidget *parent = 0 ); - ~DisplayNameEditWidget(); - - void loadContact( const KABC::Addressee &contact ); - void storeContact( KABC::Addressee &contact ) const; - - void setReadOnly( bool readOnly ); - - void setDisplayType( DisplayType type ); - DisplayType displayType() const; - - public Q_SLOTS: - void changeName( const KABC::Addressee &contact ); - void changeOrganization( const QString &organization ); - - protected: - virtual bool eventFilter( QObject *object, QEvent *event ); - - private Q_SLOTS: - void displayTypeChanged( int ); - - private: - void updateView(); - - KComboBox *mView; - DisplayType mDisplayType; - KABC::Addressee mContact; - QWidget *mViewport; - int mAdditionalPopupWidth; -}; - -#endif diff --git a/kdepim/mobile/contacts/editorbase.cpp b/kdepim/mobile/contacts/editorbase.cpp deleted file mode 100644 index aeca3ba7..00000000 --- a/kdepim/mobile/contacts/editorbase.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 "editorbase.h" - -EditorBase::EditorBase( QWidget *parent ) : QWidget( parent ) -{ -} - -EditorBase::~EditorBase() -{ -} - diff --git a/kdepim/mobile/contacts/editorbase.h b/kdepim/mobile/contacts/editorbase.h deleted file mode 100644 index 3164dab8..00000000 --- a/kdepim/mobile/contacts/editorbase.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 EDITORBASE_H -#define EDITORBASE_H - -#include - -namespace KABC -{ - class Addressee; -} - -namespace Akonadi -{ - class ContactMetaData; -} - -class EditorBase : public QWidget -{ - Q_OBJECT - - public: - explicit EditorBase( QWidget *parent = 0 ); - - ~EditorBase(); - - virtual void loadContact( const KABC::Addressee &contact, const Akonadi::ContactMetaData &metaData ) = 0; - - virtual void saveContact( KABC::Addressee &contact, Akonadi::ContactMetaData &metaData ) const = 0; -}; - -#endif diff --git a/kdepim/mobile/contacts/editorbusiness.cpp b/kdepim/mobile/contacts/editorbusiness.cpp deleted file mode 100644 index bbb947e0..00000000 --- a/kdepim/mobile/contacts/editorbusiness.cpp +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "editorbusiness.h" - -#include "ui_editorbusiness.h" - -#include - -#include - -class EditorBusiness::Private -{ - EditorBusiness *const q; - - public: - explicit Private( EditorBusiness *parent ) : q( parent ) - { - mUi.setupUi( parent ); - mUi.logoButton->setType( ImageWidget::Logo ); - - q->connect( mUi.organizationLineEdit, SIGNAL(textChanged(QString)), - q, SIGNAL(organizationChanged(QString)) ); - } - - public: - Ui::EditorBusiness mUi; - - KABC::Addressee mContact; -}; - -static QString loadCustom( const KABC::Addressee &contact, const QString &key ) -{ - return contact.custom( QLatin1String( "KADDRESSBOOK" ), key ); -} - -static void storeCustom( KABC::Addressee &contact, const QString &key, const QString &value ) -{ - if ( value.isEmpty() ) - contact.removeCustom( QLatin1String( "KADDRESSBOOK" ), key ); - else - contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), key, value ); -} - - -EditorBusiness::EditorBusiness( QWidget *parent ) - : EditorBase( parent ), d( new Private( this ) ) -{ -} - -EditorBusiness::~EditorBusiness() -{ - delete d; -} - -void EditorBusiness::loadContact( const KABC::Addressee &contact, const Akonadi::ContactMetaData& ) -{ - d->mUi.logoButton->loadContact( contact ); - d->mUi.organizationLineEdit->setText( contact.organization() ); - d->mUi.professionLineEdit->setText( loadCustom( contact, QLatin1String( "X-Profession" ) ) ); - d->mUi.titleLineEdit->setText( contact.title() ); - d->mUi.departmentLineEdit->setText( contact.department() ); - d->mUi.officeLineEdit->setText( loadCustom( contact, QLatin1String( "X-Office" ) ) ); - d->mUi.managerLineEdit->setText( loadCustom( contact, QLatin1String( "X-ManagersName" ) ) ); - d->mUi.assistantLineEdit->setText( loadCustom( contact, QLatin1String( "X-AssistantsName" ) ) ); - d->mUi.noteTextEdit->setPlainText( contact.note() ); - - d->mUi.noteTextEdit->setMinimumHeight( qMax( 200, (int)d->mUi.noteTextEdit->document()->documentLayout()->documentSize().height() + 50 ) ); -} - -void EditorBusiness::saveContact( KABC::Addressee &contact, Akonadi::ContactMetaData& ) const -{ - d->mUi.logoButton->storeContact( contact ); - contact.setOrganization( d->mUi.organizationLineEdit->text().trimmed() ); - storeCustom( contact, QLatin1String( "X-Profession" ), d->mUi.professionLineEdit->text().trimmed() ); - contact.setTitle( d->mUi.titleLineEdit->text().trimmed() ); - contact.setDepartment( d->mUi.departmentLineEdit->text().trimmed() ); - storeCustom( contact, QLatin1String( "X-Office" ), d->mUi.officeLineEdit->text().trimmed() ); - storeCustom( contact, QLatin1String( "X-ManagersName" ), d->mUi.managerLineEdit->text().trimmed() ); - storeCustom( contact, QLatin1String( "X-AssistantsName" ), d->mUi.assistantLineEdit->text().trimmed() ); - contact.setNote( d->mUi.noteTextEdit->toPlainText() ); -} - diff --git a/kdepim/mobile/contacts/editorbusiness.h b/kdepim/mobile/contacts/editorbusiness.h deleted file mode 100644 index c536a334..00000000 --- a/kdepim/mobile/contacts/editorbusiness.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 EDITORBUSINESS_H -#define EDITORBUSINESS_H - -#include "editorbase.h" - -class EditorBusiness : public EditorBase -{ - Q_OBJECT - - public: - explicit EditorBusiness( QWidget *parent = 0 ); - - ~EditorBusiness(); - - void loadContact( const KABC::Addressee &contact, const Akonadi::ContactMetaData &metaData ); - void saveContact( KABC::Addressee &contact, Akonadi::ContactMetaData &metaData ) const; - - Q_SIGNALS: - void organizationChanged( const QString &organization ); - - private: - class Private; - Private *const d; -}; - -#endif diff --git a/kdepim/mobile/contacts/editorbusiness.ui b/kdepim/mobile/contacts/editorbusiness.ui deleted file mode 100644 index 6b9d27db..00000000 --- a/kdepim/mobile/contacts/editorbusiness.ui +++ /dev/null @@ -1,164 +0,0 @@ - - - EditorBusiness - - - - 0 - 0 - 400 - 343 - - - - - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - Organization: - - - - - - - - - - Profession: - - - - - - - - - - Title: - - - - - - - - - - Department: - - - - - - - - - - Office: - - - - - - - - - - Manager: - - - - - - - - - - Assistant: - - - - - - - - - - - - - 120 - 160 - - - - - 120 - 160 - - - - - 120 - 160 - - - - - - - - 100 - 130 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Notes: - - - - - - - false - - - - - - - - ImageWidget - QPushButton -
imagewidget.h
-
-
- - -
diff --git a/kdepim/mobile/contacts/editorcontactgroup.cpp b/kdepim/mobile/contacts/editorcontactgroup.cpp deleted file mode 100644 index b572280e..00000000 --- a/kdepim/mobile/contacts/editorcontactgroup.cpp +++ /dev/null @@ -1,322 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 "editorcontactgroup.h" - -#include "ui_editorcontactgroup.h" - -#include "contactcompletionmodel_p.h" - -#include -#include -#include -#include - -#include -#include - -#include -#include - -class Recipient -{ - public: - Recipient( MobileLineEdit *input, QObject *receiver ) - : mInput( input ) - { - QObject::connect( mInput, SIGNAL(clearClicked()), receiver, SLOT(clearRecipientClicked()) ); - } - - public: - MobileLineEdit* mInput; - - Akonadi::Item mItem; - QString mPreferredEmail; -}; - -class EditorContactGroup::Private -{ - EditorContactGroup *const q; - - public: - explicit Private( EditorContactGroup *parent ) - : q( parent ) - { - mUi.setupUi( parent ); - mUi.cancelButton->setIcon( SmallIcon( QLatin1String("dialog-cancel"), 64 ) ); - mUi.saveButton->setIcon( SmallIcon( QLatin1String("document-save"), 64 ) ); - mUi.saveButton->setEnabled( false ); - - mInputs << new Recipient( mUi.recipient1, q ); - mInputs << new Recipient( mUi.recipient2, q ); - mLastRow = 2; // third row - - mUi.collectionSelector->setMimeTypeFilter( QStringList() << KABC::ContactGroup::mimeType() ); - mUi.collectionSelector->setAccessRightsFilter( Akonadi::Collection::CanCreateItem | Akonadi::Collection::CanChangeItem ); - - QObject::connect( mUi.launchAccountWizardButton, SIGNAL(clicked()), q, SIGNAL(requestLaunchAccountWizard()) ); - QObject::connect( mUi.groupName, SIGNAL(textChanged(QString)), q, SLOT(nameTextChanged(QString)) ); - - availableCollectionsChanged(); - } - - void ensureRows( int recipientCount ) - { - // TODO delete unnecessary rows? - addRows( recipientCount ); - } - - public: - Ui::EditorContactGroup mUi; - - KABC::ContactGroup mContactGroup; - - QList mInputs; - - int mLastRow; - - public: // slots - void nameTextChanged( const QString &text ) - { - mUi.saveButton->setEnabled( !text.trimmed().isEmpty() ); - } - - void addRecipientClicked(); - - void fetchResult( KJob *job ); - - void clearRecipientClicked(); - - void availableCollectionsChanged() - { - const bool available = mUi.collectionSelector->currentCollection().isValid(); - mUi.collectionSelector->setVisible( available ); - mUi.launchAccountWizardButton->setVisible( !available ); - } - - void disableSaveButton() - { - mUi.saveButton->setEnabled( false ); - } - - private: - void addRows( int newRowCount ); -}; - -void EditorContactGroup::Private::addRecipientClicked() -{ - addRows( mInputs.count() + 1 ); -} - -void EditorContactGroup::Private::fetchResult( KJob *job ) -{ - Akonadi::ItemFetchJob *fetchJob = qobject_cast( job ); - Q_ASSERT( fetchJob != 0 ); - - int index = fetchJob->property( "RecipientIndex" ).value(); - Q_ASSERT( index >= 0 && index < mInputs.count() ); - Recipient *recipient = mInputs[ index ]; - - const Akonadi::Item item = fetchJob->items().isEmpty() ? recipient->mItem : fetchJob->items().first(); - if ( fetchJob->error() != 0 ) { - kError() << "Fetching contact item" << item.id() << "failed:" << fetchJob->errorString(); - } else if ( !item.hasPayload() ) { - kError() << "Fetching contact item" << item.id() << "worked but it is not a contact"; - } else { - const KABC::Addressee contact = item.payload(); - - recipient->mItem = item; - recipient->mInput->setEnabled( true ); - - if ( recipient->mPreferredEmail.isEmpty() ) { - recipient->mInput->setText( contact.fullEmail( contact.preferredEmail() ) ); - } else { - recipient->mInput->setText( contact.fullEmail( recipient->mPreferredEmail ) ); - } - } -} - -void EditorContactGroup::Private::clearRecipientClicked() -{ - int index = 0; - for ( ; index < mInputs.count(); ++index ) { - if ( mInputs[ index ]->mInput == q->sender() ) { - break; - } - } - - Q_ASSERT( index >= 0 && index < mInputs.count() ); - - // shift data - for ( int i = index + 1; i < mInputs.count(); ++i ) { - Recipient *source = mInputs[ i ]; - Recipient *target = mInputs[ i - 1 ]; - target->mInput->setText( source->mInput->text() ); - target->mItem = source->mItem; - target->mPreferredEmail = source->mPreferredEmail; - } - - Recipient *last = mInputs.last(); - if ( mInputs.count() > 2 ) { - // remove widgets from layout - mUi.gridLayout->removeWidget( mUi.addRecipientButton ); - mUi.gridLayout->removeWidget( mUi.cancelButton ); - mUi.gridLayout->removeWidget( mUi.saveButton ); - mUi.gridLayout->removeWidget( mUi.collectionSelector ); - - const int row = mLastRow; - --mLastRow; - mInputs.pop_back(); - last->mInput->deleteLater(); - delete last; - - // re-add widgets - mUi.gridLayout->addWidget( mUi.addRecipientButton, mLastRow, 2, 1, 2 ); - mUi.gridLayout->addWidget( mUi.cancelButton, row, 2, 1, 1 ); - mUi.gridLayout->addWidget( mUi.saveButton, row, 3, 1, 1 ); - mUi.gridLayout->addWidget( mUi.collectionSelector, row, 1, 1, 1 ); - } else { - last->mInput->clear(); - last->mItem = Akonadi::Item(); - last->mPreferredEmail.clear(); - } -} - -void EditorContactGroup::Private::addRows( int newRowCount ) -{ - if ( newRowCount <= mInputs.count() ) { - return; - } - - // remove widgets from layout - mUi.gridLayout->removeWidget( mUi.addRecipientButton ); - mUi.gridLayout->removeWidget( mUi.cancelButton ); - mUi.gridLayout->removeWidget( mUi.saveButton ); - mUi.gridLayout->removeWidget( mUi.collectionSelector ); - - int row = mLastRow + 1; - - // add new widgets - for ( ; mInputs.count() < newRowCount; ++row, ++mLastRow ) { - MobileLineEdit *lineEdit = new MobileLineEdit( q ); - mUi.gridLayout->addWidget( lineEdit, row, 1, 1, 1 ); - mInputs << new Recipient( lineEdit, q ); - } - - // re-add widgets - mUi.gridLayout->addWidget( mUi.addRecipientButton, mLastRow, 2, 1, 2 ); - mUi.gridLayout->addWidget( mUi.cancelButton, row, 2, 1, 1 ); - mUi.gridLayout->addWidget( mUi.saveButton, row, 3, 1, 1 ); - mUi.gridLayout->addWidget( mUi.collectionSelector, row, 1, 1, 1 ); -} - -EditorContactGroup::EditorContactGroup( QWidget *parent ) - : QWidget( parent ), d( new Private( this ) ) -{ - connect( d->mUi.addRecipientButton, SIGNAL(clicked()), SLOT(addRecipientClicked()) ); - - connect( d->mUi.cancelButton, SIGNAL(clicked()), SIGNAL(cancelClicked()) ); - connect( d->mUi.saveButton, SIGNAL(clicked()), SLOT(disableSaveButton()) ); // prevent double clicks - connect( d->mUi.saveButton, SIGNAL(clicked()), SIGNAL(saveClicked()) ); - connect( d->mUi.collectionSelector, SIGNAL(currentChanged(Akonadi::Collection)), - SIGNAL(collectionChanged(Akonadi::Collection)) ); - - connect( d->mUi.collectionSelector->model(), SIGNAL(rowsInserted(QModelIndex,int,int)), - SLOT(availableCollectionsChanged()) ); - connect( d->mUi.collectionSelector->model(), SIGNAL(rowsRemoved(QModelIndex,int,int)), - SLOT(availableCollectionsChanged()) ); -} - -EditorContactGroup::~EditorContactGroup() -{ - delete d; -} - -void EditorContactGroup::loadContactGroup( const KABC::ContactGroup &contactGroup ) -{ - d->mContactGroup = contactGroup; - - d->mUi.groupName->setText( contactGroup.name() ); - - KABC::Addressee contact; - - d->ensureRows( contactGroup.dataCount() + contactGroup.contactReferenceCount() ); - - int count = 0; - - QStringList emails; - for ( uint i = 0; i < contactGroup.dataCount(); ++i, ++count ) { - const KABC::ContactGroup::Data &data = contactGroup.data( i ); - contact.setNameFromString( data.name() ); - emails << contact.fullEmail( data.email() ); - } - - QList::const_iterator inputIt = d->mInputs.constBegin(); - Q_FOREACH( const QString &email, emails ) { - (*inputIt)->mInput->setText( email ); - ++inputIt; - } - - for ( uint i = 0; inputIt != d->mInputs.constEnd() && i < contactGroup.contactReferenceCount(); ++inputIt, ++i, ++count ) { - const KABC::ContactGroup::ContactReference &ref = contactGroup.contactReference( i ); - (*inputIt)->mItem.setId( ref.uid().toLongLong() ); - (*inputIt)->mPreferredEmail = ref.preferredEmail(); - (*inputIt)->mInput->setText( i18nc( "@info:status", "Loading..." ) ); - (*inputIt)->mInput->setEnabled( false ); - - Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( (*inputIt)->mItem ); - job->fetchScope().fetchFullPayload( true ); - job->setProperty( "RecipientIndex", count ); - connect( job, SIGNAL(result(KJob*)), SLOT(fetchResult(KJob*)) ); - } -} - -void EditorContactGroup::saveContactGroup( KABC::ContactGroup &contactGroup ) const -{ - contactGroup.setName( d->mUi.groupName->text() ); - contactGroup.setId( d->mContactGroup.id() ); - - Q_FOREACH( Recipient *input, d->mInputs ) { - const QString email = input->mInput->text().trimmed(); - if ( !email.isEmpty() ) { - QString namePart; - QString emailPart; - KABC::Addressee::parseEmailAddress( email, namePart, emailPart ); - if ( namePart.isEmpty() ) { - namePart = emailPart; - } - - if ( !emailPart.isEmpty() ) { - contactGroup.append( KABC::ContactGroup::Data( namePart, emailPart ) ); - } - } - } -} - -Akonadi::Collection EditorContactGroup::selectedCollection() const -{ - return d->mUi.collectionSelector->currentCollection(); -} - -void EditorContactGroup::setDefaultCollection( const Akonadi::Collection &collection ) -{ - d->mUi.collectionSelector->setDefaultCollection( collection ); -} - -#include "moc_editorcontactgroup.cpp" diff --git a/kdepim/mobile/contacts/editorcontactgroup.h b/kdepim/mobile/contacts/editorcontactgroup.h deleted file mode 100644 index aece9d4d..00000000 --- a/kdepim/mobile/contacts/editorcontactgroup.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 EDITORCONTACTGROUP_H -#define EDITORCONTACTGROUP_H - -#include - -namespace Akonadi -{ - class Collection; -} - -namespace KABC -{ - class ContactGroup; -} - -class KJob; - -class EditorContactGroup : public QWidget -{ - Q_OBJECT - - public: - explicit EditorContactGroup( QWidget *parent = 0 ); - - ~EditorContactGroup(); - - void setDefaultCollection( const Akonadi::Collection &collection ); - - void loadContactGroup( const KABC::ContactGroup &contactGroup ); - - void saveContactGroup( KABC::ContactGroup &contactGroup ) const; - - Akonadi::Collection selectedCollection() const; - - Q_SIGNALS: - void collectionChanged( const Akonadi::Collection &collection ); - - void cancelClicked(); - void saveClicked(); - void requestLaunchAccountWizard(); - - private: - class Private; - Private *const d; - - Q_PRIVATE_SLOT( d, void nameTextChanged( const QString& ) ) - Q_PRIVATE_SLOT( d, void addRecipientClicked() ) - Q_PRIVATE_SLOT( d, void fetchResult( KJob* ) ) - Q_PRIVATE_SLOT( d, void clearRecipientClicked() ) - Q_PRIVATE_SLOT( d, void availableCollectionsChanged() ) - Q_PRIVATE_SLOT( d, void disableSaveButton() ) -}; - -#endif diff --git a/kdepim/mobile/contacts/editorcontactgroup.ui b/kdepim/mobile/contacts/editorcontactgroup.ui deleted file mode 100644 index 5759d0e1..00000000 --- a/kdepim/mobile/contacts/editorcontactgroup.ui +++ /dev/null @@ -1,117 +0,0 @@ - - - EditorContactGroup - - - - 0 - 0 - 410 - 136 - - - - - - - - - Name - - - - - - - - - - Recipient - - - - - - - - - - - - - Add - - - - - - - - 64 - 64 - - - - - - - - - 0 - 0 - - - - QComboBox::AdjustToMinimumContentsLength - - - - - - - New Address Book - - - - - - - - 64 - 64 - - - - - - - - - - Qt::Vertical - - - - 20 - 25 - - - - - - - - - Akonadi::CollectionComboBox - QComboBox -
akonadi/collectioncombobox.h
-
- - MobileLineEdit - QWidget -
mobilelineedit.h
-
-
- - -
diff --git a/kdepim/mobile/contacts/editorcrypto.cpp b/kdepim/mobile/contacts/editorcrypto.cpp deleted file mode 100644 index 733483ed..00000000 --- a/kdepim/mobile/contacts/editorcrypto.cpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "editorcrypto.h" - -#include "ui_editorcrypto.h" - -#include "libkleo/kleo/enum.h" - -#include - -class EditorCrypto::Private -{ - EditorCrypto *const q; - - public: - explicit Private( EditorCrypto *parent ) : q( parent ) - { - mUi.setupUi( parent ); - - mProtocolCB[ 0 ] = mUi.inlineOpenPGPCheckBox; - mProtocolCB[ 1 ] = mUi.openPGPCheckBox; - mProtocolCB[ 2 ] = mUi.smimeCheckBox; - mProtocolCB[ 3 ] = mUi.smimeOpaqueCheckBox; - - mUi.openPGPKeyRequester->setMultipleKeysEnabled( true ); - mUi.openPGPKeyRequester->setAllowedKeys( Kleo::EncryptionKeyRequester::OpenPGP ); - - mUi.smimeCertificateRequester->setMultipleKeysEnabled( true ); - mUi.smimeCertificateRequester->setAllowedKeys( Kleo::EncryptionKeyRequester::SMIME ); - - for ( unsigned int i = Kleo::UnknownSigningPreference; i < Kleo::MaxSigningPreference ; ++i ) - mUi.signComboBox->addItem( Kleo::signingPreferenceToLabel( static_cast( i ) ) ); - - for ( unsigned int i = Kleo::UnknownPreference; i < Kleo::MaxEncryptionPreference ; ++i ) - mUi.encryptComboBox->addItem( Kleo::encryptionPreferenceToLabel( static_cast( i ) ) ); - } - - public: - Ui::EditorCrypto mUi; - - enum { NumberOfProtocols = 4 }; - QCheckBox* mProtocolCB[NumberOfProtocols]; -}; - -static QString loadCustom( const KABC::Addressee &contact, const QString &key ) -{ - return contact.custom( QLatin1String( "KADDRESSBOOK" ), key ); -} - -static void storeCustom( KABC::Addressee &contact, const QString &key, const QString &value ) -{ - if ( value.isEmpty() ) - contact.removeCustom( QLatin1String( "KADDRESSBOOK" ), key ); - else - contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), key, value ); -} - - -EditorCrypto::EditorCrypto( QWidget *parent ) - : EditorBase( parent ), d( new Private( this ) ) -{ -} - -EditorCrypto::~EditorCrypto() -{ - delete d; -} - -void EditorCrypto::loadContact( const KABC::Addressee &contact, const Akonadi::ContactMetaData& ) -{ - const QStringList protocolPrefs = loadCustom( contact, QLatin1String( "CRYPTOPROTOPREF" ) ).split( QLatin1Char( ',' ), QString::SkipEmptyParts ); - const uint cryptoFormats = Kleo::stringListToCryptoMessageFormats( protocolPrefs ); - - uint msgFormat = 1; - for ( uint i = 0 ; i < Private::NumberOfProtocols ; ++i, msgFormat *= 2 ) - d->mProtocolCB[i]->setChecked( cryptoFormats & msgFormat ); - - d->mUi.signComboBox->setCurrentIndex( Kleo::stringToSigningPreference( loadCustom( contact, QLatin1String( "CRYPTOSIGNPREF" ) ) ) ); - d->mUi.encryptComboBox->setCurrentIndex( Kleo::stringToEncryptionPreference( loadCustom( contact, QLatin1String( "CRYPTOENCRYPTPREF" ) ) ) ); - - d->mUi.openPGPKeyRequester->setFingerprints( loadCustom( contact, QLatin1String( "OPENPGPFP" ) ).split( QLatin1Char( ',' ), QString::SkipEmptyParts ) ); - d->mUi.smimeCertificateRequester->setFingerprints( loadCustom( contact, QLatin1String( "SMIMEFP" ) ).split( QLatin1Char( ',' ), QString::SkipEmptyParts ) ); -} - -void EditorCrypto::saveContact( KABC::Addressee &contact, Akonadi::ContactMetaData& ) const -{ - uint cryptoFormats = 0; - uint msgFormat = 1; - for ( uint i = 0 ; i < Private::NumberOfProtocols ; ++i, msgFormat *= 2 ) { - if ( d->mProtocolCB[ i ]->isChecked() ) - cryptoFormats |= msgFormat; - } - - const QStringList protocolPref = Kleo::cryptoMessageFormatsToStringList( cryptoFormats ); - storeCustom( contact, QLatin1String( "CRYPTOPROTOPREF" ), protocolPref.join( QLatin1String( "," ) ) ); - - const Kleo::SigningPreference signPref = static_cast( d->mUi.signComboBox->currentIndex() ); - if ( signPref != Kleo::UnknownSigningPreference ) - contact.insertCustom( QLatin1String("KADDRESSBOOK"), QLatin1String("CRYPTOSIGNPREF"), QLatin1String(Kleo::signingPreferenceToString( signPref )) ); - else - contact.removeCustom(QLatin1String( "KADDRESSBOOK"), QLatin1String("CRYPTOSIGNPREF") ); - - const Kleo::EncryptionPreference encryptPref = static_cast( d->mUi.encryptComboBox->currentIndex() ); - if ( encryptPref != Kleo::UnknownPreference ) - contact.insertCustom( QLatin1String("KADDRESSBOOK"), QLatin1String("CRYPTOENCRYPTPREF"), QLatin1String(Kleo::encryptionPreferenceToString( encryptPref )) ); - else - contact.removeCustom( QLatin1String("KADDRESSBOOK"), QLatin1String("CRYPTOENCRYPTPREF") ); - - const QStringList pfp = d->mUi.openPGPKeyRequester->fingerprints(); - storeCustom( contact, QLatin1String( "OPENPGPFP" ), pfp.join( QLatin1String( "," ) ) ); - - const QStringList sfp = d->mUi.smimeCertificateRequester->fingerprints(); - storeCustom( contact, QLatin1String( "SMIMEFP" ), sfp.join( QLatin1String( "," ) ) ); -} - diff --git a/kdepim/mobile/contacts/editorcrypto.h b/kdepim/mobile/contacts/editorcrypto.h deleted file mode 100644 index 1182d91c..00000000 --- a/kdepim/mobile/contacts/editorcrypto.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 EDITORCRYPTO_H -#define EDITORCRYPTO_H - -#include "editorbase.h" - -class EditorCrypto : public EditorBase -{ - Q_OBJECT - - public: - explicit EditorCrypto( QWidget *parent = 0 ); - - ~EditorCrypto(); - - void loadContact( const KABC::Addressee &contact, const Akonadi::ContactMetaData &metaData ); - void saveContact( KABC::Addressee &contact, Akonadi::ContactMetaData &metaData ) const; - - private: - class Private; - Private *const d; -}; - -#endif diff --git a/kdepim/mobile/contacts/editorcrypto.ui b/kdepim/mobile/contacts/editorcrypto.ui deleted file mode 100644 index 136eb125..00000000 --- a/kdepim/mobile/contacts/editorcrypto.ui +++ /dev/null @@ -1,270 +0,0 @@ - - - EditorCrypto - - - - 0 - 0 - 470 - 485 - - - - - - - Allow the following protocols: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - Inline OpenPGP (deprecated) - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - OpenPGP / MIME - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - S/MIME - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - S/MIME Opaque - - - - - - - - - Preferred Open/PGP encryption key: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - - - - - - Preferred S/MIME encryption certificate: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - - - - - - Message Preference: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - - - - - - Encrypt: - - - - - - - - - - Sign: - - - - - - - - - - - Qt::Vertical - - - - 20 - 168 - - - - - - - - - KComboBox - QComboBox -
kcombobox.h
-
- - Kleo::EncryptionKeyRequester - QWidget -
libkleo/ui/keyrequester.h
- 1 -
-
- - -
diff --git a/kdepim/mobile/contacts/editorgeneral.cpp b/kdepim/mobile/contacts/editorgeneral.cpp deleted file mode 100644 index 0ddac89f..00000000 --- a/kdepim/mobile/contacts/editorgeneral.cpp +++ /dev/null @@ -1,453 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 "editorgeneral.h" - -#include "ui_editorgeneral.h" - -#include - -#include -#include - -class PhoneWidgets -{ - public: - PhoneWidgets( MobileLineEdit *input, PhoneTypeCombo *type ) - : mInput( input ), mType( type ) - { - } - - - public: - QString mId; - MobileLineEdit *mInput; - PhoneTypeCombo *mType; -}; - -class EditorGeneral::Private -{ - EditorGeneral *const q; - - public: - explicit Private( EditorGeneral *parent ) - : q( parent ) - { - mUi.setupUi( parent ); - - QObject::connect( mUi.email1, SIGNAL(clearClicked()), q, SLOT(clearEmailClicked()) ); - QObject::connect( mUi.email2, SIGNAL(clearClicked()), q, SLOT(clearEmailClicked()) ); - mEmailInputs << mUi.email1; - mEmailInputs << mUi.email2; - mLastEmailRow = 2; // third row - - QObject::connect( mUi.phone1, SIGNAL(clearClicked()), q, SLOT(clearPhoneClicked()) ); - QObject::connect( mUi.phone2, SIGNAL(clearClicked()), q, SLOT(clearPhoneClicked()) ); - mPhoneWidgets << new PhoneWidgets( mUi.phone1, mUi.phone1Type ); - mUi.phone1Type->setType( KABC::PhoneNumber::Pref ); - mPhoneWidgets << new PhoneWidgets( mUi.phone2, mUi.phone2Type ); - mLastPhoneRow = 4; // fifth row - - mUi.collectionSelector->setMimeTypeFilter( QStringList() << KABC::Addressee::mimeType() ); - mUi.collectionSelector->setAccessRightsFilter( Akonadi::Collection::CanCreateItem | Akonadi::Collection::CanChangeItem ); - - mUi.gridLayout->removeWidget( mUi.pictureButton ); - mUi.gridLayout->addWidget( mUi.pictureButton, 0, 3, 3, 1, Qt::AlignTop ); - mUi.pictureButton->setType( ImageWidget::Photo ); - - QObject::connect( mUi.launchAccountWizardButton, SIGNAL(clicked()), q, SIGNAL(requestLaunchAccountWizard()) ); - - availableCollectionsChanged(); - } - - ~Private() - { - qDeleteAll( mPhoneWidgets ); - } - - void ensureEmailRows( int emailCount ) - { - // TODO delete unnecessary rows? - addEmailRows( emailCount ); - } - - void ensurePhoneRows( int phoneCount ) - { - // TODO delete unnecessary rows? - addPhoneRows( phoneCount ); - } - - public: - Ui::EditorGeneral mUi; - - KABC::Addressee mContact; - - QList mEmailInputs; - QList mPhoneWidgets; - - int mLastEmailRow; - int mLastPhoneRow; - - public: // slots - void nameTextChanged( const QString &text ) - { - mContact.setNameFromString( text ); - mUi.saveButton->setEnabled( !text.trimmed().isEmpty() ); - - emit q->nameChanged( mContact ); - } - - void addEmailClicked(); - void clearEmailClicked(); - void addPhoneClicked(); - void clearPhoneClicked(); - - void availableCollectionsChanged() - { - const bool available = mUi.collectionSelector->currentCollection().isValid(); - mUi.collectionSelector->setVisible( available ); - mUi.launchAccountWizardButton->setVisible( !available ); - } - - void disableSaveButton() - { - mUi.saveButton->setEnabled( false ); - } - - private: - void addEmailRows( int newRowCount ); - void addPhoneRows( int newRowCount ); -}; - -void EditorGeneral::Private::addEmailClicked() -{ - addEmailRows( mEmailInputs.count() + 1 ); -} - -void EditorGeneral::Private::addPhoneClicked() -{ - addPhoneRows( mPhoneWidgets.count() + 1 ); -} - -void EditorGeneral::Private::addEmailRows( int newRowCount ) -{ - if ( newRowCount <= mEmailInputs.count() ) { - return; - } - - // remove widgets from layout - mUi.gridLayout->removeWidget( mUi.addEmailButton ); - - QList::const_iterator widgetIt = mPhoneWidgets.constBegin(); - for ( ; widgetIt != mPhoneWidgets.constEnd(); ++widgetIt ) { - mUi.gridLayout->removeWidget( (*widgetIt)->mInput ); - mUi.gridLayout->removeWidget( (*widgetIt)->mType ); - } - - mUi.gridLayout->removeWidget( mUi.phoneLabel ); - mUi.gridLayout->removeWidget( mUi.addPhoneButton ); - mUi.gridLayout->removeWidget( mUi.cancelButton ); - mUi.gridLayout->removeWidget( mUi.saveButton ); - mUi.gridLayout->removeWidget( mUi.collectionSelector ); - mUi.gridLayout->removeWidget( mUi.launchAccountWizardButton ); - - int row = mLastEmailRow + 1; - - // add new widgets - for ( ; mEmailInputs.count() < newRowCount; ++row, ++mLastEmailRow, ++mLastPhoneRow ) { - MobileLineEdit *lineEdit = new MobileLineEdit( q ); - mUi.gridLayout->addWidget( lineEdit, row, 1, 1, 1 ); - QObject::connect( lineEdit, SIGNAL(clearClicked()), q, SLOT(clearEmailClicked()) ); - mEmailInputs << lineEdit; - } - - // re-add widgets - mUi.gridLayout->addWidget( mUi.addEmailButton, mLastEmailRow, 2, 1, 1 ); - - mUi.gridLayout->addWidget( mUi.phoneLabel, row, 0, 1, 1 ); - widgetIt = mPhoneWidgets.constBegin(); - for ( ; widgetIt != mPhoneWidgets.constEnd(); ++widgetIt, ++row ) { - mUi.gridLayout->addWidget( (*widgetIt)->mInput, row, 1, 1, 1 ); - mUi.gridLayout->addWidget( (*widgetIt)->mType, row, 2, 1, 1 ); - } - - mUi.gridLayout->addWidget( mUi.addPhoneButton, mLastPhoneRow, 3, 1, 1 ); - mUi.gridLayout->addWidget( mUi.cancelButton, row, 2, 1, 1 ); - mUi.gridLayout->addWidget( mUi.saveButton, row, 3, 1, 1 ); - mUi.gridLayout->addWidget( mUi.collectionSelector, row, 1, 1, 1 ); - mUi.gridLayout->addWidget( mUi.launchAccountWizardButton, row, 1, 1, 1 ); -} - -void EditorGeneral::Private::clearEmailClicked() -{ - int index = 0; - for ( ; index < mEmailInputs.count(); ++index ) { - if ( mEmailInputs[ index ] == q->sender() ) { - break; - } - } - - Q_ASSERT( index >= 0 && index < mEmailInputs.count() ); - - // shift data - for ( int i = index + 1; i < mEmailInputs.count(); ++i ) { - mEmailInputs[ i - 1 ]->setText( mEmailInputs[ i ]->text() ); - } - - MobileLineEdit *last = mEmailInputs.last(); - if ( mEmailInputs.count() > 2 ) { - // remove widgets from layout - mUi.gridLayout->removeWidget( last ); - mUi.gridLayout->removeWidget( mUi.addEmailButton ); - - QList::const_iterator widgetIt = mPhoneWidgets.constBegin(); - for ( ; widgetIt != mPhoneWidgets.constEnd(); ++widgetIt ) { - mUi.gridLayout->removeWidget( (*widgetIt)->mInput ); - mUi.gridLayout->removeWidget( (*widgetIt)->mType ); - } - - mUi.gridLayout->removeWidget( mUi.phoneLabel ); - mUi.gridLayout->removeWidget( mUi.addPhoneButton ); - mUi.gridLayout->removeWidget( mUi.cancelButton ); - mUi.gridLayout->removeWidget( mUi.saveButton ); - mUi.gridLayout->removeWidget( mUi.collectionSelector ); - mUi.gridLayout->removeWidget( mUi.launchAccountWizardButton ); - - // delete the now obsolete widget - --mLastEmailRow; - --mLastPhoneRow; - mEmailInputs.pop_back(); - last->deleteLater(); - - // re-add widgets - mUi.gridLayout->addWidget( mUi.addEmailButton, mLastEmailRow, 2, 1, 1 ); - - int row = mLastEmailRow + 1; - mUi.gridLayout->addWidget( mUi.phoneLabel, row, 0, 1, 1 ); - widgetIt = mPhoneWidgets.constBegin(); - for ( ; widgetIt != mPhoneWidgets.constEnd(); ++widgetIt, ++row ) { - mUi.gridLayout->addWidget( (*widgetIt)->mInput, row, 1, 1, 1 ); - mUi.gridLayout->addWidget( (*widgetIt)->mType, row, 2, 1, 1 ); - } - - mUi.gridLayout->addWidget( mUi.addPhoneButton, mLastPhoneRow, 3, 1, 1 ); - mUi.gridLayout->addWidget( mUi.cancelButton, row, 2, 1, 1 ); - mUi.gridLayout->addWidget( mUi.saveButton, row, 3, 1, 1 ); - mUi.gridLayout->addWidget( mUi.collectionSelector, row, 1, 1, 1 ); - mUi.gridLayout->addWidget( mUi.launchAccountWizardButton, row, 1, 1, 1 ); - } else { - last->clear(); - } -} - -void EditorGeneral::Private::addPhoneRows( int newRowCount ) -{ - if ( newRowCount <= mPhoneWidgets.count() ) { - return; - } - - // remove widgets from layout - mUi.gridLayout->removeWidget( mUi.addPhoneButton ); - mUi.gridLayout->removeWidget( mUi.cancelButton ); - mUi.gridLayout->removeWidget( mUi.saveButton ); - mUi.gridLayout->removeWidget( mUi.collectionSelector ); - mUi.gridLayout->removeWidget( mUi.launchAccountWizardButton ); - - int row = mLastPhoneRow + 1; - // add new widgets - for ( ; mPhoneWidgets.count() < newRowCount; ++row, ++mLastPhoneRow ) { - MobileLineEdit *lineEdit = new MobileLineEdit( q ); - mUi.gridLayout->addWidget( lineEdit, row, 1, 1, 1 ); - PhoneTypeCombo *combo = new PhoneTypeCombo( q ); - mUi.gridLayout->addWidget( combo, row, 2, 1, 1 ); - - QObject::connect( lineEdit, SIGNAL(clearClicked()), q, SLOT(clearPhoneClicked()) ); - mPhoneWidgets << new PhoneWidgets( lineEdit, combo ); - } - - // re-add widgets - mUi.gridLayout->addWidget( mUi.addPhoneButton, mLastPhoneRow, 3, 1, 1 ); - mUi.gridLayout->addWidget( mUi.cancelButton, mLastPhoneRow + 1, 2, 1, 1 ); - mUi.gridLayout->addWidget( mUi.saveButton, mLastPhoneRow + 1, 3, 1, 1 ); - mUi.gridLayout->addWidget( mUi.collectionSelector, mLastPhoneRow + 1, 1, 1, 1 ); - mUi.gridLayout->addWidget( mUi.launchAccountWizardButton, mLastPhoneRow + 1, 1, 1, 1 ); -} - -void EditorGeneral::Private::clearPhoneClicked() -{ - int index = 0; - for ( ; index < mPhoneWidgets.count(); ++index ) { - if ( mPhoneWidgets[ index ]->mInput == q->sender() ) { - break; - } - } - - Q_ASSERT( index >= 0 && index < mPhoneWidgets.count() ); - - // shift data - for ( int i = index + 1; i < mPhoneWidgets.count(); ++i ) { - PhoneWidgets *source = mPhoneWidgets[ i ]; - PhoneWidgets *target = mPhoneWidgets[ i - 1 ]; - target->mInput->setText( source->mInput->text() ); - target->mType->setType( source->mType->type() ); - target->mId = source->mId; - } - - PhoneWidgets *last = mPhoneWidgets.last(); - if ( mPhoneWidgets.count() > 2 ) { - // remove widgets from layout - mUi.gridLayout->removeWidget( mUi.addPhoneButton ); - mUi.gridLayout->removeWidget( mUi.cancelButton ); - mUi.gridLayout->removeWidget( mUi.saveButton ); - mUi.gridLayout->removeWidget( mUi.collectionSelector ); - mUi.gridLayout->removeWidget( mUi.launchAccountWizardButton ); - - --mLastPhoneRow; - mPhoneWidgets.pop_back(); - last->mInput->deleteLater(); - last->mType->deleteLater(); - delete last; - - // re-add widgets - mUi.gridLayout->addWidget( mUi.addPhoneButton, mLastPhoneRow, 3, 1, 1 ); - mUi.gridLayout->addWidget( mUi.cancelButton, mLastPhoneRow + 1, 2, 1, 1 ); - mUi.gridLayout->addWidget( mUi.saveButton, mLastPhoneRow + 1, 3, 1, 1 ); - mUi.gridLayout->addWidget( mUi.collectionSelector, mLastPhoneRow + 1, 1, 1, 1 ); - mUi.gridLayout->addWidget( mUi.launchAccountWizardButton, mLastPhoneRow + 1, 1, 1, 1 ); - } else { - last->mInput->clear(); - last->mType->setType( KABC::PhoneNumber::Home ); - last->mId.clear(); - } -} - -EditorGeneral::EditorGeneral( QWidget *parent ) - : EditorBase( parent ), d( new Private( this ) ) -{ - connect( d->mUi.fullName, SIGNAL(textChanged(QString)), SLOT(nameTextChanged(QString)) ); - - connect( d->mUi.addEmailButton, SIGNAL(clicked()), SLOT(addEmailClicked()) ); - - connect( d->mUi.addPhoneButton, SIGNAL(clicked()), SLOT(addPhoneClicked()) ); - - connect( d->mUi.saveButton, SIGNAL(clicked()), SLOT(disableSaveButton()) ); // prevent double clicks - connect( d->mUi.saveButton, SIGNAL(clicked()), SIGNAL(saveClicked()) ); - connect( d->mUi.cancelButton, SIGNAL(clicked()), SIGNAL(cancelClicked()) ); - connect( d->mUi.collectionSelector, SIGNAL(currentChanged(Akonadi::Collection)), - SIGNAL(collectionChanged(Akonadi::Collection)) ); - - connect( d->mUi.collectionSelector->model(), SIGNAL(rowsInserted(QModelIndex,int,int)), - SLOT(availableCollectionsChanged()) ); - connect( d->mUi.collectionSelector->model(), SIGNAL(rowsRemoved(QModelIndex,int,int)), - SLOT(availableCollectionsChanged()) ); - - d->mUi.saveButton->setIcon( SmallIcon( QLatin1String("document-save"), 64 ) ); - d->mUi.cancelButton->setIcon( SmallIcon( QLatin1String("dialog-cancel"), 64 ) ); -} - -EditorGeneral::~EditorGeneral() -{ - delete d; -} - -void EditorGeneral::loadContact( const KABC::Addressee &contact, const Akonadi::ContactMetaData& ) -{ - d->mContact = contact; - - d->mUi.fullName->blockSignals( true ); - d->mUi.fullName->setText( contact.assembledName() ); - d->mUi.fullName->blockSignals( false ); - - const QStringList emails = contact.emails(); - d->ensureEmailRows( emails.count() ); - - QList::iterator inputIt = d->mEmailInputs.begin(); - Q_FOREACH( const QString &email, emails ) { - (*inputIt)->setText( email ); - ++inputIt; - } - - const KABC::PhoneNumber::List phones = contact.phoneNumbers(); - d->ensurePhoneRows( phones.count() ); - - QList::iterator widgetIt = d->mPhoneWidgets.begin(); - Q_FOREACH( const KABC::PhoneNumber &phone, phones ) { - PhoneWidgets* widgets = *widgetIt; - - widgets->mId = phone.id(); - widgets->mInput->setText( phone.number() ); - - widgets->mType->setType( phone.type() ); - - ++widgetIt; - } - - d->mUi.pictureButton->loadContact( contact ); -} - -void EditorGeneral::saveContact( KABC::Addressee &contact, Akonadi::ContactMetaData& ) const -{ - contact.setPrefix( d->mContact.prefix() ); - contact.setGivenName( d->mContact.givenName() ); - contact.setAdditionalName( d->mContact.additionalName() ); - contact.setFamilyName( d->mContact.familyName() ); - contact.setSuffix( d->mContact.suffix() ); - - Q_FOREACH( MobileLineEdit *input, d->mEmailInputs ) { - const QString email = input->text().trimmed(); - if ( !email.isEmpty() ) { - contact.insertEmail( email ); - } - } - - Q_FOREACH( PhoneWidgets *widgets, d->mPhoneWidgets ) { - const QString number = widgets->mInput->text().trimmed(); - if ( !number.isEmpty() ) { - KABC::PhoneNumber phone( number, widgets->mType->type() ); - if ( !widgets->mId.isEmpty() ) { - phone.setId( widgets->mId ); - } - contact.insertPhoneNumber( phone ); - } - } - - d->mUi.pictureButton->storeContact( contact ); -} - -Akonadi::Collection EditorGeneral::selectedCollection() const -{ - return d->mUi.collectionSelector->currentCollection(); -} - -void EditorGeneral::setDefaultCollection( const Akonadi::Collection &collection ) -{ - d->mUi.collectionSelector->setDefaultCollection( collection ); -} - -void EditorGeneral::updateName( const KABC::Addressee &contact ) -{ - // this slot is called when the name parts have been changed in the 'More' page - blockSignals( true ); - d->mContact = contact; - d->mUi.fullName->setText( d->mContact.assembledName() ); - d->mUi.saveButton->setEnabled( !d->mUi.fullName->text().trimmed().isEmpty() ); - blockSignals( false ); -} - -#include "moc_editorgeneral.cpp" diff --git a/kdepim/mobile/contacts/editorgeneral.h b/kdepim/mobile/contacts/editorgeneral.h deleted file mode 100644 index c01c8a9c..00000000 --- a/kdepim/mobile/contacts/editorgeneral.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 EDITORGENERAL_H -#define EDITORGENERAL_H - -#include "editorbase.h" - -namespace Akonadi -{ - class Collection; -} - -class EditorGeneral : public EditorBase -{ - Q_OBJECT - - public: - explicit EditorGeneral( QWidget *parent = 0 ); - - ~EditorGeneral(); - - void setDefaultCollection( const Akonadi::Collection &collection ); - - void loadContact( const KABC::Addressee &contact, const Akonadi::ContactMetaData &metaData ); - - void saveContact( KABC::Addressee &contact, Akonadi::ContactMetaData &metaData ) const; - - Akonadi::Collection selectedCollection() const; - - public Q_SLOTS: - void updateName( const KABC::Addressee& ); - - Q_SIGNALS: - void collectionChanged( const Akonadi::Collection &collection ); - void nameChanged( const KABC::Addressee& ); - - void saveClicked(); - void cancelClicked(); - - void requestLaunchAccountWizard(); - - private: - class Private; - Private *const d; - - Q_PRIVATE_SLOT( d, void nameTextChanged( const QString& ) ) - Q_PRIVATE_SLOT( d, void addEmailClicked() ) - Q_PRIVATE_SLOT( d, void addPhoneClicked() ) - Q_PRIVATE_SLOT( d, void clearEmailClicked() ) - Q_PRIVATE_SLOT( d, void clearPhoneClicked() ) - Q_PRIVATE_SLOT( d, void availableCollectionsChanged() ) - Q_PRIVATE_SLOT( d, void disableSaveButton() ) -}; - -#endif diff --git a/kdepim/mobile/contacts/editorgeneral.ui b/kdepim/mobile/contacts/editorgeneral.ui deleted file mode 100644 index 8814331a..00000000 --- a/kdepim/mobile/contacts/editorgeneral.ui +++ /dev/null @@ -1,166 +0,0 @@ - - - EditorGeneral - - - - 0 - 0 - 402 - 199 - - - - - - - - - Name - - - - - - - - - - - 0 - 0 - - - - - - - - - - - E-Mail - - - - - - - - - - - - - Add - - - - - - - Phone - - - - - - - - - - - - - - - - - - - Add - - - - - - - - 64 - 64 - - - - - - - - - 64 - 64 - - - - - - - - - 0 - 0 - - - - QComboBox::AdjustToMinimumContentsLength - - - - - - - New Address Book - - - - - - - - - Qt::Vertical - - - - 20 - 8 - - - - - - - - - Akonadi::CollectionComboBox - QComboBox -
akonadi/collectioncombobox.h
-
- - PhoneTypeCombo - QComboBox -
phonetypecombo.h
-
- - MobileLineEdit - QWidget -
mobilelineedit.h
-
- - ImageWidget - QPushButton -
imagewidget.h
-
-
- - -
diff --git a/kdepim/mobile/contacts/editorlocation.cpp b/kdepim/mobile/contacts/editorlocation.cpp deleted file mode 100644 index 41ae58f0..00000000 --- a/kdepim/mobile/contacts/editorlocation.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "editorlocation.h" - -#include "locationmodel.h" -#include "ui_editorlocation.h" - -#include -#include - -#include -#include -#include - -class AddressTypeDialog : public KDialog -{ - public: - AddressTypeDialog( QWidget *parent = 0 ) - : KDialog( parent) - { - setCaption( i18nc( "street/postal", "New Address" ) ); - - QWidget *page = new QWidget(this); - setMainWidget( page ); - QVBoxLayout *layout = new QVBoxLayout( page ); - layout->setSpacing( KDialog::spacingHint() ); - layout->setMargin( 0 ); - - QGroupBox *box = new QGroupBox( i18nc( "street/postal", "Address Types" ), page ); - layout->addWidget( box ); - mGroup = new QButtonGroup( box ); - mGroup->setExclusive ( false ); - - QGridLayout *buttonLayout = new QGridLayout( box ); - - mTypeList = KABC::Address::typeList(); - mTypeList.removeAll( KABC::Address::Pref ); - - KABC::Address::TypeList::ConstIterator it; - int i = 0; - int row = 0; - for ( it = mTypeList.constBegin(); it != mTypeList.constEnd(); ++it, ++i ) { - QCheckBox *checkBox = new QCheckBox( KABC::Address::typeLabel( *it ), box ); - buttonLayout->addWidget( checkBox, row, i % 3 ); - - if ( i % 3 == 2 ) - ++row; - - mGroup->addButton( checkBox ); - } - } - - KABC::Address::Type type() const - { - KABC::Address::Type type; - for ( int i = 0; i < mGroup->buttons().count(); ++i ) { - QCheckBox *box = dynamic_cast( mGroup->buttons().at( i ) ); - if ( box && box->isChecked() ) - type |= mTypeList[ i ]; - } - - return type; - } - - private: - QButtonGroup *mGroup; - - KABC::Address::TypeList mTypeList; -}; - - -class EditorLocation::Private -{ - EditorLocation *const q; - - public: - explicit Private( EditorLocation *parent ) : q( parent ) - { - mUi.setupUi( parent ); - mModel = new LocationModel( q ); - - mUi.addressSelectionCombo->setModel( mModel ); - mUi.addressSelectionCombo->setModelColumn( 0 ); - - mMapper = new QDataWidgetMapper( q ); - mMapper->setModel( mModel ); - mMapper->addMapping( mUi.streetLineEdit, 1, "plainText" ); - mMapper->addMapping( mUi.postOfficeBoxLineEdit, 2 ); - mMapper->addMapping( mUi.localityLineEdit, 3 ); - mMapper->addMapping( mUi.regionLineEdit, 4 ); - mMapper->addMapping( mUi.postalCodeLineEdit, 5 ); - mMapper->addMapping( mUi.countryLineEdit, 6 ); - mMapper->addMapping( mUi.editLabelLineEdit, 7 ); - mMapper->toFirst(); - - q->connect( mUi.addressSelectionCombo, SIGNAL(activated(int)), - mMapper, SLOT(setCurrentIndex(int)) ); - q->connect( mUi.addAddressButton, SIGNAL(clicked()), - SLOT(addAddress()) ); - q->connect( mUi.deleteAddressButton, SIGNAL(clicked()), - SLOT(removeAddress()) ); - q->connect( mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), - SLOT(addressCountChanged()) ); - q->connect( mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), - SLOT(addressCountChanged()) ); - - addressCountChanged(); - } - - void addAddress() - { - AddressTypeDialog dlg; - if ( !dlg.exec() ) - return; - - const KABC::Address::Type addressType = dlg.type(); - - if ( mModel->insertRows( 0, 1 ) ) { - mModel->setData( mModel->index( 0, 0 ), QVariant::fromValue( static_cast( addressType ) ) ); - mUi.addressSelectionCombo->setCurrentIndex( 0 ); - mMapper->setCurrentIndex( 0 ); - } - } - - void removeAddress() - { - const int answer = KMessageBox::questionYesNo( 0, i18n( "Do you really want to delete this address?" ), - i18n( "Delete Address" ), - KGuiItem( i18n("Delete") ) ); - if ( answer == KMessageBox::No ) - return; - - const int index = mMapper->currentIndex(); - mModel->removeRows( index, 1 ); - if ( index >= mModel->rowCount() ) - mMapper->setCurrentIndex( mModel->rowCount() - 1 ); - else - mMapper->setCurrentIndex( index ); - - if ( mModel->rowCount() == 0 ) { - // We have to cleanup the fields ourself in this case, - // QDataWidgetMapper does not handle a non-existing index - for ( int column = 1; column < 8; ++column ) { - QLineEdit *lineEdit = qobject_cast( mMapper->mappedWidgetAt( column ) ); - if ( lineEdit ) - lineEdit->clear(); - else { - QTextEdit *textEdit = qobject_cast( mMapper->mappedWidgetAt( column ) ); - if ( textEdit ) - textEdit->clear(); - } - } - } - } - - void addressCountChanged() - { - const bool enabled = (mModel->rowCount() > 0); - - mUi.addressSelectionCombo->setEnabled( enabled ); - mUi.deleteAddressButton->setEnabled( enabled ); - for ( int column = 1; column < 8; ++column ) { - QWidget *widget = mMapper->mappedWidgetAt( column ); - if ( widget ) - widget->setEnabled( enabled ); - } - } - - public: - Ui::EditorLocation mUi; - - KABC::Addressee mContact; - LocationModel *mModel; - QDataWidgetMapper *mMapper; -}; - - -EditorLocation::EditorLocation( QWidget *parent ) - : EditorBase( parent ), d( new Private( this ) ) -{ -} - -EditorLocation::~EditorLocation() -{ - delete d; -} - -void EditorLocation::loadContact( const KABC::Addressee &contact, const Akonadi::ContactMetaData& ) -{ - d->mModel->setLocations( contact.addresses() ); - d->mUi.addressSelectionCombo->setCurrentIndex( 0 ); - d->mMapper->setCurrentIndex( 0 ); - d->addressCountChanged(); -} - -void EditorLocation::saveContact( KABC::Addressee &contact, Akonadi::ContactMetaData& ) const -{ - const KABC::Address::List oldAddresses = contact.addresses(); - foreach ( const KABC::Address &oldAddress, oldAddresses ) - contact.removeAddress( oldAddress ); - - foreach ( const KABC::Address &newAddress, d->mModel->locations() ) - contact.insertAddress( newAddress ); -} - -#include "moc_editorlocation.cpp" diff --git a/kdepim/mobile/contacts/editorlocation.h b/kdepim/mobile/contacts/editorlocation.h deleted file mode 100644 index 5dc906a4..00000000 --- a/kdepim/mobile/contacts/editorlocation.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 EDITORLOCATION_H -#define EDITORLOCATION_H - -#include "editorbase.h" - -class EditorLocation : public EditorBase -{ - Q_OBJECT - - public: - explicit EditorLocation( QWidget *parent = 0 ); - - ~EditorLocation(); - - void loadContact( const KABC::Addressee &contact, const Akonadi::ContactMetaData &metaData ); - void saveContact( KABC::Addressee &contact, Akonadi::ContactMetaData &metaData ) const; - - private: - class Private; - Private *const d; - - Q_PRIVATE_SLOT( d, void addAddress() ) - Q_PRIVATE_SLOT( d, void removeAddress() ) - Q_PRIVATE_SLOT( d, void addressCountChanged() ) -}; - -#endif diff --git a/kdepim/mobile/contacts/editorlocation.ui b/kdepim/mobile/contacts/editorlocation.ui deleted file mode 100644 index a82c0266..00000000 --- a/kdepim/mobile/contacts/editorlocation.ui +++ /dev/null @@ -1,177 +0,0 @@ - - - EditorLocation - - - - 0 - 0 - 400 - 369 - - - - - - - - - - 0 - 0 - - - - Show address: - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - Add new - - - - - - - - - QFrame::HLine - - - QFrame::Raised - - - - - - - QFormLayout::ExpandingFieldsGrow - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - Street: - - - - - - - false - - - - - - - Post Office -Box: - - - - - - - - - - Locality: - - - - - - - - - - Region: - - - - - - - - - - Postal Code: - - - - - - - - - - Country: - - - - - - - - - - Edit Label: - - - - - - - - - - - - - - Delete this address - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - diff --git a/kdepim/mobile/contacts/editormore.cpp b/kdepim/mobile/contacts/editormore.cpp deleted file mode 100644 index b4d5bbb3..00000000 --- a/kdepim/mobile/contacts/editormore.cpp +++ /dev/null @@ -1,451 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "editormore.h" - -#include "contactmetadata_p.h" -#include "customfieldeditordialog.h" -#include "customfieldeditwidget.h" -#include "customfieldmanager_p.h" -#include "settings.h" -#include "ui_editormore.h" -#include "ui_editormore_categoriespage.h" -#include "ui_editormore_customfieldspage.h" -#include "ui_editormore_namepage.h" -#include "ui_editormore_internetpage.h" -#include "ui_editormore_personalpage.h" - -#include -#include - -#include - -#include - -#include -#include -#include -#include - -class EditorMore::Private -{ - EditorMore *const q; - - public: - explicit Private( EditorMore *parent ) : q( parent ) - { - mUi.setupUi( parent ); - - mMapper = new QSignalMapper( q ); - mMapper->setMapping( mUi.namePageButton, 0 ); - mMapper->setMapping( mUi.internetPageButton, 1 ); - mMapper->setMapping( mUi.personalPageButton, 2 ); - mMapper->setMapping( mUi.customFieldsPageButton, 3 ); - mMapper->setMapping( mUi.categoriesPageButton, 4 ); - - // tokoe: enable when ContactMetaData is part of public API - mUi.customFieldsPageButton->hide(); - - - QWidget *namePage = new QWidget; - mNamePage.setupUi( namePage ); - mNamePage.pronunciationTitle->hide(); // not editable, so don't confuse the user - mNamePage.pronunciationLabel->hide(); - - QWidget *internetPage = new QWidget; - mInternetPage.setupUi( internetPage ); - - QWidget *personalPage = new QWidget; - mPersonalPage.setupUi( personalPage ); - - QWidget *customFieldsPage = new QWidget; - mCustomFieldsPage.setupUi( customFieldsPage ); - - QWidget *categoriesPage = new QWidget; - mCategoriesPage.setupUi( categoriesPage ); - - mUi.pageWidget->insertWidget( 0, namePage ); - mUi.pageWidget->insertWidget( 1, internetPage ); - mUi.pageWidget->insertWidget( 2, personalPage ); - mUi.pageWidget->insertWidget( 3, customFieldsPage ); - mUi.pageWidget->insertWidget( 4, categoriesPage ); - - connect( mUi.namePageButton, SIGNAL(clicked()), - mMapper, SLOT(map()) ); - connect( mUi.internetPageButton, SIGNAL(clicked()), - mMapper, SLOT(map()) ); - connect( mUi.personalPageButton, SIGNAL(clicked()), - mMapper, SLOT(map()) ); - connect( mUi.customFieldsPageButton, SIGNAL(clicked()), - mMapper, SLOT(map()) ); - connect( mUi.categoriesPageButton, SIGNAL(clicked()), - mMapper, SLOT(map()) ); - connect( mMapper, SIGNAL(mapped(int)), - mUi.pageWidget, SLOT(setCurrentIndex(int)) ); - - mUi.pageWidget->setCurrentIndex( 0 ); - - connect( mNamePage.namePartsWidget, SIGNAL(nameChanged(KABC::Addressee)), - mNamePage.displayNameWidget, SLOT(changeName(KABC::Addressee)) ); - connect( mNamePage.namePartsWidget, SIGNAL(nameChanged(KABC::Addressee)), - q, SIGNAL(nameChanged(KABC::Addressee)) ); - connect( mNamePage.pronunciationLabel, SIGNAL(linkActivated(QString)), - q, SLOT(playPronunciation()) ); - - connect( mCustomFieldsPage.addCustomFieldButton, SIGNAL(clicked()), - q, SLOT(addCustomField()) ); - - connect( mCategoriesPage.categoriesButton, SIGNAL(clicked()), - q, SLOT(configureCategories()) ); - - mPersonalPage.birthdayDateEdit->setDate( QDate() ); - mPersonalPage.anniversaryDateEdit->setDate( QDate() ); - } - - void configureCategories() - { - CalendarSupport::CategoryConfig config( Settings::self(), 0 ); - - IncidenceEditorNG::CategoryDialog dlg( &config, 0 ); - dlg.setCategoryList( mCategories ); - dlg.setSelected( mCategories ); - if ( dlg.exec() ) { - mCategories = dlg.selectedCategories(); - mCategoriesPage.categoriesEdit->setText( mCategories.join( QLatin1String(", ") ) ); - } - } - - void playPronunciation() - { - if ( mContact.sound().data().isEmpty() ) - return; - - Phonon::MediaObject* player = Phonon::createPlayer( Phonon::NotificationCategory ); - QBuffer* soundData = new QBuffer( player ); - soundData->setData( mContact.sound().data() ); - player->setCurrentSource( soundData ); - player->setParent( q ); - connect( player, SIGNAL(finished()), player, SLOT(deleteLater()) ); - player->play(); - } - - void addCustomField() - { - CustomField field; - - // We use a Uuid as default key, so we won't have any duplicated keys, - // the user can still change it to something else in the editor dialog. - // Since the key only allows [A-Za-z0-9\-]*, we have to remove the curly - // braces as well. - QString key = QUuid::createUuid().toString(); - key.remove( QLatin1Char( '{' ) ); - key.remove( QLatin1Char( '}' ) ); - - field.setKey( key ); - - CustomFieldEditorDialog dlg; - dlg.setCustomField( field ); - - if ( dlg.exec() ) { - CustomFieldEditWidget *widget = new CustomFieldEditWidget; - widget->setCustomField( dlg.customField() ); - - mCustomFieldsPage.customFieldsLister->addWidget( widget ); - } - } - - public: - Ui::EditorMore mUi; - Ui::NamePage mNamePage; - Ui::InternetPage mInternetPage; - Ui::PersonalPage mPersonalPage; - Ui::CustomFieldsPage mCustomFieldsPage; - Ui::CategoriesPage mCategoriesPage; - QSignalMapper *mMapper; - - KABC::Addressee mContact; - CustomField::List mLocalCustomFields; - QStringList mCategories; -}; - -static QString loadCustom( const KABC::Addressee &contact, const QString &key ) -{ - return contact.custom( QLatin1String( "KADDRESSBOOK" ), key ); -} - -static void storeCustom( KABC::Addressee &contact, const QString &key, const QString &value ) -{ - if ( value.isEmpty() ) - contact.removeCustom( QLatin1String( "KADDRESSBOOK" ), key ); - else - contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), key, value ); -} - -static void splitCustomField( const QString &str, QString &app, QString &name, QString &value ) -{ - const int colon = str.indexOf( QLatin1Char( ':' ) ); - if ( colon != -1 ) { - const QString tmp = str.left( colon ); - value = str.mid( colon + 1 ); - - const int dash = tmp.indexOf( QLatin1Char( '-' ) ); - if ( dash != -1 ) { - app = tmp.left( dash ); - name = tmp.mid( dash + 1 ); - } - } -} - - -EditorMore::EditorMore( QWidget *parent ) - : EditorBase( parent ), d( new Private( this ) ) -{ -} - -EditorMore::~EditorMore() -{ - delete d; -} - -void EditorMore::loadContact( const KABC::Addressee &contact, const Akonadi::ContactMetaData &metaData ) -{ - Q_UNUSED( metaData ); - - d->mContact = contact; - - // name page - d->mNamePage.nicknameLineEdit->setText( contact.nickName() ); - d->mNamePage.namePartsWidget->loadContact( contact ); - d->mNamePage.displayNameWidget->loadContact( contact ); - // tokoe: enable when ContactMetaData is part of public API - // d->mNamePage.displayNameWidget->setDisplayType( (DisplayNameEditWidget::DisplayType)metaData.displayNameMode() ); - const bool hasSound = !contact.sound().isEmpty(); - d->mNamePage.pronunciationTitle->setVisible( hasSound ); - d->mNamePage.pronunciationLabel->setVisible( hasSound ); - - // internet page - d->mInternetPage.urlLineEdit->setText( contact.url().url() ); - d->mInternetPage.blogLineEdit->setText( loadCustom( contact, QLatin1String( "BlogFeed" ) ) ); - d->mInternetPage.messagingLineEdit->setText( loadCustom( contact, QLatin1String( "X-IMAddress" ) ) ); - - // personal page - d->mPersonalPage.birthdayDateEdit->setDate( contact.birthday().date() ); - const QDate anniversary = QDate::fromString( loadCustom( contact, QLatin1String( "X-Anniversary" ) ), Qt::ISODate ); - d->mPersonalPage.anniversaryDateEdit->setDate( anniversary ); - d->mPersonalPage.partnerLineEdit->setText( loadCustom( contact, QLatin1String( "X-SpousesName" ) ) ); - - // tokoe: enable when ContactMetaData is part of public API - // loadCustomFields( contact, metaData ); - - // categories page - d->mCategories = contact.categories(); - d->mCategoriesPage.categoriesEdit->setText( d->mCategories.join( QLatin1String(", ") ) ); -} - -void EditorMore::loadCustomFields( const KABC::Addressee &contact, const Akonadi::ContactMetaData &metaData ) -{ - d->mLocalCustomFields.clear(); - foreach ( const QVariant &description, metaData.customFieldDescriptions() ) - d->mLocalCustomFields.append( CustomField::fromVariantMap( description.toMap(), CustomField::LocalScope ) ); - - CustomField::List externalCustomFields; - - CustomField::List globalCustomFields = CustomFieldManager::globalCustomFieldDescriptions(); - - const QStringList customs = contact.customs(); - foreach ( const QString &custom, customs ) { - - QString app, name, value; - splitCustomField( custom, app, name, value ); - - // skip all well-known fields that have separated editor widgets - if ( custom.startsWith( QLatin1String( "messaging/" ) ) ) // IM addresses - continue; - - if ( app == QLatin1String( "KADDRESSBOOK" ) ) { - static QSet blacklist; - if ( blacklist.isEmpty() ) { - blacklist << QLatin1String( "BlogFeed" ) - << QLatin1String( "X-IMAddress" ) - << QLatin1String( "X-Profession" ) - << QLatin1String( "X-Office" ) - << QLatin1String( "X-ManagersName" ) - << QLatin1String( "X-AssistantsName" ) - << QLatin1String( "X-Anniversary" ) - << QLatin1String( "X-SpousesName" ) - << QLatin1String( "X-Profession" ); - } - - if ( blacklist.contains( name ) ) // several KAddressBook specific fields - continue; - } - - // check whether it correspond to a local custom field - bool isLocalCustomField = false; - for ( int i = 0; i < d->mLocalCustomFields.count(); ++i ) { - if ( d->mLocalCustomFields[ i ].key() == name ) { - d->mLocalCustomFields[ i ].setValue( value ); - isLocalCustomField = true; - break; - } - } - - // check whether it correspond to a global custom field - bool isGlobalCustomField = false; - for ( int i = 0; i < globalCustomFields.count(); ++i ) { - if ( globalCustomFields[ i ].key() == name ) { - globalCustomFields[ i ].setValue( value ); - isGlobalCustomField = true; - break; - } - } - - // if not local and not global it must be external - if ( !isLocalCustomField && !isGlobalCustomField ) { - if ( app == QLatin1String( "KADDRESSBOOK" ) ) { - // however if it starts with our prefix it might be that this is an outdated - // global custom field, in this case treat it as local field of type text - CustomField customField( name, name, CustomField::TextType, CustomField::LocalScope ); - customField.setValue( value ); - - d->mLocalCustomFields << customField; - } else { - // it is really an external custom field - const QString key = app + QLatin1Char( '-' ) + name; - CustomField customField( key, key, CustomField::TextType, CustomField::ExternalScope ); - customField.setValue( value ); - - externalCustomFields << customField; - } - } - } - - const CustomField::List allCustomFields = CustomField::List() << d->mLocalCustomFields << globalCustomFields << externalCustomFields; - foreach ( const CustomField &customField, allCustomFields ) { - CustomFieldEditWidget *widget = new CustomFieldEditWidget; - widget->setCustomField( customField ); - d->mCustomFieldsPage.customFieldsLister->addWidget( widget ); - } -} - -void EditorMore::saveContact( KABC::Addressee &contact, Akonadi::ContactMetaData &metaData ) const -{ - Q_UNUSED( metaData ); - - // name page - contact.setNickName( d->mNamePage.nicknameLineEdit->text() ); - d->mNamePage.namePartsWidget->storeContact( contact ); - d->mNamePage.displayNameWidget->storeContact( contact ); - // tokoe: enable when ContactMetaData is part of public API - // metaData.setDisplayNameMode( d->mNamePage.displayNameWidget->displayType() ); - - // internet page - contact.setUrl( d->mInternetPage.urlLineEdit->text() ); - storeCustom( contact, QLatin1String( "BlogFeed" ), d->mInternetPage.blogLineEdit->text() ); - storeCustom( contact, QLatin1String( "X-IMAddress" ), d->mInternetPage.messagingLineEdit->text() ); - - // personal page - storeCustom( contact, QLatin1String( "X-SpousesName" ), d->mPersonalPage.partnerLineEdit->text() ); - contact.setBirthday( QDateTime( d->mPersonalPage.birthdayDateEdit->date(), QTime(), contact.birthday().timeSpec() ) ); - const QString anniversary = d->mPersonalPage.anniversaryDateEdit->date().toString( Qt::ISODate ); - storeCustom( contact, QLatin1String( "X-Anniversary" ), anniversary ); - - // tokoe: enable when ContactMetaData is part of public API - // saveCustomFields( contact, metaData ); - - // categories page - contact.setCategories( d->mCategories ); -} - -void EditorMore::saveCustomFields( KABC::Addressee &contact, Akonadi::ContactMetaData &metaData ) const -{ - CustomField::List customFields; - for ( int index = 0; index < d->mCustomFieldsPage.customFieldsLister->count(); ++index ) { - CustomFieldEditWidget *widget = qobject_cast( d->mCustomFieldsPage.customFieldsLister->widget( index ) ); - if ( widget ) - customFields.append( widget->customField() ); - } - - foreach ( const CustomField &customField, customFields ) { - // write back values for local and global scope, leave external untouched - if ( customField.scope() != CustomField::ExternalScope ) { - if ( !customField.value().isEmpty() ) - contact.insertCustom( QLatin1String( "KADDRESSBOOK" ), customField.key(), customField.value() ); - else - contact.removeCustom( QLatin1String( "KADDRESSBOOK" ), customField.key() ); - } - } - - // Now remove all fields that were available in loadContact (these are stored in mLocalCustomFields) - // but are not part of customFields now, which means they have been removed or renamed by the user - // in the editor dialog. - foreach ( const CustomField &oldCustomField, d->mLocalCustomFields ) { - if ( oldCustomField.scope() != CustomField::ExternalScope ) { - - bool fieldStillExists = false; - foreach ( const CustomField &newCustomField, customFields ) { - if ( newCustomField.scope() != CustomField::ExternalScope ) { - if ( newCustomField.key() == oldCustomField.key() ) { - fieldStillExists = true; - break; - } - } - } - - if ( !fieldStillExists ) - contact.removeCustom( QLatin1String( "KADDRESSBOOK" ), oldCustomField.key() ); - } - } - - // And store the global custom fields descriptions as well - CustomField::List globalCustomFields; - foreach ( const CustomField &customField, customFields ) { - if ( customField.scope() == CustomField::GlobalScope ) { - globalCustomFields << customField; - } - } - - // store global custom fields - CustomFieldManager::setGlobalCustomFieldDescriptions( globalCustomFields ); - - // store local custom fields - QVariantList descriptions; - foreach ( const CustomField &field, customFields ) { - if ( field.scope() == CustomField::LocalScope ) - descriptions.append( field.toVariantMap() ); - } - - metaData.setCustomFieldDescriptions( descriptions ); -} - -void EditorMore::updateOrganization( const QString &organization ) -{ - d->mNamePage.displayNameWidget->changeOrganization( organization ); -} - -void EditorMore::updateName( const KABC::Addressee &contact ) -{ - // this slot is called when the name has been changed in the 'General' page - blockSignals( true ); - d->mNamePage.namePartsWidget->loadContact( contact ); - d->mNamePage.displayNameWidget->changeName( contact ); - blockSignals( false ); -} - -#include "moc_editormore.cpp" diff --git a/kdepim/mobile/contacts/editormore.h b/kdepim/mobile/contacts/editormore.h deleted file mode 100644 index 58a1d9ab..00000000 --- a/kdepim/mobile/contacts/editormore.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 EDITORMORE_H -#define EDITORMORE_H - -#include "editorbase.h" - -class EditorMore : public EditorBase -{ - Q_OBJECT - - public: - explicit EditorMore( QWidget *parent = 0 ); - - ~EditorMore(); - - void loadContact( const KABC::Addressee &contact, const Akonadi::ContactMetaData &metaData ); - void saveContact( KABC::Addressee &contact, Akonadi::ContactMetaData &metaData ) const; - - public Q_SLOTS: - void updateOrganization( const QString &organization ); - void updateName( const KABC::Addressee &contact ); - - Q_SIGNALS: - void nameChanged( const KABC::Addressee &contact ); - - private: - void loadCustomFields( const KABC::Addressee &contact, const Akonadi::ContactMetaData &metaData ); - void saveCustomFields( KABC::Addressee &contact, Akonadi::ContactMetaData &metaData ) const; - - class Private; - Private *const d; - - Q_PRIVATE_SLOT( d, void playPronunciation() ) - Q_PRIVATE_SLOT( d, void addCustomField() ) - Q_PRIVATE_SLOT( d, void configureCategories() ) -}; - -#endif diff --git a/kdepim/mobile/contacts/editormore.ui b/kdepim/mobile/contacts/editormore.ui deleted file mode 100644 index 1ac02393..00000000 --- a/kdepim/mobile/contacts/editormore.ui +++ /dev/null @@ -1,86 +0,0 @@ - - - EditorMore - - - - 0 - 0 - 451 - 354 - - - - - - - - - Name - - - - - - - Internet - - - - - - - Personal - - - - - - - Custom Fields - - - - - - - Categories - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - QFrame::VLine - - - QFrame::Raised - - - - - - - - - - - - - - diff --git a/kdepim/mobile/contacts/editormore_categoriespage.ui b/kdepim/mobile/contacts/editormore_categoriespage.ui deleted file mode 100644 index 29410647..00000000 --- a/kdepim/mobile/contacts/editormore_categoriespage.ui +++ /dev/null @@ -1,75 +0,0 @@ - - - CategoriesPage - - - true - - - - 0 - 0 - 400 - 300 - - - - - - - Categories: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - false - - - - - - - ... - - - - - - - - - Qt::Vertical - - - - 20 - 225 - - - - - - - - - diff --git a/kdepim/mobile/contacts/editormore_customfieldspage.ui b/kdepim/mobile/contacts/editormore_customfieldspage.ui deleted file mode 100644 index 9b1462f6..00000000 --- a/kdepim/mobile/contacts/editormore_customfieldspage.ui +++ /dev/null @@ -1,66 +0,0 @@ - - - CustomFieldsPage - - - - 0 - 0 - 400 - 300 - - - - - - - - - - - - Add new custom field - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Qt::Vertical - - - - 20 - 229 - - - - - - - - - KWidgetLister - QWidget -
kwidgetlister.h
- 1 -
-
- - -
diff --git a/kdepim/mobile/contacts/editormore_internetpage.ui b/kdepim/mobile/contacts/editormore_internetpage.ui deleted file mode 100644 index 6b1add26..00000000 --- a/kdepim/mobile/contacts/editormore_internetpage.ui +++ /dev/null @@ -1,121 +0,0 @@ - - - InternetPage - - - - 0 - 0 - 375 - 197 - - - - - - - Homepage: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - - - - - - Blog: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - - - - - - Messaging: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 36 - - - - - - - - - diff --git a/kdepim/mobile/contacts/editormore_namepage.ui b/kdepim/mobile/contacts/editormore_namepage.ui deleted file mode 100644 index ee4af138..00000000 --- a/kdepim/mobile/contacts/editormore_namepage.ui +++ /dev/null @@ -1,175 +0,0 @@ - - - NamePage - - - - 0 - 0 - 400 - 300 - - - - - - - Nickname: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - - - - - - Name parts: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - - - - - - Display name as: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - - - - - - Pronunciation: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - <a href="play://name">Listen to Name</a> - - - Qt::RichText - - - Qt::TextBrowserInteraction - - - - - - - - - Qt::Vertical - - - - 20 - 104 - - - - - - - - - NamePartsEditWidget - QWidget -
namepartseditwidget.h
- 1 -
- - DisplayNameEditWidget - QWidget -
displaynameeditwidget.h
- 1 -
-
- - -
diff --git a/kdepim/mobile/contacts/editormore_personalpage.ui b/kdepim/mobile/contacts/editormore_personalpage.ui deleted file mode 100644 index b22deda5..00000000 --- a/kdepim/mobile/contacts/editormore_personalpage.ui +++ /dev/null @@ -1,128 +0,0 @@ - - - PersonalPage - - - - 0 - 0 - 400 - 300 - - - - - - - Birthday: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - - - - - - Anniversary (Wedding): - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - - - - - - Partner's name: - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 15 - 20 - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 139 - - - - - - - - - KDateComboBox - QComboBox -
kdatecombobox.h
-
-
- - -
diff --git a/kdepim/mobile/contacts/hi48-apps-kaddressbook-mobile.png b/kdepim/mobile/contacts/hi48-apps-kaddressbook-mobile.png deleted file mode 100644 index 78fc5624..00000000 Binary files a/kdepim/mobile/contacts/hi48-apps-kaddressbook-mobile.png and /dev/null differ diff --git a/kdepim/mobile/contacts/hi64-apps-kaddressbook-mobile.png b/kdepim/mobile/contacts/hi64-apps-kaddressbook-mobile.png deleted file mode 100644 index b29c23bc..00000000 Binary files a/kdepim/mobile/contacts/hi64-apps-kaddressbook-mobile.png and /dev/null differ diff --git a/kdepim/mobile/contacts/hi80-apps-kaddressbook-mobile-harmattan.png b/kdepim/mobile/contacts/hi80-apps-kaddressbook-mobile-harmattan.png deleted file mode 100644 index 10e28849..00000000 Binary files a/kdepim/mobile/contacts/hi80-apps-kaddressbook-mobile-harmattan.png and /dev/null differ diff --git a/kdepim/mobile/contacts/imagewidget.cpp b/kdepim/mobile/contacts/imagewidget.cpp deleted file mode 100644 index 8e0dd549..00000000 --- a/kdepim/mobile/contacts/imagewidget.cpp +++ /dev/null @@ -1,324 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2009 Tobias Koenig - - 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 "imagewidget.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/** - * @short Small helper class to load image from network - */ -class ImageLoader -{ - public: - ImageLoader( QWidget *parent = 0 ); - - QImage loadImage( const KUrl &url, bool *ok ); - - private: - QImage mImage; - QWidget *mParent; -}; - - -ImageLoader::ImageLoader( QWidget *parent ) - : mParent( parent ) -{ -} - -QImage ImageLoader::loadImage( const KUrl &url, bool *ok ) -{ - QImage image; - QString tempFile; - - if ( url.isEmpty() ) - return image; - - (*ok) = false; - - if ( url.isLocalFile() ) { - if ( image.load( url.toLocalFile() ) ) { - (*ok) = true; - } - } else if ( KIO::NetAccess::download( url, tempFile, mParent ) ) { - if ( image.load( tempFile ) ) { - (*ok) = true; - } - KIO::NetAccess::removeTempFile( tempFile ); - } - - if ( !(*ok) ) { - // image does not exist (any more) - KMessageBox::sorry( mParent, i18n( "This contact's image cannot be found." ) ); - return image; - } - - QPixmap pixmap = QPixmap::fromImage( image ); - - image = KPixmapRegionSelectorDialog::getSelectedImage( pixmap, 100, 140, mParent ); - - if ( image.isNull() ) { - (*ok) = false; - return image; - } - - if ( image.height() != 140 || image.width() != 100 ) { - if ( image.height() > image.width() ) - image = image.scaledToHeight( 140 ); - else - image = image.scaledToWidth( 100 ); - } - - (*ok) = true; - - return image; -} - - - -ImageWidget::ImageWidget( QWidget *parent ) - : QPushButton( parent ), - mType( Photo ), - mHasImage( false ), - mReadOnly( false ), - mImageLoader( 0 ) -{ - setAcceptDrops( true ); - - setIconSize( QSize( 100, 130 ) ); - setFixedSize( QSize( 120, 160 ) ); - - connect( this, SIGNAL(clicked()), SLOT(changeImage()) ); - - updateView(); -} - -ImageWidget::ImageWidget( Type type, QWidget *parent ) - : QPushButton( parent ), - mHasImage( false ), - mReadOnly( false ), - mImageLoader( 0 ) -{ - setAcceptDrops( true ); - - setIconSize( QSize( 100, 130 ) ); - setFixedSize( QSize( 120, 160 ) ); - - connect( this, SIGNAL(clicked()), SLOT(changeImage()) ); - - setType( type ); - - updateView(); -} - -ImageWidget::~ImageWidget() -{ - delete mImageLoader; -} - -void ImageWidget::setType( Type type ) -{ - mType = type; - - if ( mType == Photo ) - setToolTip( i18n( "The photo of the contact (click to change)" ) ); - else - setToolTip( i18n( "The logo of the company (click to change)" ) ); - - updateView(); -} - -void ImageWidget::loadContact( const KABC::Addressee &contact ) -{ - const KABC::Picture picture = (mType == Photo ? contact.photo() : contact.logo()); - if ( picture.isIntern() && !picture.data().isNull() ) { - mHasImage = true; - mImage = picture.data(); - } - - updateView(); -} - -void ImageWidget::storeContact( KABC::Addressee &contact ) const -{ - if ( mType == Photo ) - contact.setPhoto( mImage ); - else - contact.setLogo( mImage ); -} - -void ImageWidget::setReadOnly( bool readOnly ) -{ - mReadOnly = readOnly; -} - -void ImageWidget::updateView() -{ - if ( mHasImage ) { - setIcon( QPixmap::fromImage( mImage ) ); - } else { - if ( mType == Photo ) - setIcon( KIcon( QLatin1String( "user-identity" ) ) ); - else - setIcon( KIcon( QLatin1String( "image-x-generic" ) ) ); - } -} - -#ifndef QT_NO_DRAGANDDROP -void ImageWidget::dragEnterEvent( QDragEnterEvent *event ) -{ - const QMimeData *mimeData = event->mimeData(); - event->setAccepted( mimeData->hasImage() || mimeData->hasUrls() ); -} - -void ImageWidget::dropEvent( QDropEvent *event ) -{ - if ( mReadOnly ) - return; - - const QMimeData *mimeData = event->mimeData(); - if ( mimeData->hasImage() ) { - mImage = qvariant_cast(mimeData->imageData()); - mHasImage = true; - updateView(); - } - - const KUrl::List urls = KUrl::List::fromMimeData( mimeData ); - if ( urls.isEmpty() ) { // oops, no data - event->setAccepted( false ); - } else { - bool ok = false; - const QImage image = imageLoader()->loadImage( urls.first(), &ok ); - if ( ok ) { - mImage = image; - mHasImage = true; - updateView(); - } - } -} -#endif - -void ImageWidget::mousePressEvent( QMouseEvent *event ) -{ - mDragStartPos = event->pos(); - QPushButton::mousePressEvent( event ); -} - -void ImageWidget::mouseMoveEvent( QMouseEvent *event ) -{ -#ifndef QT_NO_DRAGANDDROP - if ( (event->buttons() & Qt::LeftButton) && - (event->pos() - mDragStartPos).manhattanLength() > KGlobalSettings::dndEventDelay() ) { - - if ( mHasImage ) { - QDrag *drag = new QDrag( this ); - drag->setMimeData( new QMimeData() ); - drag->mimeData()->setImageData( mImage ); - drag->start(); - } - } -#endif -} - -#ifndef QT_NO_CONTEXTMENU -void ImageWidget::contextMenuEvent( QContextMenuEvent *event ) -{ - QMenu menu; - - if ( mType == Photo ) { - if ( !mReadOnly ) - menu.addAction( i18n( "Change photo..." ), this, SLOT(changeImage()) ); - - if ( mHasImage ) { - menu.addAction( i18n( "Save photo..." ), this, SLOT(saveImage()) ); - - if ( !mReadOnly ) - menu.addAction( i18n( "Remove photo" ), this, SLOT(deleteImage()) ); - } - } else { - if ( !mReadOnly ) - menu.addAction( i18n( "Change logo..." ), this, SLOT(changeImage()) ); - - if ( mHasImage ) { - menu.addAction( i18n( "Save logo..." ), this, SLOT(saveImage()) ); - - if ( !mReadOnly ) - menu.addAction( i18n( "Remove logo" ), this, SLOT(deleteImage()) ); - } - } - - menu.exec( event->globalPos() ); -} -#endif - -void ImageWidget::changeImage() -{ - if ( mReadOnly ) - return; - - const KUrl url = KFileDialog::getOpenUrl( QString(), KImageIO::pattern(), 0 ); - if ( url.isValid() ) { - bool ok = false; - const QImage image = imageLoader()->loadImage( url, &ok ); - if ( ok ) { - mImage = image; - mHasImage = true; - updateView(); - } - } -} - -void ImageWidget::saveImage() -{ - const QString fileName = KFileDialog::getSaveFileName( KUrl(), KImageIO::pattern(), 0 ); - if ( !fileName.isEmpty() ) - mImage.save( fileName ); -} - -void ImageWidget::deleteImage() -{ - mHasImage = false; - mImage = QImage(); - updateView(); -} - -ImageLoader* ImageWidget::imageLoader() -{ - if ( !mImageLoader ) - mImageLoader = new ImageLoader; - - return mImageLoader; -} - diff --git a/kdepim/mobile/contacts/imagewidget.h b/kdepim/mobile/contacts/imagewidget.h deleted file mode 100644 index 2d72b2d0..00000000 --- a/kdepim/mobile/contacts/imagewidget.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2009 Tobias Koenig - - 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 IMAGEWIDGET_H -#define IMAGEWIDGET_H - -#include -#include - -namespace KABC -{ -class Addressee; -} - -class ImageLoader; - -class ImageWidget : public QPushButton -{ - Q_OBJECT - - public: - enum Type { - Photo, - Logo - }; - - explicit ImageWidget( QWidget *parent = 0 ); - explicit ImageWidget( Type type, QWidget *parent = 0 ); - ~ImageWidget(); - - void setType( Type type ); - - void loadContact( const KABC::Addressee &contact ); - void storeContact( KABC::Addressee &contact ) const; - - void setReadOnly( bool readOnly ); - - protected: -#ifndef QT_NO_DRAGANDDROP - // image drop handling - virtual void dragEnterEvent( QDragEnterEvent* ); - virtual void dropEvent( QDropEvent* ); -#endif - - // image drag handling - virtual void mousePressEvent( QMouseEvent* ); - virtual void mouseMoveEvent( QMouseEvent* ); - -#ifndef QT_NO_CONTEXTMENU - // context menu handling - virtual void contextMenuEvent( QContextMenuEvent* ); -#endif - - private Q_SLOTS: - void updateView(); - - void changeImage(); - void saveImage(); - void deleteImage(); - - private: - ImageLoader *imageLoader(); - - Type mType; - QImage mImage; - bool mHasImage; - bool mReadOnly; - - QPoint mDragStartPos; - ImageLoader *mImageLoader; -}; - -#endif diff --git a/kdepim/mobile/contacts/kaddressbook-mobile-background.png b/kdepim/mobile/contacts/kaddressbook-mobile-background.png deleted file mode 100644 index 183b4a70..00000000 Binary files a/kdepim/mobile/contacts/kaddressbook-mobile-background.png and /dev/null differ diff --git a/kdepim/mobile/contacts/kaddressbook-mobile.desktop b/kdepim/mobile/contacts/kaddressbook-mobile.desktop deleted file mode 100644 index 4a7a233c..00000000 --- a/kdepim/mobile/contacts/kaddressbook-mobile.desktop +++ /dev/null @@ -1,81 +0,0 @@ -[Desktop Entry] -Version=1.0 -Name=Contacts -Name[af]=Kontakte -Name[ar]=جهات الإتصال -Name[be]=Кантакты -Name[bg]=Contacts -Name[br]=Darempredoù -Name[bs]=Kontakti -Name[ca]=Contactes -Name[ca@valencia]=Contactes -Name[cs]=Kontakty -Name[cy]=Cysylltau -Name[da]=Kontakter -Name[de]=Kontakte -Name[el]=Επαφές -Name[en_GB]=Contacts -Name[eo]=Kontaktoj -Name[es]=Contactos -Name[et]=Kontaktid -Name[eu]=Kontaktuak -Name[fa]=تماسها -Name[fi]=Yhteystiedot -Name[fr]=Contacts -Name[fy]=Adressen -Name[ga]=Teagmhálacha -Name[gl]=Contactos -Name[he]=אנשי קשר -Name[hu]=Névjegyek -Name[ia]=Contactos -Name[is]=Tengiliðir -Name[it]=Contatti -Name[ja]=連絡先 -Name[ka]=კონტაქტები -Name[kk]=Контакттар -Name[km]=ទំនាក់ទំនង -Name[ko]=연락처 -Name[lt]=Kontaktai -Name[lv]=Kontakti -Name[mai]=संपर्क -Name[mk]=Контакти -Name[mr]=संपर्क -Name[ms]=Orang hubungan -Name[nb]=Contacts -Name[nds]=Kontakten -Name[ne]=सम्पर्क -Name[nl]=Adressen -Name[nn]=Kontaktar -Name[oc]=Contactes -Name[pa]=ਸੰਪਰਕ -Name[pl]=Wizytówki -Name[pt]=Contactos -Name[pt_BR]=Contatos -Name[ro]=Contacte -Name[ru]=Контакты -Name[se]=Oktavuođat -Name[sk]=Kontakty -Name[sl]=Stiki -Name[sr]=Контакти -Name[sr@ijekavian]=Контакти -Name[sr@ijekavianlatin]=Kontakti -Name[sr@latin]=Kontakti -Name[sv]=Kontakter -Name[ta]=தொடர்புகள் -Name[tg]=Алоқот -Name[th]=ที่อยู่ติดต่อ -Name[tr]=Kişiler -Name[ug]=ئالاقەداشلار -Name[uk]=Контакти -Name[uz]=Aloqalar -Name[uz@cyrillic]=Алоқалар -Name[wa]=Contaks -Name[x-test]=xxContactsxx -Name[zh_CN]=联系人 -Name[zh_TW]=聯絡人 -Exec=kaddressbook-mobile - -Icon=kaddressbook-mobile -Type=Application -Categories=Qt;KDE;Office;ContactManagement; - diff --git a/kdepim/mobile/contacts/kaddressbook-mobile.ico b/kdepim/mobile/contacts/kaddressbook-mobile.ico deleted file mode 100644 index cc7912a5..00000000 Binary files a/kdepim/mobile/contacts/kaddressbook-mobile.ico and /dev/null differ diff --git a/kdepim/mobile/contacts/kaddressbook-mobile.qml b/kdepim/mobile/contacts/kaddressbook-mobile.qml deleted file mode 100644 index 72c07e38..00000000 --- a/kdepim/mobile/contacts/kaddressbook-mobile.qml +++ /dev/null @@ -1,455 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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 org.kde.akonadi.contacts 4.5 as Contacts -import "../mobileui/ScreenFunctions.js" as Screen - -KPIM.MainView { - id: kaddressbookMobile - - QML.Connections { - target: guiStateManager - onGuiStateChanged: { updateContextActionStates() } - } - - QML.Component.onCompleted : updateContextActionStates(); - - function updateContextActionStates() - { - if ( guiStateManager.inHomeScreenState ) { - kaddressbookActions.showOnlyCategory( "home" ) - } else if ( guiStateManager.inAccountScreenState ) { - kaddressbookActions.showOnlyCategory( "account" ) - } else if ( guiStateManager.inSingleFolderScreenState ) { - kaddressbookActions.showOnlyCategory( "single_folder" ) - } else if ( guiStateManager.inMultipleFolderScreenState || guiStateManager.inSearchResultScreenState ) { - kaddressbookActions.showOnlyCategory( "multiple_folder" ) - } else if ( guiStateManager.inViewContactState || guiStateManager.inViewContactGroupState ) { - kaddressbookActions.showOnlyCategory( "contact_viewer" ) - } - } - - Contacts.ContactView { - id: contactView - visible: guiStateManager.inViewContactState - anchors.fill: parent - itemId: -1 - - onNextItemRequest: { - _itemNavigationModel.requestNext() - } - - onPreviousItemRequest: { - _itemNavigationModel.requestPrevious() - } - - } - - KPIM.ItemEditButton { - id: editContactButton - visible: guiStateManager.inViewContactState - actionName: "akonadi_contact_item_edit" - anchors.bottom: backToFolderListButton.top - anchors.right: parent.right - anchors.margins: 12 - onClicked: { - application.editContact( contactView.item ); - } - } - - Contacts.ContactGroupView { - id: contactGroupView - visible: guiStateManager.inViewContactGroupState - anchors.fill: parent - itemId: -1 - - onNextItemRequest: { - // Only go to the next message when currently a valid item is set. - if ( contactGroupView.itemId >= 0 ) - contactList.nextItem(); - } - - onPreviousItemRequest: { - // Only go to the previous message when currently a valid item is set. - if ( contactGroupView.itemId >= 0 ) - contactList.previousItem(); - } - } - - KPIM.ItemEditButton { - id: editContactGroupButton - visible: guiStateManager.inViewContactGroupState - actionName: "akonadi_contact_item_edit" - anchors.bottom: backToFolderListButton.top - anchors.right: parent.right - anchors.margins: 12 - onClicked: { - application.editContactGroup( contactGroupView.item ); - } - } - - KPIM.Button { - id : backToFolderListButton - visible : guiStateManager.inViewContactState || guiStateManager.inViewContactGroupState - anchors.bottom: kaddressbookMobile.bottom - anchors.right: kaddressbookMobile.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(); - } - } - - 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 - anchors.right : parent.right - - QML.Image { - id: backgroundImage - x: 0 - y: 0 -// FIXME: too big, costs about 1.5Mb RAM -// source: "kaddressbook-mobile-background.png" - visible: collectionView.visible - } - - Akonadi.AkonadiBreadcrumbNavigationView { - id: collectionView - visible: { guiStateManager.inHomeScreenState || - guiStateManager.inAccountScreenState || - guiStateManager.inSingleFolderScreenState || - guiStateManager.inMultipleFolderScreenState } - anchors.top: parent.top - width: 1/3 * parent.width - anchors.bottom : selectButton.top - //height : parent.height - ( collectionView.hasSelection ? 0 : selectButton.height) - anchors.left: parent.left - itemHeight: Screen.partition( height, 7 ) - - breadcrumbComponentFactory : _breadcrumbNavigationFactory - - multipleSelectionText : KDE.i18nc("%1 is e.g. 3 address books, %2 is e.g. from 2 accounts, %3 is e.g. 9 contacts", - "You have selected \n%1\n%2\n%3", - KDE.i18np("1 address book","%1 address books",collectionView.numSelected), - KDE.i18np("from 1 account","from %1 accounts",application.numSelectedAccounts), - KDE.i18np("1 contact","%1 contacts",contactList.count)) - - onSelectedClicked : { - guiStateManager.pushState( KPIM.GuiStateManager.BulkActionScreenState ); - } - - KPIM.AgentStatusIndicator { - anchors { top: parent.top; right: parent.right; rightMargin: 10; topMargin: 10 } - } - } - - KPIM.Button2 { - id: selectButton - visible: guiStateManager.inHomeScreenState - anchors.left: collectionView.left - anchors.right: collectionView.right - anchors.bottom : parent.bottom - anchors.bottomMargin : { (collectionView.numSelected == 1) ? -selectButton.height : 0 } - buttonText : (collectionView.numSelected <= 1) ? KDE.i18n("Select") : KDE.i18n("Change Selection") - onClicked : { - application.persistCurrentSelection("preFavSelection"); - guiStateManager.pushState( KPIM.GuiStateManager.MultipleFolderSelectionScreenState ); - } - } - - KPIM.StartCanvas { - id : startPage - visible: !collectionView.hasSelection - anchors.left : collectionView.right - anchors.top : parent.top - anchors.bottom : parent.bottom - anchors.right : parent.right - anchors.leftMargin : 10 - anchors.rightMargin : 10 - - showAccountsList : false - favoritesModel : favoritesList - - contextActions : [ - QML.Column { - anchors.fill: parent - height : startPageNewContactButton.height + startPageNewContactGroupButton.height + 3 * spacing - KPIM.Button2 { - id: startPageNewContactButton - width: parent.width - buttonText : KDE.i18n( "New Contact" ) - onClicked : { - application.newContact(); - } - } - KPIM.Button2 { - id: startPageNewContactGroupButton - width: parent.width - buttonText : KDE.i18n( "New Contact Group" ) - onClicked : { - application.newContactGroup(); - } - } - } - ] - } - - QML.Rectangle { - id : emptyFolderPage - anchors.left : collectionView.right - anchors.top : parent.top - anchors.bottom : parent.bottom - anchors.right : parent.right - color : "#00000000" - visible: (!guiStateManager.inHomeScreenState && collectionView.hasBreadcrumbs && contactList.count == 0) - // TODO: content - QML.Text { - text : KDE.i18n("No contacts in this address book"); - height : 20; - font.italic : true - horizontalAlignment : QML.Text.AlignHCenter - anchors.verticalCenter : parent.verticalCenter; - anchors.horizontalCenter : parent.horizontalCenter - } - } - - QML.Rectangle { - id : contactListPage - anchors.left : collectionView.right - anchors.top : parent.top - anchors.bottom : parent.bottom - anchors.right : parent.right - color : "#00000000" - visible: { guiStateManager.inAccountScreenState || - guiStateManager.inSingleFolderScreenState || - guiStateManager.inMultipleFolderScreenState } - - ContactListView { - id: contactList - anchors.left : parent.left - anchors.top : parent.top - anchors.bottom : filterLineEdit.top - anchors.right : parent.right - model: itemModel - checkModel : _itemActionModel - itemHeight: Screen.partition( height, 7 ) - - navigationModel : _itemNavigationModel - } - - Akonadi.FilterLineEdit { - id: filterLineEdit - anchors.left : parent.left - anchors.bottom : parent.bottom - anchors.right : parent.right - visible : false - height : 0 - y : height == 0 ? parent.height : parent.height - height - } - } - } - QML.Connections { - target : _itemNavigationModel - onCurrentRowChanged : { - contactList.currentRow = _itemNavigationModel.currentRow - if ( itemModel.typeForIndex( _itemNavigationModel.currentRow ) == "contact" ) { - contactView.itemId = _itemNavigationModel.currentItemIdHack; - } - if ( itemModel.typeForIndex( _itemNavigationModel.currentRow ) == "group" ) { - contactGroupView.itemId = _itemNavigationModel.currentItemIdHack; - } - _itemActionModel.select( _itemNavigationModel.currentRow, 3 ); - } - } - - 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 - - QML.Component.onCompleted: { - actionPanel.expanded.connect( kaddressbookActions, kaddressbookActions.refresh ); - } - - content : [ - KAddressBookActions { - id : kaddressbookActions - 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_contact" -// 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 : "start_maintenance" - script : { - actionPanel.collapse(); - guiStateManager.pushState( KPIM.GuiStateManager.BulkActionScreenState ); - } - } - ] - - onDoCollapse : actionPanel.collapse(); - } - ] - } - } - - QML.Loader { - anchors.fill: parent - source: guiStateManager.inMultipleFolderSelectionScreenState ? KDE.locate( "module", "imports/org/kde/pim/mobileui/MultipleSelectionScreen.qml" ) : "" - onLoaded: { item.backgroundImage = backgroundImage.source; } - } - - QML.Loader { - anchors.fill: parent - source: guiStateManager.inBulkActionScreenState ? "BulkActionComponent.qml" : "" - onLoaded: { - item.backgroundImage = backgroundImage.source - item.itemHeight = Screen.partition( 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: ContactListView { - id: searchContactListView - model: itemModel - checkModel : _itemActionModel - navigationModel : _itemNavigationModel - anchors.fill : parent - itemHeight: Screen.partition( height, 7 ) - } - - resultText: KDE.i18np( "One contact found", "%1 contacts found", searchContactListView.count ) - } - - QML.Connections { - target: startPage - onAccountSelected : { - application.setSelectedAccount(row); - // TODO: Figure out how to expand the slider programatically. - } - } - - QML.Connections { - target: startPage - onFavoriteSelected : { - application.loadFavorite(favName); - } - } - - QML.Connections { - target: contactView - onContactRemoved : { guiStateManager.popState(); } - } - - QML.Connections { - target: contactGroupView - onContactGroupRemoved : { guiStateManager.popState(); } - } - - QML.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; } - } - - QML.Loader { - anchors.fill: parent - source: guiStateManager.inConfigScreenState ? "ConfigDialog.qml" : "" - onLoaded: item.load(); - } - - KPIM.SearchDialog { - id: searchDialog - searchWidget: Contacts.SearchWidget { - anchors.fill: parent - } - } -} diff --git a/kdepim/mobile/contacts/kaddressbook-mobile.rc b/kdepim/mobile/contacts/kaddressbook-mobile.rc deleted file mode 100644 index 3a5821da..00000000 --- a/kdepim/mobile/contacts/kaddressbook-mobile.rc +++ /dev/null @@ -1 +0,0 @@ -KADDRESSBOOK_MOBILE_ICON ICON "kaddressbook-mobile.ico" diff --git a/kdepim/mobile/contacts/kwidgetlister.cpp b/kdepim/mobile/contacts/kwidgetlister.cpp deleted file mode 100644 index 359fb59d..00000000 --- a/kdepim/mobile/contacts/kwidgetlister.cpp +++ /dev/null @@ -1,96 +0,0 @@ - -#include "kwidgetlister.h" - -#include - -class KWidgetLister::Private -{ - public: - Private( KWidgetLister *qq ) - : q( qq ), mOrientation( Qt::Vertical ) - { - mLayout = new QBoxLayout( QBoxLayout::TopToBottom, q ); - mLayout->setMargin( 0 ); - mLayout->setAlignment( Qt::AlignTop ); - } - - void addWidget( QWidget *widget ) - { - if ( !widget ) - return; - - q->connect( widget, SIGNAL(remove(QWidget*)), q, SLOT(removeWidget(QWidget*)) ); - mWidgets.append( widget ); - mLayout->addWidget( widget ); - } - - void removeWidget( QWidget *widget ) - { - if ( !mWidgets.contains( widget ) ) { - qDebug( "Warning: try to remove non-existing widget" ); - return; - } - - emit q->aboutToBeRemoved( widget ); - - mLayout->removeWidget( widget ); - mWidgets.removeAll( widget ); - widget->hide(); - widget->deleteLater(); - } - - KWidgetLister *q; - Qt::Orientation mOrientation; - QList mWidgets; - QBoxLayout *mLayout; -}; - -KWidgetLister::KWidgetLister( QWidget *parent ) - : QWidget( parent ), d( new Private( this ) ) -{ -} - -KWidgetLister::~KWidgetLister() -{ - delete d; -} - -void KWidgetLister::setOrientation( Qt::Orientation orientation ) -{ - d->mOrientation = orientation; - if ( d->mOrientation == Qt::Horizontal ) - d->mLayout->setDirection( QBoxLayout::LeftToRight ); - else - d->mLayout->setDirection( QBoxLayout::TopToBottom ); -} - -Qt::Orientation KWidgetLister::orientation() const -{ - return d->mOrientation; -} - -void KWidgetLister::addWidget( QWidget *widget ) -{ - d->addWidget( widget ); -} - -void KWidgetLister::clear() -{ - foreach ( QWidget *widget, d->mWidgets ) - d->removeWidget( widget ); -} - -int KWidgetLister::count() const -{ - return d->mWidgets.count(); -} - -QWidget* KWidgetLister::widget( int index ) const -{ - if ( index < 0 || index >= d->mWidgets.count() ) - return 0; - - return d->mWidgets.at( index ); -} - -#include "moc_kwidgetlister.cpp" diff --git a/kdepim/mobile/contacts/kwidgetlister.h b/kdepim/mobile/contacts/kwidgetlister.h deleted file mode 100644 index b1712370..00000000 --- a/kdepim/mobile/contacts/kwidgetlister.h +++ /dev/null @@ -1,73 +0,0 @@ - -#ifndef KWIDGETLISTER_H -#define KWIDGETLISTER_H - -#include - -class KWidgetLister : public QWidget -{ - Q_OBJECT - - public: - /** - * Creates a new widget lister. - * - * @param parent The parent widget. - */ - explicit KWidgetLister( QWidget *parent = 0 ); - - /** - * Destroys the widget lister. - */ - ~KWidgetLister(); - - /** - * Sets the @p orientation of the listed widgets. - */ - void setOrientation( Qt::Orientation orientation ); - - /** - * Returns the orientation of the listed widgets. - */ - Qt::Orientation orientation() const; - - /** - * Adds a new @p widget to the end of the lister. - * - * @note The lister takes ownership of the widget. - */ - void addWidget( QWidget *widget ); - - /** - * Removes all widgets from the lister and deletes them. - */ - void clear(); - - /** - * Returns the number of widgets the lister contains. - */ - int count() const; - - /** - * Returns the widget at the given @p index or @c 0 if the index - * is out of range. - */ - QWidget* widget( int index ) const; - - Q_SIGNALS: - /** - * This signal is emitted before the given @p widget is removed - * from the lister. - */ - void aboutToBeRemoved( QWidget *widget ); - - private: - //@cond PRIVATE - class Private; - Private* const d; - - Q_PRIVATE_SLOT( d, void removeWidget( QWidget* ) ) - //@endcond -}; - -#endif diff --git a/kdepim/mobile/contacts/locationmodel.cpp b/kdepim/mobile/contacts/locationmodel.cpp deleted file mode 100644 index 657aa523..00000000 --- a/kdepim/mobile/contacts/locationmodel.cpp +++ /dev/null @@ -1,211 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "locationmodel.h" - -LocationModel::LocationModel( QObject *parent ) - : QAbstractTableModel( parent ) -{ -} - -LocationModel::~LocationModel() -{ -} - -void LocationModel::setLocations( const KABC::Address::List &locations ) -{ - mLocations = locations; - reset(); -} - -KABC::Address::List LocationModel::locations() const -{ - return mLocations; -} - -int LocationModel::rowCount( const QModelIndex &parent ) const -{ - if ( parent.isValid() ) - return 0; - - return mLocations.count(); -} - -int LocationModel::columnCount( const QModelIndex &parent ) const -{ - if ( parent.isValid() ) - return 0; - - return 8; -} - -QVariant LocationModel::data( const QModelIndex &index, int role ) const -{ - if ( !index.isValid() || index.row() >= mLocations.count() || index.column() >= 8 ) - return QVariant(); - - const KABC::Address address = mLocations.at( index.row() ); - if ( role == Qt::DisplayRole ) { - switch ( index.column() ) { - case 0: - return address.typeLabel(); - break; - case 1: - return address.street(); - break; - case 2: - return address.postOfficeBox(); - break; - case 3: - return address.locality(); - break; - case 4: - return address.region(); - break; - case 5: - return address.postalCode(); - break; - case 6: - return address.country(); - break; - case 7: - return address.label(); - break; - } - } - if ( role == Qt::EditRole ) { - switch ( index.column() ) { - case 0: - return QVariant::fromValue( (int)address.type() ); - break; - case 1: - return address.street(); - break; - case 2: - return address.postOfficeBox(); - break; - case 3: - return address.locality(); - break; - case 4: - return address.region(); - break; - case 5: - return address.postalCode(); - break; - case 6: - return address.country(); - break; - case 7: - return address.label(); - break; - } - } - - return QVariant(); -} - -bool LocationModel::setData( const QModelIndex &index, const QVariant &value, int role ) -{ - if ( !index.isValid() || index.row() >= mLocations.count() || index.column() >= 8 ) - return false; - - KABC::Address &address = mLocations[ index.row() ]; - if ( role == Qt::EditRole ) { - switch ( index.column() ) { - case 0: - address.setType( KABC::Address::Type( value.toInt() ) ); - emit dataChanged( index, index ); - return true; - break; - case 1: - address.setStreet( value.toString() ); - emit dataChanged( index, index ); - return true; - break; - case 2: - address.setPostOfficeBox( value.toString() ); - emit dataChanged( index, index ); - return true; - break; - case 3: - address.setLocality( value.toString() ); - emit dataChanged( index, index ); - return true; - break; - case 4: - address.setRegion( value.toString() ); - emit dataChanged( index, index ); - return true; - break; - case 5: - address.setPostalCode( value.toString() ); - emit dataChanged( index, index ); - return true; - break; - case 6: - address.setCountry( value.toString() ); - emit dataChanged( index, index ); - return true; - break; - case 7: - address.setLabel( value.toString() ); - emit dataChanged( index, index ); - return true; - break; - } - } - - return false; -} - -Qt::ItemFlags LocationModel::flags( const QModelIndex &index ) const -{ - return (QAbstractTableModel::flags( index ) | Qt::ItemIsEditable); -} - -bool LocationModel::insertRows( int row, int count, const QModelIndex &parent ) -{ - if ( row < 0 || row > mLocations.count() || parent.isValid() ) - return false; - - beginInsertRows( parent, row, row + count - 1 ); - - for ( int pos = row; pos < row + count; ++pos ) - mLocations.insert( row, KABC::Address() ); - - endInsertRows(); - - return true; -} - -bool LocationModel::removeRows( int row, int count, const QModelIndex &parent ) -{ - if ( row < 0 || row >= mLocations.count() || parent.isValid() ) - return false; - - beginRemoveRows( parent, row, row + count - 1 ); - - for ( int pos = row; pos < row + count; ++pos ) - mLocations.removeAt( row ); - - endRemoveRows(); - - return true; -} diff --git a/kdepim/mobile/contacts/locationmodel.h b/kdepim/mobile/contacts/locationmodel.h deleted file mode 100644 index e9b10a81..00000000 --- a/kdepim/mobile/contacts/locationmodel.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 LOCATIONMODEL_H -#define LOCATIONMODEL_H - -#include - -#include - -class LocationModel : public QAbstractTableModel -{ - public: - explicit LocationModel( QObject *parent = 0 ); - ~LocationModel(); - - void setLocations( const KABC::Address::List &locations ); - KABC::Address::List locations() const; - - /** - * @reimplemented - */ - int rowCount( const QModelIndex &parent = QModelIndex() ) const; - int columnCount( const QModelIndex &parent = QModelIndex() ) const; - QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - bool setData( const QModelIndex &index, const QVariant &value, int role = Qt::EditRole ); - Qt::ItemFlags flags( const QModelIndex &index ) const; - - bool insertRows( int row, int count, const QModelIndex &parent = QModelIndex() ); - bool removeRows( int row, int count, const QModelIndex &parent = QModelIndex() ); - - private: - KABC::Address::List mLocations; -}; - -#endif /* LOCATIONMODEL_H */ diff --git a/kdepim/mobile/contacts/main.cpp b/kdepim/mobile/contacts/main.cpp deleted file mode 100644 index b1613b13..00000000 --- a/kdepim/mobile/contacts/main.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 -#include -#include - -#include - -#include "mainview.h" - -#ifdef MAIL_SERIALIZER_PLUGIN_STATIC -#include - -Q_IMPORT_PLUGIN(akonadi_serializer_addressee) -Q_IMPORT_PLUGIN(akonadi_serializer_contactgroup) -#endif - -int main( int argc, char **argv ) -{ - const QByteArray& ba = QByteArray( "kaddressbook-mobile" ); - const KLocalizedString name = ki18n( "Kontact Touch Contacts" ); - - IncidenceEditorNG::EditorConfig::setEditorConfig( new IncidenceEditorNG::KOrganizerEditorConfig ); //FIXME: use our own config for contacts - - KAboutData aboutData( ba, ba, name, ba, name ); - aboutData.setProductName( "KAddressbook Mobile" ); //has to match the bugzilla product name - - KCmdLineArgs::init( argc, argv, &aboutData ); - KDeclarativeApplication app; - - KGlobal::locale()->insertCatalog( QLatin1String("kabc") ); - KGlobal::locale()->insertCatalog( QLatin1String("akonadicontact") ); - KGlobal::locale()->insertCatalog( QLatin1String("libkdepim") ); - KGlobal::locale()->insertCatalog( QLatin1String("libkldap") ); // for ldap server dialog - KGlobal::locale()->insertCatalog( QLatin1String("calendarsupport") ); // for categories - - return app.exec(); -} - diff --git a/kdepim/mobile/contacts/mainview.cpp b/kdepim/mobile/contacts/mainview.cpp deleted file mode 100644 index f2abc35b..00000000 --- a/kdepim/mobile/contacts/mainview.cpp +++ /dev/null @@ -1,446 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "mainview.h" - -#include "actionhelper.h" -#include "configwidget.h" -#include "contactviewitem.h" -#include "contactgroupviewitem.h" -#include "contacteditorview.h" -#include "contactgroupeditorview.h" -#include "contactlistproxy.h" -#include "contactsexporthandler.h" -#include "contactsguistatemanager.h" -#include "contactsimporthandler.h" -#include "searchwidget.h" - -#include "libkdepim/ldap/ldapsearchdialog.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -QML_DECLARE_TYPE( Akonadi::Contact::ContactViewItem ) -QML_DECLARE_TYPE( Akonadi::Contact::ContactGroupViewItem ) -QML_DECLARE_TYPE( ContactsGuiStateManager ) -QML_DECLARE_TYPE( DeclarativeConfigWidget ) -QML_DECLARE_TYPE( DeclarativeSearchWidget ) - -MainView::MainView( QWidget *parent ) - : KDeclarativeMainView( QLatin1String("kaddressbook-mobile"), new ContactListProxy, parent ), - mLdapSearchDialog( 0 ) -{ -} - -void MainView::doDelayedInit() -{ - qmlRegisterType( "org.kde.akonadi.contacts", 4, 5, "ContactView" ); - qmlRegisterType( "org.kde.akonadi.contacts", 4, 5, "ContactGroupView" ); - qmlRegisterUncreatableType( "org.kde.akonadi.contacts", 4, 5, "ContactsGuiStateManager", QLatin1String( "This type is only exported for its enums" ) ); - qmlRegisterType( "org.kde.akonadi.contacts", 4, 5, "ConfigWidget" ); - qmlRegisterType( "org.kde.akonadi.contacts", 4, 5, "SearchWidget" ); - - ContactImageProvider *provider = new ContactImageProvider; - provider->setModel( itemModel() ); - engine()->addImageProvider( QLatin1String( "contact_images" ), provider ); - - setWindowTitle( i18n( "Contacts" ) ); - - addMimeType( KABC::Addressee::mimeType() ); - addMimeType( KABC::ContactGroup::mimeType() ); - itemFetchScope().fetchFullPayload(); - - KAction *action = new KAction( i18n( "Import Contacts" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(importItems()) ); - actionCollection()->addAction( QLatin1String( "import_vcards" ), action ); - - action = new KAction( i18n( "Export Contacts From This Account" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(exportItems()) ); - actionCollection()->addAction( QLatin1String( "export_account_vcards" ), action ); - - action = new KAction( i18n( "Export Displayed Contacts" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(exportItems()) ); - actionCollection()->addAction( QLatin1String( "export_selected_vcards" ), action ); - - action = new KAction( i18n( "Export Contact" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(exportSingleItem()) ); - actionCollection()->addAction( QLatin1String( "export_single_contact_vcard" ), action ); - - action = new KAction( i18n( "Send mail to" ), this ); - action->setEnabled( false ); - connect( action, SIGNAL(triggered(bool)), SLOT(sendMailTo()) ); - actionCollection()->addAction( QLatin1String( "send_mail_to" ), action ); - - action = new KAction( i18n( "Search in LDAP directory" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(searchLdap()) ); - actionCollection()->addAction( QLatin1String( "search_ldap" ), action ); - - action = new KAction( i18n( "Configure Categories" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(configureCategories()) ); - actionCollection()->addAction( QLatin1String( "configure_categories" ), action ); - - connect( itemSelectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(itemSelectionChanged(QItemSelection,QItemSelection)) ); - connect( itemActionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(bulkActionSelectionChanged()) ); -} - -void MainView::itemSelectionChanged( const QItemSelection &selected, const QItemSelection& ) -{ - if ( selected.indexes().isEmpty() ) - return; - - const QModelIndex index = selected.indexes().first(); - if ( !index.isValid() ) - return; - - const Akonadi::Item item = index.data( Akonadi::EntityTreeModel::ItemRole ).value(); - - if ( !qobject_cast( guiStateManager() )->inViewContactState() && - !qobject_cast( guiStateManager() )->inViewContactGroupState() ) { - if ( item.hasPayload() ) - guiStateManager()->pushState( ContactsGuiStateManager::ViewContactState ); - else if ( item.hasPayload() ) - guiStateManager()->pushState( ContactsGuiStateManager::ViewContactGroupState ); - } -} - -void MainView::bulkActionSelectionChanged() -{ - const bool itemsChecked = !itemActionModel()->selectedIndexes().isEmpty(); - - actionCollection()->action( QLatin1String( "send_mail_to" ) )->setEnabled( itemsChecked ); -} - -void MainView::sendMailTo() -{ - const QModelIndexList indexes = itemActionModel()->selectedIndexes(); - if ( indexes.isEmpty() ) - return; - - // select email addresses of all checked items - QStringList emailAddresses; - foreach ( const QModelIndex &index, indexes ) { - const Akonadi::Item item = index.data( Akonadi::EntityTreeModel::ItemRole ).value(); - if ( !item.isValid() ) - continue; - - if ( item.hasPayload() ) { - const KABC::Addressee contact = item.payload(); - if ( !contact.preferredEmail().isEmpty() ) - emailAddresses << contact.preferredEmail(); - } - - if ( item.hasPayload() ) { - // resolve the contact group right now - Akonadi::ContactGroupExpandJob *job = new Akonadi::ContactGroupExpandJob( item.payload() ); - if ( job->exec() ) { - foreach ( const KABC::Addressee &contact, job->contacts() ) { - if ( !contact.preferredEmail().isEmpty() ) - emailAddresses << contact.preferredEmail(); - } - } - } - } - - // try to open the email composer in kmail-mobile - QDBusInterface *interface = new QDBusInterface( QLatin1String("org.kde.kmailmobile.composer"), QLatin1String("/composer") ); - if ( !interface->isValid() ) { - delete interface; - - QDBusServiceWatcher *watcher = new QDBusServiceWatcher( QLatin1String("org.kde.kmailmobile.composer"), QDBusConnection::sessionBus(), - QDBusServiceWatcher::WatchForRegistration, this ); - QEventLoop loop; - connect( watcher, SIGNAL(serviceRegistered(QString)), &loop, SLOT(quit()) ); - QProcess::startDetached( QLatin1String("kmail-mobile") ); - loop.exec(); - - delete watcher; - - interface = new QDBusInterface( QLatin1String("org.kde.kmailmobile.composer"),QLatin1String( "/composer") ); - } - - interface->call( QLatin1String("openComposer"), emailAddresses.join( QLatin1String(", ") ), QString(), QString(), QString(), QString() ); - - delete interface; -} - -void MainView::finishEdit( QObject *editor ) -{ - mOpenItemEditors.remove( editor ); -} - -void MainView::newContact() -{ - ContactEditorView *editor = new ContactEditorView; - connect( editor, SIGNAL(requestLaunchAccountWizard()), SLOT(launchAccountWizard()) ); - - if ( regularSelectionModel()->hasSelection() ) { - const QModelIndex index = regularSelectionModel()->selectedIndexes().first(); - const Akonadi::Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( collection.isValid() ) - editor->setDefaultCollection( collection ); - } - - editor->show(); -} - -void MainView::newContactGroup() -{ - ContactGroupEditorView *editor = new ContactGroupEditorView; - connect( editor, SIGNAL(requestLaunchAccountWizard()), SLOT(launchAccountWizard()) ); - - if ( regularSelectionModel()->hasSelection() ) { - const QModelIndex index = regularSelectionModel()->selectedIndexes().first(); - const Akonadi::Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( collection.isValid() ) - editor->setDefaultCollection( collection ); - } - - editor->show(); -} - -void MainView::editItem() -{ - const Akonadi::Item::List items = mActionManager->selectedItems(); - if ( items.isEmpty() ) - return; - - const Akonadi::Item item = items.first(); - - if ( item.hasPayload() ) - editContact( item ); - else if ( item.hasPayload() ) - editContactGroup( item ); -} - -void MainView::editContact( const Akonadi::Item &item ) -{ - if ( mOpenItemEditors.values().contains( item.id() ) ) - return; // An editor for this item is already open. - - ContactEditorView *editor = new ContactEditorView; - editor->loadContact( item ); - - mOpenItemEditors.insert( editor, item.id() ); - connect( editor, SIGNAL(destroyed(QObject*)), SLOT(finishEdit(QObject*)) ); - connect( editor, SIGNAL(requestLaunchAccountWizard()), SLOT(launchAccountWizard()) ); - - editor->show(); -} - -void MainView::editContactGroup( const Akonadi::Item &item ) -{ - if ( mOpenItemEditors.values().contains( item.id() ) ) - return; // An editor for this item is already open. - - ContactGroupEditorView *editor = new ContactGroupEditorView; - editor->loadContactGroup( item ); - - mOpenItemEditors.insert( editor, item.id() ); - connect( editor, SIGNAL(destroyed(QObject*)), SLOT(finishEdit(QObject*)) ); - connect( editor, SIGNAL(requestLaunchAccountWizard()), SLOT(launchAccountWizard()) ); - - editor->show(); -} - -void MainView::setupStandardActionManager( QItemSelectionModel *collectionSelectionModel, - QItemSelectionModel *itemSelectionModel ) -{ - mActionManager = new Akonadi::StandardContactActionManager( actionCollection(), this ); - mActionManager->setCollectionSelectionModel( collectionSelectionModel ); - mActionManager->setItemSelectionModel( itemSelectionModel ); - - mActionManager->createAllActions(); - mActionManager->interceptAction( Akonadi::StandardContactActionManager::CreateContact ); - mActionManager->interceptAction( Akonadi::StandardContactActionManager::CreateContactGroup ); - mActionManager->interceptAction( Akonadi::StandardContactActionManager::EditItem ); - mActionManager->interceptAction( Akonadi::StandardActionManager::CreateResource ); - - connect( mActionManager->action( Akonadi::StandardContactActionManager::CreateContact ), SIGNAL(triggered(bool)), - this, SLOT(newContact()) ); - connect( mActionManager->action( Akonadi::StandardContactActionManager::CreateContactGroup ), SIGNAL(triggered(bool)), - this, SLOT(newContactGroup()) ); - connect( mActionManager->action( Akonadi::StandardContactActionManager::EditItem ), SIGNAL(triggered(bool)), - this, SLOT(editItem()) ); - connect( mActionManager->action( Akonadi::StandardActionManager::CreateResource ), SIGNAL(triggered(bool)), - this, SLOT(launchAccountWizard()) ); - connect( mActionManager, SIGNAL(actionStateUpdated()), SLOT(updateActionTexts()) ); - - ActionHelper::adaptStandardActionTexts( mActionManager ); - - mActionManager->action( StandardActionManager::CreateCollection )->setText( i18n( "New Sub Address Book" ) ); - mActionManager->action( StandardActionManager::CreateCollection )->setProperty( "ContentMimeTypes", QStringList( KABC::Addressee::mimeType() ) ); - mActionManager->setActionText( StandardActionManager::SynchronizeCollections, ki18np( "Synchronize This Address Book", "Synchronize These Address Books" ) ); - mActionManager->action( StandardActionManager::CollectionProperties )->setText( i18n( "Address Book Properties" ) ); - mActionManager->setActionText( StandardActionManager::DeleteCollections, ki18np( "Delete Address Book", "Delete Address Books" ) ); - mActionManager->action( StandardActionManager::MoveCollectionToDialog )->setText( i18n( "Move Address Book To" ) ); - mActionManager->action( StandardActionManager::CopyCollectionToDialog )->setText( i18n( "Copy Address Book To" ) ); - - mActionManager->action( Akonadi::StandardContactActionManager::CreateContact )->setText( i18n( "New Contact" ) ); - mActionManager->action( Akonadi::StandardContactActionManager::CreateContactGroup )->setText( i18n( "New Group Of Contacts" ) ); - mActionManager->action( Akonadi::StandardContactActionManager::EditItem )->setText( i18n( "Edit Contact" ) ); - mActionManager->setActionText( Akonadi::StandardActionManager::DeleteItems, ki18np( "Delete Contact", "Delete Contacts" ) ); - mActionManager->action( Akonadi::StandardActionManager::MoveItemToDialog )->setText( i18n( "Move Contact To" ) ); - mActionManager->action( Akonadi::StandardActionManager::CopyItemToDialog )->setText( i18n( "Copy Contact To" ) ); - - actionCollection()->action( QLatin1String("synchronize_all_items") )->setText( i18n( "Synchronize All Accounts" ) ); -} - -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 == KABC::Addressee::mimeType() ) { - actionCollection()->action( QLatin1String("akonadi_item_copy") )->setText( ki18np( "Copy Contact", "Copy %1 Contacts" ).subs( itemCount ).toString() ); - actionCollection()->action( QLatin1String("akonadi_item_copy_to_dialog") )->setText( i18n( "Copy Contact To" ) ); - actionCollection()->action( QLatin1String("akonadi_item_delete") )->setText( ki18np( "Delete Contact", "Delete %1 Contacts" ).subs( itemCount ).toString() ); - actionCollection()->action( QLatin1String("akonadi_item_move_to_dialog") )->setText( i18n( "Move Contact To" ) ); - actionCollection()->action( QLatin1String("akonadi_contact_item_edit") )->setText( i18n( "Edit Contact" ) ); - } else if ( mimeType == KABC::ContactGroup::mimeType() ) { - actionCollection()->action( QLatin1String("akonadi_item_copy") )->setText( ki18np( "Copy Group Of Contacts", "Copy %1 Groups Of Contacts" ).subs( itemCount ).toString() ); - actionCollection()->action( QLatin1String("akonadi_item_copy_to_dialog") )->setText( i18n( "Copy Group Of Contacts To" ) ); - actionCollection()->action( QLatin1String("akonadi_item_delete") )->setText( ki18np( "Delete Group Of Contacts", "Delete %1 Groups Of Contacts" ).subs( itemCount ).toString() ); - actionCollection()->action( QLatin1String("akonadi_item_move_to_dialog") )->setText( i18n( "Move Group Of Contacts To" ) ); - actionCollection()->action( QLatin1String("akonadi_contact_item_edit") )->setText( i18n( "Edit Group Of Contacts" ) ); - } -} - -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?" ) ); -} - -QAbstractProxyModel* MainView::createItemFilterModel() const -{ - return new Akonadi::ContactsFilterProxyModel(); -} - -ImportHandlerBase* MainView::importHandler() const -{ - return new ContactsImportHandler(); -} - -ExportHandlerBase* MainView::exportHandler() const -{ - return new ContactsExportHandler(); -} - -GuiStateManager* MainView::createGuiStateManager() const -{ - return new ContactsGuiStateManager(); -} - -void MainView::searchLdap() -{ - if ( !mLdapSearchDialog ) { - mLdapSearchDialog = new KLDAP::LdapSearchDialog( this ); - connect( mLdapSearchDialog, SIGNAL(contactsAdded()), SLOT(importFromLdap()) ); - } - mLdapSearchDialog->show(); -} - -void MainView::importFromLdap() -{ - Q_ASSERT( mLdapSearchDialog ); - const KABC::Addressee::List contacts = mLdapSearchDialog->selectedContacts(); - if ( contacts.isEmpty() ) // nothing to import - return; - - const QStringList mimeTypes( KABC::Addressee::mimeType() ); - - QPointer dlg = new Akonadi::CollectionDialog( entityTreeModel(), this ); - dlg->setMimeTypeFilter( mimeTypes ); - dlg->setAccessRightsFilter( Akonadi::Collection::CanCreateItem ); - dlg->setCaption( i18n( "Select Address Book" ) ); - dlg->setDescription( i18n( "Select the address book the imported contact(s) shall be saved in:" ) ); - - if ( regularSelectionModel()->hasSelection() ) { - const QModelIndex index = regularSelectionModel()->selectedIndexes().first(); - const Akonadi::Collection defaultCollection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( defaultCollection.isValid() ) - dlg->setDefaultCollection( defaultCollection ); - } - - if ( !dlg->exec() || !dlg ) { - delete dlg; - return; - } - - const Akonadi::Collection collection = dlg->selectedCollection(); - delete dlg; - if ( !collection.isValid() ) - return; - - foreach ( const KABC::Addressee &addr, contacts ) { - Akonadi::Item item; - item.setPayload( addr ); - item.setMimeType( KABC::Addressee::mimeType() ); - - new Akonadi::ItemCreateJob( item, collection ); - } -} - -void MainView::configureCategories() -{ - CalendarSupport::CategoryConfig config( IncidenceEditorNG::EditorConfig::instance()->config(), 0 ); - IncidenceEditorNG::CategoryEditDialog dialog( &config, 0 ); - if ( dialog.exec() ) - config.writeConfig(); -} - diff --git a/kdepim/mobile/contacts/mainview.h b/kdepim/mobile/contacts/mainview.h deleted file mode 100644 index 31f8acb6..00000000 --- a/kdepim/mobile/contacts/mainview.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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 MAINVIEW_H -#define MAINVIEW_H - -#include "kdeclarativemainview.h" - -#include - -namespace KLDAP { -class LdapSearchDialog; -} - -namespace Akonadi -{ - class Item; - class StandardContactActionManager; -} - -class ContactListProxy; -class KLineEdit; - -class MainView : public KDeclarativeMainView -{ - Q_OBJECT - public: - explicit MainView( QWidget *parent = 0 ); - - public Q_SLOTS: - void newContact(); - void newContactGroup(); - - void editItem(); - void editContact( const Akonadi::Item &item ); - void editContactGroup( const Akonadi::Item &item ); - - private Q_SLOTS: - void finishEdit( QObject *editor ); - void itemSelectionChanged( const QItemSelection &selected, const QItemSelection& ); - void bulkActionSelectionChanged(); - void sendMailTo(); - void searchLdap(); - void importFromLdap(); - void updateActionTexts(); - void configureCategories(); - - protected: - virtual 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; - - private: - Akonadi::StandardContactActionManager *mActionManager; - ContactListProxy *mContactListProxy; - QHash mOpenItemEditors; - KLDAP::LdapSearchDialog* mLdapSearchDialog; -}; - -#endif // MAINVIEW_H diff --git a/kdepim/mobile/contacts/mobilelineedit.cpp b/kdepim/mobile/contacts/mobilelineedit.cpp deleted file mode 100644 index 318f38ea..00000000 --- a/kdepim/mobile/contacts/mobilelineedit.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 "mobilelineedit.h" - -#include - -#include - -#include -#include -#include - -class MobileLineEdit::Private -{ - MobileLineEdit *const q; - - public: - explicit Private( MobileLineEdit *parent ) - : q( parent ), mEdit( 0 ), mButton( 0 ) - { - } - - public: - KPIM::AddresseeLineEdit *mEdit; - QPushButton *mButton; -}; - -MobileLineEdit::MobileLineEdit( QWidget *parent ) - : QWidget( parent ), d( new Private( this ) ) -{ - QHBoxLayout *box = new QHBoxLayout( this ); - box->setMargin( 0 ); - box->setSpacing( 0 ); - - d->mEdit = new KPIM::AddresseeLineEdit( this ); - box->addWidget( d->mEdit ); - - d->mButton = new QPushButton( this ); - d->mButton->setIcon( KIcon( QLatin1String("edit-clear-locationbar-rtl") ) ); - d->mButton->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum ); - box->addWidget( d->mButton ); - - connect( d->mButton, SIGNAL(clicked()), SLOT(clear()) ); - connect( d->mButton, SIGNAL(clicked()), SIGNAL(clearClicked()) ); -} - -MobileLineEdit::~MobileLineEdit() -{ - delete d; -} - -void MobileLineEdit::setText( const QString &text ) -{ - d->mEdit->setText( text ); -} - -QString MobileLineEdit::text() const -{ - return d->mEdit->text(); -} - -void MobileLineEdit::clear() -{ - d->mEdit->clear(); -} - - diff --git a/kdepim/mobile/contacts/mobilelineedit.h b/kdepim/mobile/contacts/mobilelineedit.h deleted file mode 100644 index d71b6e9f..00000000 --- a/kdepim/mobile/contacts/mobilelineedit.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (c) 2010 Kevin Krammer - - 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 MOBILELINEEDIT_H -#define MOBILELINEEDIT_H - -#include - -class QCompleter; - -class MobileLineEdit : public QWidget -{ - Q_OBJECT - - public: - explicit MobileLineEdit( QWidget *parent = 0 ); - - ~MobileLineEdit(); - - void setText( const QString &text ); - QString text() const; - - Q_SIGNALS: - void clearClicked(); - - public Q_SLOTS: - void clear(); - - private: - class Private; - Private *const d; -}; - -#endif - diff --git a/kdepim/mobile/contacts/namepartseditwidget.cpp b/kdepim/mobile/contacts/namepartseditwidget.cpp deleted file mode 100644 index 910d3bb4..00000000 --- a/kdepim/mobile/contacts/namepartseditwidget.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2010 Tobias Koenig - - 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 "namepartseditwidget.h" - -#include - -#include -#include -#include -#include - -NamePartsEditWidget::NamePartsEditWidget( QWidget *parent ) - : QWidget( parent) -{ - QFormLayout *layout = new QFormLayout( this ); - layout->setLabelAlignment( Qt::AlignLeft ); - - mPrefixCombo = new KComboBox( this ); - mPrefixCombo->setDuplicatesEnabled( false ); - mPrefixCombo->setEditable( true ); - - mGivenNameEdit = new KLineEdit( this ); - - mAdditionalNameEdit = new KLineEdit( this ); - - mFamilyNameEdit = new KLineEdit( this ); - - mSuffixCombo = new KComboBox( this ); - mSuffixCombo->setDuplicatesEnabled( false ); - mSuffixCombo->setEditable( true ); - - layout->addRow( i18n( "Honorific prefixes:" ), mPrefixCombo ); - layout->addRow( i18n( "Given name:" ), mGivenNameEdit ); - layout->addRow( i18n( "Additional names:" ), mAdditionalNameEdit ); - layout->addRow( i18n( "Family names:" ), mFamilyNameEdit ); - layout->addRow( i18n( "Honorific suffixes:" ), mSuffixCombo ); - - QStringList prefixList; - prefixList += QString(); - prefixList += i18n( "Dr." ); - prefixList += i18n( "Miss" ); - prefixList += i18n( "Mr." ); - prefixList += i18n( "Mrs." ); - prefixList += i18n( "Ms." ); - prefixList += i18n( "Prof." ); - prefixList.sort(); - - QStringList suffixList; - suffixList += QString(); - suffixList += i18n( "I" ); - suffixList += i18n( "II" ); - suffixList += i18n( "III" ); - suffixList += i18n( "Jr." ); - suffixList += i18n( "Sr." ); - suffixList.sort(); - - mPrefixCombo->addItems( prefixList ); - mSuffixCombo->addItems( suffixList ); - mPrefixCombo->lineEdit()->setFocus(); - - connect( mSuffixCombo, SIGNAL(activated(int)), this, SLOT(inputChanged()) ); - connect( mSuffixCombo, SIGNAL(editTextChanged(QString)), this, SLOT(inputChanged()) ); - connect( mPrefixCombo, SIGNAL(activated(int)), this, SLOT(inputChanged()) ); - connect( mPrefixCombo, SIGNAL(editTextChanged(QString)), this, SLOT(inputChanged()) ); - connect( mFamilyNameEdit, SIGNAL(textChanged(QString)), this, SLOT(inputChanged()) ); - connect( mGivenNameEdit, SIGNAL(textChanged(QString)), this, SLOT(inputChanged()) ); - connect( mAdditionalNameEdit, SIGNAL(textChanged(QString)), this, SLOT(inputChanged()) ); -} - -void NamePartsEditWidget::loadContact( const KABC::Addressee &contact ) -{ - mContact = contact; - - disconnect( mSuffixCombo, SIGNAL(activated(int)), this, SLOT(inputChanged()) ); - disconnect( mSuffixCombo, SIGNAL(editTextChanged(QString)), this, SLOT(inputChanged()) ); - disconnect( mPrefixCombo, SIGNAL(activated(int)), this, SLOT(inputChanged()) ); - disconnect( mPrefixCombo, SIGNAL(editTextChanged(QString)), this, SLOT(inputChanged()) ); - disconnect( mFamilyNameEdit, SIGNAL(textChanged(QString)), this, SLOT(inputChanged()) ); - disconnect( mGivenNameEdit, SIGNAL(textChanged(QString)), this, SLOT(inputChanged()) ); - disconnect( mAdditionalNameEdit, SIGNAL(textChanged(QString)), this, SLOT(inputChanged()) ); - - mPrefixCombo->setItemText( mPrefixCombo->currentIndex(), mContact.prefix() ); - mGivenNameEdit->setText( mContact.givenName() ); - mAdditionalNameEdit->setText( mContact.additionalName() ); - mFamilyNameEdit->setText( mContact.familyName() ); - mSuffixCombo->setItemText( mSuffixCombo->currentIndex(), mContact.suffix() ); - - connect( mSuffixCombo, SIGNAL(activated(int)), this, SLOT(inputChanged()) ); - connect( mSuffixCombo, SIGNAL(editTextChanged(QString)), this, SLOT(inputChanged()) ); - connect( mPrefixCombo, SIGNAL(activated(int)), this, SLOT(inputChanged()) ); - connect( mPrefixCombo, SIGNAL(editTextChanged(QString)), this, SLOT(inputChanged()) ); - connect( mFamilyNameEdit, SIGNAL(textChanged(QString)), this, SLOT(inputChanged()) ); - connect( mGivenNameEdit, SIGNAL(textChanged(QString)), this, SLOT(inputChanged()) ); - connect( mAdditionalNameEdit, SIGNAL(textChanged(QString)), this, SLOT(inputChanged()) ); -} - -void NamePartsEditWidget::storeContact( KABC::Addressee &contact ) const -{ - contact.setPrefix( mPrefixCombo->currentText() ); - contact.setGivenName( mGivenNameEdit->text() ); - contact.setAdditionalName( mAdditionalNameEdit->text() ); - contact.setFamilyName( mFamilyNameEdit->text() ); - contact.setSuffix( mSuffixCombo->currentText() ); -} - -void NamePartsEditWidget::inputChanged() -{ - storeContact( mContact ); - emit nameChanged( mContact ); -} diff --git a/kdepim/mobile/contacts/namepartseditwidget.h b/kdepim/mobile/contacts/namepartseditwidget.h deleted file mode 100644 index 6a3453b9..00000000 --- a/kdepim/mobile/contacts/namepartseditwidget.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - This file is part of Akonadi Contact. - - Copyright (c) 2010 Tobias Koenig - - 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 NAMEPARTSEDITWIDGET_H -#define NAMEPARTSEDITWIDGET_H - -#include - -#include - -class KLineEdit; -class KComboBox; - -class NamePartsEditWidget : public QWidget -{ - Q_OBJECT - - public: - explicit NamePartsEditWidget( QWidget *parent = 0 ); - - void loadContact( const KABC::Addressee &contact ); - void storeContact( KABC::Addressee &contact ) const; - - Q_SIGNALS: - void nameChanged( const KABC::Addressee &contact ); - - private Q_SLOTS: - void inputChanged(); - - private: - KComboBox *mSuffixCombo; - KComboBox *mPrefixCombo; - KLineEdit *mFamilyNameEdit; - KLineEdit *mGivenNameEdit; - KLineEdit *mAdditionalNameEdit; - KABC::Addressee mContact; -}; - -#endif diff --git a/kdepim/mobile/contacts/phonetypecombo.cpp b/kdepim/mobile/contacts/phonetypecombo.cpp deleted file mode 100644 index af6c3793..00000000 --- a/kdepim/mobile/contacts/phonetypecombo.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - Copyright (c) 2009 Tobias Koenig - Copyright (c) 2010 Kevin Krammer - - 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 "phonetypecombo.h" - -#include - -class PhoneTypeCombo::Private -{ - PhoneTypeCombo *const q; - - public: - Private( PhoneTypeCombo *parent ): q( parent ), mType( KABC::PhoneNumber::Home ), mLastSelected( 0 ) - { - for ( int i = 0; i < KABC::PhoneNumber::typeList().count(); ++i ) - mTypeList.append( KABC::PhoneNumber::typeList().at( i ) ); - - update(); - } - - void update() - { - q->clear(); - - for ( int i = 0; i < mTypeList.count(); ++i ) { - q->addItem( KABC::PhoneNumber::typeLabel( KABC::PhoneNumber::Type( mTypeList.at( i ) ) ) ); - } - - q->setCurrentIndex( mLastSelected = mTypeList.indexOf( mType ) ); - } - - public: - KABC::PhoneNumber::Type mType; - int mLastSelected; - QList mTypeList; - - public: // slots - void selected( int index ); -}; - -void PhoneTypeCombo::Private::selected( int pos ) -{ - mType = KABC::PhoneNumber::Type( mTypeList.at( pos ) ); - mLastSelected = pos; -} - -PhoneTypeCombo::PhoneTypeCombo( QWidget *parent ) : QComboBox( parent ), d( new Private( this ) ) -{ - connect( this, SIGNAL(activated(int)), SLOT(selected(int)) ); -} - -PhoneTypeCombo::~PhoneTypeCombo() -{ - delete d; -} - -void PhoneTypeCombo::setType( KABC::PhoneNumber::Type type ) -{ - if ( !d->mTypeList.contains( type ) ) - d->mTypeList.insert( d->mTypeList.at( d->mTypeList.count() - 1 ), type ); - - d->mType = type; - d->update(); -} - -KABC::PhoneNumber::Type PhoneTypeCombo::type() const -{ - return d->mType; -} - -#include "moc_phonetypecombo.cpp" diff --git a/kdepim/mobile/contacts/phonetypecombo.h b/kdepim/mobile/contacts/phonetypecombo.h deleted file mode 100644 index ecfc00ce..00000000 --- a/kdepim/mobile/contacts/phonetypecombo.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (c) 2009 Tobias Koenig - Copyright (c) 2010 Kevin Krammer - - 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 PHONETYPECOMBO_H -#define PHONETYPECOMBO_H - -#include - -#include - -/** - * @short A combobox to select a phone number type. - */ -class PhoneTypeCombo : public QComboBox -{ - Q_OBJECT - - public: - /** - * Creates a phone type combo. - * - * @param parent The parent widget. - */ - explicit PhoneTypeCombo( QWidget *parent = 0 ); - - /** - * Destroys the phone type combo. - */ - ~PhoneTypeCombo(); - - /** - * Sets the phone number @p type that shall be selected. - */ - void setType( KABC::PhoneNumber::Type type ); - - /** - * Returns the selected phone number type. - */ - KABC::PhoneNumber::Type type() const; - - private: - class Private; - Private *const d; - - Q_PRIVATE_SLOT( d, void selected( int ) ) -}; - -#endif diff --git a/kdepim/mobile/contacts/searchwidget.cpp b/kdepim/mobile/contacts/searchwidget.cpp deleted file mode 100644 index a413e356..00000000 --- a/kdepim/mobile/contacts/searchwidget.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 -#include - -SearchWidget::SearchWidget( QWidget *parent ) - : QWidget( parent ) -{ - mUi.setupUi( this ); - - // set defaults - mUi.inNames->setChecked( true ); - mUi.inEmailAddresses->setChecked( true ); - mUi.inCategories->setChecked( true ); - mUi.collectionCombo->setMimeTypeFilter( QStringList() << KABC::Addressee::mimeType() - << KABC::ContactGroup::mimeType() ); -} - -QString SearchWidget::query() const -{ - //TODO create seach 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(); -} - diff --git a/kdepim/mobile/contacts/searchwidget.h b/kdepim/mobile/contacts/searchwidget.h deleted file mode 100644 index 52321477..00000000 --- a/kdepim/mobile/contacts/searchwidget.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 -#include - -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 diff --git a/kdepim/mobile/contacts/searchwidget.ui b/kdepim/mobile/contacts/searchwidget.ui deleted file mode 100644 index 31d690c9..00000000 --- a/kdepim/mobile/contacts/searchwidget.ui +++ /dev/null @@ -1,170 +0,0 @@ - - - SearchWidget - - - - 0 - 0 - 379 - 194 - - - - - - - Search for: - - - - - - - true - - - - - - - In: - - - - - - - - 0 - - - 3 - - - 0 - - - 3 - - - - - Names - - - - - - - Email Addresses - - - - - - - Postal Addresses - - - - - - - Phone Numbers - - - - - - - Categories - - - - - - - - - - Located in: - - - - - - - - 0 - - - 3 - - - 0 - - - 3 - - - - - any folder - - - true - - - - - - - only in folder - - - - - - - false - - - - - - - - - - - KLineEdit - QLineEdit -
klineedit.h
-
- - Akonadi::CollectionComboBox - QComboBox -
akonadi/collectioncombobox.h
-
-
- - - - locatedInSpecificCollection - toggled(bool) - collectionCombo - setEnabled(bool) - - - 138 - 235 - - - 217 - 239 - - - - -
diff --git a/kdepim/mobile/contacts/settings.kcfg b/kdepim/mobile/contacts/settings.kcfg deleted file mode 100644 index 40bf6259..00000000 --- a/kdepim/mobile/contacts/settings.kcfg +++ /dev/null @@ -1,15 +0,0 @@ - - - - kglobalsettings.h - - - - - 0 - - - - diff --git a/kdepim/mobile/contacts/settings.kcfgc b/kdepim/mobile/contacts/settings.kcfgc deleted file mode 100644 index 734c1668..00000000 --- a/kdepim/mobile/contacts/settings.kcfgc +++ /dev/null @@ -1,6 +0,0 @@ -File=settings.kcfg -ClassName=Settings -Mutators=true -Singleton=true -ItemAccessors=true -SetUserTexts=true diff --git a/kdepim/mobile/hi48-apps-kdepim-mobile.png b/kdepim/mobile/hi48-apps-kdepim-mobile.png deleted file mode 100644 index c2bf10a7..00000000 Binary files a/kdepim/mobile/hi48-apps-kdepim-mobile.png and /dev/null differ diff --git a/kdepim/mobile/lib/AboutDialog.qml b/kdepim/mobile/lib/AboutDialog.qml deleted file mode 100644 index e9da5488..00000000 --- a/kdepim/mobile/lib/AboutDialog.qml +++ /dev/null @@ -1,185 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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.plasma.extras 0.1 as PlasmaExtras - -QML.Rectangle { - id: aboutDialog - property alias backgroundSource: backgroundImage.source - anchors.fill: parent - color: "white" - - QML.Image { - id: backgroundImage - anchors.fill: parent - } - - QML.Item { - anchors.fill: parent - anchors.topMargin: 40 - anchors.leftMargin: 40 - PlasmaExtras.ScrollArea { - width: parent.width - closeButton.width - height: parent.height - - flickableItem: QML.Flickable { - - contentWidth: width - 10 - contentHeight: 1900; - - - QML.Rectangle{ - id: aboutText - anchors.fill: parent - QML.Column{ - anchors.fill: parent - QML.Text{ - id: caption - font.pointSize: 18 - style: QML.Text.Raised - text: KDE.i18n( "About %1", application.name ) - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Image { - id: platformLogo - source: KDE.locate( "data", "mobileui/built-on-the-kde-platform.png" ) - } - - QML.Text{ - id:version - text: "\n" + application.version + "\n" - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text { - text : KDE.i18n("This Free Software product was created as part of a commercial contract. " + - "Kontact Touch is licensed under the GNU GPL version 2 or later and other Free Software licenses. " + - "See %1 for details.", "licenses.pdf") + "\n" - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text{ - text: KDE.i18n("Credits Project Komo3 (October 2009 - January 2011)") + "\n" - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text{ - text: KDE.i18n("Scrum Master, Team Senior: Till Adam, KDAB") + "\n" + - KDE.i18n("Product Owner, Team Senior: Bernhard Reiter, Intevation") + "\n" - style: QML.Text.Raised - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text{ - text: KDE.i18n("Development team in alphabetical order:") + "\n\n" + - "\t" + KDE.i18n("Andras Mantia (KDAB)") + "\n" + - "\t" + KDE.i18n("Andre Heinecke (Intevation)") + "\n" + - "\t" + KDE.i18n("Andreas Holzammer (KDAB)") + "\n" + - "\t" + KDE.i18n("Bertjan Broeksema (KDAB)") + "\n" + - "\t" + KDE.i18n("Björn Balazs (Apliki)") + "\n" + - "\t" + KDE.i18n("Björn Ricks (Intevation)") + "\n" + - "\t" + KDE.i18n("Casey Link (KDAB)") + "\n" + - "\t" + KDE.i18n("David Faure (KDAB)") + "\n" + - "\t" + KDE.i18n("Felix Wolfsteller (Intevation)") + "\n" + - "\t" + KDE.i18n("Kevin Krammer (KDAB)") + "\n" + - "\t" + KDE.i18n("Kevin Ottens (KDAB)") + "\n" + - "\t" + KDE.i18n("Laurent Montel (KDAB)") + "\n" + - "\t" + KDE.i18n("Leo Franchi (KDAB)") + "\n" + - "\t" + KDE.i18n("Ludwig Reiter (Intevation)") + "\n" + - "\t" + KDE.i18n("Marc Mutz (KDAB)") + "\n" + - "\t" + KDE.i18n("Marcus Brinkmann (g10 Code)") + "\n" + - "\t" + KDE.i18n("Nuno Pinheiro (KDAB)") + "\n" + - "\t" + KDE.i18n("Patrick Spendrin (KDAB)") + "\n" + - "\t" + KDE.i18n("Romain Pokrzywka (KDAB)") + "\n" + - "\t" + KDE.i18n("Sabine Faure (KDAB)") + "\n" + - "\t" + KDE.i18n("Sascha L. Teichmann (Intevation)") + "\n" + - "\t" + KDE.i18n("Sergio Martins (KDAB)") + "\n" + - "\t" + KDE.i18n("Stephen Kelly (KDAB)") + "\n" + - "\t" + KDE.i18n("Till Adam (KDAB)") + "\n" + - "\t" + KDE.i18n("Tobias Koenig (KDAB)") + "\n" + - "\t" + KDE.i18n("Volker Krause (KDAB)") + "\n" + - "\t" + KDE.i18n("Werner Koch (g10 Code)") + "\n" - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text{ - style: QML.Text.Raised - text: KDE.i18n("Special thanks to the two project persons from our principal.") + "\n" - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text{ - text: KDE.i18n("This product is built upon the KDE Platform 4 and the " + - "Kontact Desktop Client. " + - "Thanks to all contributors!\n") - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text{ - textFormat: QML.Text.RichText - text: KDE.i18n("For more information and to give feedback
\n" + - "please take a look at " + - "Kontact Touch at KDE Userbase") - wrapMode: QML.Text.WordWrap - width: parent.width - } - } - } - - } - } - } - - KPIM.Button2 { - id: licenseButton - anchors.right: parent.right - anchors.bottom: closeButton.top - anchors.bottomMargin: 10 - width: 150 - buttonText: KDE.i18n( "Licenses" ) - onClicked: { - application.openLicenses() - } - } - - KPIM.Button2 { - id: closeButton - anchors.right: parent.right - anchors.bottom: parent.bottom - width: 150 - buttonText: KDE.i18n( "Close" ) - onClicked: { - aboutDialog.parent.visible = false - } - } -} diff --git a/kdepim/mobile/lib/AboutDialog.qml.org b/kdepim/mobile/lib/AboutDialog.qml.org deleted file mode 100644 index 63f9d274..00000000 --- a/kdepim/mobile/lib/AboutDialog.qml.org +++ /dev/null @@ -1,176 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 Qt 4.7 as QML -import org.kde 4.5 -import org.kde.pim.mobileui 4.5 as KPIM - -QML.Rectangle { - id: aboutDialog - property alias backgroundSource: backgroundImage.source - anchors.fill: parent - color: "white" - - QML.Image { - id: backgroundImage - anchors.fill: parent - } - - QML.Item { - anchors.fill: parent - anchors.topMargin: 40 - anchors.leftMargin: 40 - KPIM.DecoratedFlickable{ - width: parent.width - closeButton.width - height: parent.height - contentWidth: width - 10 - contentHeight: 1800; - - content.children: [ - QML.Rectangle{ - id: aboutText - anchors.fill: parent - QML.Column{ - anchors.fill: parent - QML.Text{ - id: caption - font.pointSize: 18 - style: QML.Text.Raised - text: KDE.i18n( "About %1", application.name ) - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text{ - id:version - horizontalAlignment: QML.Text.AlignHCenter - text: "\n" + application.version + "\n" - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text { - text : KDE.i18n("This Free Software product was created as part of a commercial contract.\n" + - "%1 is licensed under the GNU GPL version 2 or later.\n" + - "See %2 for details.", application.name, "licenses.pdf") + "\n" - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text{ - text: KDE.i18n("Credits Project Komo3 (October 2009 - )") + "\n" - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text{ - text: KDE.i18n("Scrum Master, Team Senior: Till Adam, KDAB") + "\n" + - KDE.i18n("Product Owner, Team Senior: Bernhard Reiter, Intevation") + "\n" - style: QML.Text.Raised - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text{ - text: KDE.i18n("Development team in alphabetical order:") + "\n\n" + - "\t" + KDE.i18n("Andras Mantia (KDAB)") + "\n" + - "\t" + KDE.i18n("Andre Heinecke (Intevation)") + "\n" + - "\t" + KDE.i18n("Andreas Holzammer (KDAB)") + "\n" + - "\t" + KDE.i18n("Bertjan Broeksema (KDAB)") + "\n" + - "\t" + KDE.i18n("Björn Balazs (Apliki)") + "\n" + - "\t" + KDE.i18n("Björn Ricks (Intevation)") + "\n" + - "\t" + KDE.i18n("Casey Link (KDAB)") + "\n" + - "\t" + KDE.i18n("David Faure (KDAB)") + "\n" + - "\t" + KDE.i18n("Felix Wolfsteller (Intevation)") + "\n" + - "\t" + KDE.i18n("Kevin Krammer (KDAB)") + "\n" + - "\t" + KDE.i18n("Kevin Ottens (KDAB)") + "\n" + - "\t" + KDE.i18n("Laurent Montel (KDAB)") + "\n" + - "\t" + KDE.i18n("Leo Franchi (KDAB)") + "\n" + - "\t" + KDE.i18n("Ludwig Reiter (Intevation)") + "\n" + - "\t" + KDE.i18n("Marc Mutz (KDAB)") + "\n" + - "\t" + KDE.i18n("Marcus Brinkmann (g10 Code)") + "\n" + - "\t" + KDE.i18n("Nuno Pinheiro (KDAB)") + "\n" + - "\t" + KDE.i18n("Patrick Spendrin (KDAB)") + "\n" + - "\t" + KDE.i18n("Romain Pokrzywka (KDAB)") + "\n" + - "\t" + KDE.i18n("Sabine Faure (KDAB)") + "\n" + - "\t" + KDE.i18n("Sascha L. Teichmann (Intevation)") + "\n" + - "\t" + KDE.i18n("Sergio Martins (KDAB)") + "\n" + - "\t" + KDE.i18n("Stephen Kelly (KDAB)") + "\n" + - "\t" + KDE.i18n("Till Adam (KDAB)") + "\n" + - "\t" + KDE.i18n("Tobias Koenig (KDAB)") + "\n" + - "\t" + KDE.i18n("Volker Krause (KDAB)") + "\n" + - "\t" + KDE.i18n("Werner Koch (g10 Code)") + "\n" - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text{ - style: QML.Text.Raised - text: KDE.i18n("Special thanks to the two project persons from our principal.") + "\n" - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text{ - text: KDE.i18n("This project is built upon KDE SC Kontact Desktop client.\n" + - "For the outstanding work done there we\n" + - "would like to thank the original authors.\n") - wrapMode: QML.Text.WordWrap - width: parent.width - } - - QML.Text{ - textFormat: QML.Text.RichText - text: KDE.i18n("For more information and to give feedback
\n" + - "please take a look at " + - "Kontact Touch at KDE Userbase") - wrapMode: QML.Text.WordWrap - width: parent.width - } - } - } - ] - } - } - - KPIM.Button2 { - id: licenseButton - anchors.right: parent.right - anchors.bottom: closeButton.top - anchors.bottomMargin: 10 - width: 150 - buttonText: KDE.i18n( "Licenses" ) - onClicked: { - application.openLicenses() - } - } - - KPIM.Button2 { - id: closeButton - anchors.right: parent.right - anchors.bottom: parent.bottom - width: 150 - buttonText: KDE.i18n( "Close" ) - onClicked: { - aboutDialog.parent.visible = false - } - } -} diff --git a/kdepim/mobile/lib/Action.qml b/kdepim/mobile/lib/Action.qml deleted file mode 100644 index 408d6404..00000000 --- a/kdepim/mobile/lib/Action.qml +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 - -Rectangle { - id: _topContext - - property variant action - property variant actionIconName - property int hardcoded_height: 70 - property bool disableable: true - property bool showIcon: true - property bool hidable: true - property bool hidden: hidable && !action.enabled - property bool checkable: false - property alias showText: buttonText.visible - property alias image: image.source - property alias imageWidth: image.width - property alias imageHeight: image.height - - signal triggered() - signal longPressed() - - Binding { - target: image - property: "source" - value: "image://action_images/" + actionIconName - when: showIcon && actionIconName != undefined - } - - Binding { - target: buttonText - property: "text" - - value: { - action.text.replace("&", ""); - } - } - - Binding { - target: _topContext - property: "enabled" - value: disableable ? action.enabled : true - } - - height: (!hidable || action.enabled) ? hardcoded_height : 0 - visible: (!hidable || action.enabled) - - Connections { - target: action - - onChanged: { - border.width = action.checked ? 2 : 0 - if (!hidable) - return; - parent.height = action.enabled ? hardcoded_height : 0; - } - } - - radius: 12 - color: "#00000000" // Set a transparent color. - - Image { - id: image - anchors.verticalCenter: parent.verticalCenter - anchors.margins: 5 - } - - Text { - id: buttonText - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - color: parent.enabled ? "black" : "gray" - } - - MouseArea { - anchors.fill: parent - - onPressed: { - border.width = 2 - } - - onReleased: { - border.width = 0 - } - - onCanceled: border.width = 0 - - onClicked: { - triggered(); - action.trigger(); - } - - onPressAndHold: { - longPressed() - } - - } - - border.color: "#4166F5" - border.width: action.checked ? 2 : 0 -} diff --git a/kdepim/mobile/lib/ActionButton.qml b/kdepim/mobile/lib/ActionButton.qml deleted file mode 100644 index 2e11d0ed..00000000 --- a/kdepim/mobile/lib/ActionButton.qml +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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.pim.mobileui 4.5 as KPIM - -/** - * @short A button that is connected with a QAction - * - * The button will update its enabled state according to the - * associated action. - */ -KPIM.Button { - property variant action - property string actionName - - width: 70 - height: 70 - action: application.getAction( actionName, "" ) - enabled: action.enabled - opacity: enabled ? 1 : 0.65 - - onClicked : { action.trigger() } - - Connections { - target : action - onChanged : { - border.width = action.checked ? 2 : 0 - } - } - - border.width : action.checked ? 2 : 0 -} diff --git a/kdepim/mobile/lib/ActionList.qml b/kdepim/mobile/lib/ActionList.qml deleted file mode 100644 index a13d3942..00000000 --- a/kdepim/mobile/lib/ActionList.qml +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 - - -QML.Item { - id: actionList_top - width: parent.width - - //property alias listElementContent: _listElementContent.data - default property alias listContent: _listContent.content - property string category - property string name - property alias text: nameItem.buttonText - property alias columnHeight: _listContent.height - property alias totalWidth: _listContent.width - property alias depth: _listContent.bottomMargin - property alias actionItemSpacing: _listContent.actionItemSpacing - property alias actionItemHeight: _listContent.actionItemHeight - property alias showChildren: _listContent.visible - property alias menuStyle: _listContent.menuStyle - - signal doCollapse() - signal triggered(string triggeredName) - - function preselectAction() { - actionList_top.triggered(actionList_top.name) - showChildren = true - } - - onVisibleChanged: { - if (!visible) { - height = -actionItemSpacing - } else { - height = actionItemHeight - } - } - - - - KPIM.Button { - id: nameItem - height: parent.height - width: parent.width - - onClicked: { - actionList_top.triggered(actionList_top.name) - showChildren = true - } - } - - KPIM.ActionMenuContainer { - id: _listContent - - anchors { - left: nameItem.right - bottom: nameItem.top - } - - visible: false - actionItemWidth: parent.totalWidth - - onTriggered: { - actionList_top.triggered(triggeredName) - } - - onDoCollapse: { - actionList_top.doCollapse() - } - - } -} diff --git a/kdepim/mobile/lib/ActionListItem.qml b/kdepim/mobile/lib/ActionListItem.qml deleted file mode 100644 index 86ed8aca..00000000 --- a/kdepim/mobile/lib/ActionListItem.qml +++ /dev/null @@ -1,83 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 - - -QML.Item { - id: _top - height: parent.height - width: (parent ? parent.width : 0) - - property string name - property string argument: "" - property string title: "" - property bool reactsOnLongPressed: false - property string category - - signal triggered(string triggeredName) - signal doCollapse() - signal pressAndHold() - - onVisibleChanged: { - - if (!visible) { - height = -actionItemSpacing - } else { - height = actionItemHeight - } - } - - KPIM.Action { - height: parent.height - width: parent.width - showIcon: false - hidable: false - - action: { - application.setActionTitle(name, title); - application.getAction(name, argument); - } - - actionIconName: { - application.getActionIconName(name); - } - - onLongPressed: { - pressAndHold(); - } - - onTriggered: { - parent.doCollapse() - parent.triggered(name) - } - - QML.Image { - anchors { - right: parent.right - verticalCenter: parent.verticalCenter - } - source: KDE.locate( "data", "mobileui/long-press-indicator.png" ) - visible: _top.reactsOnLongPressed - } - } -} diff --git a/kdepim/mobile/lib/ActionMenuContainer.qml b/kdepim/mobile/lib/ActionMenuContainer.qml deleted file mode 100644 index 6d21830d..00000000 --- a/kdepim/mobile/lib/ActionMenuContainer.qml +++ /dev/null @@ -1,224 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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.pim.mobileui 4.5 as KPIM - -Item { - id : _topLevel - property int actionItemHeight - property int actionItemWidth - property int actionItemSpacing : 0 - property int bottomMargin - property bool menuStyle : false - property int activeCount: 0 - anchors.bottomMargin : bottomMargin - property string cachedCategory - - property alias scriptActions : myScriptActions.data - - default property alias content : itemModel.children - - signal triggered(string triggeredName) - - signal doCollapse() - - function refresh() - { - showOnlyCategory( cachedCategory ) - selectTopItem() - } - - function selectTopItem() - { - for ( var i = 0; i < itemModel.children.length; ++i ) { - if ( itemModel.children[i].visible ) { - if ( itemModel.children[i].preselectAction ) - itemModel.children[i].preselectAction(); - return; - } - } - } - - clip: true - - Item { - id : myScriptActions - - function trigger(name) - { - for (var i = 0; i < children.length; ++i ) - { - if (children[i].name == name) - { - children[i].trigger(); - return; - } - } - } - } - - function showOnlyCategory(category) - { - cachedCategory = category - itemModel.showOnlyCategory(category) - - var firstMenu = -1; - var showFirstMenu = true; - for ( var i = 0; i < itemModel.children.length; ++i ) { - // QML has no type or interface system so we rely on the all children of itemModel - // that are items have a category property - if (firstMenu == -1 && itemModel.children[i].visible && itemModel.children[i].showChildren != undefined ) { - // We make the first visible item show its children. - firstMenu = i; - } - if (itemModel.children[i].showChildren != undefined && itemModel.children[i].showChildren) { - return; - } - } - itemModel.children[firstMenu].showChildren = true; - } - - VisualItemModel { - id : itemModel - - property int spaceAbove - property int spaceBelow - - function refresh() { - var _depth = -myListView.height; - - var _spaceAbove = 0; - var _spaceBelow = 0; - var _activeCount = 0; - var found = false; - - for ( var i = 0; i < children.length; ++i ) { - if (children[i].visible) { - children[i].height = actionItemHeight - _activeCount++; - } - if (children[i].columnHeight != undefined) - children[i].columnHeight = myListView.height - if (children[i].totalWidth != undefined) - children[i].totalWidth = _topLevel.width - actionItemWidth - if (children[i].depth != undefined) { - children[i].depth = _depth - } - _depth += children[i].height + actionItemSpacing; - if (children[i].actionItemSpacing != undefined) - children[i].actionItemSpacing = actionItemSpacing - if (children[i].actionItemHeight != undefined) - children[i].actionItemHeight = actionItemHeight - if (children[i].doCollapse != undefined) { - children[i].doCollapse.disconnect(_topLevel, doCollapse) - children[i].doCollapse.connect(_topLevel, doCollapse) - } - children[i].triggered.disconnect( itemModel, triggered ) - children[i].triggered.connect( itemModel, triggered ) - // children[i].width = parent.actionItemWidth - if (i == myListView.currentIndex) - { - found = true; - if (children[i].showChildren != undefined) - children[i].showChildren = true; - } - if (found) - _spaceBelow += children[i].height - else - _spaceAbove += children[i].height - } - spaceAbove = _spaceAbove; - if (myListView.currentItem) - spaceBelow = _spaceBelow - myListView.currentItem.height; - else - spaceBelow = _spaceBelow; - activeCount = _activeCount; - } - onChildrenChanged : { - refresh(); - } - function triggered(triggeredName) { - myScriptActions.trigger(triggeredName) - _topLevel.triggered(triggeredName) - - var _spaceAbove = 0; - var _spaceBelow = 0; - var found = false; - for ( var i = 0; i < children.length; ++i ) { - if (children[i].name != triggeredName && children[i].showChildren != undefined) { - children[i].showChildren = false; - } - else if (children[i].name == triggeredName) - { - found = true - myListView.currentIndex = i - } - if (found) - _spaceBelow += children[i].height + actionItemSpacing - else - _spaceAbove += children[i].height + actionItemSpacing - } - spaceAbove = _spaceAbove; - spaceBelow = _spaceBelow - myListView.currentItem.height; - } - function showOnlyCategory(category) - { - for ( var i = 0; i < children.length; ++i ) { - if ( children[i].category != undefined && children[i].category != "standard" ) - { - children[i].visible = (children[i].category == category) - } - } - refresh(); - } - } - - KPIM.DecoratedListView { - height : parent.height - width : parent.actionItemWidth - id : myListView - model : itemModel - spacing : actionItemSpacing - interactive: (actionItemHeight + actionItemSpacing) * (activeCount <= 0 ? count : activeCount) > height - - highlight : ActiveActionMenuItemDelegate{ - id : menuHighLight - visible : menuStyle - spaceAbove : itemModel.spaceAbove - spaceBelow : itemModel.spaceBelow - actionItemHeight: _topLevel.actionItemHeight - } - - onHeightChanged : { - itemModel.refresh() - } - } - - onActionItemSpacingChanged : { - itemModel.refresh(); - } - - onActionItemHeightChanged : { - itemModel.refresh(); - } -} diff --git a/kdepim/mobile/lib/ActiveActionMenuItemDelegate.qml b/kdepim/mobile/lib/ActiveActionMenuItemDelegate.qml deleted file mode 100644 index 8ff4299c..00000000 --- a/kdepim/mobile/lib/ActiveActionMenuItemDelegate.qml +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 - -QML.Item { - id: _top - - property int spaceAbove - property int spaceBelow - property int actionItemHeight - - onSpaceAboveChanged: { - lineAbove.height = Math.max( spaceAbove, 0 ); - } - - onSpaceBelowChanged: { - lineBelow.height = Math.max( spaceBelow, 0 ); - } - - QML.Behavior on y { - QML.NumberAnimation { - duration: 250 - easing.type: Easing.OutQuad - } - } - - QML.Image { - id: lineAbove - anchors { - bottom: active_image.top - right: _top.right - } - source: "images/dividing-line.png" - height: 0 - } - - QML.BorderImage { - id: active_image - anchors { - right: _top.right - rightMargin: -10 - } - height: actionItemHeight - source: "images/activeactionitem.png" - border { - left: 0 - right: 0 - top: 20 - bottom: 20 - } - verticalTileMode: QML.BorderImage.Repeat - } - - QML.Image { - id: lineBelow - anchors { - top: active_image.bottom - right: _top.right - } - source: "images/dividing-line.png" - height: 0 - } -} diff --git a/kdepim/mobile/lib/AgentInstanceList.qml b/kdepim/mobile/lib/AgentInstanceList.qml deleted file mode 100644 index 7bfd3e0b..00000000 --- a/kdepim/mobile/lib/AgentInstanceList.qml +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 - - -QML.Item { - id : agentInstanceList_top - width : parent.width - - property string category - property string name - - property alias text : nameItem.buttonText - property alias totalWidth : _listContent.width - property alias columnHeight : _listContent.height - property alias depth : _listContent.bottomMargin - property alias actionItemHeight: _listContent.actionItemHeight - - property alias customActions : _listContent.customActions - - property alias model : _listContent.model - - property alias showChildren : _listContent.visible - signal triggered(string triggeredName) - - onVisibleChanged : - { - if (!visible) - height = -actionItemSpacing - else - height = actionItemHeight - } - - - KPIM.Button { - id : nameItem - height : parent.height - width : parent.width - - onClicked : { - agentInstanceList_top.triggered(agentInstanceList_top.name) - showChildren = true - } - } - - KPIM.AgentInstanceListContainer { - id : _listContent - anchors.left : nameItem.right - anchors.bottom : nameItem.top - - property int bottomMargin - anchors.bottomMargin : bottomMargin - visible : false - - onTriggered : { - actionList_top.triggered(triggeredName) - } - } -} diff --git a/kdepim/mobile/lib/AgentInstanceListContainer.qml b/kdepim/mobile/lib/AgentInstanceListContainer.qml deleted file mode 100644 index 2ea1a924..00000000 --- a/kdepim/mobile/lib/AgentInstanceListContainer.qml +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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.plasma.extras 0.1 as PlasmaExtras -import org.kde.pim.mobileui 4.5 as KPIM - -QML.Rectangle { - - id: _topLevel - anchors.bottomMargin: bottomMargin - color: "#00000000" - - property int actionItemHeight: 70 - property int actionItemWidth: 200 - property int actionItemSpacing: 0 - property int bottomMargin - property alias model: myList.model - property alias customActions: actionColumn.content - - signal triggered(string triggeredName) - - PlasmaExtras.ScrollArea { - - anchors { - top: parent.top - bottom: parent.bottom - left: parent.left - } - - width: parent.width - actionColumn.width - - flickableItem: QML.ListView { - id: myList - focus: true - clip: true - - delegate: AgentInstanceListDelegate { - height: _topLevel.actionItemHeight - width: myList.width - } - - onCurrentIndexChanged: { - application.setAgentInstanceListSelectedRow( currentIndex ) - } - } - } - - ActionMenuContainer { - id: actionColumn - width: _topLevel.actionItemWidth - anchors { - top: parent.top - bottom: parent.bottom - right: parent.right - } - actionItemWidth: width - actionItemHeight: _topLevel.actionItemHeight - - content: [ - ActionListItem { name: "akonadi_agentinstance_configure" }, - ActionListItem { name: "akonadi_agentinstance_delete" }, - ActionListItem { name: "akonadi_agentinstance_create" } - ] - } - -} diff --git a/kdepim/mobile/lib/AgentInstanceListDelegate.qml b/kdepim/mobile/lib/AgentInstanceListDelegate.qml deleted file mode 100644 index 23d65cc3..00000000 --- a/kdepim/mobile/lib/AgentInstanceListDelegate.qml +++ /dev/null @@ -1,98 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (C) 2010 Volker Krause - - 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 - -QML.Item { - - id: _delegateTopLevel - clip: true - width: QML.ListView.width - height: 100 - - function statusMessage( msg, progress ) { - if ( progress <= 0 || progress >= 100 ) { - return msg; - } - return KDE.i18nc( "status message (50%)", "%1 (%2%)", msg, progress ); - } - - QML.Rectangle { - id: background - anchors.fill: parent - opacity: (_delegateTopLevel.QML.ListView.isCurrentItem ? 0.25 : 0) - color: "lightsteelblue" - } - - QML.Item { - anchors.margins: 4 - anchors.fill: parent - - AgentInstanceStatusIndicator { - id: statusIcon - - anchors { - top: parent.top - left: parent.left - } - - online: model.online - status: model.status - } - - QML.Text { - id: nameLabel - - anchors { - verticalCenter: statusIcon.verticalCenter - left: statusIcon.right - } - - width: parent.width - statusIcon.width - elide: QML.Text.ElideRight - text: model.display - } - - QML.Text { - id: statusLabel - - anchors { - left: nameLabel.left - top: nameLabel.bottom - topMargin: 2 - } - - width: nameLabel.width - font.pixelSize: 16 - elide: QML.Text.ElideRight - text: statusMessage( model.statusMessage, model.progress ) - } - - } - - QML.MouseArea { - anchors.fill: parent - onClicked: { - _delegateTopLevel.QML.ListView.view.currentIndex = model.index; - } - } -} diff --git a/kdepim/mobile/lib/AgentInstanceStatusIndicator.qml b/kdepim/mobile/lib/AgentInstanceStatusIndicator.qml deleted file mode 100644 index 8194c6d8..00000000 --- a/kdepim/mobile/lib/AgentInstanceStatusIndicator.qml +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (C) 2010 Volker Krause - - 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 - -Image { - - property int online - property int status - - function iconForStatus( online, status ) - { - if ( !online ) { - return "images/status/offline.png"; - } - - if ( status == 0 ) { - return "images/status/online.png" - } else if ( status == 1 ) { - return "images/status/receiving.png"; - } else { - return KDE.iconPath( "dialog-warning", 26 ); - } - } - - source: iconForStatus( online, status ) - -} \ No newline at end of file diff --git a/kdepim/mobile/lib/AgentStatusIndicator.qml b/kdepim/mobile/lib/AgentStatusIndicator.qml deleted file mode 100644 index 9a7e5144..00000000 --- a/kdepim/mobile/lib/AgentStatusIndicator.qml +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 - -QML.Item { - id: root - - width: icon.width - height: icon.height - - function iconFromStatus( status ) { - if ( !(status & KPIM.AgentStatusMonitor.Online) ) { - return "images/status/offline.png"; - } else { - if ( (status & KPIM.AgentStatusMonitor.Sending) && (status & KPIM.AgentStatusMonitor.Receiving) ) { - return "images/status/sending-receiving.png"; - } else if ( status & KPIM.AgentStatusMonitor.Receiving ) { - return "images/status/receiving.png"; - } else if ( status & KPIM.AgentStatusMonitor.Sending ) { - return "images/status/sending.png"; - } else { - return "images/status/online.png" - } - } - } - - QML.Image { - id: icon - source: iconFromStatus( agentStatusMonitor.status ) - } -} diff --git a/kdepim/mobile/lib/ApplicationGeneralActions.qml b/kdepim/mobile/lib/ApplicationGeneralActions.qml deleted file mode 100644 index 4548150b..00000000 --- a/kdepim/mobile/lib/ApplicationGeneralActions.qml +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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.ActionList { - id : actions - property alias configureActionVisible: configureAction.visible - property string type - property alias addNewActionName: addNewAction.name - property alias addNewActionReactsOnLongPressed: addNewAction.reactsOnLongPressed - //property alias searchActionTitle: searchAction.title - property alias configureActionTitle: configureAction.title - signal longPressed(string actionName) - - KPIM.ActionListItem { - name : "quit_akonadi" - onPressAndHold: { - longPressed(name); - } - } - - KPIM.ActionListItem { - id: addNewAction - onPressAndHold: { - longPressed(name); - } - } - -//TODO enable when SearchWidget::query() is implemented -// KPIM.ScriptActionItem { -// id : searchAction -// name : "search_" + type -// } - - KPIM.ActionListItem { - name : "akonadi_work_offline" - onPressAndHold: { - longPressed(name); - } - } - - KPIM.ScriptActionItem { - id : configureAction - name : "configure" - } - - KPIM.ScriptActionItem { - name : "show_about_dialog" - title : KDE.i18n( "About Kontact Touch" ) - } -} - diff --git a/kdepim/mobile/lib/AttachmentList.qml b/kdepim/mobile/lib/AttachmentList.qml deleted file mode 100644 index bcc94f3b..00000000 --- a/kdepim/mobile/lib/AttachmentList.qml +++ /dev/null @@ -1,243 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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.plasma.extras 0.1 as PlasmaExtras - -/** - * Shows a list view of the specified attachment model of a MessageView component. - * @param model An attachment model - */ - -Item { - id: _attachmentList - - property alias model: attachmentListView.model - property int rowHeight: 48 - property int attachmentListWidth: 250 - property int actionListWidth: 240 - - /** Emittted when an attachment has been selected. */ - signal openAttachment(string url, string mimeType) - signal saveAttachment(string url, string fileName) - - Component { - id: attachmentDelegate - - Item { - id: wrapper - width: attachmentListWidth - height: rowHeight - clip: true - - Rectangle { - id: background - anchors.fill: parent - opacity: (wrapper.ListView.isCurrentItem ? 0.4 : 0.25) - color: "lightsteelblue" - } - - Text { - anchors.fill: parent; - text: model.display; - horizontalAlignment: "AlignHCenter"; - verticalAlignment: "AlignVCenter"; - } - - MouseArea { - anchors.fill: parent - onClicked: { - wrapper.ListView.view.currentIndex = model.index - wrapper.ListView.view.currentMimeType = model.mimeType; - wrapper.ListView.view.currentAttachmentUrl = model.attachmentUrl; - wrapper.ListView.view.currentFileName = model.display; - } - } - } - } - - PlasmaExtras.ScrollArea { - - anchors { - top: parent.top - left: parent.left - right: actionView.left - bottom: parent.bottom - } - - flickableItem: ListView { - id: attachmentListView - - property string currentMimeType - property string currentAttachmentUrl - property string currentFileName - - delegate: attachmentDelegate - clip: true - - Connections { - target: model - onModelReset: { - attachmentListView.currentIndex = -1 - attachmentListView.currentMimeType = ""; - attachmentListView.currentAttachmentUrl = ""; - attachmentListView.currentFileName = ""; - } - } - } - } - - Item { - id: actionView - visible: false - width: 0 - - anchors { - top: parent.top - right: parent.right - bottom: parent.bottom - } - - KPIM.Button { - id: openButton - - anchors { - top: parent.top - horizontalCenter: parent.horizontalCenter - } - - width: parent.width - 10 - height: parent.height / 6 - buttonText: KDE.i18n( "Open" ) - - onClicked: { - openAttachment(attachmentListView.currentAttachmentUrl, attachmentListView.currentMimeType); - } - } - - KPIM.Button { - id: saveButton - - anchors { - top: openButton.bottom; - horizontalCenter: parent.horizontalCenter - } - - width: parent.width - 10 - height: parent.height / 6 - buttonText: KDE.i18n( "Save" ) - onClicked: { - saveAttachment(attachmentListView.currentAttachmentUrl, attachmentListView.currentFileName); - } - } - } - - Item { - id: previewView - visible: false - - anchors { - top: parent.top - right: parent.right - bottom: parent.bottom - } - - width: _attachmentList.width - attachmentListWidth - 6 - - PlasmaExtras.ScrollArea { - id: previewScrollArea - anchors.fill: parent - - flickableItem: Flickable { - - contentWidth: previewImage.width - contentHeight: previewImage.height - - Image { - id: previewImage - source: attachmentListView.currentAttachmentUrl - } - - } - } - - KPIM.Button { - id: previewSaveButton - - anchors { - bottom: parent.bottom - right: parent.right - margins: 12 - } - - width: 48 - height: 48 - icon: KDE.iconPath( "document-save", width ); - - onClicked: { - saveAttachment(attachmentListView.currentAttachmentUrl, attachmentListView.currentFileName); - } - - states: [ - State { - name: "movingState" - when: previewScrollArea.moving - - PropertyChanges { - target: previewSaveButton - opacity: 0.25 - } - } - ] - - transitions: [ - Transition { - NumberAnimation { - properties: "opacity" - duration: 200 - } - } - ] - } - } - - states: [ - State { - name: "actionState" - when: (attachmentListView.currentIndex >= 0 && attachmentListView.currentIndex < model.attachmentCount) && attachmentListView.currentMimeType.indexOf( "image" ) != 0 - PropertyChanges { - target: actionView - width: actionListWidth - visible: true - } - }, - - State { - name: "previewState" - when: (attachmentListView.currentIndex >= 0 && attachmentListView.currentIndex < model.attachmentCount) && attachmentListView.currentMimeType.indexOf( "image" ) == 0 - PropertyChanges { - target: previewView - visible: true - } - } - ] - -} diff --git a/kdepim/mobile/lib/BulkActionList.qml b/kdepim/mobile/lib/BulkActionList.qml deleted file mode 100644 index 06bd8779..00000000 --- a/kdepim/mobile/lib/BulkActionList.qml +++ /dev/null @@ -1,185 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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.akonadi 4.5 -import org.kde.pim.mobileui 4.5 as KPIM -import org.kde.plasma.extras 0.1 as PlasmaExtras - -QML.Column { - id: _top - - property alias selectedItemModel: selectedItem.model - property alias multipleText: _multipleText.text - property alias actionModel: actionListView.model - property int itemHeight: 65 - - signal backClicked() - signal triggered(string name) - - onChildrenChanged: { - var newChild = children[ children.length - 1 ]; - newChild.anchors.left = _top.left; - newChild.anchors.right = _top.right; - newChild.height = itemHeight; - } - - QML.Item { - id: firstItem - height: itemHeight - anchors { - left: parent.left - right: parent.right - } - - - PlasmaExtras.ScrollArea { - id: selectedItemContainer - anchors.fill: parent - - flickableItem: QML.ListView { - id: selectedItem - - delegate: CollectionDelegate { - height: 70 - indentation: 80 - } - visible: count == 1 - } - } - - QML.Text { - id: _multipleText - anchors.horizontalCenter : parent.horizontalCenter - y: height / 2 - visible: selectedItem.count != 1 - height: 70 - } - - QML.Image { - id: topLine - source: "images/list-line-top.png" - anchors { - right: selectedItemContainer.right - top: selectedItemContainer.top - } - } - - QML.Image { - id: topLineFiller - source: "images/dividing-line-horizontal.png" - anchors { - right: topLine.left - bottom: topLine.bottom - } - fillMode: QML.Image.TileHorizontally - width: parent.width - topLine.width - } - - QML.Image { - id: bottomLine - source: "images/dividing-line-horizontal.png" - anchors { - right: selectedItemContainer.right - bottom: selectedItemContainer.bottom - } - fillMode: QML.Image.TileHorizontally - width: parent.width - } - - QML.Image { - source: "images/dividing-line.png" - anchors { - top: selectedItemContainer.bottom - right: parent.right - } - height: _top.height - selectedItemContainer.height - fillMode: QML.Image.TileVertically - } - - QML.Image { - id: backIcon - source: "images/bulk-back-overlay.png" - anchors { - right: parent.right - verticalCenter: parent.verticalCenter - } - } - - QML.MouseArea { - id: back_ma - anchors.fill: parent - onClicked: _top.backClicked() - } - - } - - QML.ListModel { - id: actionModel; - - QML.ListElement { - action: "akonadi_item_delete" - } - - QML.ListElement { - action: "akonadi_item_move_to_dialog" - } - - QML.ListElement { - action: "akonadi_item_copy_to_dialog" - } - } - - QML.Rectangle { - anchors { - left: _top.left - right: _top.right - top: _top.top - topMargin: itemHeight - } - height: _top.height - itemHeight - clip: true - - QML.Text { - anchors.fill: parent - horizontalAlignment: QML.Text.AlignHCenter - verticalAlignment: QML.Text.AlignVCenter - font.pixelSize: 22 - text: KDE.i18n( "Please select one\nor more items\non the right." ) - visible: !_itemActionModel.hasSelection - } - - PlasmaExtras.ScrollArea { - anchors.fill:parent - - flickableItem: QML.ListView { - id: actionListView - model: actionModel - - delegate: KPIM.Action { - height: itemHeight - width: parent.width - action: application.getAction( model.action, "" ) - } - } - } - } -} diff --git a/kdepim/mobile/lib/BulkActionScreen.qml b/kdepim/mobile/lib/BulkActionScreen.qml deleted file mode 100644 index f95916c1..00000000 --- a/kdepim/mobile/lib/BulkActionScreen.qml +++ /dev/null @@ -1,134 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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.akonadi 4.5 as Akonadi -import org.kde.pim.mobileui 4.5 as KPIM - -QML.Rectangle { - id: _top - - anchors { - fill: parent - topMargin: 12 - } - - color: "white" - - default property alias actions: actionList.children - property alias selectedItemModel: actionList.selectedItemModel - property alias multipleText: actionList.multipleText - property alias headerList: headerList.children - property alias actionListWidth: actionList.width - property alias backgroundImage: _backgroundImage.source - property alias actionModel: actionList.actionModel - property alias itemHeight: actionList.itemHeight - - QML.Image { - id: _backgroundImage - } - - BulkActionList { - id: actionList - anchors { - top: parent.top - bottom: selectAllButton.top - left: parent.left - } - - onBackClicked: { - guiStateManager.popState() - bulkActionFilterLineEdit.clear() - } - - onTriggered: { - //mainPanel.complete(name) - } - } - - KPIM.Button2 { - id: selectAllButton - anchors { - left: parent.left - bottom: parent.bottom - right: mainPanel.left - } - - buttonText: stateHolder.state == "check_all" ? KDE.i18n( "Select All" ) : KDE.i18n( "Deselect All" ) - - onClicked: { - if ( stateHolder.state == "check_all" ) { - application.checkAllBulkActionItems( true ) - stateHolder.state = "uncheck_all" - } else { - application.checkAllBulkActionItems( false ) - stateHolder.state = "check_all" - } - } - - QML.Item { - id: stateHolder - state: "check_all" - - states: [ - QML.State { - name: "check_all" - }, - - QML.State { - name: "uncheck_all" - } - ] - } - } - - QML.Item { - id : mainPanel - achors { - top: parent.top - right: parent.right - bottom: parent.bottom - left: actionList.right - } - - QML.Item { - id: headerList - anchors { - left: parent.left - top: parent.top - bottom: bulkActionFilterLineEdit.top - right: parent.right - } - } - - Akonadi.BulkActionFilterLineEdit { - id: bulkActionFilterLineEdit - anchors { - left: parent.left - bottom: parent.bottom - right: parent.right - } - visible: false - height: 0 - y: height == 0 ? parent.height : parent.height - height - } - } -} diff --git a/kdepim/mobile/lib/Button.qml b/kdepim/mobile/lib/Button.qml deleted file mode 100644 index a012ef96..00000000 --- a/kdepim/mobile/lib/Button.qml +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 - -Rectangle { - property string icon - property alias buttonText: buttonText.text - property alias font: buttonText.font - signal clicked - - radius: 12 - color: "#00000000" // Set a transparent color. - - Image { - source: icon - anchors.fill: parent - anchors.margins: 5 - } - - Text { - id: buttonText - anchors.horizontalCenter: parent.horizontalCenter - anchors.verticalCenter: parent.verticalCenter - } - - MouseArea { - anchors.fill: parent - onPressed: { - border.color = "#4166F5"; - border.width = 2 - } - onReleased: border.width = 0 - onCanceled : border.width = 0 - onClicked: parent.clicked() - } -} diff --git a/kdepim/mobile/lib/Button2.qml b/kdepim/mobile/lib/Button2.qml deleted file mode 100644 index 3615775a..00000000 --- a/kdepim/mobile/lib/Button2.qml +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 - -QML.Rectangle { - id: root - - property string _state - property alias icon: iconImage.source - property alias buttonText: buttonLabel.text - property alias font: buttonLabel.font - property bool enabled: true - - signal clicked - - - height: 52 - color: "#00000000" // Set a transparent color. - - QML.BorderImage { - id: borderImage - anchors.fill: parent - source: "images/button-border" + root._state + ".png" - border { - left: 14 - right: 14 - top: 14 - bottom: 14 - } - horizontalTileMode: QML.BorderImage.Repeat - verticalTileMode: QML.BorderImage.Stretch - } - - QML.Image { - id: iconImage - - anchors { - verticalCenter: parent.verticalCenter - margins: (source == "" ? 0 : 5); - left: (buttonText == "" ? undefined : parent.left); - horizontalCenter: (buttonText == "" ? parent.horizontalCenter : undefined) - } - - fillMode: QML.Image.PreserveAspectFit - height: (root.height > sourceSize.height) ? sourceSize.height : (root.height - anchors.margins) - smooth: true - } - - QML.Text { - id: buttonLabel - - anchors { - centerIn: parent - left: iconImage.right - right: parent.right - } - - color: root.enabled ? "black" : "gray" - } - - states: [ - QML.State { - name: "pressed" - when: _mouseArea.pressed - - QML.PropertyChanges { - target: root - _state: "-active" - } - - QML.PropertyChanges { - target: buttonLabel - color: "white" - } - } - ] - - QML.MouseArea { - id: _mouseArea - anchors.fill: parent - enabled: parent.enabled - onClicked: parent.clicked() - } -} diff --git a/kdepim/mobile/lib/CMakeLists.txt b/kdepim/mobile/lib/CMakeLists.txt deleted file mode 100644 index fcc13bb8..00000000 --- a/kdepim/mobile/lib/CMakeLists.txt +++ /dev/null @@ -1,127 +0,0 @@ -include_directories( - ${CMAKE_SOURCE_DIR}/incidenceeditor-ng - ${CMAKE_SOURCE_DIR} - ${Boost_INCLUDE_DIR} -) - -add_subdirectory( calendar ) -add_subdirectory( docs ) - -set(mobileui_SRCS - agentstatusmonitor.cpp - akonadibreadcrumbnavigationfactory.cpp - breadcrumbnavigation.cpp - breadcrumbnavigationcontext.cpp - collectionfetchwatcher.cpp - declarativewidgetbase.cpp - declarativeakonadiitem.cpp - exporthandlerbase.cpp - favoriteseditor.cpp - favoritescontroller.cpp - favoriteslistmodel.cpp - guistatemanager.cpp - hierarchyresolver.cpp - importhandlerbase.cpp - kcolorcombo.cpp - kdeclarativeapplication.cpp - kdeclarativefullscreenview.cpp - kdeclarativemainview.cpp - kdeclarativemainview_p.cpp - kresettingproxymodel.cpp - listproxy.cpp - modelselectiontransition.cpp - orderedchildcollectionsmodel.cpp - qmllistselectionmodel.cpp - rangemanager.cpp - searchmanager.cpp - statemachinebuilder.cpp - stylesheetloader.cpp - threadmodel.cpp - threadgroupermodel.cpp - threadselectionmodel.cpp -) - -if (KDEQMLPLUGIN_STATIC) - add_definitions(-DKDEQMLPLUGIN_STATIC) -endif () - -set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}" ) - -kde4_add_library(kdepimmobileui ${LIBRARY_TYPE} ${mobileui_SRCS}) -set_target_properties(kdepimmobileui PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION}) - -target_link_libraries(kdepimmobileui - ${QT_QTDECLARATIVE_LIBRARY} - ${QT_QTOPENGL_LIBRARY} - ${KDEPIMLIBS_AKONADI_KMIME_LIBS} - ${KDE4_SOLID_LIBRARY} - akonadi_next - kdepim - calendarsupport -) - -if (KDEQMLPLUGIN_STATIC) - target_link_libraries(kdepimmobileui kdeqmlplugin) -endif () - -if (X11_FOUND) - target_link_libraries(kdepimmobileui ${X11_LIBRARIES}) -endif() - -set( STYLE_IMAGE_PATH ${PLUGIN_INSTALL_DIR}/imports/org/kde/pim/mobileui/images ) - -configure_file( stylesheet.css.cmake ${CMAKE_CURRENT_BINARY_DIR}/stylesheet.css ) - -add_subdirectory(images) - -install(TARGETS kdepimmobileui ${INSTALL_TARGETS_DEFAULT_ARGS}) -install(FILES - qmldir - Action.qml - ActionButton.qml - ActiveActionMenuItemDelegate.qml - BulkActionScreen.qml - BulkActionList.qml - DecoratedListView.qml - FakeAction.qml - FavoriteManager.qml - ActionList.qml - ReorderList.qml - ReorderListDelegate.qml - MultipleSelectionComponent.qml - MultipleSelectionScreen.qml - ReorderListContainer.qml - ActionListItem.qml - ActionMenuContainer.qml - AgentInstanceList.qml - AgentInstanceListContainer.qml - AgentInstanceListDelegate.qml - AgentInstanceStatusIndicator.qml - AttachmentList.qml - ApplicationGeneralActions.qml - Button.qml - Button2.qml - AboutDialog.qml - CompletionSlider.qml - ItemListView.qml - ItemListViewDelegate.qml - MainView.qml - ScriptAction.qml - ScriptActionItem.qml - StartCanvas.qml - VerticalSelector.qml - Clock.qml - Calendar.qml - CalendarDay.qml - AgentStatusIndicator.qml - SearchDialog.qml - SearchResultScreen.qml - ItemEditButton.qml - Switch.qml - DESTINATION ${PLUGIN_INSTALL_DIR}/imports/org/kde/pim/mobileui) -install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/stylesheet.css - ScreenFunctions.js - DESTINATION ${DATA_INSTALL_DIR}/mobileui) - -add_subdirectory( tests ) diff --git a/kdepim/mobile/lib/Calendar.qml b/kdepim/mobile/lib/Calendar.qml deleted file mode 100644 index 1c0ca998..00000000 --- a/kdepim/mobile/lib/Calendar.qml +++ /dev/null @@ -1,276 +0,0 @@ -/* - Copyright (C) 2010 Artur Duque de Souza - - 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 CalendarHelper 4.5 - -Item { - id: calendar - width: 460 - height: 360 - - property alias day: calendarHelper.day - property alias month: calendarHelper.month - property alias year: calendarHelper.year - property alias daysInMonth: calendarHelper.daysInMonth - - signal daySelected(); - - CalendarHelper { - id: calendarHelper - onDayChanged: calendar.daySelected() - } - - Row { - id: title - spacing: 8 - anchors.left: parent.left - anchors.leftMargin: spacer.width + 5 - - Text { - text: KDE.i18n(calendarHelper.monthName) - color: "#004bb8" - font.pixelSize: 24 - } - - Text { - text: calendarHelper.year - color: "#004bb8" - font.pixelSize: 24 - } - } - - Grid { - id: calendarGrid - spacing: 3 - columns: 8 - rows: 7 - anchors.top: title.bottom - anchors.topMargin: 10 - - property int dayBoxSize: 54 - property int headlineHeight: 15 - property int weekNumberWidth: 20 - - // headline - Item { - id: spacer - width: calendarGrid.weekNumberWidth - height: calendarGrid.headlineHeight - } - - Repeater { - model: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] - Text { - width: calendarGrid.dayBoxSize - height: calendarGrid.headlineHeight - text: KDE.i18n(modelData) - color: "#5c5c5c" - font.pixelSize: 16 - style: Text.Sunken - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignBottom - } - } - - // first row - Text { - id: week1 - width: calendarGrid.weekNumberWidth - height: calendarGrid.dayBoxSize - color: "#828282" - text: calendarHelper.weekForPosition(1) - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignTop - } - - Repeater { - model: 7 - CalendarDay { - dayPos: index + 1 - currentDay: calendarHelper.day - text: calendarHelper.dayForPosition(dayPos); - } - } - - - // second row - Text { - id: week2 - width: calendarGrid.weekNumberWidth - height: calendarGrid.dayBoxSize - color: "#828282" - text: calendarHelper.weekForPosition(2) - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignTop - } - - Repeater { - model: 7 - CalendarDay { - dayPos: index + 8 - currentDay: calendarHelper.day - text: calendarHelper.dayForPosition(dayPos); - } - } - - - // third row - Text { - id: week3 - width: calendarGrid.weekNumberWidth - height: calendarGrid.dayBoxSize - color: "#828282" - text: calendarHelper.weekForPosition(3) - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignTop - } - - Repeater { - model: 7 - CalendarDay { - dayPos: index + 15 - currentDay: calendarHelper.day - text: calendarHelper.dayForPosition(dayPos); - } - } - - - // forth row - Text { - id: week4 - width: calendarGrid.weekNumberWidth - height: calendarGrid.dayBoxSize - color: "#828282" - text: calendarHelper.weekForPosition(4) - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignTop - } - - Repeater { - model: 7 - CalendarDay { - dayPos: index + 22 - currentDay: calendarHelper.day - text: calendarHelper.dayForPosition(dayPos); - } - } - - - // fifth row - Text { - id: week5 - width: calendarGrid.weekNumberWidth - height: calendarGrid.dayBoxSize - color: "#828282" - text: calendarHelper.weekForPosition(5) - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignTop - } - - Repeater { - model: 7 - CalendarDay { - dayPos: index + 29 - currentDay: calendarHelper.day - text: calendarHelper.dayForPosition(dayPos); - } - } - - - // sixth row - Text { - id: week6 - width: calendarGrid.weekNumberWidth - height: calendarGrid.dayBoxSize - color: "#828282" - text: calendarHelper.weekForPosition(6) - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignTop - } - - Repeater { - model: 7 - CalendarDay { - dayPos: index + 36 - currentDay: calendarHelper.day - text: calendarHelper.dayForPosition(dayPos); - } - } - } - - MouseArea { - anchors.fill: calendarGrid - anchors.topMargin: calendarGrid.headlineHeight - anchors.leftMargin: calendarGrid.weekNumberWidth - - property int oldX : 0 - property int oldY : 0 - - onPressed: { - oldX = mouseX; - oldY = mouseY; - } - - onReleased: { - var xDiff = oldX - mouseX; - var yDiff = oldY - mouseY; - - if ( Math.abs( xDiff ) > width * 0.3 || Math.abs( yDiff ) > height * 0.3 ) { - // distance is width enough to be a swipe action - - if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) { - if ( oldX > mouseX ) - calendarHelper.previousMonth(); - else - calendarHelper.nextMonth(); - } else { - if ( oldY > mouseY ) - calendarHelper.previousYear(); - else - calendarHelper.nextYear(); - } - } else { - selectDay(mouse); - } - } - - //onPositionChanged: selectDay(mouse) - - function selectDay(mouse) { - if ((mouse.x < 0) || (mouse.x >= width) || (mouse.y < 0) || (mouse.y >= height)) - return; - - var boxSize = calendarGrid.dayBoxSize + calendarGrid.spacing; - var row = Math.floor(mouse.y / boxSize); - var column = Math.floor(mouse.x / boxSize); - var dayForPosition = calendarHelper.dayForPosition(row * 7 + column + 1); - - if (dayForPosition != "") - calendarHelper.day = dayForPosition; - } - } - - Component.onCompleted: { - calendarHelper.registerItems(calendarGrid); - } -} - diff --git a/kdepim/mobile/lib/CalendarDay.qml b/kdepim/mobile/lib/CalendarDay.qml deleted file mode 100644 index 6b90157c..00000000 --- a/kdepim/mobile/lib/CalendarDay.qml +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2010 Artur Duque de Souza - - 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 - -Image { - id: calendarDay - property alias text: myText.text - property int currentDay: 0 - property int dayPos: 0 - - width: 54 - height: 54 - - source: "images/normaldate.png" - - Image { - anchors.fill: parent - source: { - if (myText.text == "") { - return "images/inactivedate.png"; - } else if (myText.text == currentDay) { - return "images/activedate.png"; - } else { - return ""; - } - } - } - - Text { - id: myText - anchors.centerIn: parent - color: "#5ba0d4" - font.bold: true - font.pixelSize: 26 - style: Text.Sunken - } -} diff --git a/kdepim/mobile/lib/Clock.qml b/kdepim/mobile/lib/Clock.qml deleted file mode 100644 index 84523321..00000000 --- a/kdepim/mobile/lib/Clock.qml +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (C) 2010 Anselmo Lacerda Silveira de Melo - Copyright (C) 2010 Artur Duque de Souza - - 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 ClockHelper 4.5 - -Image { - id: clock - - property alias minutes: clockHelper.minutes - property alias hours: clockHelper.hours - - source: "images/clock-background.png" - smooth: true - - MouseArea { - id: clockMArea - anchors.fill: parent - hoverEnabled: true - onClicked: clockHelper.unselectAll() - onPositionChanged: clockHelper.setXY(mouseX, mouseY) - } - - Image { - id: minutesHand - source: "images/clock-minutes.png" - smooth: true - - x: clock.width/2 - minutesHand.width/2 - y: clock.height/2 - minutesHand.height*0.95 - height: clock.height/(372/148) - width: clock.width/(370/12) - - transform: Rotation { - origin.x: minutesHand.width/2 - origin.y: minutesHand.height*0.95 - angle: clockHelper.minutesAngle -// Behavior on angle { PropertyAnimation {} } - } - - MouseArea { - anchors.fill: parent - onPressed: clockHelper.selectMinute() - } - } - - Image { - id: hoursHand - source: "images/clock-hours.png" - smooth: true - - x: clock.width/2 - hoursHand.width/2 - y: clock.height/2 - hoursHand.height*0.95 - height: clock.height/(372/113) - width: clock.width/(370/12) - - transform: Rotation { - origin.x: hoursHand.width/2 - origin.y: hoursHand.height*0.95 - angle: clockHelper.hoursAngle -// Behavior on angle { PropertyAnimation {} } - } - - MouseArea { - anchors.fill: parent - onPressed: clockHelper.selectHour() - } - } - - Image { - id: center - source: "images/clock-center.png" - smooth: true - - anchors.centerIn: clock - height: clock.height/(372/38) - width: clock.width/(370/38) - } - - ClockHelper { - id: clockHelper - - originX: clockMArea.width / 2 - originY: clockMArea.height / 2 - } - - function clearSelection() { - clockHelper.unselectAll() - } -} diff --git a/kdepim/mobile/lib/CompletionSlider.qml b/kdepim/mobile/lib/CompletionSlider.qml deleted file mode 100644 index 6ae46251..00000000 --- a/kdepim/mobile/lib/CompletionSlider.qml +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 - -Rectangle { - id: root - - property real percentComplete: 0 - - color: "#00000000" - width: 155 - height: 52 - - Image { - anchors.fill: parent - source: "images/sliderbackground.png"; - } - - Image { - anchors.verticalCenter: parent.verticalCenter - property bool dirtyBit - x: 3 + ((model.percentComplete/100) * (root.width - width - 6)) + (dirtyBit ? 0 : 0) - source: "images/sliderhandle.png" - - MouseArea { - anchors.fill: parent - drag.target: parent - drag.axis: "XAxis" - drag.minimumX: 3 - drag.maximumX: width - 6 - onReleased: { - root.percentageUpdated(((parent.x - 3)/(root.width - width - 6)) * 100); - parent.dirtyBit = !parent.dirtyBit - } - } - } - - signal percentageUpdated(real value); -} diff --git a/kdepim/mobile/lib/DecoratedListView.qml b/kdepim/mobile/lib/DecoratedListView.qml deleted file mode 100644 index 180c2389..00000000 --- a/kdepim/mobile/lib/DecoratedListView.qml +++ /dev/null @@ -1,21 +0,0 @@ -import QtQuick 1.1 - -ListView { - id: listView - Image { - source: KDE.locate( "lib", "kde4/imports/org/kde/scrollable-top.png" ); - anchors.top: parent.top - anchors.right: parent.right - anchors.left: parent.left - fillMode: Image.TileHorizontally - visible: !listView.atYBeginning - } - Image { - source: KDE.locate( "lib", "kde4/imports/org/kde/scrollable-bottom.png" ); - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.left: parent.left - fillMode: Image.TileHorizontally - visible: !listView.atYEnd - } -} diff --git a/kdepim/mobile/lib/FakeAction.qml b/kdepim/mobile/lib/FakeAction.qml deleted file mode 100644 index 64398ef7..00000000 --- a/kdepim/mobile/lib/FakeAction.qml +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 - - -QML.Rectangle { - height : parent.height - width : parent.width - color : "red" - property string name - - onVisibleChanged : - { - if (!visible) - height = -actionItemSpacing - else - height = actionItemHeight - } - - signal triggered(string triggeredName) - - KPIM.Button { - height : parent.height - width : parent.width - buttonText : name; - - onClicked : - { - triggered(parent.name) - } - - } -} diff --git a/kdepim/mobile/lib/FavoriteManager.qml b/kdepim/mobile/lib/FavoriteManager.qml deleted file mode 100644 index 4dde003f..00000000 --- a/kdepim/mobile/lib/FavoriteManager.qml +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (C) 2010 Volker Krause - - 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 - -ReorderList { - id: _root - category : "home" - - name : "favorites_list" - text : KDE.i18n( "Favorites" ) - - ActionButton { - icon : "images/moveup.png" - actionName : "favoriteseditor_moveup" - } - - ActionButton { - icon : "images/movedown.png" - actionName : "favoriteseditor_movedown" - } - - ActionButton { - icon : KDE.locate( "data", "mobileui/delete-button.png" ) - actionName : "favoriteseditor_remove" - } - - onCurrentIndexChanged : { favoritesEditor.setRowSelected( index ) } -} diff --git a/kdepim/mobile/lib/ItemEditButton.qml b/kdepim/mobile/lib/ItemEditButton.qml deleted file mode 100644 index d61e502e..00000000 --- a/kdepim/mobile/lib/ItemEditButton.qml +++ /dev/null @@ -1,25 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 - -KPIM.ActionButton { - icon: KDE.locate( "data", "mobileui/edit-button.png" ); -} diff --git a/kdepim/mobile/lib/ItemListView.qml b/kdepim/mobile/lib/ItemListView.qml deleted file mode 100644 index 18c245b6..00000000 --- a/kdepim/mobile/lib/ItemListView.qml +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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 -import org.kde.plasma.extras 0.1 as PlasmaExtras - -QML.Rectangle { - color : "#00000000" - id : _topListView - property alias model: itemListView.model - property alias currentIndex: itemListView.currentIndex - property int currentItemId: -1 - property int currentRow : -1 - property alias delegate: itemListView.delegate - property alias count: itemListView.count - property alias section: itemListView.section - property variant navigationModel - property int itemHeight: height / 7 - - PlasmaExtras.ScrollArea { - anchors.fill: parent - flickableItem: QML.ListView { - id: itemListView - - focus: true - clip: true - } - } - onCurrentRowChanged : { - if (navigationModel != undefined) - navigationModel.select(currentRow, 3) - } - QML.Connections { - target : navigationModel - onCurrentRowChanged : { - _topListView.currentRow = navigationModel.currentRow - } - } - -} diff --git a/kdepim/mobile/lib/ItemListViewDelegate.qml b/kdepim/mobile/lib/ItemListViewDelegate.qml deleted file mode 100644 index 4b79057f..00000000 --- a/kdepim/mobile/lib/ItemListViewDelegate.qml +++ /dev/null @@ -1,68 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 - -/** Delegate base class for use in ItemListView */ -Item { - id: itemViewTopLevel - property alias summaryContent: itemSummary.data - property alias color: itemSummary.color - property alias showCheckBox : checkBoxImage.visible - property variant checkModel - property variant navigationModel - - width: itemListView.width - - SystemPalette { id: palette; colorGroup: "Active" } - - MouseArea { - anchors.fill: parent - onClicked: { - if (showCheckBox && checkModel) { - checkModel.select(model.index, 8) - } else if (itemViewTopLevel.navigationModel != undefined) { - itemViewTopLevel.navigationModel.select(model.index, 3) - } else { - itemViewTopLevel.ListView.view.currentIndex = model.index; - itemViewTopLevel.ListView.view.parent.currentItemId = model.itemId; - } - } - } - - Rectangle { - anchors.fill: parent - anchors.margins: 4 - id: itemSummary - } - Rectangle { - id: bottomLine - x: 1; y: parent.height -2; width: parent.width - 2; height: 1 - border.color: palette.mid - opacity: 0.25 - } - Image { - id : checkBoxImage - anchors.verticalCenter: parent.verticalCenter; - anchors.right : parent.right; - visible : false - opacity : model.checkOn ? 1 : 0 - source : "images/check.png" - } -} diff --git a/kdepim/mobile/lib/MainView.qml b/kdepim/mobile/lib/MainView.qml deleted file mode 100644 index 409ea4b2..00000000 --- a/kdepim/mobile/lib/MainView.qml +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 - -/** Base class for the application top-level view. */ -QML.Rectangle { - height: 480 - width: 800 - color : "#FAFAFA" -} diff --git a/kdepim/mobile/lib/Messages.sh b/kdepim/mobile/lib/Messages.sh deleted file mode 100644 index b7e73822..00000000 --- a/kdepim/mobile/lib/Messages.sh +++ /dev/null @@ -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/libkdepimmobileui.pot -$XGETTEXT -ktranslate `find . -name '*.qml'` -j -L Java -o $podir/libkdepimmobileui.pot -rm -f rc.cpp diff --git a/kdepim/mobile/lib/MultipleSelectionComponent.qml b/kdepim/mobile/lib/MultipleSelectionComponent.qml deleted file mode 100644 index 1e9781f6..00000000 --- a/kdepim/mobile/lib/MultipleSelectionComponent.qml +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 -import org.kde.akonadi 4.5 -import org.kde.plasma.extras 0.1 as PlasmaExtras - -QML.Rectangle { - color : "#00000000" - AkonadiBreadcrumbNavigationView { - id : navigationView - - indentation : 0 - - clickToBulkAction : false - - showCheckboxes : true - checkable : true - - breadcrumbComponentFactory : _multiSelectionComponentFactory - - anchors.top : parent.top - anchors.left : parent.left - anchors.bottom : parent.bottom - width : parent.width / 3 - } - - PlasmaExtras.ScrollArea { - anchors.left : navigationView.right - anchors.right : parent.right - anchors.top : parent.top - anchors.bottom : parent.bottom - - flickableItem: QML.ListView { - id : selectedView - - model : _multiSelectionComponentFactory.qmlCheckedItemsModel() - - delegate : CollectionDelegate { - id : selectedDelegate - uncheckable : true - alternatingRowColors : true - checkModel : _multiSelectionComponentFactory.qmlCheckedItemsCheckModel(); - height : 70 - } - } - } -} diff --git a/kdepim/mobile/lib/MultipleSelectionScreen.qml b/kdepim/mobile/lib/MultipleSelectionScreen.qml deleted file mode 100644 index e26c8ef1..00000000 --- a/kdepim/mobile/lib/MultipleSelectionScreen.qml +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 -import org.kde 4.5 - -QML.Rectangle { - anchors.fill : parent - anchors.topMargin : 12 - property alias backgroundImage : backgroundImage.source - - QML.Image { - id: backgroundImage - x: 0 - y: 0 - } - - signal finished() - signal canceled() - - KPIM.MultipleSelectionComponent { - id : multSelectionComponent - anchors.top : parent.top - anchors.left : parent.left - anchors.right : parent.right - anchors.bottom : buttonRow.top - } - - QML.Item { - id : buttonRow - anchors.bottom : parent.bottom - anchors.left : parent.left - anchors.right : parent.right - height : 50 - KPIM.Button2 { - id : doneButton - anchors.top : parent.top - anchors.bottom : parent.bottom - anchors.left : parent.left - buttonText : KDE.i18n("Done") - width : 150 - onClicked : - { - finished(); - guiStateManager.popState(); - application.clearPersistedSelection("preFavSelection"); - application.multipleSelectionFinished(); - } - } - KPIM.Button2 { - id : cancelButton - anchors.top : parent.top - anchors.bottom : parent.bottom - anchors.right : parent.right - buttonText : KDE.i18n("Cancel") - width : 150 - onClicked : - { - canceled(); - guiStateManager.popState(); - application.restorePersistedSelection("preFavSelection"); - } - } - } -} diff --git a/kdepim/mobile/lib/ReorderList.qml b/kdepim/mobile/lib/ReorderList.qml deleted file mode 100644 index f9d9f997..00000000 --- a/kdepim/mobile/lib/ReorderList.qml +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 - - -QML.Item { - id : reorderList_top - width : parent.width - - property string category - - property string name - property alias text : nameItem.buttonText - property alias totalWidth : _listContent.width - property alias columnHeight : _listContent.height - property alias depth : _listContent.bottomMargin - - property alias actionItemSpacing : _listContent.actionItemSpacing - property alias actionItemHeight : _listContent.actionItemHeight - property alias actionItemWidth : _listContent.actionItemWidth - - property alias model : _listContent.model - property alias delegate : _listContent.delegate - property alias showChildren : _listContent.visible - - default property alias content : _listContent.content - - signal triggered( string triggeredName ) - signal currentIndexChanged( int index ) - - onVisibleChanged : - { - if (!visible) - height = -actionItemSpacing - else - height = actionItemHeight - } - - KPIM.Button { - id : nameItem - height : parent.height - width : parent.width - - onClicked : { - reorderList_top.triggered( reorderList_top.name ) - showChildren = true - } - } - - KPIM.ReorderListContainer { - id : _listContent - anchors.left : nameItem.right - anchors.bottom : nameItem.top - - property int bottomMargin - anchors.bottomMargin : bottomMargin - visible : false - - onTriggered : { - reorderList_top.triggered( triggeredName ) - } - - onCurrentIndexChanged : { - reorderList_top.currentIndexChanged( index ) - } - } -} diff --git a/kdepim/mobile/lib/ReorderListContainer.qml b/kdepim/mobile/lib/ReorderListContainer.qml deleted file mode 100644 index 332f1478..00000000 --- a/kdepim/mobile/lib/ReorderListContainer.qml +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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.plasma.extras 0.1 as PlasmaExtras -import org.kde.pim.mobileui 4.5 as KPIM - -Rectangle { - id : _topLevel - color : "#00000000" - property int actionItemHeight: 70 - property int actionItemWidth: 200 - property int actionItemSpacing : 0 - property int bottomMargin - anchors.bottomMargin : bottomMargin - - property alias model : myList.model - property alias delegate : myList.delegate - - default property alias content : actionColumn.children - - signal triggered( string triggeredName ) - signal currentIndexChanged( int index ) - - PlasmaExtras.ScrollArea { - anchors.top : _topLevel.top - anchors.bottom : _topLevel.bottom - anchors.left : _topLevel.left - anchors.right : actionColumn.left - - flickableItem: ListView { - id : myList - - interactive: count * actionItemHeight > height - focus: true - - delegate : ReorderListDelegate { - height: _topLevel.actionItemHeight - width: ListView.view.width; - } - - onCurrentIndexChanged : { - _topLevel.currentIndexChanged( currentIndex ) - } - } - } - - Column { - id : actionColumn - anchors.top : parent.top - anchors.bottom : parent.bottom - anchors.right : parent.right - width : 100 - } -} diff --git a/kdepim/mobile/lib/ReorderListDelegate.qml b/kdepim/mobile/lib/ReorderListDelegate.qml deleted file mode 100644 index daa8fcd4..00000000 --- a/kdepim/mobile/lib/ReorderListDelegate.qml +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (C) 2010 Volker Krause - - 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 - -QML.Item { - id: _delegateTopLevel - clip: true - width: QML.ListView.width - height: 100 - - QML.Rectangle { - id: background - anchors.fill: parent - opacity: (_delegateTopLevel.QML.ListView.isCurrentItem ? 0.25 : 0) - color: "lightsteelblue" - } - - QML.Text { - anchors.centerIn: parent - text : model.display - } - - QML.MouseArea { - anchors.fill: parent - onClicked: { _delegateTopLevel.QML.ListView.view.currentIndex = model.index; } - } -} diff --git a/kdepim/mobile/lib/ScreenFunctions.js b/kdepim/mobile/lib/ScreenFunctions.js deleted file mode 100644 index a5c4178c..00000000 --- a/kdepim/mobile/lib/ScreenFunctions.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (C) 2011 Volker Krause - - 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. -*/ - -/** - * Contains the minimum size necessary for usable finger interaction elements - */ -var fingerSize = KDE.mm2px( 12 ); - -/** - * Returns size of a screen partition. - * This is supposed to be used when dividing a bit of screen space into equaly sized sub-spaces - * without having unused/partial areas left. - * @param totalSize Total amount of available pixel space - * @param minPartitions Minimum number of partitions requried - * @returns Pixel-size of a partition. - */ -function partition( totalSize, minPartitions ) -{ - // at least 15mm for touch interaction - var optimalPartitionCount = Math.floor(totalSize / fingerSize); - return totalSize / Math.max(minPartitions, optimalPartitionCount); -} diff --git a/kdepim/mobile/lib/ScriptAction.qml b/kdepim/mobile/lib/ScriptAction.qml deleted file mode 100644 index 0c3b1f99..00000000 --- a/kdepim/mobile/lib/ScriptAction.qml +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 - -Item { - property string name - property alias script : myAction.script - - function trigger() - { - state = "execute"; - state = ""; - } - - states : State { - name : "execute" - } - - transitions : Transition { - from : ""; to : "execute" - ScriptAction { - id : myAction - } - } -} diff --git a/kdepim/mobile/lib/ScriptActionItem.qml b/kdepim/mobile/lib/ScriptActionItem.qml deleted file mode 100644 index a4eada7e..00000000 --- a/kdepim/mobile/lib/ScriptActionItem.qml +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 - - -QML.Item { - height : parent.height - width : (parent ? parent.width : 0) - property string name - property string title - - property string category - - signal triggered(string triggeredName) - - onVisibleChanged : - { - if (!visible) - height = -actionItemSpacing - else - height = actionItemHeight - } - - KPIM.Button { - height : parent.height - width : parent.width - buttonText: parent.title - onClicked: parent.triggered( parent.name ) - } -} diff --git a/kdepim/mobile/lib/SearchDialog.qml b/kdepim/mobile/lib/SearchDialog.qml deleted file mode 100644 index 5c5fa5aa..00000000 --- a/kdepim/mobile/lib/SearchDialog.qml +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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.plasma.extras 0.1 as PlasmaExtras - -QML.Rectangle { - property alias searchWidget: searchWidget.children - - id: searchDialog - anchors.fill: parent - z: 10 - color: "white" - visible: guiStateManager.inSearchScreenState - - PlasmaExtras.ScrollArea { - id: searchWidgetBox - anchors { - top: parent.top - topMargin: 25 - bottom: parent.bottom - left: parent.left - right: searchButton.left - } - - flickableItem: QML.Flickable { - id: searchWidgetFlickable - contentHeight: searchWidget.height - - contentItem.children: [ - QML.Item { // dummy item to make the widget visible with the broken QML version on the N900 - anchors.fill: parent - QML.Item { - id: searchWidget - width: parent.width - - onChildrenChanged: { searchWidgetFlickable.contentHeight = children[0].height } - } - } - ] - } - } - - KPIM.Button2 { - id: searchButton - anchors.top: parent.top - anchors.topMargin: 20 - anchors.right: parent.right - width: 150 - buttonText: KDE.i18n( "Search" ) - onClicked: { - searchManager.startSearch( searchWidget.children[0].query ) - } - } - - KPIM.Button2 { - id: cancelButton - anchors.top: searchButton.bottom - anchors.right: parent.right - width: 150 - buttonText: KDE.i18n( "Back" ) - onClicked: { - guiStateManager.popState() - } - } -} diff --git a/kdepim/mobile/lib/SearchResultScreen.qml b/kdepim/mobile/lib/SearchResultScreen.qml deleted file mode 100644 index 48bfa1cd..00000000 --- a/kdepim/mobile/lib/SearchResultScreen.qml +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 -import org.kde.akonadi 4.5 as Akonadi - -QML.Rectangle { - property alias itemView: itemView.children - property alias resultText: collectionView.multipleSelectionText - - id: searchResultView - visible: guiStateManager.inSearchResultScreenState - color: "white" - - Akonadi.AkonadiBreadcrumbNavigationView { - id: collectionView - anchors.left: parent.left - anchors.top: parent.top - anchors.bottom: backButton.top - width: 1/3 * parent.width - - breadcrumbComponentFactory: _breadcrumbNavigationFactory - - onHomeClicked: { - searchManager.stopSearch() - guiStateManager.popState() - - // the user clicked on home, so explicitly change the state to it - guiStateManager.switchState( KPIM.GuiStateManager.HomeScreenState ) - } - - KPIM.AgentStatusIndicator { - anchors { top: parent.top; right: parent.right; rightMargin: 10; topMargin: 10 } - } - } - - KPIM.Button2 { - id: backButton - anchors.left: collectionView.left - anchors.right: collectionView.right - anchors.bottom: parent.bottom - buttonText: KDE.i18n( "Back to Search" ) - onClicked: { - searchManager.stopSearch() - } - } - - QML.Rectangle { - id: itemView - anchors.left: collectionView.right - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - color: "#00000000" - } -} diff --git a/kdepim/mobile/lib/StartCanvas.qml b/kdepim/mobile/lib/StartCanvas.qml deleted file mode 100644 index 5c35f783..00000000 --- a/kdepim/mobile/lib/StartCanvas.qml +++ /dev/null @@ -1,138 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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.pim.mobileui 4.5 as KPIM -import org.kde.akonadi 4.5 -import org.kde.plasma.extras 0.1 as PlasmaExtras - -Item { - id : _topContext - property alias startText: startText.text - property alias contextActions: contextContainer.children - property alias favoritesModel : favsView.model - property alias showAccountsList : accountsList.visible - - signal accountSelected( int row ) - signal favoriteSelected( string favName ) - - Component { - id : accountDelegate - CollectionDelegate { - fullClickArea : true - height : accountsList.height / 6 - width : accountsList.width - onIndexSelected : { _topContext.accountSelected( model.index ); } - } - } - - Component { - id : favDelegate - CollectionDelegate { - fullClickArea : true - height : _topContext.height / 6 - width : ListView.view.width - onIndexSelected : { - favoriteSelected(model.display); - } - } - } - - Row { - anchors.topMargin: 30 - anchors.left: parent.left - anchors.top: parent.top - anchors.right: parent.right - anchors.bottom: firstStepsLink.top - spacing: 10 - - Column { - width: accountsList.visible ? (parent.width) : 0 - height: parent.height - spacing: 5 - - Text { - width: parent.width - id: startText - font { - pointSize: 14 - } - } - - PlasmaExtras.ScrollArea { - width: parent.width - height : parent.height - - flickableItem: ListView { - id : accountsList - clip: true - - model : accountsModel - delegate : accountDelegate - } - } - } - - Column { - width: parent.width - height: parent.height - spacing: 5 - - Item { - id : contextContainer - height: childrenRect.height - width: parent.width - } - - PlasmaExtras.ScrollArea { - width: parent.width - height: parent.height - contextContainer.height - 2 - 4 * 5 - - flickableItem: ListView { - id : favsView - - delegate : favDelegate - clip: true - } - } - } - } - - Text { - id: firstStepsLink - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.bottomMargin: visible ? 20 : 0 - text: KDE.i18n( "First steps..." ) - textFormat: Text.RichText - verticalAlignment: Text.AlignTop - MouseArea { - anchors.fill: parent - onClicked: { application.openManual() } - } - - visible: favsView.count < 4 - height: visible ? 20 : 0 - y: visible ? parent.height - height : parent.height - } -} diff --git a/kdepim/mobile/lib/Switch.qml b/kdepim/mobile/lib/Switch.qml deleted file mode 100644 index e1982876..00000000 --- a/kdepim/mobile/lib/Switch.qml +++ /dev/null @@ -1,81 +0,0 @@ -import QtQuick 1.1 - -Item { - id: toggleswitch - width: background.width - height: background.height - - property bool on: false - - function setOn( value ) - { - if ( value ) - toggleswitch.state = "on"; - else - toggleswitch.state = "off"; - } - - function toggle() { - if ( toggleswitch.state == "on" ) - toggleswitch.state = "off"; - else - toggleswitch.state = "on"; - } - - function releaseSwitch() { - if ( handle.x == 1 ) { - if ( toggleswitch.state == "off" ) - return; - } - if ( handle.x == 78 ) { - if ( toggleswitch.state == "on" ) - return; - } - - toggle(); - } - - Image { - id: background - source : "images/sliderbackground.png"; - MouseArea { - anchors.fill: parent - onClicked: toggle() - } - } - - Image { - id: handle - x: 1; - y: 2 - source : "images/sliderhandle.png"; - - MouseArea { - anchors.fill: parent - drag.target: handle - drag.axis: Drag.XAxis - drag.minimumX: 1 - drag.maximumX: 78 - - onClicked: toggle() - onReleased: releaseSwitch() - } - } - - states: [ - State { - name: "on" - PropertyChanges { target: handle; x: 78 } - PropertyChanges { target: toggleswitch; on: true } - }, - State { - name: "off" - PropertyChanges { target: handle; x: 1 } - PropertyChanges { target: toggleswitch; on: false } - } - ] - - transitions: Transition { - NumberAnimation { properties: "x"; easing.type: Easing.InOutQuad; duration: 200 } - } -} diff --git a/kdepim/mobile/lib/VerticalSelector.qml b/kdepim/mobile/lib/VerticalSelector.qml deleted file mode 100644 index 8836fde5..00000000 --- a/kdepim/mobile/lib/VerticalSelector.qml +++ /dev/null @@ -1,173 +0,0 @@ -/* - Copyright (C) 2010 Artur Duque de Souza - - 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 - -Item { - id: verticalselector - width: 160 - height: 90 - state: "unselected" - - property alias model: list.model - property int value: -1 - signal selected() - - property int beginWith: 0 - property variant displayTexts - - onValueChanged: { - list.positionViewAtIndex( value - beginWith, ListView.Center ); - } - - Image { - id: inputLeft - source: "images/scrollinput-left" + (verticalselector.focus ? "-active" : "") + ".png" - - anchors.top: parent.top - anchors.topMargin: 15 - anchors.bottom: parent.bottom - anchors.bottomMargin: 15 - anchors.left: parent.left - anchors.leftMargin: 5 - } - - BorderImage { - id: inputCenter - source: "images/scrollinput-center" + (verticalselector.focus ? "-active" : "") + ".png" - - anchors.top: parent.top - anchors.topMargin: 15 - anchors.bottom: parent.bottom - anchors.bottomMargin: 15 - anchors.left: inputLeft.right - anchors.right: inputRight.left - } - - Image { - id: inputRight - source: "images/scrollinput-right" + (verticalselector.focus ? "-active" : "") + ".png" - - anchors.top: parent.top - anchors.topMargin: 15 - anchors.bottom: parent.bottom - anchors.bottomMargin: 15 - anchors.right: parent.right - anchors.rightMargin: 5 - } - - // ### TODO: for some reason, onValueChanged is not properly - // setting the positionViewAtIndex when the component is just - // loaded. maybe a bug with the list? - function setValue(newValue) { - value = newValue; - list.positionViewAtIndex( value - beginWith, ListView.Center ); - } - - function setRange(range) { - list.model = range - list.positionViewAtIndex( value - beginWith, ListView.Center ) - } - - function toggleState(newValue) - { - state = (state == "selected") ? "unselected" : "selected"; - if (state == "unselected") - verticalselector.value = newValue - else - verticalselector.selected(); - } - - Component { - id: fadeDelegate - Item { - id: fadewrapper - width: verticalselector.width - height: verticalselector.height - Text { - text: displayTexts ? displayTexts[list.currentIndex + beginWith] : list.currentIndex + beginWith - anchors.fill: parent - color: "#004bb8" - font.bold: true - font.pixelSize: 28 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - MouseArea { - hoverEnabled: true - anchors.fill: parent - onClicked: { - toggleState(list.currentIndex + beginWith) - } - } - } - } - - Component { - id: highlight - Rectangle { - color: "red" - opacity: 0 - } - } - - ListView { - id: list - clip: true - model: 10 - interactive: verticalselector.focus - - delegate: fadeDelegate - highlight: highlight - highlightRangeMode: ListView.StrictlyEnforceRange - highlightFollowsCurrentItem: true - preferredHighlightBegin: 0 - preferredHighlightEnd: verticalselector.height - - anchors.fill: parent - anchors.leftMargin: 5 - anchors.rightMargin: 5 - orientation: Qt.Vertical - snapMode: ListView.SnapToItem - } - - states: [ - State { - name: "selected" - PropertyChanges { - target: verticalselector - focus: true - height: 135 - width: 240 - } - }, - State { - name: "unselected" - PropertyChanges { - target: verticalselector - focus: false - height: 90 - width: 160 - } - } - ] - transitions: Transition { - PropertyAnimation { target: verticalselector; properties: "height, width"; duration: 500 } - } -} diff --git a/kdepim/mobile/lib/actionhelper.cpp b/kdepim/mobile/lib/actionhelper.cpp deleted file mode 100644 index a5b3898b..00000000 --- a/kdepim/mobile/lib/actionhelper.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 -#include -#include - -using namespace Akonadi; - -template -void ActionHelper::adaptStandardActionTexts( T *manager ) -{ - manager->setActionText( StandardActionManager::SynchronizeResources, ki18np( "Synchronize This Account", "Synchronize These Accounts" ) ); - manager->action( StandardActionManager::SynchronizeResources )->setText( i18n("Synchronize This Account") ); - manager->action( StandardActionManager::ManageLocalSubscriptions )->setText( i18n( "Local Subscriptions" ) ); - manager->action( StandardActionManager::ResourceProperties )->setText( i18n( "Account Properties" ) ); - manager->action( StandardActionManager::ToggleWorkOffline )->setText( i18n( "Work Offline" ) ); -} diff --git a/kdepim/mobile/lib/actionhelper.h b/kdepim/mobile/lib/actionhelper.h deleted file mode 100644 index aed308e5..00000000 --- a/kdepim/mobile/lib/actionhelper.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 ACTIONHELPER_H -#define ACTIONHELPER_H - -namespace Akonadi { -class StandardActionManager; -} - -namespace ActionHelper { - - /** - * Adapts the texts of the standard actions to the mobile applications. - */ - template - void adaptStandardActionTexts( T *manager ); - -} - -#include "actionhelper.cpp" - -#endif diff --git a/kdepim/mobile/lib/agentstatusmonitor.cpp b/kdepim/mobile/lib/agentstatusmonitor.cpp deleted file mode 100644 index f1e556bf..00000000 --- a/kdepim/mobile/lib/agentstatusmonitor.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "agentstatusmonitor.h" - -#include -#include - -#include - -#include - -using namespace Akonadi; - -Q_DECLARE_METATYPE( AgentStatusMonitor::AgentStatus ) - -AgentStatusMonitor::AgentStatusMonitor( QObject* parent ) - : QObject( parent ), m_status( Offline ) -{ - qRegisterMetaType(); - connect( AgentManager::self(), SIGNAL(instanceAdded(Akonadi::AgentInstance)), SLOT(updateStatus()) ); - connect( AgentManager::self(), SIGNAL(instanceRemoved(Akonadi::AgentInstance)), SLOT(updateStatus()) ); - connect( AgentManager::self(), SIGNAL(instanceOnline(Akonadi::AgentInstance,bool)), SLOT(updateStatus()) ); - connect( AgentManager::self(), SIGNAL(instanceStatusChanged(Akonadi::AgentInstance)), SLOT(updateStatus()) ); - connect( Solid::Networking::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)), SLOT(updateStatus()) ); - updateStatus(); -} - -AgentStatusMonitor::AgentStatus AgentStatusMonitor::status() const -{ - return m_status; -} - -void AgentStatusMonitor::updateStatus() -{ - const AgentStatus oldStatus = m_status; - - m_status = Offline; - foreach ( const AgentInstance &instance, AgentManager::self()->instances() ) { - if ( instance.type().identifier() == QLatin1String( "akonadi_maildispatcher_agent" ) ) { - if ( instance.status() == AgentInstance::Running ) - m_status |= Sending; - } else if ( instance.type().capabilities().contains( QLatin1String( "Resource" ) ) && m_mimeTypeChecker.containsWantedMimeType( instance.type().mimeTypes() ) ) { - if ( instance.status() == AgentInstance::Running ) - m_status |= Receiving; - if ( instance.isOnline() ) - m_status |= Online; - } - } - - if ( Solid::Networking::status() != Solid::Networking::Connected && Solid::Networking::status() != Solid::Networking::Unknown ) - m_status &= ~Online; - - if ( m_status != oldStatus ) - emit statusChanged(); -} - -void AgentStatusMonitor::setMimeTypeFilter( const QStringList &mimeTypes ) -{ - m_mimeTypeChecker.setWantedMimeTypes( mimeTypes ); - updateStatus(); -} - diff --git a/kdepim/mobile/lib/agentstatusmonitor.h b/kdepim/mobile/lib/agentstatusmonitor.h deleted file mode 100644 index 7d7e5f9b..00000000 --- a/kdepim/mobile/lib/agentstatusmonitor.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 AGENTSTATUSMONITOR_H -#define AGENTSTATUSMONITOR_H - -#include - -#include -#include - -class AgentStatusMonitor : public QObject -{ - Q_OBJECT - Q_FLAGS( AgentStatus ) - Q_PROPERTY( AgentStatus status READ status NOTIFY statusChanged ) - - public: - enum Status { - Offline = 0, - Online = 1, - Receiving = 2, - Sending = 4 - }; - Q_DECLARE_FLAGS( AgentStatus, Status ) - - explicit AgentStatusMonitor( QObject *parent = 0 ); - - AgentStatus status() const; - void setMimeTypeFilter( const QStringList &mimeTypes ); - - Q_SIGNALS: - void statusChanged(); - - private Q_SLOTS: - void updateStatus(); - - private: - AgentStatus m_status; - Akonadi::MimeTypeChecker m_mimeTypeChecker; -}; - -Q_DECLARE_OPERATORS_FOR_FLAGS( AgentStatusMonitor::AgentStatus ) - -#endif diff --git a/kdepim/mobile/lib/akonadibreadcrumbnavigationfactory.cpp b/kdepim/mobile/lib/akonadibreadcrumbnavigationfactory.cpp deleted file mode 100644 index f122eae5..00000000 --- a/kdepim/mobile/lib/akonadibreadcrumbnavigationfactory.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "akonadibreadcrumbnavigationfactory.h" - -#include "orderedchildcollectionsmodel.h" - -#include - -using namespace Akonadi; - -BreadcrumbNavigationFactory::BreadcrumbNavigationFactory( QObject* parent ) - : KBreadcrumbNavigationFactory(parent) -{ -} - -QAbstractItemModel* BreadcrumbNavigationFactory::getChildItemsModel( QAbstractItemModel* model ) -{ - EntityMimeTypeFilterModel *filterProxy = new Akonadi::EntityMimeTypeFilterModel( this ); - filterProxy->setHeaderGroup( Akonadi::EntityTreeModel::CollectionTreeHeaders ); - filterProxy->setSourceModel( model ); - filterProxy->addMimeTypeInclusionFilter( Akonadi::Collection::mimeType() ); - - OrderedChildCollectionsModel *orderProxy = new OrderedChildCollectionsModel( this ); - orderProxy->sort(0, Qt::AscendingOrder ); - orderProxy->setSourceModel( filterProxy ); - - return orderProxy; -} - diff --git a/kdepim/mobile/lib/akonadibreadcrumbnavigationfactory.h b/kdepim/mobile/lib/akonadibreadcrumbnavigationfactory.h deleted file mode 100644 index 6f874a94..00000000 --- a/kdepim/mobile/lib/akonadibreadcrumbnavigationfactory.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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_BREADCRUMBNAVIGATIONFACTORY_H -#define AKONADI_BREADCRUMBNAVIGATIONFACTORY_H - -#include "breadcrumbnavigationcontext.h" - -#include "mobileui_export.h" - -namespace Akonadi -{ - -class MOBILEUI_EXPORT BreadcrumbNavigationFactory : public KBreadcrumbNavigationFactory -{ - Q_OBJECT - - public: - explicit BreadcrumbNavigationFactory( QObject* parent = 0 ); - - protected: - virtual QAbstractItemModel* getChildItemsModel( QAbstractItemModel* model ); -}; - -} - -#endif diff --git a/kdepim/mobile/lib/breadcrumbnavigation.cpp b/kdepim/mobile/lib/breadcrumbnavigation.cpp deleted file mode 100644 index 86d3651c..00000000 --- a/kdepim/mobile/lib/breadcrumbnavigation.cpp +++ /dev/null @@ -1,223 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "breadcrumbnavigation.h" - -#include - -#include - -KBreadcrumbNavigationProxyModel::KBreadcrumbNavigationProxyModel( QItemSelectionModel *selectionModel, QObject *parent ) - : Akonadi::SelectionProxyModel( selectionModel, parent ) -{ -} - -QVariant KBreadcrumbNavigationProxyModel::data( const QModelIndex &index, int role ) const -{ - if ( rowCount() > 2 && index.row() == 0 && role == Qt::DisplayRole ) { - QStringList dataList; - - QModelIndex sourceIndex = mapToSource( index ); - while ( sourceIndex.isValid() ) { - dataList.prepend( sourceIndex.data().toString() ); - sourceIndex = sourceIndex.parent(); - } - - return dataList.join( QLatin1String(" > ") ); - } - - return KSelectionProxyModel::data( index, role ); -} - -void KBreadcrumbNavigationProxyModel::setShowHiddenAscendantData( bool showHiddenAscendantData ) -{ - m_showHiddenAscendantData = showHiddenAscendantData; -} - -bool KBreadcrumbNavigationProxyModel::showHiddenAscendantData() const -{ - return m_showHiddenAscendantData; -} - -KNavigatingProxyModel::KNavigatingProxyModel( KForwardingItemSelectionModel *selectionModel, QObject *parent ) - : Akonadi::SelectionProxyModel( selectionModel, parent ), - m_selectionModel( selectionModel ) -{ -} - -void KNavigatingProxyModel::silentSelect( const QItemSelection &selection, QItemSelectionModel::SelectionFlags command ) -{ - disconnect( m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(navigationSelectionChanged(QItemSelection,QItemSelection)) ); - - m_selectionModel->select( selection, command ); - - connect( m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(navigationSelectionChanged(QItemSelection,QItemSelection)) ); -} - -void KNavigatingProxyModel::setSourceModel(QAbstractItemModel* sourceModel) -{ - connect( m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(navigationSelectionChanged(QItemSelection,QItemSelection)) ); - connect( m_selectionModel, SIGNAL(resetNavigation()), SLOT(updateNavigation()) ); - - disconnect( sourceModel, SIGNAL(modelReset()), this, SLOT(updateNavigation()) ); - disconnect( sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(_sourceRowsInserted(QModelIndex,int,int)) ); - disconnect( sourceModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SLOT(_sourceRowsRemoved(QModelIndex,int,int)) ); - - KSelectionProxyModel::setSourceModel( sourceModel ); - updateNavigation(); - - connect( sourceModel, SIGNAL(modelReset()), SLOT(updateNavigation()) ); - connect( sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(_sourceRowsInserted(QModelIndex,int,int)) ); - connect( sourceModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SLOT(_sourceRowsRemoved(QModelIndex,int,int)) ); -} - -void KNavigatingProxyModel::_sourceRowsInserted( const QModelIndex &parent, int start, int end ) -{ - if ( filterBehavior() != ExactSelection || parent.isValid() ) - return; - - const QItemSelection selection( sourceModel()->index( start, 0, parent ), - sourceModel()->index( end, sourceModel()->columnCount( parent ) - 1, parent ) ); - - silentSelect( selection, QItemSelectionModel::Select ); -} - -void KNavigatingProxyModel::_sourceRowsRemoved( const QModelIndex &parent, int start, int end ) -{ - if ( filterBehavior() != ExactSelection || parent.isValid() ) - return; - - m_selectionModel->select( QItemSelection( sourceModel()->index( start, 0, parent ), - sourceModel()->index( end, sourceModel()->columnCount( parent ), parent ) ), - QItemSelectionModel::Deselect ); - - if ( m_selectionModel->selection().isEmpty() ) - updateNavigation(); -} - -void KNavigatingProxyModel::navigationSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected ) -{ - Q_UNUSED( selected ); - if (deselected.size() != 1) - return updateNavigation(); - - const QItemSelectionRange range = deselected.first(); - if (range.parent().isValid()) - return updateNavigation(); - - // When a top level item is removed this slot may be invoked before the source rows - // removed handler. In that case we need to make sure we don't update the navigation - // structures here, but wait for that to be done in the rows removed handler. - int rows = range.height(); - foreach(const QItemSelectionRange &selRange, m_selectionModel->selection()) { - if (!selRange.parent().isValid()) { - rows += selRange.height(); - } else { - return updateNavigation(); - } - } - if (rows != m_selectionModel->model()->rowCount()) - return updateNavigation(); -} - -void KNavigatingProxyModel::updateNavigation() -{ - if ( !sourceModel() ) { - setFilterBehavior( KSelectionProxyModel::ChildrenOfExactSelection ); - return; - } - - if ( m_selectionModel->selection().isEmpty() ) { - beginResetModel(); - - blockSignals( true ); // prevent KSelectionProxyModel to emit modelReset, we'll do it some lines below ourself - setFilterBehavior( KSelectionProxyModel::ExactSelection ); - blockSignals( false ); - - const QModelIndex top = sourceModel()->index( 0, 0 ); - const QModelIndex bottom = sourceModel()->index( sourceModel()->rowCount() - 1, 0 ); - silentSelect( QItemSelection( top, bottom ), QItemSelectionModel::Select ); - endResetModel(); - } else if ( filterBehavior() != KSelectionProxyModel::ChildrenOfExactSelection ) { - setFilterBehavior( KSelectionProxyModel::ChildrenOfExactSelection ); - } -} - -KForwardingItemSelectionModel::KForwardingItemSelectionModel( QAbstractItemModel *model, QItemSelectionModel *selectionModel, QObject *parent ) - : QItemSelectionModel( model, parent ), - m_selectionModel( selectionModel ), - m_direction( Forward ) -{ - Q_ASSERT( model == selectionModel->model() ); - connect( selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(navigationSelectionChanged(QItemSelection,QItemSelection)) ); -} - -KForwardingItemSelectionModel::KForwardingItemSelectionModel( QAbstractItemModel *model, QItemSelectionModel *selectionModel, - Direction direction, QObject *parent ) - : QItemSelectionModel( model, parent ), - m_selectionModel( selectionModel ), - m_direction( direction ) -{ - Q_ASSERT( model == selectionModel->model() ); - - if ( m_direction == Forward ) - connect( selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(navigationSelectionChanged(QItemSelection,QItemSelection)) ); -} - -void KForwardingItemSelectionModel::select( const QModelIndex &index, QItemSelectionModel::SelectionFlags command ) -{ - if ( m_direction == Reverse ) - m_selectionModel->select( index, command ); - else - QItemSelectionModel::select( index, command ); -} - -void KForwardingItemSelectionModel::select( const QItemSelection &selection, QItemSelectionModel::SelectionFlags command ) -{ - if ( m_direction == Reverse ) - m_selectionModel->select( selection, command ); - else - QItemSelectionModel::select( selection, command ); -} - -void KForwardingItemSelectionModel::navigationSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected ) -{ - // ### The KNavigatingProxyModel selects all top level items if there is 'no selection'. - // This slot is called when we newly get a selection, so we can unselect all. - if ( selectedRows().size() == model()->rowCount() ) - select( selected, ClearAndSelect ); - else - select( selected, Select ); - - select( deselected, Deselect ); - - if ( selected == selection() ) - resetNavigation(); -} diff --git a/kdepim/mobile/lib/breadcrumbnavigation.h b/kdepim/mobile/lib/breadcrumbnavigation.h deleted file mode 100644 index 213370b8..00000000 --- a/kdepim/mobile/lib/breadcrumbnavigation.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 BREADCRUMBNAVIGATION_H -#define BREADCRUMBNAVIGATION_H - -#include - -#include - -// Copied from kdeui/tests/proxymodeltestapp/breadcrumbnavigationwidget -// A version of these might be somewhere stable in the future. - -class KBreadcrumbNavigationProxyModel : public Akonadi::SelectionProxyModel -{ - Q_OBJECT - - public: - explicit KBreadcrumbNavigationProxyModel( QItemSelectionModel *selectionModel, QObject *parent = 0 ); - - void setShowHiddenAscendantData( bool showHiddenAscendantData ); - bool showHiddenAscendantData() const; - - virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const; - - private: - bool m_showHiddenAscendantData; -}; - -class KForwardingItemSelectionModel; - -class KNavigatingProxyModel : public Akonadi::SelectionProxyModel -{ - Q_OBJECT - - public: - explicit KNavigatingProxyModel( KForwardingItemSelectionModel *selectionModel, QObject *parent = 0 ); - - virtual void setSourceModel( QAbstractItemModel *sourceModel ); - - private Q_SLOTS: - void updateNavigation(); - void navigationSelectionChanged( const QItemSelection&, const QItemSelection& ); - void _sourceRowsInserted( const QModelIndex &parent, int start, int end ); - void _sourceRowsRemoved( const QModelIndex &parent, int start, int end ); - - private: - void silentSelect( const QItemSelection &selection, QItemSelectionModel::SelectionFlags command ); - - using KSelectionProxyModel::setFilterBehavior; - KForwardingItemSelectionModel *m_selectionModel; -}; - -class KForwardingItemSelectionModel : public QItemSelectionModel -{ - Q_OBJECT - - public: - enum Direction - { - Forward, - Reverse - }; - - KForwardingItemSelectionModel( QAbstractItemModel *model, QItemSelectionModel *selectionModel, QObject *parent = 0 ); - KForwardingItemSelectionModel( QAbstractItemModel *model, QItemSelectionModel *selectionModel, Direction direction, QObject *parent = 0 ); - - virtual void select( const QModelIndex &index, SelectionFlags command ); - virtual void select( const QItemSelection &selection, SelectionFlags command ); - - Q_SIGNALS: - void resetNavigation(); - - private Q_SLOTS: - void navigationSelectionChanged( const QItemSelection &selected, const QItemSelection &deselected ); - - private: - QItemSelectionModel *m_selectionModel; - Direction m_direction; -}; - -#endif diff --git a/kdepim/mobile/lib/breadcrumbnavigationcontext.cpp b/kdepim/mobile/lib/breadcrumbnavigationcontext.cpp deleted file mode 100644 index 4cce8341..00000000 --- a/kdepim/mobile/lib/breadcrumbnavigationcontext.cpp +++ /dev/null @@ -1,384 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "breadcrumbnavigationcontext.h" - -#include "breadcrumbnavigation.h" -#include "kbreadcrumbselectionmodel.h" -#include "klinkitemselectionmodel.h" -#include "kmodelindexproxymapper.h" -#include -#include "kselectionproxymodel.h" -#include "qmlcheckableproxymodel.h" -#include "qmllistselectionmodel.h" - -#include -#include - -class KBreadcrumbNavigationFactoryPrivate -{ - KBreadcrumbNavigationFactoryPrivate( KBreadcrumbNavigationFactory *qq ) - : q_ptr( qq ), - m_breadcrumbSelectionModel( 0 ), - m_selectionModel( 0 ), - m_childItemsSelectionModel( 0 ), - m_breadcrumbModel( 0 ), - m_selectedItemModel( 0 ), - m_unfilteredChildItemsModel( 0 ), - m_childItemsModel( 0 ), - m_breadcrumbDepth( -1 ), - m_modelIndexProxyMapper( 0 ), - m_checkModel( 0 ), - m_qmlBreadcrumbSelectionModel( 0 ), - m_qmlSelectedItemSelectionModel( 0 ), - m_qmlChildSelectionModel( 0 ), - m_qmlBreadcrumbCheckModel( 0 ), - m_qmlSelectedItemCheckModel( 0 ), - m_qmlChildCheckModel( 0 ), - m_checkedItemsModel( 0 ), - m_checkedItemsCheckModel( 0 ), - m_qmlCheckedItemsCheckModel( 0 ) - { - } - - Q_DECLARE_PUBLIC( KBreadcrumbNavigationFactory ) - KBreadcrumbNavigationFactory * const q_ptr; - - QItemSelectionModel *m_breadcrumbSelectionModel; - QItemSelectionModel *m_selectionModel; - QItemSelectionModel *m_childItemsSelectionModel; - - QAbstractItemModel *m_breadcrumbModel; - QAbstractItemModel *m_selectedItemModel; - QAbstractItemModel *m_unfilteredChildItemsModel; - QAbstractItemModel *m_childItemsModel; - int m_breadcrumbDepth; - KModelIndexProxyMapper *m_modelIndexProxyMapper; - - QItemSelectionModel *m_checkModel; - - QMLListSelectionModel *m_qmlBreadcrumbSelectionModel; - QMLListSelectionModel *m_qmlSelectedItemSelectionModel; - QMLListSelectionModel *m_qmlChildSelectionModel; - - QMLListSelectionModel *m_qmlBreadcrumbCheckModel; - QMLListSelectionModel *m_qmlSelectedItemCheckModel; - QMLListSelectionModel *m_qmlChildCheckModel; - - KSelectionProxyModel *m_checkedItemsModel; - QItemSelectionModel *m_checkedItemsCheckModel; - QMLListSelectionModel *m_qmlCheckedItemsCheckModel; -}; - - -KBreadcrumbNavigationFactory::KBreadcrumbNavigationFactory( QObject *parent ) - : QObject( parent ), - d_ptr( new KBreadcrumbNavigationFactoryPrivate( this ) ) -{ -} - -KBreadcrumbNavigationFactory::~KBreadcrumbNavigationFactory() -{ - delete d_ptr; -} - -void KBreadcrumbNavigationFactory::createCheckableBreadcrumbContext( QAbstractItemModel *model, QObject *parent ) -{ - Q_D( KBreadcrumbNavigationFactory ); - - d->m_checkModel = new QItemSelectionModel( model, parent ); - - QMLCheckableItemProxyModel *checkableProxy = new QMLCheckableItemProxyModel( parent ); - checkableProxy->setSourceModel( model ); - checkableProxy->setSelectionModel( d->m_checkModel ); - - KDescendantsProxyModel *descProxy = new KDescendantsProxyModel( parent ); - descProxy->setDisplayAncestorData( true ); - descProxy->setSourceModel( checkableProxy ); - - createBreadcrumbContext( checkableProxy, parent ); - - KLinkItemSelectionModel *breadcrumbLinkSelectionModel = new KLinkItemSelectionModel( d->m_breadcrumbModel, d->m_checkModel, parent ); - KLinkItemSelectionModel *childLinkSelectionModel = new KLinkItemSelectionModel( d->m_childItemsModel, d->m_checkModel, parent ); - KLinkItemSelectionModel *selectedItemLinkSelectionModel = new KLinkItemSelectionModel( d->m_selectedItemModel, d->m_checkModel, parent ); - - d->m_qmlBreadcrumbCheckModel = new QMLListSelectionModel( breadcrumbLinkSelectionModel, parent ); - d->m_qmlSelectedItemCheckModel = new QMLListSelectionModel( selectedItemLinkSelectionModel, parent ); - d->m_qmlChildCheckModel = new QMLListSelectionModel( childLinkSelectionModel, parent ); - - d->m_checkedItemsModel = new KSelectionProxyModel( d->m_checkModel, parent ); - d->m_checkedItemsModel->setFilterBehavior( KSelectionProxyModel::ExactSelection ); - d->m_checkedItemsModel->setSourceModel( descProxy ); - - d->m_checkedItemsCheckModel = new KLinkItemSelectionModel( d->m_checkedItemsModel, d->m_checkModel, parent ); - - d->m_qmlCheckedItemsCheckModel = new QMLListSelectionModel( d->m_checkedItemsCheckModel, parent ); -} - -void KBreadcrumbNavigationFactory::createBreadcrumbContext( QAbstractItemModel *model, QObject *parent ) -{ - Q_D(KBreadcrumbNavigationFactory); - - d->m_selectionModel = new QItemSelectionModel( model, parent ); - connect( d->m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(collectionSelectionChanged()) ); - - KSelectionProxyModel *currentCollectionSelectionModel = new KSelectionProxyModel( d->m_selectionModel, parent ); - currentCollectionSelectionModel->setFilterBehavior( KSelectionProxyModel::ExactSelection ); - currentCollectionSelectionModel->setSourceModel( model ); - d->m_selectedItemModel = currentCollectionSelectionModel; - - KBreadcrumbSelectionModel *breadcrumbCollectionSelection - = new KBreadcrumbSelectionModel( d->m_selectionModel, KBreadcrumbSelectionModel::MakeBreadcrumbSelectionInOther, parent ); - breadcrumbCollectionSelection->setActualSelectionIncluded( false ); - breadcrumbCollectionSelection->setBreadcrumbLength( d->m_breadcrumbDepth ); - - KBreadcrumbNavigationProxyModel *breadcrumbNavigationModel - = new KBreadcrumbNavigationProxyModel( breadcrumbCollectionSelection, parent ); - breadcrumbNavigationModel->setSourceModel( model ); - breadcrumbNavigationModel->setFilterBehavior( KSelectionProxyModel::ExactSelection ); - d->m_breadcrumbModel = getBreadcrumbNavigationModel( breadcrumbNavigationModel ); - - KLinkItemSelectionModel *proxyBreadcrumbCollectionSelection - = new KLinkItemSelectionModel( d->m_breadcrumbModel, d->m_selectionModel, parent ); - - d->m_breadcrumbSelectionModel = new KForwardingItemSelectionModel( d->m_breadcrumbModel, - proxyBreadcrumbCollectionSelection, - KForwardingItemSelectionModel::Reverse, - parent ); - - // Breadcrumbs done. (phew!) - - KForwardingItemSelectionModel *oneway = new KForwardingItemSelectionModel( model, d->m_selectionModel, parent ); - - KNavigatingProxyModel *navigatingProxyModel = new KNavigatingProxyModel( oneway, parent ); - navigatingProxyModel->setSourceModel( model ); - d->m_unfilteredChildItemsModel = navigatingProxyModel; - - d->m_childItemsModel = getChildItemsModel( d->m_unfilteredChildItemsModel ); - - d->m_childItemsSelectionModel = new KLinkItemSelectionModel( d->m_childItemsModel, d->m_selectionModel, parent ); - - d->m_modelIndexProxyMapper = new KModelIndexProxyMapper( model, d->m_childItemsModel, parent ); - - // Navigation stuff for QML: - - d->m_qmlBreadcrumbSelectionModel = new QMLListSelectionModel( d->m_breadcrumbSelectionModel, parent ); - d->m_qmlSelectedItemSelectionModel = new QMLListSelectionModel( d->m_selectionModel, parent ); - d->m_qmlChildSelectionModel = new QMLListSelectionModel( d->m_childItemsSelectionModel, parent ); - - connect( d->m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(selectedDisplayTextChanged()) ); -} - -QItemSelectionModel* KBreadcrumbNavigationFactory::selectionModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_selectionModel; -} - -QAbstractItemModel* KBreadcrumbNavigationFactory::selectedItemModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_selectedItemModel; -} - -int KBreadcrumbNavigationFactory::breadcrumbDepth() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_breadcrumbDepth; -} - -void KBreadcrumbNavigationFactory::setBreadcrumbDepth( int depth ) -{ - Q_D( KBreadcrumbNavigationFactory ); - d->m_breadcrumbDepth = depth; -} - -QAbstractItemModel* KBreadcrumbNavigationFactory::breadcrumbItemModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_breadcrumbModel; -} - -QItemSelectionModel* KBreadcrumbNavigationFactory::breadcrumbSelectionModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_breadcrumbSelectionModel; -} - -QAbstractItemModel* KBreadcrumbNavigationFactory::childItemModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_childItemsModel; -} - -QAbstractItemModel* KBreadcrumbNavigationFactory::unfilteredChildItemModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_unfilteredChildItemsModel; -} - -QAbstractItemModel* KBreadcrumbNavigationFactory::getBreadcrumbNavigationModel( QAbstractItemModel *model ) -{ - return model; -} - -QAbstractItemModel* KBreadcrumbNavigationFactory::getChildItemsModel( QAbstractItemModel *model ) -{ - return model; -} - -QItemSelectionModel* KBreadcrumbNavigationFactory::childSelectionModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_childItemsSelectionModel; -} - -void KBreadcrumbNavigationFactory::selectBreadcrumb( int row ) -{ - Q_D( KBreadcrumbNavigationFactory ); - - if ( row < 0 ) { - d->m_selectionModel->clearSelection(); - return; - } - - const QModelIndex index = d->m_breadcrumbModel->index( row, 0 ); - d->m_breadcrumbSelectionModel->select( QItemSelection( index, index ), QItemSelectionModel::Rows | QItemSelectionModel::ClearAndSelect ); -} - -void KBreadcrumbNavigationFactory::selectChild( int row ) -{ - Q_D( KBreadcrumbNavigationFactory ); - - if ( row < 0 ) { - d->m_selectionModel->clearSelection(); - return; - } - - const QModelIndex index = d->m_childItemsModel->index( row, 0 ); - d->m_childItemsSelectionModel->select( QItemSelection( index, index ), QItemSelectionModel::Rows | QItemSelectionModel::ClearAndSelect ); -} - -bool KBreadcrumbNavigationFactory::childCollectionHasChildren( int row ) const -{ - if ( row < 0 ) - return false; - - Q_D( const KBreadcrumbNavigationFactory ); - - static const int column = 0; - const QModelIndex index = d->m_modelIndexProxyMapper->mapRightToLeft( d->m_childItemsModel->index( row, column ) ); - if ( !index.isValid() ) - return false; - - return (index.model()->rowCount( index ) > 0); -} - -QObject* KBreadcrumbNavigationFactory::qmlBreadcrumbSelectionModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_qmlBreadcrumbSelectionModel; -} - -QObject* KBreadcrumbNavigationFactory::qmlBreadcrumbsModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_breadcrumbModel; -} - -QObject* KBreadcrumbNavigationFactory::qmlChildItemsModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_childItemsModel; -} - -QObject* KBreadcrumbNavigationFactory::qmlChildSelectionModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_qmlChildSelectionModel; -} - -QObject* KBreadcrumbNavigationFactory::qmlSelectedItemModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_selectedItemModel; -} - -QObject* KBreadcrumbNavigationFactory::qmlSelectionModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_qmlSelectedItemSelectionModel; -} - -QObject* KBreadcrumbNavigationFactory::qmlBreadcrumbCheckModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_qmlBreadcrumbCheckModel; -} - -QObject* KBreadcrumbNavigationFactory::qmlChildCheckModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_qmlChildCheckModel; -} - -QObject* KBreadcrumbNavigationFactory::qmlSelectedItemCheckModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_qmlSelectedItemCheckModel; -} - -QItemSelectionModel* KBreadcrumbNavigationFactory::checkedItemsCheckModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_checkedItemsCheckModel; -} - -QAbstractItemModel* KBreadcrumbNavigationFactory::checkedItemsModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_checkedItemsModel; -} - -QItemSelectionModel* KBreadcrumbNavigationFactory::checkModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_checkModel; -} - -QObject* KBreadcrumbNavigationFactory::qmlCheckedItemsCheckModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_qmlCheckedItemsCheckModel; -} - -QObject* KBreadcrumbNavigationFactory::qmlCheckedItemsModel() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_checkedItemsModel; -} - -QString KBreadcrumbNavigationFactory::selectedDisplayText() const -{ - Q_D( const KBreadcrumbNavigationFactory ); - return d->m_selectedItemModel->index( 0, 0 ).data().toString(); -} - diff --git a/kdepim/mobile/lib/breadcrumbnavigationcontext.h b/kdepim/mobile/lib/breadcrumbnavigationcontext.h deleted file mode 100644 index 3ac50eb7..00000000 --- a/kdepim/mobile/lib/breadcrumbnavigationcontext.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 BREADCRUMBNAVIGATIONCONTEXT_H -#define BREADCRUMBNAVIGATIONCONTEXT_H - -#include - -#include "mobileui_export.h" - -class QAbstractItemModel; -class QDeclarativeContext; -class QItemSelectionModel; - -class KBreadcrumbNavigationFactoryPrivate; - -class MOBILEUI_EXPORT KBreadcrumbNavigationFactory : public QObject -{ - Q_OBJECT - Q_PROPERTY( QString selectedDisplayText READ selectedDisplayText NOTIFY selectedDisplayTextChanged ) - - public: - explicit KBreadcrumbNavigationFactory( QObject* parent = 0 ); - ~KBreadcrumbNavigationFactory(); - - void createBreadcrumbContext( QAbstractItemModel *model, QObject* parent = 0 ); - void createCheckableBreadcrumbContext( QAbstractItemModel *model, QObject* parent = 0 ); - - void setBreadcrumbDepth( int depth ); - int breadcrumbDepth() const; - - QItemSelectionModel *breadcrumbSelectionModel() const; - QItemSelectionModel *selectionModel() const; - QItemSelectionModel *childSelectionModel() const; - - QAbstractItemModel *breadcrumbItemModel() const; - QAbstractItemModel *selectedItemModel() const; - QAbstractItemModel *unfilteredChildItemModel() const; - QAbstractItemModel *childItemModel() const; - - QItemSelectionModel *checkModel() const; - QAbstractItemModel *checkedItemsModel() const; - QItemSelectionModel *checkedItemsCheckModel() const; - - QString selectedDisplayText() const; - - public Q_SLOTS: - QObject* qmlBreadcrumbSelectionModel() const; - QObject* qmlSelectionModel() const; - QObject* qmlChildSelectionModel() const; - - QObject* qmlBreadcrumbCheckModel() const; - QObject* qmlSelectedItemCheckModel() const; - QObject* qmlChildCheckModel() const; - QObject* qmlCheckedItemsModel() const; - QObject* qmlCheckedItemsCheckModel() const; - - QObject* qmlBreadcrumbsModel() const; - QObject* qmlSelectedItemModel() const; - QObject* qmlChildItemsModel() const; - - void selectBreadcrumb( int row ); - void selectChild( int row ); - - bool childCollectionHasChildren( int row ) const; - - Q_SIGNALS: - void selectedDisplayTextChanged(); - void collectionSelectionChanged(); - - protected: - virtual QAbstractItemModel* getBreadcrumbNavigationModel( QAbstractItemModel *model ); - virtual QAbstractItemModel* getChildItemsModel( QAbstractItemModel *model ); - - private: - Q_DECLARE_PRIVATE( KBreadcrumbNavigationFactory ) - KBreadcrumbNavigationFactoryPrivate * const d_ptr; -}; - -#endif diff --git a/kdepim/mobile/lib/calendar/CMakeLists.txt b/kdepim/mobile/lib/calendar/CMakeLists.txt deleted file mode 100644 index f23ec775..00000000 --- a/kdepim/mobile/lib/calendar/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -include_directories( - ${CMAKE_SOURCE_DIR}/incidenceeditor-ng - ${CMAKE_SOURCE_DIR}/calendarsupport - ${CMAKE_BINARY_DIR}/calendarsupport - ${CMAKE_SOURCE_DIR}/libkdepim/ - ${CMAKE_CURRENT_SOURCE_DIR}/.. - ${Boost_INCLUDE_DIR} -) - -set(mobileui_calendar_SRCS - calendarhelper.cpp - clockhelper.cpp - declarativeeditors.cpp - groupwareuidelegate.cpp - incidenceview.cpp - kcalitembrowseritem.cpp -) - -set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}" ) - -kde4_add_ui_files(mobileui_calendar_SRCS - ${CMAKE_SOURCE_DIR}/incidenceeditor-ng/dialogmobile.ui - ${CMAKE_SOURCE_DIR}/incidenceeditor-ng/dialogmoremobile.ui -) - -add_definitions( -DKDEPIMMOBILEUICALENDAR_STATIC_LIB ) -kde4_add_library(kdepimmobileuicalendar STATIC ${mobileui_calendar_SRCS}) - -target_link_libraries(kdepimmobileuicalendar - ${KDEPIMLIBS_AKONADI_LIBS} - ${KDEPIMLIBS_KCALCORE_LIBS} - akonadi-calendar - akonadi_next - incidenceeditorsngmobile - calendarsupport - kdepimmobileui - ${QT_QTDECLARATIVE_LIBRARY} -) - -install(FILES incidence-editor.qml DESTINATION ${DATA_INSTALL_DIR}/mobileui) -install(FILES - CalendarDialog.qml - ClockDialog.qml - MorePanel.qml - DESTINATION ${PLUGIN_INSTALL_DIR}/imports/org/kde/pim/mobileui) diff --git a/kdepim/mobile/lib/calendar/CalendarDialog.qml b/kdepim/mobile/lib/calendar/CalendarDialog.qml deleted file mode 100644 index 1e0e4c31..00000000 --- a/kdepim/mobile/lib/calendar/CalendarDialog.qml +++ /dev/null @@ -1,205 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - Copyright (C) 2010 Artur Duque de Souza - Copyright (C) 2010 Anselmo Lacerda Silveira de Melo - Copyright (C) 2010 Eduardo Madeira Fleury - - 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 - -Dialog { - id: calendarWidget - property alias okEnabled: calendarWidgetOk.enabled - property alias day: myCalendar.day - property alias month: myCalendar.month - property alias year: myCalendar.year - - signal dateChanged( int day, int month, int year ) - - content: [ - Item { - anchors.fill: parent - - KPIM.Calendar { - id: myCalendar - - anchors { - left: parent.left - top: parent.top - bottom: parent.bottom - } - - //why onDayChanged doesn't work here as onDaysInMothChanged do? - onDaySelected: { - // ### TODO: instead of calling function just set value - // was supposed to work - daySelector.setValue(myCalendar.day); - } - - onMonthChanged: { - // ### TODO: instead of calling function just set value - // was supposed to work - monthSelector.setValue(myCalendar.month); - } - - onYearChanged: { - // ### TODO: instead of calling function just set value - // was supposed to work - yearSelector.setValue(myCalendar.year); - } - - onDaysInMonthChanged: { - daySelector.setRange(daysInMonth) - } - } - - Column { - spacing: 5 - - anchors { - top: parent.top - left: myCalendar.right - right: parent.right - topMargin: 20 - } - - KPIM.VerticalSelector { - id: daySelector - height: 100 - model: myCalendar.daysInMonth - beginWith: 1 - - onValueChanged: { - // selector change -> update calendar - myCalendar.day = value; - calendarWidgetOk.enabled = true; - } - - onSelected: { - monthSelector.state = "unselected"; - yearSelector.state = "unselected"; - } - - Component.onCompleted: { - // ### TODO: instead of calling function just set value - // was supposed to work - daySelector.setValue(myCalendar.day); - } - } - - KPIM.VerticalSelector { - id: monthSelector - height: 100 - model: 12 - beginWith: 1 - - displayTexts: [ - "dummy", - KDE.i18n( "Jan" ), - KDE.i18n( "Feb" ), - KDE.i18n( "Mar" ), - KDE.i18n( "Apr" ), - KDE.i18n( "May" ), - KDE.i18n( "Jun" ), - KDE.i18n( "Jul" ), - KDE.i18n( "Aug" ), - KDE.i18n( "Sep" ), - KDE.i18n( "Oct" ), - KDE.i18n( "Nov" ), - KDE.i18n( "Dec" ) - ]; - - onValueChanged: { - // selector change -> update calendar - myCalendar.month = value; - calendarWidgetOk.enabled = true; - } - - onSelected: { - daySelector.state = "unselected"; - yearSelector.state = "unselected"; - } - - Component.onCompleted: { - // ### TODO: instead of calling function just set value - // was supposed to work - monthSelector.setValue(myCalendar.month); - } - } - - KPIM.VerticalSelector { - id: yearSelector - height: 100 - // high enough == 2050 :) - model: 51 - // value - 2000 because the index starts at '0' - beginWith: 2000 - - onValueChanged: { - myCalendar.year = value; - calendarWidgetOk.enabled = true; - } - - onSelected: { - daySelector.state = "unselected"; - monthSelector.state = "unselected"; - } - - Component.onCompleted: { - // ### TODO: instead of calling function just set value - // was supposed to work - yearSelector.setValue(myCalendar.year); - } - } - } - - Row { - spacing: 5 - - anchors{ - bottom: parent.bottom - right: parent.right - } - - KPIM.Button2 { - id: calendarkWidgetCancel - buttonText: KDE.i18n( "Cancel" ); - width: 130 - - onClicked: { - calendarWidget.collapse() - //### + reset widget - } - } - - KPIM.Button2 { - id: calendarWidgetOk - buttonText: KDE.i18n( "OK" ); - width: 130 - - onClicked: { - calendarWidget.collapse() - dateChanged( myCalendar.day, myCalendar.month, myCalendar.year ) - } - } - } - } - ] -} diff --git a/kdepim/mobile/lib/calendar/ClockDialog.qml b/kdepim/mobile/lib/calendar/ClockDialog.qml deleted file mode 100644 index 6869d2e8..00000000 --- a/kdepim/mobile/lib/calendar/ClockDialog.qml +++ /dev/null @@ -1,353 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - Copyright (C) 2010 Artur Duque de Souza - Copyright (C) 2010 Anselmo Lacerda Silveira de Melo - Copyright (c) 2010 Eduardo Madeira Fleury - - 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 - -Dialog { - id: clockWidget - - property alias okEnabled: clockWidgetOk.enabled - property alias hours: hourSelector.value - property alias minutes: minuteSelector.value - property bool blockSignalEmission: false - - signal timeChanged( int hour, int minute ) - - content: [ - Item { - anchors.fill: parent - - MouseArea { - anchors.fill: parent - onClicked: {} - } - - Item { - id: digitalClock - anchors.fill: parent - - Row { - anchors.centerIn: parent - - Text { - id: hourSelector - - property int value: 0 - - width: digitalClock.width/2.5 - text: value < 10 ? "0" + value : value - color: "#004bb8" - font.bold: true - font.pixelSize: 100 - horizontalAlignment: Text.AlignRight - verticalAlignment: Text.AlignVCenter - style: Text.Sunken - - MouseArea { - anchors.fill: parent - - onClicked: { - hoursTable.currentHour = hourSelector.value; - hoursTable.visible = true - } - } - } - - Text { - text: ":" - width: digitalClock.width - hourSelector.width - minuteSelector.width - color: "#004bb8" - font.bold: true - font.pixelSize: 100 - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - style: Text.Sunken - } - - Text { - id: minuteSelector - - width: digitalClock.width/2.5 - text: value < 10 ? "0" + value : value - color: "#004bb8" - font.bold: true - font.pixelSize: 100 - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - style: Text.Sunken - - property int value: 0 - - MouseArea { - anchors.fill: parent - - onClicked: { - minutesTable.currentMinute = minuteSelector.value; - minutesTable.visible = true - } - } - } - } - } - - Row { - spacing: 5 - - anchors{ - bottom: parent.bottom - right: parent.right - } - - KPIM.Button2 { - id: clockWidgetCancel - buttonText: KDE.i18n( "Cancel" ); - width: 130 - - onClicked: { - clockWidget.collapse() - } - } - - KPIM.Button2 { - id: clockWidgetOk - buttonText: KDE.i18n( "OK" ); - width: 130 - - onClicked: { - clockWidget.collapse() - timeChanged(clockWidget.hours, clockWidget.minutes); - } - } - } - } - ] - - Rectangle { - id: hoursTable - - visible: false - - property int currentHour - - signal selectionFinished( int value ) - - Grid { - anchors.fill: parent - spacing: 3 - columns: 6 - rows: 4 - - Repeater { - model: 24 - - Image { - width: (hoursTable.width-(3*5))/6 - height: (hoursTable.height-(3*3))/4 - source: "images/normaldate.png" - - Image { - anchors.fill: parent - source: { - if ( hourText.text == hoursTable.currentHour ) { - return "images/activedate.png"; - } else { - return ""; - } - } - } - - Text { - id: hourText - anchors.centerIn: parent - color: "#5ba0d4" - font.bold: true - font.pixelSize: 26 - style: Text.Sunken - text: index - } - - MouseArea { - anchors.fill: parent - - onClicked: { - hoursTable.currentHour = index - hoursTable.selectionFinished( index ) - hoursTable.visible = false - } - } - } - } - } - - Behavior on visible { - - ParallelAnimation { - - PropertyAnimation { - target: hoursTable - property: "x" - from: mapFromItem(hourSelector, hourSelector.width/2, 0).x - to: 0 - duration: 200 - } - PropertyAnimation { - target: hoursTable - property: "y" - from: mapFromItem(hourSelector, 0, hourSelector.height/2).y - to: 0 - duration: 200 - } - PropertyAnimation { - target: hoursTable - property: "width" - from: 0 - to: clockWidget.width - duration: 200 - } - PropertyAnimation { - target: hoursTable - property: "height" - from: 0 - to: clockWidget.height - duration: 200 - } - } - } - } - - Connections { - target: hoursTable - onSelectionFinished: { - hourSelector.value = value - clockWidgetOk.enabled = true - } - } - - Rectangle { - id: minutesTable - visible: false - - property int currentMinute - property variant minutesOffset: [0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55]; - - signal selectionFinished( int value ) - - onCurrentMinuteChanged: { - // round input values to a multiple of 5 - currentMinute = (Math.round(currentMinute/5)*5 == 60) ? 0 : Math.round(currentMinute/5)*5 - } - - Grid { - anchors.fill: parent - spacing: 3 - columns: 4 - rows: 3 - - Repeater { - model: 12 - - Image { - width: (minutesTable.width-(3*3))/4 - height: (minutesTable.height-(3*2))/3 - source: "images/normaldate.png" - - Image { - anchors.fill: parent - - source: { - if ( minuteText.text == minutesTable.currentMinute ) { - return "images/activedate.png"; - } else { - return ""; - } - } - } - - Text { - id: minuteText - anchors.centerIn: parent - color: "#5ba0d4" - font.bold: true - font.pixelSize: 26 - style: Text.Sunken - text: minutesTable.minutesOffset[ index ] - } - - MouseArea { - anchors.fill: parent - - onClicked: { - minutesTable.currentMinute = minutesTable.minutesOffset[ index ] - minutesTable.selectionFinished( minutesTable.minutesOffset[ index ] ) - minutesTable.visible = false - } - } - } - } - } - - Behavior on visible { - - ParallelAnimation { - - PropertyAnimation { - target: minutesTable - property: "x" - from: mapFromItem(minuteSelector, minuteSelector.width/2, 0).x - to: 0 - duration: 200 - } - PropertyAnimation { - target: minutesTable; - property: "y" - from: mapFromItem(minuteSelector, 0, minuteSelector.height/2).y - to: 0 - duration: 200 - } - PropertyAnimation { - target: minutesTable - property: "width" - from: 0 - to: clockWidget.width - duration: 200 - } - PropertyAnimation { - target: minutesTable - property: "height" - from: 0 - to: clockWidget.height - duration: 200 - } - } - } - } - - Connections { - target: minutesTable - onSelectionFinished: { - minuteSelector.value = value - clockWidgetOk.enabled = true - } - } -} diff --git a/kdepim/mobile/lib/calendar/MorePanel.qml b/kdepim/mobile/lib/calendar/MorePanel.qml deleted file mode 100644 index 059381bb..00000000 --- a/kdepim/mobile/lib/calendar/MorePanel.qml +++ /dev/null @@ -1,94 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - Copyright (C) 2010 Artur Duque de Souza - Copyright (C) 2010 Anselmo Lacerda Silveira de Melo - Copyright (c) 2010 Eduardo Madeira Fleury - - 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.incidenceeditors 4.5 as IncidenceEditors - -SlideoutPanel { - titleText: KDE.i18n("More..."); - handlePosition: 250 - handleHeight: 120 - // TODO: Better icons for the buttons probably. - content: [ - Column { - id: buttonColumn - width: 64; - height: parent.height; - KPIM.Button { - id: btnGeneral - width: 64 - height: 64 - icon: KDE.iconPath( "accessories-text-editor", 64 ) - onClicked: { - moreEditors.currentIndex = 0 - } - } - KPIM.Button { - id: btnAttendees - width: 64 - height: 64 - icon: KDE.iconPath( "view-pim-contacts", 64 ) - onClicked: { - moreEditors.currentIndex = 1 - } - } - KPIM.Button { - id: btnReminder - width: 64 - height: 64 - icon: KDE.iconPath( "appointment-reminder", 64 ) - onClicked: { - moreEditors.currentIndex = 2 - } - } - KPIM.Button { - id: btnRecurrence - width: 64 - height: 64 - icon: KDE.iconPath( "appointment-recurring", 64 ) - onClicked: { - moreEditors.currentIndex = 3 - } - } - KPIM.Button { - id: btnAttachment - width: 64 - height: 64 - icon: KDE.iconPath( "mail-attachment", 64 ) - onClicked: { - moreEditors.currentIndex = 4 - } - } - }, - - IncidenceEditors.MoreEditor { - id : moreEditors - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: buttonColumn.right - anchors.right: parent.right - currentIndex : 0 - } - ] -} diff --git a/kdepim/mobile/lib/calendar/calendarhelper.cpp b/kdepim/mobile/lib/calendar/calendarhelper.cpp deleted file mode 100644 index ac4c655c..00000000 --- a/kdepim/mobile/lib/calendar/calendarhelper.cpp +++ /dev/null @@ -1,291 +0,0 @@ -/* - Copyright (C) 2010 Artur Duque de Souza - - 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 "calendarhelper.h" - -#define MAX_DAYS_ON_WIDGET 42 -#define MAX_WEEKS_ON_WIDGET 6 - -#include -#include - - -CalendarHelper::CalendarHelper( QObject *parent ) - : QObject( parent ) -{ - setDate(QDate::currentDate()); - connect( this, SIGNAL(monthChanged(int)), this, SLOT(updateDays()) ); - connect( this, SIGNAL(yearChanged(int)), this, SLOT(updateDays()) ); - connect( this, SIGNAL(monthChanged(int)), this, SLOT(updateWeeks()) ); - connect( this, SIGNAL(yearChanged(int)), this, SLOT(updateWeeks()) ); -} - -CalendarHelper::~CalendarHelper() -{ -} - -QDate CalendarHelper::date() const -{ - return m_original; -} - -void CalendarHelper::setDate( const QDate date ) -{ - m_original = date; - - m_day = date.day(); - emit dayChanged( m_day ); - - m_month = date.month(); - m_daysInMonth = m_original.daysInMonth(); - emit monthChanged( m_month ); - emit daysInMonthChanged( m_daysInMonth ); - - m_year = date.year(); - emit yearChanged( m_year ); - - updateOffsets(); -} - -void CalendarHelper::updateOffsets() -{ - // calculate the offsets for day and week - QDate firstDay = QDate(m_year, m_month, 1); - m_offset = firstDay.dayOfWeek(); - m_weekOffset = firstDay.weekNumber(); - -} - -int CalendarHelper::day() const -{ - return m_day; -} - -void CalendarHelper::setDay( const int day ) -{ - if ( m_day == day ) - return; - - QDate newDate(m_year, m_month, day); - if ( !newDate.isValid() ) - return; - - m_original = newDate; - m_day = day; - - updateOffsets(); - emit dayChanged( m_day ); -} - -QString CalendarHelper::monthName() const -{ - return QDate::longMonthName( m_month ); -} - -int CalendarHelper::month() const -{ - return m_month; -} - -void CalendarHelper::setMonth( const int month ) -{ - if ( m_month == month ) - return; - - QDate newDate(m_year, month, m_day); - if ( !newDate.isValid() ){ - return; - } - - m_original = newDate; - m_month = month; - updateOffsets(); - - m_daysInMonth = m_original.daysInMonth(); - - emit monthChanged( m_month ); - emit daysInMonthChanged( m_daysInMonth ); -} - -int CalendarHelper::daysInMonth() const -{ - return m_daysInMonth; -} - -int CalendarHelper::year() const -{ - return m_year; -} - -void CalendarHelper::setYear( const int year ) -{ - if ( m_year == year ) - return; - - QDate newDate( year, m_month, m_day ); - // we don't accept years BC (so no negative years) - if ( !newDate.isValid() || year <= 0 ) - return; - - m_original = newDate; - m_year = year; - - // Check if we changed from a Leap year to a common one (vice versa) - if ( m_month == 2 && m_daysInMonth != m_original.daysInMonth() ) { - m_daysInMonth = m_original.daysInMonth(); - emit daysInMonthChanged( m_daysInMonth ); - } - - updateOffsets(); - emit yearChanged( m_year ); -} - -QString CalendarHelper::dayForPosition( const int pos ) const -{ - int res = (pos - m_offset); - - // out of range - if ( pos < 1 || pos > MAX_DAYS_ON_WIDGET || res < 1 ) - return QString(); - - // if the position is the firsts days (0 to m_offset) - if ( pos < m_offset ) - return QString::number(pos); - - // the current day - if ( pos == m_offset ) { - const QString rpos = QString::number(pos); - return rpos; - } - - if ( res > m_daysInMonth ) { - return QString(); - } - - return QString::number( res ); -} - -int CalendarHelper::weekForPosition( const int pos ) const -{ - // out of range - if ( pos < 1 || pos > MAX_WEEKS_ON_WIDGET ) - return -1; - - // if the position is the first week - if ( pos == 1 ) - return m_weekOffset; - - // for all other weeks do the math - return pos + m_weekOffset - 1; -} - -bool CalendarHelper::isCurrentDay( const QString &text ) const -{ - return ( m_day == text.toInt() ); -} - -void CalendarHelper::registerItems( QObject *obj ) -{ - // we expect to receive the item that has all the days and weeks as children - for( int i = 0; i < obj->children().size(); ++i) { - // check for days and weeks - QObject *item = obj->children().at(i); - QVariant currentDay = item->property("currentDay"); - QVariant weekPos = item->property("weekPos"); - - // add to the list if we found each one - if ( currentDay.isValid() ) { - m_days << item; - } else if ( weekPos.isValid() ) { - m_weeks << item; - } - } -} - -void CalendarHelper::nextMonth() -{ - QDate date( m_year, m_month, m_day ); - date = date.addMonths( 1 ); - - setDate( date ); -} - -void CalendarHelper::previousMonth() -{ - QDate date( m_year, m_month, m_day ); - date = date.addMonths( -1 ); - - setDate( date ); -} - -void CalendarHelper::nextYear() -{ - QDate date( m_year, m_month, m_day ); - date = date.addYears( 1 ); - - setDate( date ); -} - -void CalendarHelper::previousYear() -{ - QDate date( m_year, m_month, m_day ); - date = date.addYears( -1 ); - - setDate( date ); -} - -void CalendarHelper::updateDays() -{ - QDate today = QDate::currentDate(); - bool disableCurrentDay = !( m_month == today.month() ); - - for( int i = 0; i < m_days.size(); ++i) { - QObject *item = m_days.at(i); - QVariant position = item->property( "dayPos" ); - - // invalid item - if ( !position.isValid() ) { - continue; - } - - if ( disableCurrentDay ) { - item->setProperty( "currentDay", -1 ); - } else { - item->setProperty( "currentDay", today.day() ); - } - - item->setProperty( "text", dayForPosition(position.toInt()) ); - } -} - -void CalendarHelper::updateWeeks() -{ - for( int i = 0; i < m_weeks.size(); ++i ) { - QObject *item = m_weeks.at( i ); - QVariant position = item->property( "weekPos" ); - - // invalid item - if ( !position.isValid() ) { - continue; - } - - item->setProperty( "text", weekForPosition(position.toInt()) ); - } -} - diff --git a/kdepim/mobile/lib/calendar/calendarhelper.h b/kdepim/mobile/lib/calendar/calendarhelper.h deleted file mode 100644 index 3e0c657f..00000000 --- a/kdepim/mobile/lib/calendar/calendarhelper.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - Copyright (C) 2010 Artur Duque de Souza - - 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 CALENDARHELPER_H -#define CALENDARHELPER_H - -#include -#include - - -class CalendarHelper : public QObject -{ - Q_OBJECT - Q_PROPERTY(int day READ day WRITE setDay NOTIFY dayChanged) - Q_PROPERTY(int daysInMonth READ daysInMonth NOTIFY daysInMonthChanged) - Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged) - Q_PROPERTY(QString monthName READ monthName NOTIFY monthChanged) - Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged) - - public: - explicit CalendarHelper( QObject *parent = 0 ); - ~CalendarHelper(); - - QDate date() const; - void setDate( const QDate date ); - - void updateOffsets(); - - int day() const; - void setDay( const int day ); - - int month() const; - int daysInMonth() const; - QString monthName() const; - void setMonth( const int month ); - - int year() const; - void setYear( const int year ); - - Q_INVOKABLE QString dayForPosition( const int pos ) const; - Q_INVOKABLE int weekForPosition( const int pos ) const; - Q_INVOKABLE bool isCurrentDay( const QString &text ) const; - Q_INVOKABLE void registerItems( QObject *obj ); - - Q_INVOKABLE void nextMonth(); - Q_INVOKABLE void previousMonth(); - Q_INVOKABLE void nextYear(); - Q_INVOKABLE void previousYear(); - - protected slots: - void updateDays(); - void updateWeeks(); - - signals: - void dayChanged( int newDay ); - void daysInMonthChanged( int newDays ); - void monthChanged( int newMonth ); - void yearChanged( int newYear ); - - private: - QDate m_original; - QList m_days; - QList m_weeks; - int m_day; - int m_month; - int m_year; - int m_offset; - int m_weekOffset; - int m_daysInMonth; -}; - -#endif diff --git a/kdepim/mobile/lib/calendar/clockhelper.cpp b/kdepim/mobile/lib/calendar/clockhelper.cpp deleted file mode 100644 index bd8a4f10..00000000 --- a/kdepim/mobile/lib/calendar/clockhelper.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/* - Copyright (C) 2010 Anselmo Lacerda Silveira de Melo - Copyright (C) 2010 Artur Duque de Souza - Copyright (c) 2010 Eduardo Madeira Fleury - - 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 "clockhelper.h" - -#include -#include - -static const qreal Q_PI = qreal(3.14159265358979323846); // pi -static const qreal Q_2PI = qreal(6.28318530717958647693); // 2*pi - -static inline qreal normalize(qreal angle) -{ - return angle - 360 * qFloor(angle / 360); // qreal modulus 360 -} - -static inline qreal toRadians(qreal angle) -{ - return angle * Q_2PI / 360; -} - -static inline qreal fromRadians(qreal angle) -{ - return angle * 360 / Q_2PI; -} - - -ClockHelper::ClockHelper(QObject *parent) - : QObject(parent), m_origin(0, 0), m_position(0, 0), - m_angle(0), m_minutes(0), m_minutesAngle(0), m_hours(0), - m_hoursAngle(0), selected(ClockHelper::None) -{ - // init the clock with a sane value - QTime time = QTime::currentTime(); - setHour( time.hour() ); - setMinute( time.minute() ); -} - -ClockHelper::~ClockHelper() -{ -} - -/* - Calculate angle and radius based on current origin and position. -*/ -void ClockHelper::calculateAngle() -{ - const qreal projectionInX = m_position.x() - m_origin.x(); - const qreal projectionInY = m_position.y() - m_origin.y(); - const qreal oldAngle = m_angle; - - const qreal radius = sqrt(projectionInX * projectionInX + projectionInY * projectionInY); - - if (radius == 0) { - // Corner case - m_angle = 0; - } else if (projectionInX > 0) { - if (projectionInY >= 0) { - // First quadrant - m_angle = qAsin(projectionInY / radius); - } else { - // Fourth quadrant - m_angle = Q_2PI + qAsin(projectionInY / radius); - } - } else { - // Second and Third quadrants - m_angle = Q_PI - qAsin(projectionInY / radius); - } - - // +90 because we need to adjust the clock '0 degree' - m_angle = normalize(fromRadians(m_angle) + 90); - - if (oldAngle != m_angle) { - switch(selected) { - case ClockHelper::Hour: - setHour( m_angle/30 ); - break; - case ClockHelper::Minute: - setMinute( m_angle/6 ); - break; - case ClockHelper::None: - default: - break; - } - } -} - -qreal ClockHelper::originX() const -{ - return m_origin.x(); -} - -void ClockHelper::setOriginX(qreal x) -{ - if (x == m_origin.x()) - return; - - m_origin.setX(x); -} - -qreal ClockHelper::originY() const -{ - return m_origin.y(); -} - -void ClockHelper::setOriginY(qreal y) -{ - if (y == m_origin.y()) - return; - - m_origin.setY(y); -} - -void ClockHelper::setXY(qreal x, qreal y) -{ - if (selected == ClockHelper::None) - return; - - const bool xEqual = (x == m_position.x()); - const bool yEqual = (y == m_position.y()); - - if (xEqual && yEqual) - return; - - m_position.setX(x); - m_position.setY(y); - calculateAngle(); -} - -int ClockHelper::minutes() const -{ - return m_minutes; -} - -int ClockHelper::minutesAngle() const -{ - return m_minutesAngle; -} - -void ClockHelper::setMinute(int min) -{ - if (min == m_minutes) - return; - - m_minutes = min; - emit minutesChanged(min); - - // match our angle - min = normalize(min) * 6; - m_minutesAngle = min; - emit minutesAngleChanged(min); -} - -int ClockHelper::hours() const -{ - return m_hours; -} - -int ClockHelper::hoursAngle() const -{ - return m_hoursAngle; -} - -void ClockHelper::setHour(int hour) -{ - if (hour == m_hours) - return; - - m_hours = hour; - emit hoursChanged(); - - // math our angle - hour = normalize(hour) * 30; - m_hoursAngle = hour; - emit hoursAngleChanged(); -} - -void ClockHelper::selectMinute() -{ - selected = ClockHelper::Minute; -} - -void ClockHelper::selectHour() -{ - selected = ClockHelper::Hour; -} - -void ClockHelper::unselectAll() -{ - selected = ClockHelper::None; -} diff --git a/kdepim/mobile/lib/calendar/clockhelper.h b/kdepim/mobile/lib/calendar/clockhelper.h deleted file mode 100644 index a5662414..00000000 --- a/kdepim/mobile/lib/calendar/clockhelper.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright (C) 2010 Anselmo Lacerda Silveira de Melo - Copyright (C) 2010 Artur Duque de Souza - Copyright (c) 2010 Eduardo Madeira Fleury - - 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 CLOCKHELPER_H -#define CLOCKHELPER_H - -#include -#include -#include -#include - -class ClockHelper : public QObject -{ - Q_OBJECT - - Q_PROPERTY(qreal originX READ originX WRITE setOriginX) - Q_PROPERTY(qreal originY READ originY WRITE setOriginY) - Q_PROPERTY(int minutes READ minutes WRITE setMinute NOTIFY minutesChanged) - Q_PROPERTY(int minutesAngle READ minutesAngle NOTIFY minutesAngleChanged) - Q_PROPERTY(int hours READ hours WRITE setHour NOTIFY hoursChanged) - Q_PROPERTY(int hoursAngle READ hoursAngle NOTIFY hoursAngleChanged) - -public: - explicit ClockHelper(QObject *parent = 0); - virtual ~ClockHelper(); - - qreal originX() const; - void setOriginX(qreal x); - - qreal originY() const; - void setOriginY(qreal x); - - Q_INVOKABLE void setXY(qreal x, qreal y); - Q_INVOKABLE void selectMinute(); - Q_INVOKABLE void selectHour(); - Q_INVOKABLE void unselectAll(); - - int minutes() const; - int minutesAngle() const; - void setMinute(int min); - - int hours() const; - int hoursAngle() const; - void setHour(int hour); - -Q_SIGNALS: - void minutesChanged(int); - void minutesAngleChanged(int); - void hoursChanged(); - void hoursAngleChanged(); - -private: - enum ClockPart { - None = 0, - Hour, - Minute - }; - - void calculateAngle(); - - QPointF m_origin; - QPointF m_position; - qreal m_angle; - int m_minutes; - int m_minutesAngle; - int m_hours; - int m_hoursAngle; - - ClockHelper::ClockPart selected; -}; - -QML_DECLARE_TYPE(ClockHelper) - -#endif // CLOCKHELPER_H diff --git a/kdepim/mobile/lib/calendar/declarativeeditors.cpp b/kdepim/mobile/lib/calendar/declarativeeditors.cpp deleted file mode 100644 index fcd70449..00000000 --- a/kdepim/mobile/lib/calendar/declarativeeditors.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 "declarativeeditors.h" - -#include "ui_dialogmobile.h" -#include "ui_dialogmoremobile.h" - -#include - -DCollectionCombo::DCollectionCombo( QGraphicsItem *parent ) - : DeclarativeWidgetBase( parent ) -{ } - -MobileIncidenceGeneral::MobileIncidenceGeneral( QWidget *parent ) - : QWidget( parent ), mUi( new Ui::EventOrTodoDesktop ) -{ - mUi->setupUi( this ); -} - -MobileIncidenceGeneral::~MobileIncidenceGeneral() -{ - delete mUi; -} - -DIEGeneral::DIEGeneral( QGraphicsItem *parent ) - : DeclarativeWidgetBase( parent ) -{ - QTimer::singleShot( 0, this, SLOT(hack()) ); -} - -void DIEGeneral::hack() -{ - // For whatever reason, this is needed to make the widget resize correctly. If - // someone finds a nices way to make this actually work.... - // - // Without this hack the widget gets a width that is too large for the app. It - // doesn't seem to matter which size you pass here. - widget()->resize( QSize() ); -} - -MobileIncidenceMore::MobileIncidenceMore( QWidget *parent ) - : QStackedWidget( parent ), mUi( new Ui::EventOrTodoMore ) -{ - mUi->setupUi( this ); -} - -MobileIncidenceMore::~MobileIncidenceMore() -{ - delete mUi; -} - -DIEMore::DIEMore( QGraphicsItem *parent ) - : DeclarativeWidgetBase( parent ) -{ } - -int DIEMore::currentIndex() const -{ - return widget()->currentIndex(); -} - -void DIEMore::setCurrentIndex( int index ) -{ - widget()->setCurrentIndex( index ); -} - diff --git a/kdepim/mobile/lib/calendar/declarativeeditors.h b/kdepim/mobile/lib/calendar/declarativeeditors.h deleted file mode 100644 index 5a338665..00000000 --- a/kdepim/mobile/lib/calendar/declarativeeditors.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 DECLARATIVEEDITORS_H -#define DECLARATIVEEDITORS_H - -#include "declarativewidgetbase.h" -#include "incidenceview.h" - -#include - -#include - -namespace Ui -{ - class EventOrTodoDesktop; - class EventOrTodoMore; -} - -/// DIE == DeclarativeIncidenceEditor - -class DCollectionCombo - : public DeclarativeWidgetBase -{ - Q_OBJECT - public: - explicit DCollectionCombo( QGraphicsItem *parent = 0 ); -}; - -class MobileIncidenceGeneral : public QWidget -{ - Q_OBJECT - public: - explicit MobileIncidenceGeneral( QWidget *parent = 0 ); - - ~MobileIncidenceGeneral(); - - public: - Ui::EventOrTodoDesktop *mUi; -}; - -class DIEGeneral - : public DeclarativeWidgetBase -{ - Q_OBJECT - public: - explicit DIEGeneral( QGraphicsItem *parent = 0 ); - - private Q_SLOTS: - void hack(); -}; - -class MobileIncidenceMore : public QStackedWidget -{ - Q_OBJECT - public: - explicit MobileIncidenceMore( QWidget *parent = 0 ); - - ~MobileIncidenceMore(); - - public: - Ui::EventOrTodoMore *mUi; -}; - -class DIEMore - : public DeclarativeWidgetBase -{ - Q_OBJECT - - Q_PROPERTY( int currentIndex READ currentIndex WRITE setCurrentIndex ) - - public: - explicit DIEMore( QGraphicsItem *parent = 0 ); - - int currentIndex() const; - - public Q_SLOTS: - void setCurrentIndex( int index ); -}; - -#endif diff --git a/kdepim/mobile/lib/calendar/groupwareuidelegate.cpp b/kdepim/mobile/lib/calendar/groupwareuidelegate.cpp deleted file mode 100644 index 28e4811a..00000000 --- a/kdepim/mobile/lib/calendar/groupwareuidelegate.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (c) 2011 Tobias Koenig - - 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 "groupwareuidelegate.h" - -#include "incidenceview.h" - -#include -#include -#include -#include -#include -#include -#include - -GroupwareUiDelegate::GroupwareUiDelegate() -{ -} - -void GroupwareUiDelegate::setCalendar( const Akonadi::ETMCalendar::Ptr &calendar ) -{ - mCalendar = calendar; -} - -void GroupwareUiDelegate::createCalendar() -{ - QStringList mimeTypes; - mimeTypes << KCalCore::Event::eventMimeType() << KCalCore::Todo::todoMimeType(); - mCalendar = Akonadi::ETMCalendar::Ptr( new Akonadi::ETMCalendar( mimeTypes ) ); - mCalendar->setObjectName( QLatin1String("Groupware calendar") ); - mCalendar->setOwner( KCalCore::Person::Ptr( new KCalCore::Person( CalendarSupport::KCalPrefs::instance()->fullName(), - CalendarSupport::KCalPrefs::instance()->email() ) ) ); -} - -void GroupwareUiDelegate::requestIncidenceEditor( const Akonadi::Item &item ) -{ - const KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( item ); - if ( !incidence ) { - kWarning() << "Incidence is null, won't open the editor"; - return; - } - - IncidenceView *editor = new IncidenceView; - editor->setWindowTitle( i18n( "Kontact Touch Calendar" ) ); - editor->load( item, QDate::currentDate() ); - - editor->setIsCounterProposal( true ); - editor->show(); -} diff --git a/kdepim/mobile/lib/calendar/groupwareuidelegate.h b/kdepim/mobile/lib/calendar/groupwareuidelegate.h deleted file mode 100644 index 22ddd50b..00000000 --- a/kdepim/mobile/lib/calendar/groupwareuidelegate.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (c) 2011 Tobias Koenig - - 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 GROUPWAREUIDELEGATE_H -#define GROUPWAREUIDELEGATE_H - -#include "mobileuicalendar_export.h" - -#include -#include -#include - -class MOBILEUICALENDAR_EXPORT GroupwareUiDelegate : public QObject, public Akonadi::GroupwareUiDelegate -{ - public: - GroupwareUiDelegate(); - - void setCalendar( const Akonadi::ETMCalendar::Ptr &calendar ); - void createCalendar(); - - void requestIncidenceEditor( const Akonadi::Item &item ); - - private: - Akonadi::ETMCalendar::Ptr mCalendar; -}; - -#endif diff --git a/kdepim/mobile/lib/calendar/incidence-editor.qml b/kdepim/mobile/lib/calendar/incidence-editor.qml deleted file mode 100644 index 7c0834b1..00000000 --- a/kdepim/mobile/lib/calendar/incidence-editor.qml +++ /dev/null @@ -1,130 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - Copyright (C) 2010 Artur Duque de Souza - Copyright (C) 2010 Anselmo Lacerda Silveira de Melo - - 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.incidenceeditors 4.5 as IncidenceEditors -import org.kde.plasma.extras 0.1 as PlasmaExtras - -KPIM.MainView { - id: mainview - - Connections { - target: _incidenceview - onShowCalendarWidget: { - calendarWidget.expand() - calendarWidget.okEnabled = false - - calendarWidget.day = day; - calendarWidget.month = month; - calendarWidget.year = year; - } - } - - Connections { - target: _incidenceview - onShowClockWidget: { - clockWidget.expand() - clockWidget.okEnabled = false - - // set the initial values - clockWidget.hours = hour; - clockWidget.minutes = minute; - } - } - - Connections { - target: clockWidget - onTimeChanged: { - _incidenceview.setNewTime( hour, minute ); - } - } - - Connections { - target: calendarWidget - onDateChanged: { - _incidenceview.setNewDate( day, month, year ); - } - } - - KPIM.MorePanel { - anchors.fill: parent - } - - KPIM.CalendarDialog { - id: calendarWidget - anchors.fill: parent - } - - KPIM.ClockDialog { - id: clockWidget - anchors.fill: parent - } - - PlasmaExtras.ScrollArea { - anchors.top: parent.top - anchors.bottom: collectionCombo.top - anchors.left: parent.left - anchors.right: parent.right - - anchors.topMargin: 40 - anchors.leftMargin: 40; - - flickableItem: Flickable { - contentHeight: generalEditor.height; - - IncidenceEditors.GeneralEditor { - id: generalEditor - anchors.fill: parent - } - } - } - - IncidenceEditors.CollectionCombo { - id: collectionCombo - anchors.bottom: parent.bottom; - anchors.right: cancelButton.left; - anchors.left: parent.left; - - height: parent.height / 6; - } - - KPIM.Button2 { - id: cancelButton - anchors.bottom: parent.bottom; - anchors.right: okButton.left; - width: height * 1.5; - height: collectionCombo.height - icon: KDE.iconPath( "dialog-cancel", 64 ); - onClicked: window.cancel(); - } - - KPIM.Button2 { - id: okButton; - anchors.bottom: parent.bottom; - anchors.right: parent.right; - width: height * 1.5; - height: collectionCombo.height - icon: KDE.iconPath( "document-save", 64 ); - onClicked: window.save(); - } -} diff --git a/kdepim/mobile/lib/calendar/incidenceview.cpp b/kdepim/mobile/lib/calendar/incidenceview.cpp deleted file mode 100644 index e6af6c4d..00000000 --- a/kdepim/mobile/lib/calendar/incidenceview.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 "incidenceview.h" -#include "calendarhelper.h" -#include "clockhelper.h" - -#include "ui_dialogmobile.h" - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "declarativeeditors.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -using namespace Akonadi; -using namespace IncidenceEditorNG; -using namespace KCalCore; -using namespace CalendarSupport; - -IncidenceView::IncidenceView( QWidget* parent ) - : KDeclarativeFullScreenView( QLatin1String( "incidence-editor" ), parent ) - , mItemManager( new EditorItemManager( this ) ) - , mCollectionCombo( 0 ) - , mEditor( new CombinedIncidenceEditor( parent ) ) - , mEditorDateTime( 0 ) - , mIncidenceMore( 0 ) - , mIncidenceGeneral( 0 ) - , mDateWidget( 0 ) - , mTimeWidget( 0 ) - , mIncidenceAttendee( 0 ) -{ - setAttribute(Qt::WA_DeleteOnClose); - QDeclarativeContext *context = engine()->rootContext(); - context->setContextProperty( QLatin1String("_incidenceview"), this ); -} - -void IncidenceView::doDelayedInit() -{ - qmlRegisterType( "org.kde.incidenceeditors", 4, 5, "CollectionCombo" ); - qmlRegisterType( "org.kde.incidenceeditors", 4, 5, "GeneralEditor" ); - qmlRegisterType( "org.kde.incidenceeditors", 4, 5, "MoreEditor" ); - qmlRegisterType( "CalendarHelper", 4, 5, "CalendarHelper" ); - qmlRegisterType( "ClockHelper", 4, 5, "ClockHelper" ); - - connect( mItemManager, SIGNAL(itemSaveFinished(IncidenceEditorNG::EditorItemManager::SaveAction)), - SLOT(slotSaveFinished(IncidenceEditorNG::EditorItemManager::SaveAction)) ); - connect( mItemManager, SIGNAL(itemSaveFailed(IncidenceEditorNG::EditorItemManager::SaveAction,QString)), - SLOT(slotSaveFailed(IncidenceEditorNG::EditorItemManager::SaveAction,QString)) ); -} - -IncidenceView::~IncidenceView() -{ - delete mEditor; -} - -void IncidenceView::load( const Akonadi::Item &item, const QDate &date ) -{ - Q_ASSERT( item.hasPayload() ); // TODO: Fetch payload if there is no payload set. - - mItem = item; - mItemManager->load( mItem ); - mActiveDate = date; - - if ( mCollectionCombo ) - mCollectionCombo->setDefaultCollection( mItem.parentCollection() ); -} - -void IncidenceView::setCollectionCombo( Akonadi::CollectionComboBox *combo ) -{ - mCollectionCombo = combo; - const KCalCore::Incidence::Ptr incidence = CalendarSupport::incidence( mItem ); - mCollectionCombo->setMimeTypeFilter( QStringList() << incidence->mimeType() ); - mCollectionCombo->setAccessRightsFilter( Collection::CanCreateItem ); - - if ( mDefaultCollection.isValid() ) - mCollectionCombo->setDefaultCollection( mDefaultCollection ); - else - mCollectionCombo->setDefaultCollection( mItem.parentCollection() ); -} - -void IncidenceView::setGeneralEditor( MobileIncidenceGeneral *editorWidget ) -{ - mIncidenceGeneral = editorWidget; - - Q_ASSERT( mItem.hasPayload() ); - Incidence::Ptr incidencePtr = CalendarSupport::incidence( mItem ); - - IncidenceEditorNG::IncidenceEditor *editor = new IncidenceEditorNG::IncidenceWhatWhere( editorWidget->mUi ); - mEditor->combine( editor ); - - Q_ASSERT( mEditorDateTime == 0 ); - mEditorDateTime = new IncidenceEditorNG::IncidenceDateTime( editorWidget->mUi ); - mEditorDateTime->setActiveDate( mActiveDate ); - connect( mEditorDateTime, SIGNAL(startDateFocus(QObject*)), this, SLOT(showCalendar(QObject*)) ); - connect( mEditorDateTime, SIGNAL(endDateFocus(QObject*)), this, SLOT(showCalendar(QObject*)) ); - connect( mEditorDateTime, SIGNAL(startTimeFocus(QObject*)), this, SLOT(showClock(QObject*)) ); - connect( mEditorDateTime, SIGNAL(endTimeFocus(QObject*)), this, SLOT(showClock(QObject*)) ); - mEditor->combine( mEditorDateTime ); - - editor = new IncidenceEditorNG::IncidenceCompletionPriority( editorWidget->mUi ); - mEditor->combine( editor ); - mEditor->load( incidencePtr ); - - const QStringList allEmails = IncidenceEditorNG::EditorConfig::instance()->allEmails(); - const KCalCore::Attendee::Ptr me = incidencePtr->attendeeByMails( allEmails ); - - if ( incidencePtr->attendeeCount() > 1 && - me && ( me->status() == KCalCore::Attendee::NeedsAction || - me->status() == KCalCore::Attendee::Tentative || - me->status() == KCalCore::Attendee::InProcess ) ) { - editorWidget->mUi->mInvitationBar->show(); - } else { - editorWidget->mUi->mInvitationBar->hide(); - } - - if ( mIncidenceMore != 0 ) { // IncidenceMore was set *before* general. - initIncidenceMore(); - - connect( editorWidget->mUi->mAcceptInvitationButton, SIGNAL(clicked()), - mIncidenceAttendee, SLOT(acceptForMe()), Qt::UniqueConnection ); - connect( editorWidget->mUi->mDeclineInvitationButton, SIGNAL(clicked()), - mIncidenceAttendee, SLOT(declineForMe()), Qt::UniqueConnection ); - } - - connect( editorWidget->mUi->mAcceptInvitationButton, SIGNAL(clicked()), - editorWidget->mUi->mInvitationBar, SLOT(hide()) ); - connect( editorWidget->mUi->mDeclineInvitationButton, SIGNAL(clicked()), - editorWidget->mUi->mInvitationBar, SLOT(hide()) ); -} - -void IncidenceView::showCalendar( QObject *obj ) -{ - /*### Workaround to force focus out, so - the dialog doesn't reopen incorrectly */ - mIncidenceMore->setFocus(); - - mDateWidget = qobject_cast( obj ); - if ( !mDateWidget ) - return; - - QDate date = mDateWidget->date(); - emit showCalendarWidget( date.day(), date.month(), date.year() ); -} - -void IncidenceView::setNewDate( int day, int month, int year ) -{ - if ( mDateWidget == 0 ) - return; - - mDateWidget->setDate( QDate( year, month, day ) ); -} - -void IncidenceView::showClock( QObject *obj ) -{ - /*### Workaround to force focus out, so - the dialog doesn't reopen incorrectly */ - mIncidenceMore->setFocus(); - mTimeWidget = qobject_cast( obj ); - if ( !mTimeWidget ) - return; - - QTime time = mTimeWidget->time(); - emit showClockWidget( time.hour(), time.minute() ); -} - -void IncidenceView::setNewTime( int hour, int minute ) -{ - if ( mTimeWidget == 0 ) - return; - - mTimeWidget->setTime( QTime( hour, minute ) ); -} - -void IncidenceView::initIncidenceMore() -{ - Q_ASSERT( mItem.hasPayload() ); - const Incidence::Ptr incidencePtr = CalendarSupport::incidence( mItem ); - - IncidenceEditorNG::IncidenceEditor *editor = new IncidenceEditorNG::IncidenceCategories( mIncidenceMore->mUi ); - mEditor->combine( editor ); - - editor = new IncidenceEditorNG::IncidenceDescription( mIncidenceMore->mUi ); - mEditor->combine( editor ); - - mIncidenceAttendee = new IncidenceEditorNG::IncidenceAttendee( 0, mEditorDateTime, mIncidenceMore->mUi ); - mEditor->combine( mIncidenceAttendee ); - - editor = new IncidenceEditorNG::IncidenceAlarm( mEditorDateTime, mIncidenceMore->mUi ); - mEditor->combine( editor ); - - Q_ASSERT( mEditorDateTime != 0 ); - editor = new IncidenceEditorNG::IncidenceRecurrence( mEditorDateTime, mIncidenceMore->mUi ); - mEditor->combine( editor ); - - editor = new IncidenceEditorNG::IncidenceSecrecy( mIncidenceMore->mUi ); - mEditor->combine( editor ); - - editor = new IncidenceEditorNG::IncidenceAttachment( mIncidenceMore->mUi ); - mEditor->combine( editor ); - mEditor->load( incidencePtr ); -} - -void IncidenceView::setMoreEditor( MobileIncidenceMore *editorWidget ) -{ - mIncidenceMore = editorWidget; - - if ( mEditorDateTime != 0 ) // IncidenceGeneral was not set yet. - initIncidenceMore(); - - if ( mIncidenceGeneral ) { - connect( mIncidenceGeneral->mUi->mAcceptInvitationButton, SIGNAL(clicked()), - mIncidenceAttendee, SLOT(acceptForMe()), Qt::UniqueConnection ); - connect( mIncidenceGeneral->mUi->mDeclineInvitationButton, SIGNAL(clicked()), - mIncidenceAttendee, SLOT(declineForMe()), Qt::UniqueConnection ); - } -} - -void IncidenceView::setDefaultCollection( const Akonadi::Collection &collection ) -{ - mDefaultCollection = collection; -} - -void IncidenceView::setIsCounterProposal( bool isCounterProposal ) -{ - mItemManager->setIsCounterProposal( isCounterProposal ); - //TODO_SERGIO - //mInvitationDispatcher->setIsCounterProposal( isCounterProposal ); -} - -/// ItemEditorUi methods - -bool IncidenceView::containsPayloadIdentifiers( const QSet &partIdentifiers ) const -{ - return partIdentifiers.contains( QByteArray( "PLD:RFC822" ) ); -} - -bool IncidenceView::hasSupportedPayload( const Akonadi::Item &item ) const -{ - return item.hasPayload() && item.hasPayload() - && ( item.hasPayload() || item.hasPayload() ); -} - -bool IncidenceView::isDirty() const -{ - return mEditor->isDirty(); -} - -bool IncidenceView::isValid() const -{ - return mEditor->isValid(); -} - -void IncidenceView::load( const Akonadi::Item &item ) -{ - Q_ASSERT( hasSupportedPayload( item ) ); - - mItem = item; - mEditor->load( CalendarSupport::incidence( item ) ); -} - -Akonadi::Item IncidenceView::save( const Akonadi::Item &item ) -{ - if ( !hasSupportedPayload( mItem ) ) { - kWarning() << "Item id=" << mItem.id() << "remoteId=" << mItem.remoteId() - << "mime=" << mItem.mimeType() << "does not have a supported MIME type"; - return item; - } - - KCalCore::Incidence::Ptr incidenceInEditor = mEditor->incidence(); - KCalCore::Incidence::Ptr incidence( incidenceInEditor->clone() ); - - mEditor->save( incidence ); - - // Mark the incidence as changed - if ( mItem.isValid() ) - incidence->setRevision( incidence->revision() + 1 ); - - Akonadi::Item result = item; - result.setPayload( incidence ); - result.setMimeType( mItem.mimeType() ); - return result; -} - -Akonadi::Collection IncidenceView::selectedCollection() const -{ - return mCollectionCombo->currentCollection(); -} - -void IncidenceView::reject( RejectReason /*reason*/, const QString &errorMessage ) -{ - kDebug() << "Rejecting:" << errorMessage; - deleteLater(); -} - -/// IncidenceView slots - -void IncidenceView::save() -{ - mEditor->focusInvalidField(); - if ( mEditor->isValid() ) { - if ( mCollectionCombo->currentCollection().isValid() ) { - mItemManager->save(); - } else { - KMessageBox::sorry( this, i18n( "Please select an account" ) ); - kDebug() << "No collection selected"; - } - } else { - kDebug() << "Editor content isn't valid because: " << mEditor->lastErrorString(); - } -} - -void IncidenceView::slotSaveFinished( IncidenceEditorNG::EditorItemManager::SaveAction action ) -{ - Q_UNUSED( action ); - deleteLater(); -} - -void IncidenceView::slotSaveFailed( IncidenceEditorNG::EditorItemManager::SaveAction action, - const QString &message ) -{ - Q_UNUSED( action ); - - QPointer dlg = new QMessageBox; //krazy:exclude=qclasses - dlg->setIcon( QMessageBox::Warning ); - dlg->setWindowTitle( i18n( "Saving the event failed." ) ); - dlg->setInformativeText( i18n( "Reason:\n\n" ) + message ); - dlg->addButton( i18n( "OK" ), QMessageBox::AcceptRole ); - dlg->exec(); - delete dlg; -} - -void IncidenceView::cancel() -{ - deleteLater(); -} - diff --git a/kdepim/mobile/lib/calendar/incidenceview.h b/kdepim/mobile/lib/calendar/incidenceview.h deleted file mode 100644 index 6626c6c6..00000000 --- a/kdepim/mobile/lib/calendar/incidenceview.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 INCIDENCEVIEW_H -#define INCIDENCEVIEW_H - -#include -#include -#include - -#include -#include - -#include "kdeclarativefullscreenview.h" - -class KDateComboBox; -class KJob; -class KTimeComboBox; -class QTimeEdit; -class QDateEdit; - -namespace Akonadi { -class CollectionComboBox; -} - -namespace IncidenceEditorNG { -class IncidenceAttendee; -class IncidenceDateTime; -} - -class MobileIncidenceGeneral; -class MobileIncidenceMore; - -class IncidenceView : public KDeclarativeFullScreenView, public IncidenceEditorNG::ItemEditorUi -{ - Q_OBJECT - public: - explicit IncidenceView( QWidget* parent = 0 ); - ~IncidenceView(); - - void load( const Akonadi::Item &item, const QDate &date ); - - void setCollectionCombo( Akonadi::CollectionComboBox * ); - void setGeneralEditor( MobileIncidenceGeneral * ); - void setMoreEditor( MobileIncidenceMore * ); - - void setDefaultCollection( const Akonadi::Collection &collection ); - void setIsCounterProposal( bool isCounterProposal ); - - public: /// ItemEditorUi function implementations - virtual bool containsPayloadIdentifiers( const QSet &partIdentifiers ) const; - virtual bool hasSupportedPayload( const Akonadi::Item &item ) const; - virtual bool isDirty() const; - virtual bool isValid() const; - virtual void load( const Akonadi::Item &item ); - virtual Akonadi::Item save( const Akonadi::Item &item ); - virtual Akonadi::Collection selectedCollection() const; - virtual void reject( RejectReason reason, const QString &errorMessage = QString() ); - - signals: - void showCalendarWidget( int day, int month, int year ); - void showClockWidget( int hour, int minute ); - - public slots: - void save(); /// Ok clicked in the user interface - void cancel(); /// Cancel clicked in the user interface - void showCalendar( QObject *obj ); - void setNewDate( int day, int month, int year ); - void showClock( QObject *obj ); - void setNewTime( int hour, int minute ); - - private slots: - void slotSaveFinished( IncidenceEditorNG::EditorItemManager::SaveAction action ); - void slotSaveFailed( IncidenceEditorNG::EditorItemManager::SaveAction action, - const QString &message ); - - private: - void doDelayedInit(); - void initIncidenceMore(); - - private: - QDate mActiveDate; - Akonadi::Item mItem; - IncidenceEditorNG::EditorItemManager *mItemManager; - Akonadi::CollectionComboBox *mCollectionCombo; - Akonadi::Collection mDefaultCollection; - IncidenceEditorNG::CombinedIncidenceEditor *mEditor; - IncidenceEditorNG::IncidenceDateTime *mEditorDateTime; - - /// We need this because we can't rely on the order in which those two are added. - MobileIncidenceMore *mIncidenceMore; - MobileIncidenceGeneral *mIncidenceGeneral; - - KDateComboBox *mDateWidget; - KTimeComboBox *mTimeWidget; - IncidenceEditorNG::IncidenceAttendee *mIncidenceAttendee; -}; - -#endif // INCIDENCEVIEW_H diff --git a/kdepim/mobile/lib/calendar/kcalitembrowseritem.cpp b/kdepim/mobile/lib/calendar/kcalitembrowseritem.cpp deleted file mode 100644 index c19d5a8c..00000000 --- a/kdepim/mobile/lib/calendar/kcalitembrowseritem.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "kcalitembrowseritem.h" - -#include - -using namespace CalendarSupport; -using namespace CalendarSupport::KCal; - -ExtendedIncidenceViewer::ExtendedIncidenceViewer( const Akonadi::ETMCalendar::Ptr &calendar, QWidget *parent ) - : IncidenceViewer( calendar.data(), parent ) -{ -} - -void ExtendedIncidenceViewer::itemRemoved() -{ - emit incidenceRemoved(); -} - - -KCalItemBrowserItem::KCalItemBrowserItem(QDeclarativeItem* parent) : DeclarativeAkonadiItem(parent) -{ - m_viewer = new ExtendedIncidenceViewer( Akonadi::ETMCalendar::Ptr() ); - connect( m_viewer, SIGNAL(incidenceRemoved()), SIGNAL(incidenceRemoved()) ); - - setWidget( m_viewer ); -} - -KCalItemBrowserItem::~KCalItemBrowserItem() -{ - delete m_viewer; -} - -Akonadi::Item KCalItemBrowserItem::item() const -{ - return m_viewer->item(); -} - -qint64 KCalItemBrowserItem::itemId() const -{ - return m_viewer->item().id(); -} - -void KCalItemBrowserItem::setItemId(qint64 id) -{ - m_viewer->setItem( Akonadi::Item( id ) ); - emit attachmentModelChanged(); -} - -QDate KCalItemBrowserItem::activeDate() const -{ - return m_viewer->activeDate(); -} - -void KCalItemBrowserItem::setActiveDate( const QDate &date ) -{ - m_viewer->setIncidence( m_viewer->item(), date ); -} - -QObject* KCalItemBrowserItem::attachmentModel() const -{ - return m_viewer->attachmentModel(); -} - diff --git a/kdepim/mobile/lib/calendar/kcalitembrowseritem.h b/kdepim/mobile/lib/calendar/kcalitembrowseritem.h deleted file mode 100644 index 1729737c..00000000 --- a/kdepim/mobile/lib/calendar/kcalitembrowseritem.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 KCALITEMBROWSERITEM_H -#define KCALITEMBROWSERITEM_H - -#include "declarativeakonadiitem.h" - -#include -#include -#include - -namespace CalendarSupport { - -class Item; - -namespace KCal { - -/** - * @short A wrapper class to make the 'removed' signal available. - */ -class ExtendedIncidenceViewer : public IncidenceViewer -{ - Q_OBJECT - - public: - explicit ExtendedIncidenceViewer( const Akonadi::ETMCalendar::Ptr &calendar, QWidget *parent = 0 ); - - Q_SIGNALS: - void incidenceRemoved(); - - private: - virtual void itemRemoved(); -}; - -class KCalItemBrowserItem : public DeclarativeAkonadiItem -{ - Q_OBJECT - Q_PROPERTY( QObject* attachmentModel READ attachmentModel NOTIFY attachmentModelChanged ) - Q_PROPERTY( QDate activeDate WRITE setActiveDate READ activeDate ) - public: - explicit KCalItemBrowserItem( QDeclarativeItem *parent = 0 ); - virtual ~KCalItemBrowserItem(); - - virtual Akonadi::Item item() const; - virtual qint64 itemId() const; - virtual void setItemId(qint64 id); - - /** - * Sets the active date for the incidence. The active date is used for - * incideces that have recurrence. - */ - QDate activeDate() const; - void setActiveDate( const QDate &date ); - - QObject *attachmentModel() const; - - Q_SIGNALS: - void attachmentModelChanged(); - void incidenceRemoved(); - - private: - ExtendedIncidenceViewer *m_viewer; -}; - -} -} - -#endif /* KCALITEMBROWSERITEM_H */ diff --git a/kdepim/mobile/lib/calendar/mobileuicalendar_export.h b/kdepim/mobile/lib/calendar/mobileuicalendar_export.h deleted file mode 100644 index b9b8224f..00000000 --- a/kdepim/mobile/lib/calendar/mobileuicalendar_export.h +++ /dev/null @@ -1,39 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 David Faure - - 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 MOBILEUICALENDAR_EXPORT_H -#define MOBILEUICALENDAR_EXPORT_H - -/* needed for KDE_EXPORT and KDE_IMPORT macros */ -#include -#define MOBILEUICALENDAR_EXPORT - -#ifndef MOBILEUICALENDAR_EXPORT -# if defined(KDEPIM_STATIC_LIBS) || defined(KDEPIMMOBILEUICALENDAR_STATIC_LIB) - /* No export/import for static libraries */ -# define MOBILEUICALENDAR_EXPORT -# elif defined(MAKE_KDEPIMMOBILEUICALENDAR_LIB) - /* We are building this library */ -# define MOBILEUICALENDAR_EXPORT KDE_EXPORT -# else - /* We are using this library */ -# define MOBILEUICALENDAR_EXPORT KDE_IMPORT -# endif -#endif - -#endif // MOBILEUICALENDAR_EXPORT_H diff --git a/kdepim/mobile/lib/collectionfetchwatcher.cpp b/kdepim/mobile/lib/collectionfetchwatcher.cpp deleted file mode 100644 index f9f1f1d8..00000000 --- a/kdepim/mobile/lib/collectionfetchwatcher.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "collectionfetchwatcher.h" - -#include -#include - -#include - -using namespace AkonadiFuture; - -class CollectionFetchWatcher::Private -{ - public: - Private( CollectionFetchWatcher *qq, const QModelIndex &index, const QAbstractItemModel *model ) - : q( qq ), mIndex( index ), mModel( model ) - { - } - - void dataChanged( const QModelIndex &index, const QModelIndex& ) - { - if ( index != mIndex ) - return; - - if ( mIndex.data( Akonadi::EntityTreeModel::FetchStateRole ).toInt() == Akonadi::EntityTreeModel::IdleState ) { - q->disconnect( mModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - q, SLOT(dataChanged(QModelIndex,QModelIndex)) ); - - emit q->collectionFetched( mIndex ); - - q->deleteLater(); - } - } - - CollectionFetchWatcher *q; - QPersistentModelIndex mIndex; - const QAbstractItemModel *mModel; -}; - -CollectionFetchWatcher::CollectionFetchWatcher( const QModelIndex &index, const QAbstractItemModel *model, QObject *parent ) - : QObject( parent ), d( new Private( this, index, model ) ) -{ - Q_ASSERT( d->mIndex.model() == d->mModel ); // make sure we work on the right indexes/model -} - -CollectionFetchWatcher::~CollectionFetchWatcher() -{ - delete d; -} - -void CollectionFetchWatcher::start() -{ - const Akonadi::Collection collection = d->mIndex.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - Q_ASSERT( collection.isValid() ); - - if ( collection.statistics().count() == 0 ) { - // no reason to wait, this collection does not contain any items - emit collectionFetched( d->mIndex ); - deleteLater(); - return; - } - - // check if the loading has been finished already - if ( d->mIndex.data( Akonadi::EntityTreeModel::FetchStateRole ).toInt() == Akonadi::EntityTreeModel::IdleState ) { - emit collectionFetched( d->mIndex ); - deleteLater(); - return; - } - - // start our work - connect( d->mModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(dataChanged(QModelIndex,QModelIndex)) ); -} - -#include "moc_collectionfetchwatcher.cpp" diff --git a/kdepim/mobile/lib/collectionfetchwatcher.h b/kdepim/mobile/lib/collectionfetchwatcher.h deleted file mode 100644 index 27fe38a7..00000000 --- a/kdepim/mobile/lib/collectionfetchwatcher.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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_COLLECTIONFETCHWATCHER_H -#define AKONADI_COLLECTIONFETCHWATCHER_H - -#include "mobileui_export.h" - -#include - -class QAbstractItemModel; -class QModelIndex; - -namespace AkonadiFuture { - -/** - * @short A class that encapsulates logic to wait for an collection to be completely loaded into a model. - * - * @author Tobias Koenig - */ -class MOBILEUI_EXPORT CollectionFetchWatcher : public QObject -{ - Q_OBJECT - - public: - /** - * Creates a new collection fetch watcher. - * - * @param index The model index of the collection to wait for. - * @param model The model to work on. - * @param parent The parent object. - */ - CollectionFetchWatcher( const QModelIndex &index, const QAbstractItemModel *model, QObject *parent = 0 ); - - /** - * Destroys the collection fetch watcher. - */ - ~CollectionFetchWatcher(); - - /** - * Starts watching the collection. - */ - void start(); - - Q_SIGNALS: - /** - * This signal is emitted when the watched collection at @p index has been loaded completely into - * the model. - */ - void collectionFetched( const QModelIndex &index ); - - private: - //@cond PRIVATE - class Private; - Private* const d; - - Q_PRIVATE_SLOT( d, void dataChanged( const QModelIndex&, const QModelIndex& ) ) - //@endcond -}; - -} - -#endif diff --git a/kdepim/mobile/lib/declarativeakonadiitem.cpp b/kdepim/mobile/lib/declarativeakonadiitem.cpp deleted file mode 100644 index 77dbce8e..00000000 --- a/kdepim/mobile/lib/declarativeakonadiitem.cpp +++ /dev/null @@ -1,222 +0,0 @@ -#include "declarativeakonadiitem.h" - -#include - -#include -#include -#include -#include -#include -#include - -#include - -static double sDirectionThreshHold = 8.5; /// Threshold in pixels - -/// DeclarativeAkonadiItemPrivate - -struct DeclarativeAkonadiItemPrivate -{ -/// Enum - enum Direction { - Unknown, /// Need more events to determin the actual direction. - Up, - Down, - Left, - Right - }; - -/// Members - QGraphicsProxyWidget *mProxy; - - /// Handle mouse events for clicks and swipes - QTimer mClickDetectionTimer; - bool mMousePressed; - int mDx; - int mDy; - double mSwipeLength; - -/// Methods - DeclarativeAkonadiItemPrivate(); - Direction direction() const; -}; - -DeclarativeAkonadiItemPrivate::DeclarativeAkonadiItemPrivate() - : mProxy( 0 ) - , mMousePressed( false ) - , mDx( 0 ) - , mDy( 0 ) - , mSwipeLength( 0 ) -{ } - -DeclarativeAkonadiItemPrivate::Direction DeclarativeAkonadiItemPrivate::direction() const -{ - const double length = qSqrt( ( mDx ^ 2 ) + ( mDy ^ 2 ) ); - if (length < sDirectionThreshHold ) - return Unknown; - - bool horizontal = false; - if ( mDx != 0 ) { - // We Use an X shape to determine the direction of the move. - // tan(45) == 1; && tan(-45) == -1; Same for 135 and 225 degrees - double angle = mDy / mDx; - horizontal = angle > -1 && angle <= 1; - } - - Direction dir; - if ( horizontal ) { - dir = mDx > 0 ? Right : Left; - } else { - dir = mDy > 0 ? Up : Down; - } - - return dir; -} - -/// DeclarativeAkonadiItem - -DeclarativeAkonadiItem::DeclarativeAkonadiItem( QDeclarativeItem *parent ) - : QDeclarativeItem( parent ) - , d_ptr( new DeclarativeAkonadiItemPrivate ) -{ - Q_D( DeclarativeAkonadiItem ); - - d->mClickDetectionTimer.setInterval( 150 ); - d->mClickDetectionTimer.setSingleShot( true ); - - d->mProxy = new QGraphicsProxyWidget( this ); - d->mProxy->installEventFilter( this ); -} - -DeclarativeAkonadiItem::~DeclarativeAkonadiItem() -{ - // Weird, the proxy seems to be already deleted at this point. If we get crashes - // related to events we need to do this different. - //d_ptr->mProxy->removeEventFilter( this ); - delete d_ptr; -} - -Akonadi::Item DeclarativeAkonadiItem::item() const -{ - return Akonadi::Item( itemId() ); -} - -void DeclarativeAkonadiItem::setWidget( QWidget *widget ) -{ - Q_D( DeclarativeAkonadiItem ); - - if ( QWidget *curWidget = d->mProxy->widget() ) - delete curWidget; - - d->mProxy->setWidget( widget ); -} - -double DeclarativeAkonadiItem::swipeLength() const -{ - Q_D( const DeclarativeAkonadiItem ); - return d->mSwipeLength; -} - -void DeclarativeAkonadiItem::setSwipeLength( double length ) -{ - Q_D( DeclarativeAkonadiItem ); - Q_ASSERT( length >= 0 && length <= 1 ); - d->mSwipeLength = length; -} - -void DeclarativeAkonadiItem::geometryChanged( const QRectF &newGeometry, - const QRectF&oldGeometry ) -{ - Q_D( DeclarativeAkonadiItem ); - QDeclarativeItem::geometryChanged( newGeometry, oldGeometry ); - d->mProxy->resize( newGeometry.size() ); -} - -bool DeclarativeAkonadiItem::eventFilter( QObject *obj, QEvent *ev ) -{ - Q_D( DeclarativeAkonadiItem ); - - if ( ev->type() == QEvent::GraphicsSceneMousePress ) { - QGraphicsSceneMouseEvent *mev = static_cast( ev ); - if ( mev->button() == Qt::LeftButton ) { - d->mMousePressed = true; - d->mClickDetectionTimer.stop(); // Make sure that it isn't running atm - d->mClickDetectionTimer.start(); - return true; - } - } else if ( ev->type() == QEvent::GraphicsSceneMouseRelease ) { - const bool wasActive = d->mClickDetectionTimer.isActive(); - QGraphicsSceneMouseEvent *mev = static_cast( ev ); - if ( mev->button() == Qt::LeftButton ) { - if ( wasActive ) // Timer didn't time out, we're dealing with a click - simulateMouseClick( mev->pos().toPoint() ); - else if ( qAbs( d->mDx ) >= ( d->mSwipeLength * width() ) ) { - // We don't trigger a next or previous *always*. Only when the configured - // swipelength is met. - const DeclarativeAkonadiItemPrivate::Direction dir = d->direction(); - if ( dir == DeclarativeAkonadiItemPrivate::Left ) { - emit nextItemRequest(); - } else if ( dir == DeclarativeAkonadiItemPrivate::Right ) { - emit previousItemRequest(); - } - } - - d->mMousePressed = false; - d->mDx = 0; - d->mDy = 0; - return true; - } - } else if ( ev->type() == QEvent::GraphicsSceneMouseMove && d->mMousePressed ) { - QGraphicsSceneMouseEvent *mev = static_cast( ev ); - d->mDx += mev->pos().x() - mev->lastPos().x(); // Moving to right gives positive values - d->mDy += mev->pos().y() - mev->lastPos().y(); // Moving up gives positive values - - const DeclarativeAkonadiItemPrivate::Direction dir = d->direction(); - if ( dir == DeclarativeAkonadiItemPrivate::Unknown ) - return true; - if ( dir == DeclarativeAkonadiItemPrivate::Up ) { - scrollUp( d->mDy ); - d->mDx = 0; - d->mDy = 0; - } else if ( dir == DeclarativeAkonadiItemPrivate::Down ) { - scrollDown( d->mDy ); - d->mDx = 0; - d->mDy = 0; - } - - return true; - } - - return QObject::eventFilter( obj, ev ); -} - -void DeclarativeAkonadiItem::scrollDown( int dist ) -{ - QAbstractScrollArea *sa = qFindChild( d_ptr->mProxy->widget() ); - if ( sa ) { - // TODO make this actually scroll by the given pixel value - sa->verticalScrollBar()->setValue( sa->verticalScrollBar()->value() - dist ); - } -} - -void DeclarativeAkonadiItem::scrollUp( int dist ) -{ - scrollDown( dist ); -} - -void DeclarativeAkonadiItem::simulateMouseClick( const QPoint &pos ) -{ - if ( !d_ptr->mProxy->widget() ) - return; - QWidget *receiver = d_ptr->mProxy->widget()->childAt( pos ); - if ( receiver ) { - QPoint mappedPos = pos; - if ( receiver != d_ptr->mProxy->widget() ) - mappedPos = receiver->mapFrom( d_ptr->mProxy->widget(), pos ); - QMouseEvent *event = new QMouseEvent( QEvent::MouseButtonPress, mappedPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier ); - QCoreApplication::sendEvent( receiver, event ); - event = new QMouseEvent( QEvent::MouseButtonRelease, mappedPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier ); - QCoreApplication::sendEvent( receiver, event ); - } -} - diff --git a/kdepim/mobile/lib/declarativeakonadiitem.h b/kdepim/mobile/lib/declarativeakonadiitem.h deleted file mode 100644 index c614e4d8..00000000 --- a/kdepim/mobile/lib/declarativeakonadiitem.h +++ /dev/null @@ -1,88 +0,0 @@ -#ifndef DECLARATIVEAKONADIITEM_H -#define DECLARATIVEAKONADIITEM_H - -#include - -#include - -#include "mobileui_export.h" - -class DeclarativeAkonadiItemPrivate; - -class MOBILEUI_EXPORT DeclarativeAkonadiItem : public QDeclarativeItem -{ - Q_OBJECT - Q_PROPERTY( Akonadi::Item item READ item ) - Q_PROPERTY( int itemId READ itemId WRITE setItemId ) - Q_PROPERTY( double swipeLength READ swipeLength WRITE setSwipeLength ) - -public: - /** - * Returns the current Akonadi::Item. The default implementation returns an - * item without payload. - */ - virtual Akonadi::Item item() const; - - /** - * Set/get the Akonadi::Item::Id. We use quint64 here so we can deal with - * the id in QML files too. - */ - virtual qint64 itemId() const = 0; - virtual void setItemId( qint64 id ) = 0; - - /** - * The length, expressed as percentage of the width, which trigers the next - * or previous requests. - * - * Value must be between 0 and 1. - */ - double swipeLength() const; - void setSwipeLength( double length ); - -signals: - void nextItemRequest(); - void previousItemRequest(); - -protected: - explicit DeclarativeAkonadiItem( QDeclarativeItem *parent = 0 ); - ~DeclarativeAkonadiItem(); - - /** - * Sets the widget that show the current item. If a widget currently is set, - * it will be deleted. - */ - void setWidget( QWidget *widget ); - - /** Reimplement QObject::eventFilter() for swiping */ - virtual bool eventFilter( QObject *obj, QEvent *event ); - - /** Reimplement QObject::geometryChanged() to update the size of the internal widget */ - virtual void geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry); - - /** - * Are called by the event filter when when a vertical drag is detected. By - * default these functions do nothing. Subclasses should reimplement them when - * needed. - * - * @param dist the distance in pixels to scroll. - */ - virtual void scrollDown( int dist ); - virtual void scrollUp( int dist ); - - /** - * A mouse click was detected by the custom event handling. If you need to - * pass through mouse clicks to an internal widget, reimplement this method. - * - * Note: We assume usage on a device, which has not the concept of left or right - * mouse buttons as it is operated with a finger. Therefore, on normal - * systems this method is only triggered for left mouse button clicks. - */ - virtual void simulateMouseClick( const QPoint &pos ); - -private: - DeclarativeAkonadiItemPrivate * const d_ptr; - Q_DECLARE_PRIVATE( DeclarativeAkonadiItem ) - Q_DISABLE_COPY( DeclarativeAkonadiItem ) -}; - -#endif // DECLARATIVEAKONADIITEM_H diff --git a/kdepim/mobile/lib/declarativewidgetbase.cpp b/kdepim/mobile/lib/declarativewidgetbase.cpp deleted file mode 100644 index 95fbe1d7..00000000 --- a/kdepim/mobile/lib/declarativewidgetbase.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "declarativewidgetbase.h" - -#include "stylesheetloader.h" - -#include -#include - -DeclarativeWidgetBaseHelper::DeclarativeWidgetBaseHelper( QWidget * widget, QGraphicsItem * parent, const RegisterFunction & registerFunc ) - : QGraphicsProxyWidget( parent ), - m_registerFunc( registerFunc ), - m_widget( widget ) -{ - Q_ASSERT( m_widget ); - - QPalette pal = m_widget->palette(); - pal.setColor( QPalette::Window, QColor( 0, 0, 0, 0 ) ); - m_widget->setPalette( pal ); - StyleSheetLoader::applyStyle( m_widget ); - setWidget( m_widget ); - setFocusPolicy( Qt::StrongFocus ); -} - -DeclarativeWidgetBaseHelper::~DeclarativeWidgetBaseHelper() -{ -} - -QVariant DeclarativeWidgetBaseHelper::itemChange( GraphicsItemChange change, const QVariant & value ) -{ - if ( !m_registerFunc.empty() ) - if ( change == ItemSceneHasChanged ) - if ( QGraphicsScene* scene = value.value() ) - Q_FOREACH( QGraphicsView * v, scene->views() ) - m_registerFunc( v, m_widget ); - return QGraphicsProxyWidget::itemChange ( change, value ); -} - -QString DeclarativeWidgetBaseHelper::styleSheet() const -{ - return m_widget->styleSheet(); -} - -void DeclarativeWidgetBaseHelper::setStyleSheet(const QString& styleSheet) -{ - m_widget->setStyleSheet( styleSheet ); -} - diff --git a/kdepim/mobile/lib/declarativewidgetbase.h b/kdepim/mobile/lib/declarativewidgetbase.h deleted file mode 100644 index b83b6936..00000000 --- a/kdepim/mobile/lib/declarativewidgetbase.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 DECLARATIVEWIDGETBASE_H -#define DECLARATIVEWIDGETBASE_H - -#include "mobileui_export.h" - -#include - -#include - -class QGraphicsView; -class QWidget; - -/** - \internal -*/ -class MOBILEUI_EXPORT DeclarativeWidgetBaseHelper : public QGraphicsProxyWidget -{ - Q_OBJECT - Q_PROPERTY( QString styleSheet READ styleSheet WRITE setStyleSheet ) -public: - QString styleSheet() const; - void setStyleSheet( const QString &styleSheet ); - -protected: - typedef boost::function RegisterFunction; - DeclarativeWidgetBaseHelper( QWidget * widget, QGraphicsItem *parent, const RegisterFunction & registerFunc ); - ~DeclarativeWidgetBaseHelper(); - - QWidget * widget() const { return m_widget; } - -protected: - /* reimp */ QVariant itemChange( GraphicsItemChange change, const QVariant & value ); - -private: - const RegisterFunction m_registerFunc; - QWidget * m_widget; -}; - -template -class DeclarativeWidgetBase : public DeclarativeWidgetBaseHelper -{ - public: - explicit DeclarativeWidgetBase( QGraphicsItem *parent = 0 ) - : DeclarativeWidgetBaseHelper( new WidgetT, parent, ¬ify ) {} - - /** use this constructor if you inherit from this template to customize widget construction. */ - DeclarativeWidgetBase( WidgetT *widget, QGraphicsItem *parent ) - : DeclarativeWidgetBaseHelper( widget, parent, ¬ify ) {} - - protected: - WidgetT * widget() const { return static_cast( DeclarativeWidgetBaseHelper::widget() ); } - - private: - static void notify( QGraphicsView * v, QWidget * w ) { - if ( ViewT * view = qobject_cast( v ) ) - (view->*registerFunc)( static_cast( w ) ); - } -}; - -#endif diff --git a/kdepim/mobile/lib/docs/CMakeLists.txt b/kdepim/mobile/lib/docs/CMakeLists.txt deleted file mode 100644 index 080c5cfd..00000000 --- a/kdepim/mobile/lib/docs/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -# install in data dir because docs are getting removed on maemo automatically by docpurge -install(FILES de/index.html DESTINATION ${DATA_INSTALL_DIR}/kontact-touch/de/manual/) -install(FILES en/index.html DESTINATION ${DATA_INSTALL_DIR}/kontact-touch/en/manual/) diff --git a/kdepim/mobile/lib/docs/de/index.html b/kdepim/mobile/lib/docs/de/index.html deleted file mode 100644 index a4da898c..00000000 --- a/kdepim/mobile/lib/docs/de/index.html +++ /dev/null @@ -1,26 +0,0 @@ - - -

Willkommen zu Kontact Touch!

-

Dieses Dokument dient dazu, Ihnen mit ein paar Tipps den Einstieg in die Benutzung der Kontact Touch Applikationen (Mail, Adressen, Termine, Aufgaben und Notizen) zu vereinfachen. Weiterführende Informationen stehen Ihnen jederzeit im Internet zur Verfügung (s.u.).

-

Benutzung von Kontact Touch

-

Navigation

-

Auf der linken Seite finden Sie die Navigationsleiste. Hier können Sie durch Antippen der Ordnernamen durch Ihre Ordner navigieren. Der aktuell ausgewählte Ordner ist nach oben und unten von den anderen Ordnern abgegrenzt.

-

Aktionen

-

Ganz auf der linken Seite finden Sie in der Regel eine oder mehrere so genannte "Laschen". Darunter findet sich in der Regel eine mit der Aufschrift "Aktionen". Diese Laschen können Sie herausziehen indem Sie von links nach rechts darüber streichen. So wird verhindert, dass Sie aus Versehen den Ordner wechseln, obwohl Sie eigentlich eine Aktion ausführen wollten.

-

Das so geöffnete Aktionsmenü bietet Ihnen immer eine Auswahl von Aktionen an, die sich je nach Ansicht ändern. So können Sie im Aktionsmenü der "Home"-Ansicht grundlegende Konfigurationen vornehmen, wie ein neues Account hinzufügen. Öffnen Sie das Menü aus einer Ansicht in der beispielsweise mehrere Mails dargestellt werden, so finden Sie im Aktionsmenu Möglichkeiten, mit diesen Mails zu arbeiten (etwa verschieben, löschen oder darauf zu antworten).

-

Auswahl einzelner Objekte

-

Möchten Sie einzelne Objekte (z.B. eine Mail) auswählen, um diese zu lesen, so tippen Sie einfach in der Liste auf dieses Objekt. Es wird dann geöffnet. In dieser Ansicht können Sie durch Streichen nach oben oder unten die nicht sichtbare Teile des Objekts erreichen ("Scrollen"). Streichen Sie nach rechts oder links, so blättern Sie durch die Liste der Objekte - es wird also das nächste oder vorhergehende Objekt der Liste geladen. Zusätzlich finden Sie im rechten unteren Bereich des Objekts ein oder mehrere Icons. Eines davon symbolisiert eine Liste und bringt Sie aus der Ansicht eines Objekts zurück in den Navigationsmodus.

-

Erste Schritte

-

Legen Sie als erstes im "Aktionen"-Menu der "Home"-Ansicht unter dem Punkt "Konten" Ihre vorhanden E-Mail und Groupware Konten an. Bitte beachten Sie, dass die nachfolgende erste Synchronisation sehr lange dauern kann. Ist diese einmalig erfolgt, sollte Kontact Touch flüssig laufen.

-

Tipps und Tricks

-

Auswahl mehrerer Ordner

-

In der "Home"-Ansicht finden Sie unten rechts einen Button mit der Aufschrift "Auswählen". Tippen Sie darauf, so haben Sie die Möglichkeit, mehrere Ordner gleichzeitig auszuwählen und nach tippen auf "Fertig" anzeigen zu lassen. Zur Auswahl der Ordner können Sie wie gewohnt auf der linken Seite durch Ihre Ordner navigieren und die gewünschten Ordner dann auf die rechte Seite ziehen.

-

Häufig benötigte Ansichten

-

Gibt es eine Ansicht mit einem oder mehreren Ordnern, die Sie besonders häufig benötigen, so finden Sie im Aktionsmenü den Punkt "Als Favorit hinzufügen". Wählen Sie diesen aus, so können Sie einen Namen festlegen unter dem Sie diese Ansicht direkt aus der "Home"-Ansicht heraus anwählen können. So können Sie schnell in alle häufig benötigten Ansichten wechseln.

-

Bearbeiten vieler Objekte

-

Möchten Sie die gleiche Aktion mit vielen Objekten in einer Ansicht gleichzeitig machen (z.B. mehrere Mails in einen bestimmten Ordner verschieben), so können Sie in der Navigation auf den bereits ausgewählten Ordner nochmals antippen. Die Ansicht wechselt daraufhin in den "Massenbearbeitungsmodus". Tippen Sie nun auf ein Objekt, so wird dieses lediglich ausgewählt. Sie haben nun auf der linken Seite die Möglichkeit, bestimmte Aktionen mit den ausgewählten Objekten durchzuführen (z.B. Verschieben). Sie können diesen "Massenbearbeitungsmodus" wieder verlassen, indem Sie auf den nach links weisenden Pfeil unterhalb des Ordnernamens tippen.

-

Weitere Informationen

-

Es gibt zahlreiche weitere Informations- und Hilfequellen für Sie. Diese finden Sie im Internet unter: http://userbase.kde.org/Kontact_Touch

-

Das Entwicklungsteam wünscht Ihnen viel Spaß mit Kontact Touch. Wir hoffen, dass Ihnen das Produkt gefällt und freuen uns über Ihr Feedback!

- - diff --git a/kdepim/mobile/lib/docs/en/index.html b/kdepim/mobile/lib/docs/en/index.html deleted file mode 100644 index 40ade5da..00000000 --- a/kdepim/mobile/lib/docs/en/index.html +++ /dev/null @@ -1,26 +0,0 @@ - - -

Welcome to Kontact Touch!

-

The purpose of this document is to provide you a few tips on how to use the Kontact Touch applications (mail, contacts, appointments, tasks and notes). Further information is available at any time on the Internet (see below).

-

Using Kontact Touch

-

Navigation

-

On the left you find the navigation bar. Here you can tap on the folder names to navigate through your folders. The currently selected folder is bounded to the top and to the bottom from other folders.

-

Actions

-

Completely on the left you will usually find one or more so-called 'flaps'. Among them there usually is one labeled 'Actions'. You can pull out these flaps by swiping them from left to right. This prevents you from accidentally changing the folder even though you actually wanted to perform an action.

-

The hereby opened action menu always offers you a range of actions that change depending on the view. In the action menu of the 'Home'-view you can do basic configurations, such as adding a new account. If you open the menu from a view that for example displays several mails, you will find options to work with these messages (such as moving, deleting, or replying to them).

-

Select individual objects

-

To select individual objects (e.g. an email) in order to read them, you simply tap on that object in the list. It will then open. In this view you can reach the non-visible parts of the object by swiping up or down. By swiping right or left, you will scroll through the list of objects - in other words the next or previous item of the list will get loaded. In addition, in the lower right corner of the object you will find one or more icons. One of them symbolizes a list and returns you from the object-view to the navigation mode.

-

Getting Started

-

First thing you should do is to set-up your existing e-mail and groupware accounts in the 'Actions' menu of the 'Home' view under 'accounts'. Please note that the first synchronization may take a very long time. After this had happened once, Kontact Touch should run smoothly.

-

Tips and Tricks

-

Select multiple folders

-

In the 'home' view you find in the bottom right a button labeled 'Select'. Tap it to have the option to select multiple folders and to show them in one view after tap 'done'. To select the folders you can navigate as usual through your folders on the left side and drag the desired folders to the right side.

-

Frequently needed views

-

Is there a view containing one or more folders that you need more often, you will find in the action menu the option 'Add as Favorite'. If you select this option, you can specify a name under which you can subsequently select it directly out of your 'Home' view. This way you can quickly change between all frequently needed views.

-

Editing multiple objects

-

If you want to perform the same action simultaneously with multiple objects in a view (e.g. move multiple messages to a particular folder), you can tap on the already selected folder again. The view then switches to the 'bulk edit' mode. If you then tap an object, it will only be selected. On the left side you now have several options to perform actions with the selected objects (e.g. moving). You can leave the 'bulk edit' mode by tapping the left-pointing arrow below the folder name.

-

More information

-

There are many other sources of information and help for you. These can be found at: http://userbase.kde.org/Kontact_Touch

-

The development team wishes you much fun with Kontact touch. We hope you will enjoy the product and we are looking forward to your feedback!

- - diff --git a/kdepim/mobile/lib/exporthandlerbase.cpp b/kdepim/mobile/lib/exporthandlerbase.cpp deleted file mode 100644 index ad3e0615..00000000 --- a/kdepim/mobile/lib/exporthandlerbase.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "exporthandlerbase.h" - -#include -#include -#include -#include -#include - -#include - -ExportHandlerBase::ExportHandlerBase( QObject *parent ) - : QObject( parent ), - mSelectionModel( 0 ), - mItemSelectionModel( 0 ) -{ -} - -ExportHandlerBase::~ExportHandlerBase() -{ -} - -void ExportHandlerBase::setSelectionModel( QItemSelectionModel *model ) -{ - mSelectionModel = model; -} - -void ExportHandlerBase::setItemSelectionModel( QItemSelectionModel *model ) -{ - mItemSelectionModel = model; -} - -void ExportHandlerBase::exec() -{ - Akonadi::Collection::List selectedCollections; - - if ( mSelectionModel ) { - const QModelIndexList indexes = mSelectionModel->selectedRows(); - foreach ( const QModelIndex &index, indexes ) { - const Akonadi::Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( collection.isValid() ) - selectedCollections << collection; - } - } - - bool exportAllItems = false; - if ( mSelectionModel && !selectedCollections.isEmpty() ) { - switch ( KMessageBox::questionYesNo( 0, dialogText(), QString(), - KGuiItem( dialogAllText() ), - KGuiItem( dialogLocalOnlyText() ) ) ) { - case KMessageBox::Yes: - exportAllItems = true; - break; - case KMessageBox::No: // fall through - default: - exportAllItems = false; - } - } else { - if ( !mItemSelectionModel ) { - exportAllItems = true; - } - } - - Akonadi::Item::List items; - if ( exportAllItems ) { - Akonadi::RecursiveItemFetchJob *job = new Akonadi::RecursiveItemFetchJob( Akonadi::Collection::root(), mimeTypes() ); - job->fetchScope().fetchFullPayload(); - - job->exec(); - - items << job->items(); - } else { - if ( !mItemSelectionModel ) { - foreach ( const Akonadi::Collection &collection, selectedCollections ) { - Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( collection ); - job->fetchScope().fetchFullPayload(); - - if ( job->exec() ) - items << job->items(); - } - } else { - // use the selected item - foreach ( const QModelIndex &index, mItemSelectionModel->selectedRows() ) { - const Akonadi::Item item = index.data( Akonadi::EntityTreeModel::ItemRole ).value(); - if ( item.isValid() ) { - items << item; - } else { - kDebug() << "Invalid item encountered during export!"; - } - } - } - } - - exportItems( items ); - - deleteLater(); -} - diff --git a/kdepim/mobile/lib/exporthandlerbase.h b/kdepim/mobile/lib/exporthandlerbase.h deleted file mode 100644 index f5c595de..00000000 --- a/kdepim/mobile/lib/exporthandlerbase.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 EXPORTHANDLERBASE_H -#define EXPORTHANDLERBASE_H - -#include "mobileui_export.h" - -#include - -#include - -class QItemSelectionModel; - -class MOBILEUI_EXPORT ExportHandlerBase : public QObject -{ - Q_OBJECT - - public: - explicit ExportHandlerBase( QObject *parent = 0 ); - ~ExportHandlerBase(); - - void setSelectionModel( QItemSelectionModel *model ); - void setItemSelectionModel( QItemSelectionModel *model ); - - public Q_SLOTS: - void exec(); - - protected: - virtual QString dialogText() const = 0; - virtual QString dialogAllText() const = 0; - virtual QString dialogLocalOnlyText() const = 0; - - virtual QStringList mimeTypes() const = 0; - virtual bool exportItems( const Akonadi::Item::List &items ) = 0; - - private: - QItemSelectionModel *mSelectionModel; - QItemSelectionModel *mItemSelectionModel; -}; - -#endif diff --git a/kdepim/mobile/lib/favoritescontroller.cpp b/kdepim/mobile/lib/favoritescontroller.cpp deleted file mode 100644 index fb197671..00000000 --- a/kdepim/mobile/lib/favoritescontroller.cpp +++ /dev/null @@ -1,206 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "favoritescontroller.h" - -#include "favoriteslistmodel.h" - -#include -#include -#include -#include - -#include -#include -#include - -static const QString sFavoritePrefix = QLatin1String("Favorite_"); -static const int sFavoritePrefixLength = 9; - -class FavoritesController::Private -{ - public: - QStringList rereadFavoritesList() const; - - void selectionChanged(); - void removeFavorite(); - void moveUpFavorite(); - void moveDownFavorite(); - - KSharedConfig::Ptr mConfig; - FavoritesListModel *mModel; - QItemSelectionModel *mSelectionModel; - QItemSelectionModel *mCollectionSelectionModel; - QAction *mRemoveAction; - QAction *mMoveUpAction; - QAction *mMoveDownAction; -}; - -QStringList FavoritesController::Private::rereadFavoritesList() const -{ - QStringList names; - foreach ( const QString &group, mConfig->groupList() ) { - if ( group.startsWith( sFavoritePrefix ) ) - names.append( QString( group ).remove( 0, sFavoritePrefixLength ) ); - } - - return names; -} - -void FavoritesController::Private::selectionChanged() -{ - const bool favoriteSelected = mSelectionModel->hasSelection(); - - if ( favoriteSelected ) { - mRemoveAction->setEnabled( true ); - - const QModelIndex index = mSelectionModel->selectedRows().first(); - mMoveUpAction->setEnabled( index.row() != 0 ); - mMoveDownAction->setEnabled( index.row() != (mModel->rowCount() - 1) ); - } else { - mRemoveAction->setEnabled( false ); - mMoveUpAction->setEnabled( false ); - mMoveDownAction->setEnabled( false ); - } -} - -void FavoritesController::Private::removeFavorite() -{ - if ( !mSelectionModel->hasSelection() ) - return; - - const QModelIndex index = mSelectionModel->selectedRows().first(); - - const int result = KMessageBox::questionYesNo( 0, i18n( "Do you really want to remove favorite %1?", - index.data( Qt::DisplayRole ).toString() ), - i18n( "Remove Favorite" ) ); - if ( result == KMessageBox::No ) - return; - - mModel->removeItem( index.row() ); -} - -void FavoritesController::Private::moveUpFavorite() -{ - if ( !mSelectionModel->hasSelection() ) - return; - - const QModelIndex index = mSelectionModel->selectedRows().first(); - mModel->moveUp( index.row() ); -} - -void FavoritesController::Private::moveDownFavorite() -{ - if ( !mSelectionModel->hasSelection() ) - return; - - const QModelIndex index = mSelectionModel->selectedRows().first(); - mModel->moveDown( index.row() ); -} - - -FavoritesController::FavoritesController( const KSharedConfig::Ptr &config, QObject *parent ) - : QObject( parent ), d( new Private ) -{ - d->mConfig = config; - d->mModel = new FavoritesListModel( config, this ); - d->mSelectionModel = new QItemSelectionModel( d->mModel ); - d->mCollectionSelectionModel = 0; - - d->mRemoveAction = new QAction( i18n( "Remove" ), this ); - d->mMoveUpAction = new QAction( i18n( "Move Up" ), this ); - d->mMoveDownAction = new QAction( i18n( "Move Down" ), this ); - - connect( d->mSelectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(selectionChanged()) ); - - connect( d->mRemoveAction, SIGNAL(triggered(bool)), SLOT(removeFavorite()) ); - connect( d->mMoveUpAction, SIGNAL(triggered(bool)), SLOT(moveUpFavorite()) ); - connect( d->mMoveDownAction, SIGNAL(triggered(bool)), SLOT(moveDownFavorite()) ); - - d->selectionChanged(); -} - -FavoritesController::~FavoritesController() -{ - delete d; -} - -QAbstractItemModel* FavoritesController::model() const -{ - return d->mModel; -} - -QItemSelectionModel* FavoritesController::selectionModel() const -{ - return d->mSelectionModel; -} - -void FavoritesController::setCollectionSelectionModel( QItemSelectionModel *model ) -{ - d->mCollectionSelectionModel = model; -} - -QAction* FavoritesController::removeAction() const -{ - return d->mRemoveAction; -} - -QAction* FavoritesController::moveUpAction() const -{ - return d->mMoveUpAction; -} - -QAction* FavoritesController::moveDownAction() const -{ - return d->mMoveDownAction; -} - -void FavoritesController::loadFavorite( const QString &name ) const -{ - Q_ASSERT( d->mCollectionSelectionModel ); - - Akonadi::ETMViewStateSaver *saver = new Akonadi::ETMViewStateSaver; - saver->setSelectionModel( d->mCollectionSelectionModel ); - - KConfigGroup group( d->mConfig, sFavoritePrefix + name ); - if ( !group.isValid() ) { - delete saver; - return; - } - - saver->restoreState( group ); -} - -void FavoritesController::saveFavorite( const QString &name ) -{ - Q_ASSERT( d->mCollectionSelectionModel ); - - Akonadi::ETMViewStateSaver saver; - saver.setSelectionModel( d->mCollectionSelectionModel ); - - KConfigGroup group( d->mConfig, sFavoritePrefix + name ); - saver.saveState( group ); - group.sync(); - d->mModel->setStringList( d->rereadFavoritesList() ); -} - -#include "moc_favoritescontroller.cpp" diff --git a/kdepim/mobile/lib/favoritescontroller.h b/kdepim/mobile/lib/favoritescontroller.h deleted file mode 100644 index fd1a12d6..00000000 --- a/kdepim/mobile/lib/favoritescontroller.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 FAVORITESCONTROLLER_H -#define FAVORITESCONTROLLER_H - -#include - -#include - -class QAbstractItemModel; -class QAction; -class QItemSelectionModel; - -class FavoritesController : public QObject -{ - Q_OBJECT - - Q_PROPERTY( QAbstractItemModel* model READ model ) - Q_PROPERTY( QItemSelectionModel* selectionModel READ selectionModel ) - - Q_PROPERTY( QAction* removeAction READ removeAction ) - Q_PROPERTY( QAction* moveUpAction READ moveUpAction ) - Q_PROPERTY( QAction* moveDownAction READ moveDownAction ) - - public: - /** - * Creates a new favorites controller. - * - * @param parent The parent object. - */ - explicit FavoritesController( const KSharedConfig::Ptr &config, QObject *parent = 0 ); - - /** - * Destroys the favorites controller. - */ - ~FavoritesController(); - - /** - * Returns the model that represents the list of favoritess. - */ - QAbstractItemModel* model() const; - - /** - * Returns the item selection model, which is used for adapting - * the state of the actions. - */ - QItemSelectionModel* selectionModel() const; - - /** - * Sets the collection selection @p model the loading and saving of favorites - * shall be applied on. - */ - void setCollectionSelectionModel( QItemSelectionModel *model ); - - /** - * Returns the action for removing the currently selected favorites. - */ - QAction* removeAction() const; - - /** - * Returns the action for moving up the currently selected favorites. - */ - QAction* moveUpAction() const; - - /** - * Returns the action for moving down the currently selected favorites. - */ - QAction* moveDownAction() const; - - public Q_SLOTS: - /** - * Applies the favorite with the given @p name on the collection selection model. - */ - void loadFavorite( const QString &name ) const; - - /** - * Saves the current collection selection as favorite with the given @p name. - */ - void saveFavorite( const QString &name ); - - private: - //@cond PRIVATE - class Private; - Private* const d; - - Q_PRIVATE_SLOT( d, void selectionChanged() ) - Q_PRIVATE_SLOT( d, void removeFavorite() ) - Q_PRIVATE_SLOT( d, void moveUpFavorite() ) - Q_PRIVATE_SLOT( d, void moveDownFavorite() ) - //@endcond -}; - -#endif diff --git a/kdepim/mobile/lib/favoriteseditor.cpp b/kdepim/mobile/lib/favoriteseditor.cpp deleted file mode 100644 index 382254ba..00000000 --- a/kdepim/mobile/lib/favoriteseditor.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "favoriteseditor.h" - -#include "favoritescontroller.h" - -#include - -#include -#include -#include - -FavoritesEditor::FavoritesEditor( KActionCollection *actionCollection, const KSharedConfig::Ptr &config, QObject *parent ) - : QObject( parent ) -{ - mFavoritesController = new FavoritesController( config, this ); - - actionCollection->addAction( QLatin1String("favoriteseditor_moveup"), mFavoritesController->moveUpAction() ); - actionCollection->addAction( QLatin1String("favoriteseditor_movedown"), mFavoritesController->moveDownAction() ); - actionCollection->addAction( QLatin1String("favoriteseditor_remove"), mFavoritesController->removeAction() ); -} - -QAbstractItemModel* FavoritesEditor::model() const -{ - return mFavoritesController->model(); -} - -void FavoritesEditor::setCollectionSelectionModel( QItemSelectionModel *model ) -{ - mFavoritesController->setCollectionSelectionModel( model ); -} - -void FavoritesEditor::loadFavorite( const QString &name ) const -{ - mFavoritesController->loadFavorite( name ); -} - -void FavoritesEditor::saveFavorite( const QString &name ) -{ - mFavoritesController->saveFavorite( name ); -} - -void FavoritesEditor::setRowSelected( int row ) -{ - Q_ASSERT( row >= 0 && row < mFavoritesController->model()->rowCount() ); - - QAbstractItemModel *model = mFavoritesController->model(); - QItemSelectionModel *selectionModel = mFavoritesController->selectionModel(); - - selectionModel->select( model->index( row, 0, QModelIndex() ), QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows ); -} - diff --git a/kdepim/mobile/lib/favoriteseditor.h b/kdepim/mobile/lib/favoriteseditor.h deleted file mode 100644 index b7bc9627..00000000 --- a/kdepim/mobile/lib/favoriteseditor.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 FAVORITESEDITOR_H -#define FAVORITESEDITOR_H - -#include - -#include - -class FavoritesController; -class KActionCollection; -class QAbstractItemModel; -class QItemSelectionModel; - -/** - * @short The C++ part of the favorites editor for mobile apps. - * - * This class encapsulates the logic of the favorites viewing/editing - * and the UI is provided by FavoritesEditor.qml. - */ -class FavoritesEditor : public QObject -{ - Q_OBJECT - - public: - /** - * Creates a new favorites editor. - * - * @param actionCollection The action collection to register the manipulation - * actions (e.g. remove, moveUp, moveDown) at. - * @param config The config object to store the favorites. - * @param parent The parent object. - */ - FavoritesEditor( KActionCollection *actionCollection, const KSharedConfig::Ptr &config, QObject *parent = 0 ); - - /** - * Returns the model that represents the list of favoritess. - */ - QAbstractItemModel* model() const; - - /** - * Sets the collection selection @p model the loading and saving of favorites - * shall be applied on. - */ - void setCollectionSelectionModel( QItemSelectionModel *model ); - - /** - * Applies the favorite with the given @p name on the collection selection model. - */ - void loadFavorite( const QString &name ) const; - - /** - * Saves the current collection selection as favorite with the given @p name. - */ - void saveFavorite( const QString &name ); - - public Q_SLOTS: - /** - * Sets the row of the favorite the user has selected in the UI. - */ - void setRowSelected( int row ); - - private: - FavoritesController *mFavoritesController; -}; - -#endif diff --git a/kdepim/mobile/lib/favoriteslistmodel.cpp b/kdepim/mobile/lib/favoriteslistmodel.cpp deleted file mode 100644 index a283673a..00000000 --- a/kdepim/mobile/lib/favoriteslistmodel.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "favoriteslistmodel.h" - -#include -#include - -static const QString sFavoritePrefix = QLatin1String("Favorite_"); -static const QString sFavoriteOrder = QLatin1String("FavoriteOrder"); -static const int sFavoritePrefixLength = 9; - -FavoritesListModel::FavoritesListModel( const KSharedConfigPtr &config, QObject *parent ) - : QStringListModel( parent ), mConfig( config ) -{ - reparseConfiguration(); -} - -void FavoritesListModel::reparseConfiguration() -{ - QStringList list; - foreach ( const QString &group, mConfig->groupList() ) - if ( group.startsWith( sFavoritePrefix ) ) - list.append( QString( group ).remove( 0, sFavoritePrefixLength ) ); - - const KConfigGroup group = mConfig->group("FavoriteGeneral"); - QStringList favsList = group.readEntry( "Order", QStringList() ); - - QStringList::iterator it = favsList.begin(); - while ( it != favsList.end() ) { - if ( !list.contains( *it ) ) { - it = favsList.erase( it ); - } else { - ++it; - } - } - - foreach ( const QString &item, list ) { - if ( !favsList.contains( item ) ) - favsList.append( item ); - } - - setStringList( favsList ); -} - -void FavoritesListModel::saveConfig() -{ - QStringList favsList = stringList(); - foreach ( const QString &group, mConfig->groupList() ) { - if ( group.startsWith( sFavoritePrefix ) ) { - const QString name = QString( group ).remove( 0, sFavoritePrefixLength ); - if ( !favsList.contains( name ) ) { - mConfig->deleteGroup( group ); - } - } - } - - QStringList::iterator it = favsList.begin(); - while ( it != favsList.end() ) { - if ( !mConfig->groupList().contains( sFavoritePrefix + *it ) ) { - it = favsList.erase( it ); - } else { - ++it; - } - } - - KConfigGroup group = mConfig->group( "FavoriteGeneral" ); - group.writeEntry( "Order", favsList ); - mConfig->sync(); - mConfig->reparseConfiguration(); // needed to make sure that the groups got really removed from the KConfig object -} - -void FavoritesListModel::moveUp( int row ) -{ - if ( row <= 0 ) - return; - - QStringList list = stringList(); - - if ( row >= list.size() ) - return; - - list.move( row, row - 1 ); - - // resets the model. - setStringList( list ); - saveConfig(); -} - -void FavoritesListModel::moveDown( int row ) -{ - if ( row < 0 ) - return; - - QStringList list = stringList(); - - if ( row >= list.size() - 1 ) - return; - - list.move( row, row + 1 ); - - // resets the model. - setStringList( list ); - saveConfig(); -} - -void FavoritesListModel::removeItem( int row ) -{ - QStringListModel::removeRow( row ); - saveConfig(); -} diff --git a/kdepim/mobile/lib/favoriteslistmodel.h b/kdepim/mobile/lib/favoriteslistmodel.h deleted file mode 100644 index 08d5bb41..00000000 --- a/kdepim/mobile/lib/favoriteslistmodel.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 FAVORITESLISTMODEL_H -#define FAVORITESLISTMODEL_H - -#include - -#include - -class FavoritesListModel : public QStringListModel -{ - Q_OBJECT - - public: - explicit FavoritesListModel( const KSharedConfigPtr &config, QObject *parent = 0 ); - - void reparseConfiguration(); - - public Q_SLOTS: - void moveUp( int row ); - void moveDown( int row ); - void removeItem( int row ); - - private: - void saveConfig(); - - KSharedConfigPtr mConfig; -}; - -#endif diff --git a/kdepim/mobile/lib/guistatemanager.cpp b/kdepim/mobile/lib/guistatemanager.cpp deleted file mode 100644 index 756e6b8b..00000000 --- a/kdepim/mobile/lib/guistatemanager.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "guistatemanager.h" - -#include - -static void printStack( const QStack &stack ) -{ - QString output = QLatin1String( "UI-State-Stack: " ); - for ( int i = 0; i < stack.count(); ++i ) - output += QLatin1Char( ':' ) + QString::number( stack.at( i ) ); - - qDebug( "%s", qPrintable( output ) ); -} - -class GuiStateManager::Private -{ - public: - Private() - { - mGuiStates.push( GuiStateManager::HomeScreenState ); - } - - QStack mGuiStates; -}; - -GuiStateManager::GuiStateManager( QObject *parent ) - : QObject( parent ), d( new Private ) -{ -} - -GuiStateManager::~GuiStateManager() -{ - delete d; -} - -void GuiStateManager::switchState( int state ) -{ - Q_ASSERT( !d->mGuiStates.isEmpty() ); - - const int previousState = d->mGuiStates.pop(); - d->mGuiStates.push( state ); - - printStack( d->mGuiStates ); - emitChangedSignal(); - - emit guiStateChanged( previousState, state ); -} - -void GuiStateManager::pushState( int state ) -{ - const int previousState = (d->mGuiStates.isEmpty() ? -1 : d->mGuiStates.top()); - - d->mGuiStates.push( state ); - - printStack( d->mGuiStates ); - emitChangedSignal(); - - emit guiStateChanged( previousState, state ); -} - -void GuiStateManager::pushUniqueState( int state ) -{ - const int previousState = (d->mGuiStates.isEmpty() ? -1 : d->mGuiStates.top()); - - if ( d->mGuiStates.isEmpty() ) { - d->mGuiStates.push( state ); - } else { - if ( d->mGuiStates.top() != state ) - d->mGuiStates.push( state ); - } - - printStack( d->mGuiStates ); - emitChangedSignal(); - - emit guiStateChanged( previousState, state ); -} - -void GuiStateManager::popState() -{ - const int previousState = d->mGuiStates.pop(); - Q_ASSERT( !d->mGuiStates.isEmpty() ); - - printStack( d->mGuiStates ); - emitChangedSignal(); - - emit guiStateChanged( previousState, d->mGuiStates.top() ); -} - -int GuiStateManager::currentState() const -{ - Q_ASSERT( !d->mGuiStates.isEmpty() ); - - return d->mGuiStates.top(); -} - -bool GuiStateManager::inHomeScreenState() const -{ - return (currentState() == HomeScreenState); -} - -bool GuiStateManager::inAccountScreenState() const -{ - return (currentState() == AccountScreenState); -} - -bool GuiStateManager::inSingleFolderScreenState() const -{ - return (currentState() == SingleFolderScreenState); -} - -bool GuiStateManager::inMultipleFolderScreenState() const -{ - return (currentState() == MultipleFolderScreenState); -} - -bool GuiStateManager::inBulkActionScreenState() const -{ - return (currentState() == BulkActionScreenState); -} - -bool GuiStateManager::inMultipleFolderSelectionScreenState() const -{ - return (currentState() == MultipleFolderSelectionScreenState); -} - -bool GuiStateManager::inViewSingleItemState() const -{ - return (currentState() == ViewSingleItemState); -} - -bool GuiStateManager::inSearchScreenState() const -{ - return (currentState() == SearchScreenState); -} - -bool GuiStateManager::inSearchResultScreenState() const -{ - return (currentState() == SearchResultScreenState); -} - -bool GuiStateManager::inConfigScreenState() const -{ - return (currentState() == ConfigScreenState); -} - -void GuiStateManager::emitChangedSignal() -{ - emit guiStateChanged(); -} - diff --git a/kdepim/mobile/lib/guistatemanager.h b/kdepim/mobile/lib/guistatemanager.h deleted file mode 100644 index 21a43939..00000000 --- a/kdepim/mobile/lib/guistatemanager.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 GUISTATEMANAGER_H -#define GUISTATEMANAGER_H - -#include "mobileui_export.h" - -#include -#include - -/** - * @short A class that manages the UI states of the mobile PIM applications. - * - * @author Tobias Koenig - */ -class MOBILEUI_EXPORT GuiStateManager : public QObject -{ - Q_OBJECT - - Q_PROPERTY( bool inHomeScreenState READ inHomeScreenState NOTIFY guiStateChanged ) - Q_PROPERTY( bool inAccountScreenState READ inAccountScreenState NOTIFY guiStateChanged ) - Q_PROPERTY( bool inSingleFolderScreenState READ inSingleFolderScreenState NOTIFY guiStateChanged ) - Q_PROPERTY( bool inMultipleFolderScreenState READ inMultipleFolderScreenState NOTIFY guiStateChanged ) - Q_PROPERTY( bool inBulkActionScreenState READ inBulkActionScreenState NOTIFY guiStateChanged ) - Q_PROPERTY( bool inMultipleFolderSelectionScreenState READ inMultipleFolderSelectionScreenState NOTIFY guiStateChanged ) - Q_PROPERTY( bool inViewSingleItemState READ inViewSingleItemState NOTIFY guiStateChanged ) - Q_PROPERTY( bool inSearchScreenState READ inSearchScreenState NOTIFY guiStateChanged ) - Q_PROPERTY( bool inSearchResultScreenState READ inSearchResultScreenState NOTIFY guiStateChanged ) - Q_PROPERTY( bool inConfigScreenState READ inConfigScreenState NOTIFY guiStateChanged ) - - Q_ENUMS( GuiState ) - - public: - /** - * Describes the state of the visible screens. - */ - enum GuiState { - /** - * The state when the 'Home' entry is selected in the navigation bar. - */ - HomeScreenState, - - /** - * The state when an account entry (an Akonadi resource collection) is selected - * in the navigation bar. - */ - AccountScreenState, - - /** - * The state when a folder entry (a normal Akonadi collection) is selected - * in the navigation bar. - */ - SingleFolderScreenState, - - /** - * The state when the 'Home' entry is selected in the navigation bar and - * the user has selected multiple favorite folders. - */ - MultipleFolderScreenState, - - /** - * The state when the user activated the bulk action mode by double clicking on - * a folder in the navigation bar. - */ - BulkActionScreenState, - - /** - * The state when the user activated the multiple folder selection mode by clicking on - * the 'Select' resp. 'Change Selection' button. - */ - MultipleFolderSelectionScreenState, - - /** - * The state when the user selected a single item from a view and the item specific viewer - * is shown. - */ - ViewSingleItemState, - - /** - * The state when the search dialog is shown. - */ - SearchScreenState, - - /** - * The state when the user started a search and the results are listed. - */ - SearchResultScreenState, - - /** - * The state when the main configuration dialog is shown. - */ - ConfigScreenState, - - /** - * Point of extension. - */ - UserState - }; - - /** - * Creates a new gui state manager. - * - * @param parent The parent object. - */ - GuiStateManager( QObject *parent = 0 ); - - /** - * Destroys the gui state manager. - */ - ~GuiStateManager(); - - public Q_SLOTS: - /** - * Switches from the current gui state to the new gui @p state. - */ - void switchState( int state ); - - /** - * Switches to the new gui @p state but stores the old one on the internal stack. - * - * This method should be used if you want to return to the previous gui state at - * a later point in the execution. - */ - void pushState( int state ); - - /** - * Switches to the new gui @p state, if it is not on the top of the stack already, - * but stores the old one on the internal stack. - * - * This method should be used if you want to return to the previous gui state at - * a later point in the execution. - */ - void pushUniqueState( int state ); - - /** - * Switches to the gui state previously stored on the internal stack. - */ - void popState(); - - /** - * Returns the current gui state. - */ - int currentState() const; - - public: - /** - * Returns whether the current state is the home screen state. - */ - bool inHomeScreenState() const; - - /** - * Returns whether the current state is the account screen state. - */ - bool inAccountScreenState() const; - - /** - * Returns whether the current state is the single folder screen state. - */ - bool inSingleFolderScreenState() const; - - /** - * Returns whether the current state is the multiple folder screen state. - */ - bool inMultipleFolderScreenState() const; - - /** - * Returns whether the current state is the bulk action screen state. - */ - bool inBulkActionScreenState() const; - - /** - * Returns whether the current state is the multiple folder selection screen state. - */ - bool inMultipleFolderSelectionScreenState() const; - - /** - * Returns whether the current state is the view single item state. - */ - bool inViewSingleItemState() const; - - /** - * Returns whether the current state is the search screen state. - */ - bool inSearchScreenState() const; - - /** - * Returns whether the current state is the search result screen state. - */ - bool inSearchResultScreenState() const; - - /** - * Returns whether the current state is the config screen state. - */ - bool inConfigScreenState() const; - - Q_SIGNALS: - /** - * This signal is emitted whenever the current state has changed. - */ - void guiStateChanged(); - - /** - * This signal is emitted whenever the current state has changed. - * - * @param oldState The old state the manager was in. - * @param newState The new state the manager is in. - */ - void guiStateChanged( int oldState, int newState ); - - protected: - virtual void emitChangedSignal(); - - private: - //@cond PRIVATE - class Private; - Private* const d; - //@endcond -}; - -#endif diff --git a/kdepim/mobile/lib/hierarchyresolver.cpp b/kdepim/mobile/lib/hierarchyresolver.cpp deleted file mode 100644 index c89d44ca..00000000 --- a/kdepim/mobile/lib/hierarchyresolver.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "hierarchyresolver.h" - -#include - -void HierarchyResolver::addNode( const QByteArray &identifier ) -{ - mTopNodes.insert( identifier ); -} - -void HierarchyResolver::addRelation( const QByteArray &child, const QByteArray &parent ) -{ - if ( child != parent ) - mRelations.insert( child, parent ); - else - //TODO_TOKOE - kDebug() << "child equals parent: " << parent; -} - -void HierarchyResolver::resolve( const QSet &existingIdentifiers ) -{ - mChildParentResultMap.clear(); - mParentChildrenResultMap.clear(); - - // first insert all top nodes - foreach ( const QByteArray &node, mTopNodes ) { - mChildParentResultMap.insert( node, node ); - mParentChildrenResultMap.insert( node, QSet() ); - } - - // search top-most parents for each added relation child node - QHashIterator it( mRelations ); - while ( it.hasNext() ) { - it.next(); - - // check if direct parent is top node - if ( mTopNodes.contains( it.value() ) ) { - mChildParentResultMap.insert( it.key(), it.value() ); - mParentChildrenResultMap[ it.value() ].insert( it.key() ); - - continue; // we are done - } - - QByteArray parentNode = it.value(); - if ( !existingIdentifiers.contains( parentNode ) ) { - mChildParentResultMap.insert( it.key(), it.key() ); - mParentChildrenResultMap[ it.key() ].insert( it.key() ); - } else { - // iterate up the parent path - while ( mRelations.contains( parentNode ) && existingIdentifiers.contains( mRelations.value( parentNode ) ) ) - parentNode = mRelations.value( parentNode ); - - mChildParentResultMap.insert( it.key(), parentNode ); - mParentChildrenResultMap[ parentNode ].insert( it.key() ); - } - } -} - -QHash HierarchyResolver::childParentMap() const -{ - return mChildParentResultMap; -} - -QHash > HierarchyResolver::parentChildrenMap() const -{ - return mParentChildrenResultMap; -} diff --git a/kdepim/mobile/lib/hierarchyresolver.h b/kdepim/mobile/lib/hierarchyresolver.h deleted file mode 100644 index b064c732..00000000 --- a/kdepim/mobile/lib/hierarchyresolver.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 HIERARCHYRESOLVER_H -#define HIERARCHYRESOLVER_H - -#include "mobileui_export.h" - -#include -#include - -/** - * @short A utility class to resolve single parent-child relationships to a tree. - * - * This class allows the user to specify a couple of parent child relation ships - * which it will resolve to child -> top-most parent relation ships. - * - * @author Tobias Koenig - */ -class MOBILEUI_EXPORT HierarchyResolver -{ - public: - /** - * Adds a single node to the resolver. - * - * The node is known to have no relation, so it must - * be a top node. - * - * @param identifier The unique identifier of this node - */ - void addNode( const QByteArray &identifier ); - - /** - * Adds a child -> parent relation to the resolver. - * - * @param child The unique identifier of the child node. - * @param parent The unique identifier of the parent node. - */ - void addRelation( const QByteArray &child, const QByteArray &parent ); - - /** - * Resolves the hierarchy. - */ - void resolve( const QSet &existingIdentifiers ); - - /** - * Returns a hash with the child node as key and its resolved top-most parent - * node as value. - * - * The top-most parent of a parent node is the node itself. - */ - QHash childParentMap() const; - - /** - * Returns a hash with the top-most parent node as key and a set of all its descendant - * nodes as value. - */ - QHash > parentChildrenMap() const; - - private: - QSet mTopNodes; - QHash mRelations; - - QHash mChildParentResultMap; - QHash > mParentChildrenResultMap; -}; - -#endif diff --git a/kdepim/mobile/lib/images/CMakeLists.txt b/kdepim/mobile/lib/images/CMakeLists.txt deleted file mode 100644 index 5fe8a78c..00000000 --- a/kdepim/mobile/lib/images/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_subdirectory(status) - -FILE(GLOB IMAGES *.png) -install(FILES ${IMAGES} - DESTINATION ${PLUGIN_INSTALL_DIR}/imports/org/kde/pim/mobileui/images) diff --git a/kdepim/mobile/lib/images/activeactionitem.png b/kdepim/mobile/lib/images/activeactionitem.png deleted file mode 100644 index dd9b386d..00000000 Binary files a/kdepim/mobile/lib/images/activeactionitem.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/activedate.png b/kdepim/mobile/lib/images/activedate.png deleted file mode 100644 index 03136dd0..00000000 Binary files a/kdepim/mobile/lib/images/activedate.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/bulk-back-overlay.png b/kdepim/mobile/lib/images/bulk-back-overlay.png deleted file mode 100644 index 87c9ec47..00000000 Binary files a/kdepim/mobile/lib/images/bulk-back-overlay.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/bulk-forward-overlay.png b/kdepim/mobile/lib/images/bulk-forward-overlay.png deleted file mode 100644 index 19f460da..00000000 Binary files a/kdepim/mobile/lib/images/bulk-forward-overlay.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/button-border-active.png b/kdepim/mobile/lib/images/button-border-active.png deleted file mode 100644 index 762280bc..00000000 Binary files a/kdepim/mobile/lib/images/button-border-active.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/button-border.png b/kdepim/mobile/lib/images/button-border.png deleted file mode 100644 index 8beabc00..00000000 Binary files a/kdepim/mobile/lib/images/button-border.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/button-minus-active.png b/kdepim/mobile/lib/images/button-minus-active.png deleted file mode 100644 index 502786a9..00000000 Binary files a/kdepim/mobile/lib/images/button-minus-active.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/button-minus-disabled.png b/kdepim/mobile/lib/images/button-minus-disabled.png deleted file mode 100644 index d87b0d10..00000000 Binary files a/kdepim/mobile/lib/images/button-minus-disabled.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/button-minus.png b/kdepim/mobile/lib/images/button-minus.png deleted file mode 100644 index f29baaa4..00000000 Binary files a/kdepim/mobile/lib/images/button-minus.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/button-plus-active.png b/kdepim/mobile/lib/images/button-plus-active.png deleted file mode 100644 index c599a851..00000000 Binary files a/kdepim/mobile/lib/images/button-plus-active.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/button-plus-disabled.png b/kdepim/mobile/lib/images/button-plus-disabled.png deleted file mode 100644 index 20ce8c50..00000000 Binary files a/kdepim/mobile/lib/images/button-plus-disabled.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/button-plus.png b/kdepim/mobile/lib/images/button-plus.png deleted file mode 100644 index a62ca152..00000000 Binary files a/kdepim/mobile/lib/images/button-plus.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/check.png b/kdepim/mobile/lib/images/check.png deleted file mode 100644 index f996983f..00000000 Binary files a/kdepim/mobile/lib/images/check.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/clock-background.png b/kdepim/mobile/lib/images/clock-background.png deleted file mode 100644 index f5c0afc3..00000000 Binary files a/kdepim/mobile/lib/images/clock-background.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/clock-center.png b/kdepim/mobile/lib/images/clock-center.png deleted file mode 100644 index 965fafba..00000000 Binary files a/kdepim/mobile/lib/images/clock-center.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/clock-hours.png b/kdepim/mobile/lib/images/clock-hours.png deleted file mode 100644 index 58f2c9fa..00000000 Binary files a/kdepim/mobile/lib/images/clock-hours.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/clock-minutes.png b/kdepim/mobile/lib/images/clock-minutes.png deleted file mode 100644 index 57c740c8..00000000 Binary files a/kdepim/mobile/lib/images/clock-minutes.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/clock-seconds.png b/kdepim/mobile/lib/images/clock-seconds.png deleted file mode 100644 index ec2b2438..00000000 Binary files a/kdepim/mobile/lib/images/clock-seconds.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/dividing-line-horizontal.png b/kdepim/mobile/lib/images/dividing-line-horizontal.png deleted file mode 100644 index 3b0de8c2..00000000 Binary files a/kdepim/mobile/lib/images/dividing-line-horizontal.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/dividing-line.png b/kdepim/mobile/lib/images/dividing-line.png deleted file mode 100644 index 9e80239b..00000000 Binary files a/kdepim/mobile/lib/images/dividing-line.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/inactivedate.png b/kdepim/mobile/lib/images/inactivedate.png deleted file mode 100644 index 86f04adc..00000000 Binary files a/kdepim/mobile/lib/images/inactivedate.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/list-line-top.png b/kdepim/mobile/lib/images/list-line-top.png deleted file mode 100644 index d83e032c..00000000 Binary files a/kdepim/mobile/lib/images/list-line-top.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/movedown.png b/kdepim/mobile/lib/images/movedown.png deleted file mode 100644 index c9775fb3..00000000 Binary files a/kdepim/mobile/lib/images/movedown.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/moveup.png b/kdepim/mobile/lib/images/moveup.png deleted file mode 100644 index e33d4b68..00000000 Binary files a/kdepim/mobile/lib/images/moveup.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/normaldate.png b/kdepim/mobile/lib/images/normaldate.png deleted file mode 100644 index 412ca2b8..00000000 Binary files a/kdepim/mobile/lib/images/normaldate.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/scrollinput-center-active.png b/kdepim/mobile/lib/images/scrollinput-center-active.png deleted file mode 100644 index 4fe804fb..00000000 Binary files a/kdepim/mobile/lib/images/scrollinput-center-active.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/scrollinput-center.png b/kdepim/mobile/lib/images/scrollinput-center.png deleted file mode 100644 index 7e236fd3..00000000 Binary files a/kdepim/mobile/lib/images/scrollinput-center.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/scrollinput-left-active.png b/kdepim/mobile/lib/images/scrollinput-left-active.png deleted file mode 100644 index 3772a20b..00000000 Binary files a/kdepim/mobile/lib/images/scrollinput-left-active.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/scrollinput-left.png b/kdepim/mobile/lib/images/scrollinput-left.png deleted file mode 100644 index 0226622e..00000000 Binary files a/kdepim/mobile/lib/images/scrollinput-left.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/scrollinput-right-active.png b/kdepim/mobile/lib/images/scrollinput-right-active.png deleted file mode 100644 index 13b2dd2c..00000000 Binary files a/kdepim/mobile/lib/images/scrollinput-right-active.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/scrollinput-right.png b/kdepim/mobile/lib/images/scrollinput-right.png deleted file mode 100644 index 588751a2..00000000 Binary files a/kdepim/mobile/lib/images/scrollinput-right.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/sliderbackground.png b/kdepim/mobile/lib/images/sliderbackground.png deleted file mode 100644 index e5af759c..00000000 Binary files a/kdepim/mobile/lib/images/sliderbackground.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/sliderhandle.png b/kdepim/mobile/lib/images/sliderhandle.png deleted file mode 100644 index 9f6f15d8..00000000 Binary files a/kdepim/mobile/lib/images/sliderhandle.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/status/CMakeLists.txt b/kdepim/mobile/lib/images/status/CMakeLists.txt deleted file mode 100644 index ad7d0a6f..00000000 --- a/kdepim/mobile/lib/images/status/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -FILE(GLOB IMAGES *.png) -install(FILES ${IMAGES} - DESTINATION ${PLUGIN_INSTALL_DIR}/imports/org/kde/pim/mobileui/images/status) diff --git a/kdepim/mobile/lib/images/status/offline.png b/kdepim/mobile/lib/images/status/offline.png deleted file mode 100644 index 2e04cdd6..00000000 Binary files a/kdepim/mobile/lib/images/status/offline.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/status/online.png b/kdepim/mobile/lib/images/status/online.png deleted file mode 100644 index fc1dd0a6..00000000 Binary files a/kdepim/mobile/lib/images/status/online.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/status/receiving.png b/kdepim/mobile/lib/images/status/receiving.png deleted file mode 100644 index 2cac9b95..00000000 Binary files a/kdepim/mobile/lib/images/status/receiving.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/status/sending-receiving.png b/kdepim/mobile/lib/images/status/sending-receiving.png deleted file mode 100644 index c928eaef..00000000 Binary files a/kdepim/mobile/lib/images/status/sending-receiving.png and /dev/null differ diff --git a/kdepim/mobile/lib/images/status/sending.png b/kdepim/mobile/lib/images/status/sending.png deleted file mode 100644 index 1ede2e88..00000000 Binary files a/kdepim/mobile/lib/images/status/sending.png and /dev/null differ diff --git a/kdepim/mobile/lib/importhandlerbase.cpp b/kdepim/mobile/lib/importhandlerbase.cpp deleted file mode 100644 index 7d311524..00000000 --- a/kdepim/mobile/lib/importhandlerbase.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "importhandlerbase.h" - -#include -#include -#include -#include -#include - -#include - -ImportHandlerBase::ImportHandlerBase( QObject *parent ) - : QObject( parent ), - mImportProgressDialog( 0 ), - mSelectionModel( 0 ) -{ -} - -ImportHandlerBase::~ImportHandlerBase() -{ -} - -void ImportHandlerBase::setSelectionModel( QItemSelectionModel *model ) -{ - mSelectionModel = model; -} - -void ImportHandlerBase::exec() -{ - const QStringList fileNames = KFileDialog::getOpenFileNames( KUrl(), fileDialogNameFilter(), - 0, fileDialogTitle() ); - - if ( fileNames.count() == 0 ) { - deleteLater(); - return; - } - - bool ok = false; - const Akonadi::Item::List items = createItems( fileNames, &ok ); - if ( !ok || items.isEmpty() ) { - deleteLater(); - return; - } - - QPointer dlg = new Akonadi::CollectionDialog(); - dlg->setMimeTypeFilter( mimeTypes() ); - dlg->setAccessRightsFilter( Akonadi::Collection::CanCreateItem ); - dlg->setCaption( collectionDialogTitle() ); - dlg->setDescription( collectionDialogText() ); - - // preselect the currently selected folder - if ( mSelectionModel ) { - const QModelIndexList indexes = mSelectionModel->selectedRows(); - if ( !indexes.isEmpty() ) { - const QModelIndex collectionIndex = indexes.first(); - const Akonadi::Collection collection = collectionIndex.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( collection.isValid() ) - dlg->setDefaultCollection( collection ); - } - } - - if ( !dlg->exec() || !dlg ) { - delete dlg; - deleteLater(); - return; - } - - const Akonadi::Collection collection = dlg->selectedCollection(); - delete dlg; - - if ( !mImportProgressDialog ) { - mImportProgressDialog = new KProgressDialog( 0, importDialogTitle() ); - mImportProgressDialog->setLabelText( importDialogText( items.count(), collection.name() ) ); - mImportProgressDialog->setAllowCancel( false ); - mImportProgressDialog->setAutoClose( true ); - mImportProgressDialog->progressBar()->setRange( 1, items.count() ); - } - - mImportProgressDialog->show(); - - foreach ( const Akonadi::Item &item, items ) { - Akonadi::ItemCreateJob *job = new Akonadi::ItemCreateJob( item, collection ); - connect( job, SIGNAL(result(KJob*)), SLOT(slotImportJobDone(KJob*)) ); - } -} - -void ImportHandlerBase::slotImportJobDone( KJob* ) -{ - if ( !mImportProgressDialog ) - return; - - QProgressBar *progressBar = mImportProgressDialog->progressBar(); - - progressBar->setValue( progressBar->value() + 1 ); - - // cleanup on last step - if ( progressBar->value() == progressBar->maximum() ) { - mImportProgressDialog->deleteLater(); - mImportProgressDialog = 0; - deleteLater(); - } -} - diff --git a/kdepim/mobile/lib/importhandlerbase.h b/kdepim/mobile/lib/importhandlerbase.h deleted file mode 100644 index 6d9569f9..00000000 --- a/kdepim/mobile/lib/importhandlerbase.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 IMPORTHANDLERBASE_H -#define IMPORTHANDLERBASE_H - -#include "mobileui_export.h" - -#include - -#include - -class KJob; -class KProgressDialog; -class QItemSelectionModel; - -class MOBILEUI_EXPORT ImportHandlerBase : public QObject -{ - Q_OBJECT - - public: - explicit ImportHandlerBase( QObject *parent = 0 ); - ~ImportHandlerBase(); - - void setSelectionModel( QItemSelectionModel *model ); - - public Q_SLOTS: - void exec(); - - protected: - virtual QString fileDialogNameFilter() const = 0; - virtual QString fileDialogTitle() const = 0; - virtual QString collectionDialogText() const = 0; - virtual QString collectionDialogTitle() const = 0; - virtual QString importDialogText( int count, const QString &collectionName ) const = 0; - virtual QString importDialogTitle() const = 0; - - virtual QStringList mimeTypes() const = 0; - virtual Akonadi::Item::List createItems( const QStringList &fileNames, bool *ok ) = 0; - - private Q_SLOTS: - void slotImportJobDone( KJob* ); - - private: - KProgressDialog *mImportProgressDialog; - QItemSelectionModel *mSelectionModel; -}; - -#endif diff --git a/kdepim/mobile/lib/kcolorcombo.cpp b/kdepim/mobile/lib/kcolorcombo.cpp deleted file mode 100644 index 26a21bf6..00000000 --- a/kdepim/mobile/lib/kcolorcombo.cpp +++ /dev/null @@ -1,373 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997 Martin Jones (mjones@kde.org) - Copyright (C) 2007 Pino Toscano (pino@kde.org) - Copyright (c) 2007 David Jarvie (software@astrojar.org.uk) - - 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 "kcolorcombo.h" - -#include -#include -#include - -#include - -using namespace KPIM; - -namespace KPIM { - -class KColorComboDelegate : public QAbstractItemDelegate -{ - public: - enum ItemRoles { - ColorRole = Qt::UserRole + 1 - }; - - enum LayoutMetrics { - FrameMargin = 3 - }; - - KColorComboDelegate(QObject *parent = 0); - virtual ~KColorComboDelegate(); - - virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; - virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; -}; - -} - -static QBrush k_colorcombodelegate_brush(const QModelIndex &index, int role) -{ - QBrush brush; - QVariant v = index.data(role); - if (v.type() == QVariant::Brush) { - brush = v.value(); - } else if (v.type() == QVariant::Color) { - brush = QBrush(v.value()); - } - return brush; -} - -KColorComboDelegate::KColorComboDelegate(QObject *parent) - : QAbstractItemDelegate(parent) -{ -} - -KColorComboDelegate::~KColorComboDelegate() -{ -} - -void KColorComboDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const -{ - // background - QColor innercolor(Qt::white); - bool isSelected = (option.state & QStyle::State_Selected); - bool paletteBrush = (k_colorcombodelegate_brush(index, Qt::BackgroundRole).style() == Qt::NoBrush); - if (isSelected) { - innercolor = option.palette.color(QPalette::Highlight); - } else { - innercolor = option.palette.color(QPalette::Base); - } - // highlight selected item - QStyleOptionViewItemV4 opt(option); - opt.showDecorationSelected = true; - QStyle *style = opt.widget ? opt.widget->style() : QApplication::style(); - style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget); - QRect innerrect = option.rect.adjusted(FrameMargin, FrameMargin, -FrameMargin, -FrameMargin); - // inner color - QVariant cv = index.data(ColorRole); - if (cv.type() == QVariant::Color) { - QColor tmpcolor = cv.value(); - if (tmpcolor.isValid()) { - innercolor = tmpcolor; - paletteBrush = false; - painter->setPen(Qt::transparent); - painter->setBrush(innercolor); - QPainter::RenderHints tmpHint = painter->renderHints(); - painter->setRenderHint(QPainter::Antialiasing); - painter->drawRoundedRect(innerrect, 2, 2); - painter->setRenderHints(tmpHint); - painter->setBrush(Qt::NoBrush); - } - } - // text - QVariant tv = index.data(Qt::DisplayRole); - if (tv.type() == QVariant::String) { - QString text = tv.toString(); - QColor textColor; - if (paletteBrush) { - if (isSelected) { - textColor = option.palette.color(QPalette::HighlightedText); - } else { - textColor = option.palette.color(QPalette::Text); - } - } else { - int unused, v; - innercolor.getHsv(&unused, &unused, &v); - if (v > 128) { - textColor = Qt::black; - } else { - textColor = Qt::white; - } - } - painter->setPen(textColor); - painter->drawText(innerrect.adjusted(1, 1, -1, -1), text); - } -} - -QSize KColorComboDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const -{ - Q_UNUSED(index) - - // the width does not matter, as the view will always use the maximum width available - return QSize(100, option.fontMetrics.height() + 2 * FrameMargin); -} - - -static const uchar standardPalette[][4] = { - { 255, 255, 255 }, // white - { 192, 192, 192 }, // light gray - { 160, 160, 160 }, // gray - { 128, 128, 128 }, // dark gray - { 0, 0, 0 }, // black - - { 255, 128, 128 }, //light red - { 255, 192, 128 }, //light orange - { 255, 255, 128 }, //light yellow - { 128, 255, 128 }, //light green - { 128, 255, 255 }, //cyan blue - { 128, 128, 255 }, //light blue - { 255, 128, 255 }, //light violet - { 255, 0, 0 }, //red - { 255, 128, 0 }, //orange - { 255, 255, 0 }, //yellow - { 0, 255, 0 }, //green - { 0, 255, 255 }, //light blue - { 0, 0, 255 }, //blue - { 255, 0, 255 }, //violet - { 128, 0, 0 }, //dark red - { 128, 64, 0 }, //dark orange - { 128, 128, 0 }, //dark yellow - { 0, 128, 0 }, //dark green - { 0, 128, 128 }, //dark light blue - { 0, 0, 128 }, //dark blue - { 128, 0, 128 } //dark violet -}; - -#define STANDARD_PALETTE_SIZE (int(sizeof(standardPalette) / sizeof(*standardPalette))) - -static inline QColor standardColor(int i) -{ - const uchar *entry = standardPalette[i]; - return QColor(entry[0], entry[1], entry[2]); -} - -namespace KPIM { - -class KColorComboPrivate -{ - public: - KColorComboPrivate(KColorCombo *qq); - - void addColors(); - void setCustomColor(const QColor &color, bool lookupInPresets = true); - - // slots - void _k_slotActivated(int index); - void _k_slotHighlighted(int index); - - KColorCombo *q; - QList colorList; - QColor customColor; - QColor internalcolor; -}; - -} - -KColorComboPrivate::KColorComboPrivate(KColorCombo *qq) - : q(qq), customColor(Qt::white) -{ -} - -void KColorComboPrivate::setCustomColor(const QColor &color, bool lookupInPresets) -{ - if (lookupInPresets) { - if (colorList.isEmpty()) { - for (int i = 0; i < STANDARD_PALETTE_SIZE; ++i) { - if (standardColor(i) == color) { - q->setCurrentIndex(i + 1); - internalcolor = color; - return; - } - } - } else { - int i = colorList.indexOf(color); - if (i >= 0) { - q->setCurrentIndex(i + 1); - internalcolor = color; - return; - } - } - } - - internalcolor = color; - customColor = color; - q->setItemData(0, customColor, KColorComboDelegate::ColorRole); -} - - -KColorCombo::KColorCombo( QWidget *parent ) - : QComboBox(parent), d(new KColorComboPrivate(this)) -{ - setItemDelegate(new KColorComboDelegate(this)); - d->addColors(); - - connect(this, SIGNAL(activated(int)), SLOT(_k_slotActivated(int))); - connect(this, SIGNAL(highlighted(int)), SLOT(_k_slotHighlighted(int))); - - // select the white color - setCurrentIndex(1); - d->_k_slotActivated(1); - - setMaxVisibleItems(13); -} - - -KColorCombo::~KColorCombo() -{ - delete d; -} - -void KColorCombo::setColors( const QList &colors ) -{ - clear(); - d->colorList = colors; - d->addColors(); -} - -QList KColorCombo::colors() const -{ - if (d->colorList.isEmpty()) { - QList list; - for (int i = 0; i < STANDARD_PALETTE_SIZE; ++i) { - list += standardColor(i); - } - return list; - } else { - return d->colorList; - } -} - -/** - Sets the current color - */ -void KColorCombo::setColor( const QColor &col ) -{ - if (!col.isValid()) { - return; - } - - if (count() == 0) { - d->addColors(); - } - - d->setCustomColor(col, true); -} - - -/** - Returns the currently selected color - */ -QColor KColorCombo::color() const { - return d->internalcolor; -} - -bool KColorCombo::isCustomColor() const -{ - return d->internalcolor == d->customColor; -} - -void KColorCombo::paintEvent(QPaintEvent *event) -{ - Q_UNUSED(event) - QStylePainter painter(this); - painter.setPen(palette().color(QPalette::Text)); - - QStyleOptionComboBox opt; - initStyleOption(&opt); - painter.drawComplexControl(QStyle::CC_ComboBox, opt); - - QRect frame = style()->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxEditField, this); - painter.setRenderHint(QPainter::Antialiasing); - painter.setPen(Qt::transparent); - painter.setBrush(QBrush(d->internalcolor)); - painter.drawRoundedRect(frame.adjusted(1, 1, -1, -1), 2, 2); -} - -/** - Show an empty list, till the next color is set with setColor - */ -void KColorCombo::showEmptyList() -{ - clear(); -} - -void KColorComboPrivate::_k_slotActivated(int index) -{ - if (index == 0) { - internalcolor = customColor; - } else if (colorList.isEmpty()) { - internalcolor = standardColor(index - 1); - } else { - internalcolor = colorList[index - 1]; - } - - emit q->activated(internalcolor); -} - -void KColorComboPrivate::_k_slotHighlighted(int index) -{ - if (index == 0) { - internalcolor = customColor; - } else if (colorList.isEmpty()) { - internalcolor = standardColor(index - 1); - } else { - internalcolor = colorList[index - 1]; - } - - emit q->highlighted(internalcolor); -} - -void KColorComboPrivate::addColors() -{ - q->addItem(QString()); - - if (colorList.isEmpty()) { - for (int i = 0; i < STANDARD_PALETTE_SIZE; ++i) { - q->addItem(QString()); - q->setItemData(i + 1, standardColor(i), KColorComboDelegate::ColorRole); - } - } else { - for (int i = 0, count = colorList.count(); i < count; ++i) { - q->addItem(QString()); - q->setItemData(i + 1, colorList[i], KColorComboDelegate::ColorRole); - } - } -} - -#include "moc_kcolorcombo.cpp" diff --git a/kdepim/mobile/lib/kcolorcombo.h b/kdepim/mobile/lib/kcolorcombo.h deleted file mode 100644 index fbb5b039..00000000 --- a/kdepim/mobile/lib/kcolorcombo.h +++ /dev/null @@ -1,119 +0,0 @@ -/* This file is part of the KDE libraries - Copyright (C) 1997 Martin Jones (mjones@kde.org) - Copyright (c) 2007 David Jarvie (software@astrojar.org.uk) - - 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. -*/ -//----------------------------------------------------------------------------- -// KDE color selection combo box - -// layout management added Oct 1997 by Mario Weilguni -// - - -#ifndef KPIM_KCOLORCOMBO_H -#define KPIM_KCOLORCOMBO_H - -#include "mobileui_export.h" - -#include -#include - -namespace KPIM { - -class KColorComboPrivate; - -/** - * Combobox for colors. - * - * The combobox provides some preset colors to be selected, and an entry to - * select a custom color using a color dialog. - * - * \image html kcolorcombo.png "KDE Color Combo Box" - */ -class MOBILEUI_EXPORT KColorCombo : public QComboBox -{ - Q_OBJECT - Q_PROPERTY( QColor color READ color WRITE setColor NOTIFY activated USER true ) - Q_PROPERTY( QList colors READ colors WRITE setColors ) - -public: - /** - * Constructs a color combo box. - */ - explicit KColorCombo(QWidget *parent = 0); - ~KColorCombo(); - - /** - * Selects the color @p col. - */ - void setColor( const QColor &col ); - /** - * Returns the currently selected color. - **/ - QColor color() const; - - /** - * Find whether the currently selected color is a custom color selected - * using a color dialog. - **/ - bool isCustomColor() const; - - /** - * Set a custom list of colors to choose from, in place of the standard - * list. - * @param cols list of colors. If empty, the selection list reverts to - * the standard list. - **/ - void setColors(const QList &colors ); - - /** - * Return the list of colors available for selection. - * @return list of colors - **/ - QList colors() const; - - /** - * Clear the color list and don't show it, till the next setColor() call - **/ - void showEmptyList(); - -Q_SIGNALS: - /** - * Emitted when a new color box has been selected. - */ - void activated( const QColor &col ); - /** - * Emitted when a new item has been highlighted. - */ - void highlighted( const QColor &col ); - -protected: - virtual void paintEvent(QPaintEvent *event); - -private: - friend class KColorComboPrivate; - KColorComboPrivate *const d; - - Q_DISABLE_COPY(KColorCombo) - - Q_PRIVATE_SLOT(d, void _k_slotActivated(int)) - Q_PRIVATE_SLOT(d, void _k_slotHighlighted(int)) -}; - -} - -#endif // KCOLORCOMBO_H diff --git a/kdepim/mobile/lib/kdeclarativeapplication.cpp b/kdepim/mobile/lib/kdeclarativeapplication.cpp deleted file mode 100644 index cf335724..00000000 --- a/kdepim/mobile/lib/kdeclarativeapplication.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "kdeclarativeapplication.h" -#include "stylesheetloader.h" - -#include -#include -#include -#include -#include -#include - -#ifdef KDELIBS_STATIC_LIBS -int staticInitKConfigGroupGui(); -#endif - -static inline bool runPreApplicationSetup( const KCmdLineOptions & opts ) { - -#ifdef KDELIBS_STATIC_LIBS - //This is needed to get KConfig working with QColor - staticInitKConfigGroupGui(); -#endif - KDeclarativeApplicationBase::preApplicationSetup(opts); - return true; // <-- default value of KApplication(bool) ctor -} - -KDeclarativeApplicationBase::KDeclarativeApplicationBase() - : KUniqueApplication( runPreApplicationSetup( KCmdLineOptions() ) ) // inject some code before KApplication ctor runs -{ - postApplicationSetup(); -} - -KDeclarativeApplicationBase::KDeclarativeApplicationBase( const KCmdLineOptions & opts ) - : KUniqueApplication( runPreApplicationSetup( opts ) ) // inject some code before KApplication ctor runs -{ - postApplicationSetup(); -} - -// static -void KDeclarativeApplicationBase::postApplicationSetup() -{ - static bool run = false; - - if ( run ) { - kDebug() << "called twice"; - return; - } - - run = true; - - setFont(KGlobalSettings::generalFont()); - - KGlobal::locale()->insertCatalog( QLatin1String("libakonadi") ); - KGlobal::locale()->insertCatalog( QLatin1String("accountwizard") ); - KGlobal::locale()->insertCatalog( QLatin1String("libkdepimmobileui") ); - KGlobal::locale()->insertCatalog( QLatin1String("akonadi_serializer_plugins") ); // for conflict handling -} - -// static -void KDeclarativeApplicationBase::preApplicationSetup() -{ - preApplicationSetup( KCmdLineOptions() ); -} - - -// static -void KDeclarativeApplicationBase::preApplicationSetup( const KCmdLineOptions & appOptions ) -{ - static bool run = false; - - if ( run ) { - kDebug() << "called twice"; - return; - } - - run = true; - - // doesn't really belong here, but needs to be called before the ctor - QApplication::setGraphicsSystem( QLatin1String("raster") ); - - KCmdLineOptions options(appOptions); - options.add("timeit", ki18n("start timers for various parts of the application startup")); - options.add("enable-opengl", ki18n("use OpenGL ES acceleration for rendering (for testing only)")); - options.add("disable-opengl", ki18n("do not use OpenGL ES acceleration for rendering (for testing only)")); - KCmdLineArgs::addCmdLineOptions(options); -} - diff --git a/kdepim/mobile/lib/kdeclarativeapplication.h b/kdepim/mobile/lib/kdeclarativeapplication.h deleted file mode 100644 index 8e48579d..00000000 --- a/kdepim/mobile/lib/kdeclarativeapplication.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 KDECLARATIVEAPPLICATION_H -#define KDECLARATIVEAPPLICATION_H - -#include "mobileui_export.h" -#include -#include - -class KCmdLineOptions; - -class MOBILEUI_EXPORT KDeclarativeApplicationBase : public KUniqueApplication -{ - Q_OBJECT - public: - KDeclarativeApplicationBase(); - explicit KDeclarativeApplicationBase( const KCmdLineOptions & applicationOptions ); - - /** Sets up some stuff. Only needs to be called (before the - KApplication constructor) if you don't use - KDeclarativeApplication as your KApplication. - You can pass your own options as \a applicationOptions. - */ - static void preApplicationSetup( const KCmdLineOptions & applicationOptions ); - /** - \overload - */ - static void preApplicationSetup(); - - KDE_DEPRECATED static void initCmdLine() { preApplicationSetup(); } - - /** Sets up some other stuff. Only needs to be called (after the - KApplication constructor) if you don't use - KDeclarativeApplication as your KApplication */ - static void postApplicationSetup(); - - private: - static void emulateMaemo5(); - static void emulateMaemo6(); -}; - -template -class KDeclarativeApplication : public KDeclarativeApplicationBase -{ - public: - KDeclarativeApplication() : KDeclarativeApplicationBase(), m_mainView( 0 ) {} - explicit KDeclarativeApplication( const KCmdLineOptions &applicationOptions ) : KDeclarativeApplicationBase( applicationOptions ), m_mainView( 0 ) {} - virtual ~KDeclarativeApplication() - { - delete m_mainView; - } - - int newInstance() - { - kDebug(); - if ( !m_mainView ) { - m_mainView = new T; - m_mainView->show(); - } else { - m_mainView->raise(); - } - - return 0; - } - - protected: - T* m_mainView; -}; - -#endif diff --git a/kdepim/mobile/lib/kdeclarativefullscreenview.cpp b/kdepim/mobile/lib/kdeclarativefullscreenview.cpp deleted file mode 100644 index b412026b..00000000 --- a/kdepim/mobile/lib/kdeclarativefullscreenview.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "kdeclarativefullscreenview.h" -#include "stylesheetloader.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#ifdef KDEQMLPLUGIN_STATIC -#include "runtime/qml/kde/kdeintegration.h" -#include -#endif - -KDeclarativeFullScreenView::KDeclarativeFullScreenView(const QString& qmlFileName, QWidget* parent) : - QDeclarativeView( parent ), -#ifndef Q_OS_WIN - m_glWidget( 0 ), -#endif - m_qmlFileName( qmlFileName ), - m_splashScreen( 0 ) -{ - bool openGlEnabled = false; // off by default, seems to have random bad side-effects on the N900 - if ( KCmdLineArgs::parsedArgs()->isSet( "enable-opengl" ) ) - openGlEnabled = true; - if ( KCmdLineArgs::parsedArgs()->isSet( "disable-opengl" ) ) - openGlEnabled = false; - - if ( openGlEnabled ) { - // make MainView use OpenGL ES2 backend for better performance - // right now, the best performance can be achieved with a GLWidget - // and the use of the raster graphicssystem. - QGLFormat format = QGLFormat::defaultFormat(); - format.setSampleBuffers(false); - m_glWidget = new QGLWidget(format, this); // use OpenGL ES2 backend. - m_glWidget->setAutoFillBackground(false); - setViewport(m_glWidget); - Akonadi::Control::widgetNeedsAkonadi( m_glWidget ); - } else { - Akonadi::Control::widgetNeedsAkonadi( this ); - } - -#ifdef KDEQMLPLUGIN_STATIC - rootContext()->setContextProperty( QLatin1String("KDE"), new KDEIntegration( this ) ); -#endif - - setResizeMode( QDeclarativeView::SizeRootObjectToView ); - - resize(800, 480); - - qApp->setStartDragDistance(40); - - m_splashScreen = new QLabel( this ); - QPixmap splashBackground; - splashBackground.load( KStandardDirs::locate( "data", QLatin1String( "mobileui" ) + QDir::separator() + QLatin1String( "splashscreenstatic.png" ) ) ); - m_splashScreen->setPixmap( splashBackground ); - - QMetaObject::invokeMethod( this, "delayedInit", Qt::QueuedConnection ); -} - -void KDeclarativeFullScreenView::delayedInit() -{ - kDebug(); - static const bool debugTiming = KCmdLineArgs::parsedArgs()->isSet("timeit"); - QTime t; - - connect( this, SIGNAL(statusChanged(QDeclarativeView::Status)), SLOT(slotStatusChanged(QDeclarativeView::Status)) ); - - engine()->rootContext()->setContextProperty( QLatin1String("window"), QVariant::fromValue( static_cast( this ) ) ); - - if ( debugTiming ) { - kWarning() << "Adding QML import paths" << t.elapsed() << &t; - } - foreach ( const QString &importPath, KGlobal::dirs()->findDirs( "module", QLatin1String("imports") ) ) - engine()->addImportPath( importPath ); - QString qmlPath = KStandardDirs::locate( "appdata", m_qmlFileName + QLatin1String(".qml") ); - - if ( debugTiming ) { - kWarning() << "Adding QML import paths done" << t.elapsed() << &t; - } - - if ( qmlPath.isEmpty() ) // Try harder - qmlPath = KStandardDirs::locate( "data", QLatin1String( "mobileui" ) + QDir::separator() + m_qmlFileName + QLatin1String(".qml") ); - - // TODO: Get this from a KXMLGUIClient? - mActionCollection = new KActionCollection( this ); - - KAction *action = KStandardAction::close( this, SLOT(close()), this ); - mActionCollection->addAction( QLatin1String( "close" ), action ); - - action = new KAction( i18n( "Full Shutdown" ), this ); - connect( action, SIGNAL(triggered()), SLOT(closeAkonadi()) ); - mActionCollection->addAction( QLatin1String( "quit_akonadi" ), action ); - - if ( debugTiming ) { - kWarning() << "KDeclarativeFullScreenView ctor done" << t.elapsed() << &t << QDateTime::currentDateTime(); - } - - doDelayedInitInternal(); - doDelayedInit(); // let sub-classes do their init work - - // call setSource() only once our derived classes have set up everything - QMetaObject::invokeMethod( this, "setQmlFile", Qt::QueuedConnection, Q_ARG( QString, qmlPath ) ); -} - -KDeclarativeFullScreenView::~KDeclarativeFullScreenView() -{ -#ifndef Q_OS_WIN - delete m_glWidget; -#endif -} - -void KDeclarativeFullScreenView::setQmlFile(const QString& source) -{ - static const bool debugTiming = KCmdLineArgs::parsedArgs()->isSet("timeit"); - QTime t; - if ( debugTiming ) { - t.start(); - kWarning() << "start setSource" << &t << " - " << QDateTime::currentDateTime(); - } - qDebug() << QLatin1String("trying to load \"") + source << QLatin1String("\""); - setSource( QUrl::fromLocalFile(source) ); - if ( debugTiming ) { - kWarning() << "setSourceDone" << t.elapsed() << &t; - } -} - -void KDeclarativeFullScreenView::closeAkonadi() -{ - const QString message = i18n( "A full shutdown will disable notifications\nabout new emails and upcoming events." ); - const int result = KMessageBox::warningContinueCancel( 0, message ); - - if ( result == KMessageBox::Cancel ) - return; - - Akonadi::ServerManager::self()->stop(); - close(); -} - -void KDeclarativeFullScreenView::closeAllFrontends(const QString &qmlFileName) -{ - QStringList applications; - applications << QLatin1String( "notes-mobile" ) - << QLatin1String( "tasks-mobile" ) - << QLatin1String( "kmail-mobile" ) - << QLatin1String( "kaddressbook-mobile" ) - << QLatin1String( "korganizer-mobile" ); - if ( !applications.contains( qmlFileName + QLatin1String( "-mobile" ) ) && - !applications.contains( qmlFileName ) ){ - return; - } - foreach( const QString &app, applications ) { - if ( app.startsWith( qmlFileName ) ) - continue; - QDBusConnection::sessionBus().call( QDBusMessage::createMethodCall( - QLatin1String( "org.kde." ) + app, QLatin1String( "/MainApplication" ), - QLatin1String( "org.kde.KApplication" ), QLatin1String( "quit" ) ), QDBus::NoBlock ); - } -} - -void KDeclarativeFullScreenView::slotStatusChanged ( QDeclarativeView::Status status ) -{ - if ( status == QDeclarativeView::Error ) { - QStringList errorMessages; - std::transform( errors().constBegin(), errors().constEnd(), std::back_inserter( errorMessages ), boost::bind( &QDeclarativeError::toString, _1 ) ); - KMessageBox::error( this, i18n( "Application loading failed: %1", errorMessages.join( QLatin1String( "\n" ) ) ) ); - QCoreApplication::instance()->exit( 1 ); - } - - if ( status == QDeclarativeView::Ready ) { - if ( m_splashScreen ) { - m_splashScreen->deleteLater(); - m_splashScreen = 0; - } - } -} - -KActionCollection* KDeclarativeFullScreenView::actionCollection() const -{ - return mActionCollection; -} - -QObject* KDeclarativeFullScreenView::getAction( const QString& name, const QString& argument ) const -{ - QAction * action = mActionCollection->action( name ); - if ( !argument.isEmpty() && action ) - action->setData( argument ); - return action; -} - -QString KDeclarativeFullScreenView::getActionIconName( const QString& name ) const -{ - QAction * action = mActionCollection->action( name ); - if ( action ) - return action->icon().name(); - - return QString(); -} - -void KDeclarativeFullScreenView::setActionTitle(const QString& name, const QString& title) -{ - QAction * action = mActionCollection->action( name ); - if ( !title.isEmpty() && action ) - action->setText( title ); -} - -void KDeclarativeFullScreenView::bringToFront() -{ - activateWindow(); - raise(); -} - -void KDeclarativeFullScreenView::resizeEvent(QResizeEvent* event) -{ - QDeclarativeView::resizeEvent(event); - if ( m_splashScreen ) { - m_splashScreen->move( (event->size().width() - m_splashScreen->sizeHint().width())/2, - (event->size().height() - m_splashScreen->sizeHint().height())/2 ); - } -} - diff --git a/kdepim/mobile/lib/kdeclarativefullscreenview.h b/kdepim/mobile/lib/kdeclarativefullscreenview.h deleted file mode 100644 index 2e4e7a58..00000000 --- a/kdepim/mobile/lib/kdeclarativefullscreenview.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 KDECLARATIVEFULLSCREENVIEW_H -#define KDECLARATIVEFULLSCREENVIEW_H - -#include - -#include - -#ifndef Q_OS_WIN -#include -#endif - - -#include "mobileui_export.h" - -class KActionCollection; -class QLabel; - -/** - * Full screen view for mobile applications. This class is just to share code and therefore - * should not be instantiated by itself. - */ -class MOBILEUI_EXPORT KDeclarativeFullScreenView : public QDeclarativeView -{ - Q_OBJECT - protected: - /** - * Creates a new full screen view for a mobile application. - * - * @param qmlFileName is used to find the QML file in ${APP_DATA_DIR}/qmlFileName.qml - */ - KDeclarativeFullScreenView( const QString &qmlFileName, QWidget *parent = 0 ); - virtual ~KDeclarativeFullScreenView(); - - public Q_SLOTS: - - /** Get an action based on name. If the @param argument is not empty, it sets that - * as the data member of the action, see QAction::setData(). - */ - QObject* getAction( const QString &name, const QString& argument ) const; - - /** - * Returns the icon name for the action with the given @p name. - */ - QString getActionIconName( const QString &name ) const; - - - /** - * Brings the View to the foreground - */ - void bringToFront(); - - void setActionTitle( const QString& name, const QString& title); - - KActionCollection* actionCollection() const; - - protected: - /** Most initialization work should be done here instead of the ctor. - */ - virtual void doDelayedInit() = 0; - /** This is for KDeclarativeFullScreenView, don't touch! */ - virtual void doDelayedInitInternal() {} - - virtual void resizeEvent( QResizeEvent* event ); - - private Q_SLOTS: - void delayedInit(); - void setQmlFile( const QString &source ); - void slotStatusChanged ( QDeclarativeView::Status ); - void closeAkonadi(); - void closeAllFrontends( const QString &qmlFileName ); - - private: - - KActionCollection *mActionCollection; - - QGLWidget *m_glWidget; - - QString m_qmlFileName; - QLabel *m_splashScreen; -}; - -#endif diff --git a/kdepim/mobile/lib/kdeclarativemainview.cpp b/kdepim/mobile/lib/kdeclarativemainview.cpp deleted file mode 100644 index 45f3e21a..00000000 --- a/kdepim/mobile/lib/kdeclarativemainview.cpp +++ /dev/null @@ -1,1008 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 "kdeclarativemainview.h" -#include "kdeclarativemainview_p.h" - -#include "agentstatusmonitor.h" -#include "akonadibreadcrumbnavigationfactory.h" -#include "declarativewidgetbase.h" -#include "exporthandlerbase.h" -#include "guistatemanager.h" -#include "importhandlerbase.h" -#include "kdepim-version.h" -#include "kresettingproxymodel.h" -#include "listproxy.h" -#include "qmlcheckableproxymodel.h" -#include "qmllistselectionmodel.h" -#include "statemachinebuilder.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "kdeversion.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#define VIEW(model) { \ - QTreeView *view = new QTreeView( this ); \ - view->setWindowFlags( Qt::Window ); \ - view->setAttribute(Qt::WA_DeleteOnClose); \ - view->setModel(model); \ - view->setWindowTitle(#model); \ - view->show(); \ -} \ - -class ActionImageProvider : public QDeclarativeImageProvider -{ - public: - ActionImageProvider() - : QDeclarativeImageProvider( QDeclarativeImageProvider::Pixmap ) - { - } - - QPixmap requestPixmap( const QString &id, QSize *size, const QSize &requestedSize ) - { - int width = 32; - int height = 32; - if ( requestedSize.isValid() ) { - width = requestedSize.width(); - height = requestedSize.height(); - } - - if ( size ) - *size = QSize( width, height ); - - const QIcon icon = KIconLoader::global()->loadIcon( id, KIconLoader::Dialog, KIconLoader::SizeHuge ); - return icon.pixmap( width, height ); - } -}; - -using namespace Akonadi; - -typedef DeclarativeWidgetBase DeclarativeFilterLineEdit; -QML_DECLARE_TYPE( DeclarativeFilterLineEdit ) -QML_DECLARE_TYPE( DeclarativeBulkActionFilterLineEdit ) -QML_DECLARE_TYPE( AgentStatusMonitor ) -QML_DECLARE_TYPE( GuiStateManager ) - -KDeclarativeMainView::KDeclarativeMainView( const QString &appName, ListProxy *listProxy, QWidget *parent ) - : KDeclarativeFullScreenView( appName, parent ) - , d( new KDeclarativeMainViewPrivate( this ) ) -{ - d->mListProxy = listProxy; - - ActionImageProvider *provider = new ActionImageProvider; - engine()->addImageProvider( QLatin1String( "action_images" ), provider ); - - d->mSearchManager = new SearchManager( this ); - connect( d->mSearchManager, SIGNAL(searchStarted(Akonadi::Collection)), - d, SLOT(searchStarted(Akonadi::Collection)) ); - connect( d->mSearchManager, SIGNAL(searchStopped()), - d, SLOT(searchStopped()) ); -} - -void KDeclarativeMainView::doDelayedInitInternal() -{ - qmlRegisterType( "org.kde.akonadi", 4, 5, "FilterLineEdit" ); - qmlRegisterType( "org.kde.akonadi", 4, 5, "BulkActionFilterLineEdit" ); - qmlRegisterUncreatableType( "org.kde.pim.mobileui", 4, 5, "GuiStateManager", QLatin1String( "This type is only exported for its enums" ) ); - - static const bool debugTiming = KCmdLineArgs::parsedArgs()->isSet( "timeit" ); - - QTime time; - if ( debugTiming ) { - time.start(); - kWarning() << "Start KDeclarativeMainView ctor" << &time << " - " << QDateTime::currentDateTime(); - } - - KGlobal::locale()->insertCatalog( QLatin1String( "libkdepimmobileui" ) ); - KGlobal::locale()->insertCatalog( QLatin1String( "libincidenceeditors" ) ); // for category dialog - - if ( debugTiming ) { - kWarning() << "Catalog inserted" << time.elapsed() << &time; - } - - d->mChangeRecorder = new Akonadi::ChangeRecorder( this ); - d->mChangeRecorder->fetchCollection( true ); - d->mChangeRecorder->setCollectionMonitored( Akonadi::Collection::root() ); - d->mChangeRecorder->itemFetchScope().setFetchModificationTime( false ); - - d->mEtm = new Akonadi::EntityTreeModel( d->mChangeRecorder, this ); - d->mEtm->setItemPopulationStrategy( Akonadi::EntityTreeModel::LazyPopulation ); - d->mEtm->setIncludeUnsubscribed( false ); - - if ( debugTiming ) { - kWarning() << "ETM created" << time.elapsed() << &time; - } - - QAbstractItemModel *mainModel = d->mEtm; - - QAbstractProxyModel *mainProxyModel = createMainProxyModel(); - if ( mainProxyModel ) { - mainProxyModel->setSourceModel( mainModel ); - mainModel = mainProxyModel; - } - - d->mBnf = new Akonadi::BreadcrumbNavigationFactory( this ); - d->mBnf->createBreadcrumbContext( mainModel, this ); - - connect( d->mBnf, SIGNAL(collectionSelectionChanged()), SIGNAL(collectionSelectionChanged()) ); - - if ( debugTiming ) { - kWarning() << "BreadcrumbNavigation factory created" << time.elapsed() << &time; - } - - QDeclarativeContext *context = engine()->rootContext(); - context->setContextProperty( QLatin1String("searchManager"), d->mSearchManager ); - - context->setContextProperty( QLatin1String("_breadcrumbNavigationFactory"), d->mBnf ); - - d->mMultiBnf = new Akonadi::BreadcrumbNavigationFactory( this ); - d->mMultiBnf->createCheckableBreadcrumbContext( mainModel, this ); - - context->setContextProperty( QLatin1String("_multiSelectionComponentFactory"), d->mMultiBnf ); - - context->setContextProperty( QLatin1String("accountsModel"), QVariant::fromValue( static_cast( mainModel ) ) ); - - Akonadi::EntityMimeTypeFilterModel *filterModel = new Akonadi::EntityMimeTypeFilterModel( this ); - filterModel->setSourceModel( d->mBnf->unfilteredChildItemModel() ); - filterModel->addMimeTypeExclusionFilter( Akonadi::Collection::mimeType() ); - - d->mItemModel = createItemModelContext( context, filterModel ); - - context->setContextProperty( QLatin1String("application"), QVariant::fromValue( static_cast( this ) ) ); - - // The global screen manager - d->mGuiStateManager = createGuiStateManager(); - context->setContextProperty( QLatin1String("guiStateManager"), QVariant::fromValue( static_cast( d->mGuiStateManager ) ) ); - connect( d->mGuiStateManager, SIGNAL(guiStateChanged(int,int)), d, SLOT(guiStateChanged(int,int)) ); - - // A list of available favorites - d->mFavoritesEditor = new FavoritesEditor( actionCollection(), KGlobal::config(), this ); - d->mFavoritesEditor->setCollectionSelectionModel( d->mBnf->selectionModel() ); - - context->setContextProperty( QLatin1String("favoritesEditor"), d->mFavoritesEditor ); - context->setContextProperty( QLatin1String("favoritesList"), d->mFavoritesEditor->model() ); - - // A list of agent instances - Akonadi::AgentInstanceModel *agentInstanceModel = new Akonadi::AgentInstanceModel( this ); - d->mAgentInstanceFilterModel = new Akonadi::AgentFilterProxyModel( this ); - d->mAgentInstanceFilterModel->addCapabilityFilter( QLatin1String( "Resource" ) ); - d->mAgentInstanceFilterModel->setSourceModel( agentInstanceModel ); - - context->setContextProperty( QLatin1String("agentInstanceList"), QVariant::fromValue( static_cast( d->mAgentInstanceFilterModel ) ) ); - d->mAgentInstanceSelectionModel = new QItemSelectionModel( d->mAgentInstanceFilterModel, this ); - - setupAgentActionManager( d->mAgentInstanceSelectionModel ); - - KAction *action = KStandardAction::quit( qApp, SLOT(quit()), this ); - actionCollection()->addAction( QLatin1String( "quit" ), action ); - - action = new KAction( i18n( "Synchronize all" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(synchronizeAllItems()) ); - actionCollection()->addAction( QLatin1String( "synchronize_all_items" ), action ); - - action = new KAction( i18n( "Report Bug Or Request Feature" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(reportBug()) ); - actionCollection()->addAction( QLatin1String( "report_bug" ), action ); - - setupStandardActionManager( regularSelectionModel(), d->mItemActionSelectionModel ); - - connect( qApp, SIGNAL(aboutToQuit()), d, SLOT(saveState()) ); - - connect( d->mBnf->selectedItemModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), SIGNAL(isLoadingSelectedChanged()) ); - connect( d->mBnf->selectedItemModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), SIGNAL(isLoadingSelectedChanged()) ); - connect( d->mBnf->selectedItemModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), SIGNAL(isLoadingSelectedChanged()) ); - - connect( d->mBnf->qmlBreadcrumbsModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(breadcrumbsSelectionChanged()) ); - connect( d->mBnf->qmlBreadcrumbsModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(breadcrumbsSelectionChanged()) ); - connect( d->mBnf->qmlSelectedItemModel(), SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(breadcrumbsSelectionChanged()) ); - connect( d->mBnf->qmlSelectedItemModel(), SIGNAL(rowsRemoved(QModelIndex,int,int)), SLOT(breadcrumbsSelectionChanged()) ); - - if ( debugTiming ) { - kWarning() << "Restoring state" << time.elapsed() << &time; - } - - QTimer::singleShot(1000, d, SLOT(initializeStateSaver())); - - if ( debugTiming ) { - kWarning() << "restore state done" << time.elapsed() << &time; - } - - connect( d->mBnf->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(numSelectedAccountsChanged()) ); - - if ( debugTiming ) { - time.start(); - kWarning() << "Finished KDeclarativeMainView ctor: " << time.elapsed() << " - " << &time; - } - - qmlRegisterUncreatableType( "org.kde.pim.mobileui", 4, 5, "AgentStatusMonitor", QLatin1String( "This type is only exported for its enums" ) ); - d->mAgentStatusMonitor = new AgentStatusMonitor( this ); - d->mAgentStatusMonitor->setMimeTypeFilter( d->mChangeRecorder->mimeTypesMonitored() ); - context->setContextProperty( QLatin1String("agentStatusMonitor"), QVariant::fromValue( d->mAgentStatusMonitor ) ); - - connect( itemSelectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(itemSelectionChanged()) ); -} - -void KDeclarativeMainView::itemSelectionChanged() -{ - const QModelIndexList list = itemSelectionModel()->selectedRows(); - if ( list.size() != 1 ) { - // TODO Clear messageViewerItem - return; - } - - const QModelIndex itemIndex = list.first(); - const Akonadi::Collection parentCollection = itemIndex.data( Akonadi::EntityTreeModel::ParentCollectionRole ).value(); - Q_ASSERT( parentCollection.isValid() ); - const QModelIndex index = EntityTreeModel::modelIndexForCollection( entityTreeModel(), parentCollection ); - Q_ASSERT( index.isValid() ); - - const Akonadi::Item item = itemIndex.data( EntityTreeModel::ItemRole ).value(); - viewSingleItem( item ); -} - -void KDeclarativeMainView::viewSingleItem( const Akonadi::Item& ) -{ -} - -bool KDeclarativeMainView::useFilterLineEditInCurrentState() const -{ - return false; -} - -bool KDeclarativeMainView::doNotUseFilterLineEditInCurrentState() const -{ - return false; -} - -KDeclarativeMainView::~KDeclarativeMainView() -{ - delete d; -} - -void KDeclarativeMainView::setItemNaigationAndActionSelectionModels( QItemSelectionModel *itemNavigationSelectionModel, QItemSelectionModel *itemActionSelectionModel ) -{ - d->mItemNavigationSelectionModel = itemNavigationSelectionModel; - - d->mItemViewStateMaintainer = new KViewStateMaintainer( KGlobal::config()->group( QLatin1String( "ItemSelectionState" ) ), this ); - d->mItemViewStateMaintainer->setSelectionModel( d->mItemNavigationSelectionModel ); - - d->mItemActionSelectionModel = itemActionSelectionModel; -} - -QAbstractItemModel* KDeclarativeMainView::createItemModelContext( QDeclarativeContext *context, QAbstractItemModel *model ) -{ - d->mItemFilterModel = createItemFilterModel(); - if ( d->mItemFilterModel ) { - d->mItemFilterModel->setSourceModel( model ); - model = d->mItemFilterModel; - } - - QMLCheckableItemProxyModel *qmlCheckable = new QMLCheckableItemProxyModel( this ); - qmlCheckable->setSourceModel( model ); - - QItemSelectionModel *itemActionCheckModel = new QItemSelectionModel( model, this ); - qmlCheckable->setSelectionModel( itemActionCheckModel ); - - KSelectionProxyModel *checkedItems = new KSelectionProxyModel( itemActionCheckModel, this ); - checkedItems->setFilterBehavior( KSelectionProxyModel::ExactSelection ); - checkedItems->setSourceModel( model ); - - QItemSelectionModel *itemSelectionModel = new QItemSelectionModel( model, this ); - - if ( d->mListProxy ) { - d->mListProxy->setParent( this ); // Make sure the proxy gets deleted when this gets deleted. - - d->mListProxy->setSourceModel( qmlCheckable ); - } - - KLinkItemSelectionModel *itemNavigationSelectionModel = new KLinkItemSelectionModel( d->mListProxy, itemSelectionModel, this ); - KLinkItemSelectionModel *itemActionSelectionModel = new KLinkItemSelectionModel( d->mListProxy, itemActionCheckModel, this ); - - setItemNaigationAndActionSelectionModels( itemNavigationSelectionModel, itemActionSelectionModel ); - - if ( d->mListProxy ) { - context->setContextProperty( QLatin1String("itemModel"), d->mListProxy ); - - QMLListSelectionModel *qmlItemNavigationSelectionModel = new QMLListSelectionModel( d->mItemNavigationSelectionModel, this ); - QMLListSelectionModel *qmlItemActionSelectionModel = new QMLListSelectionModel( d->mItemActionSelectionModel, this ); - - context->setContextProperty( QLatin1String("_itemNavigationModel"), QVariant::fromValue( static_cast( qmlItemNavigationSelectionModel ) ) ); - context->setContextProperty( QLatin1String("_itemActionModel"), QVariant::fromValue( static_cast( qmlItemActionSelectionModel ) ) ); - - Akonadi::BreadcrumbNavigationFactory *bulkActionBnf = new Akonadi::BreadcrumbNavigationFactory( this ); - bulkActionBnf->createCheckableBreadcrumbContext( d->mEtm, this ); - context->setContextProperty( QLatin1String("_bulkActionBnf"), QVariant::fromValue( static_cast( bulkActionBnf ) ) ); - } - - StateMachineBuilder *builder = new StateMachineBuilder; - builder->setItemSelectionModel( itemNavigationSelectionModel ); - builder->setNavigationModel( d->mBnf->selectionModel() ); - d->mStateMachine = builder->getMachine( this ); - Q_ASSERT( d->mStateMachine ); - connect( d->mStateMachine, SIGNAL(stateChanged()), SIGNAL(stateChanged()) ); - d->mStateMachine->start(); - delete builder; - - return model; -} - -void KDeclarativeMainView::setApplicationState( const QString &state ) -{ - d->mStateMachine->requestState( state ); -} - -QString KDeclarativeMainView::applicationState() const -{ - if ( !d->mStateMachine ) - return QString(); - - const QSet set = d->mStateMachine->configuration(); - if ( set.isEmpty() ) - return QString(); - Q_ASSERT( !set.isEmpty() ); - - QSet::const_iterator it = set.begin(); - const QSet::const_iterator end = set.end(); - QObject *top = *it; - ++it; - for ( ; it != end; ++it ) { - QObject *state = *it; - QObject *parent = state->parent(); - while ( parent ) { - if ( parent == top ) - top = state; - parent = parent->parent(); - } - } - - return top->objectName(); -} - -void KDeclarativeMainView::breadcrumbsSelectionChanged() -{ - const int numBreadcrumbs = qobject_cast( d->mBnf->qmlBreadcrumbsModel() )->rowCount(); - const int numSelectedItems = qobject_cast( d->mBnf->qmlSelectedItemModel() )->rowCount(); - - if ( d->mGuiStateManager->inSearchScreenState() || - d->mGuiStateManager->inSearchResultScreenState() || - d->mGuiStateManager->inViewSingleItemState() ) - return; - - if ( numBreadcrumbs == 0 && numSelectedItems == 0) { - d->mGuiStateManager->switchState( GuiStateManager::HomeScreenState ); - } else if ( numBreadcrumbs == 0 && numSelectedItems == 1 ) { - d->mGuiStateManager->switchState( GuiStateManager::AccountScreenState ); - } else if ( numSelectedItems > 1 ) { - d->mGuiStateManager->switchState( GuiStateManager::MultipleFolderScreenState ); - } else { - d->mGuiStateManager->switchState( GuiStateManager::SingleFolderScreenState ); - } -} - -ItemFetchScope& KDeclarativeMainView::itemFetchScope() -{ - return d->mChangeRecorder->itemFetchScope(); -} - -void KDeclarativeMainView::addMimeType( const QString &mimeType ) -{ - d->mChangeRecorder->setMimeTypeMonitored( mimeType ); - d->mAgentInstanceFilterModel->addMimeTypeFilter( mimeType ); - d->mAgentStatusMonitor->setMimeTypeFilter( d->mChangeRecorder->mimeTypesMonitored() ); -} - -QStringList KDeclarativeMainView::mimeTypes() const -{ - return d->mChangeRecorder->mimeTypesMonitored(); -} - -void KDeclarativeMainView::setAgentInstanceListSelectedRow( int row ) -{ - static const int column = 0; - const QModelIndex idx = d->mAgentInstanceSelectionModel->model()->index( row, column ); - d->mAgentInstanceSelectionModel->select( QItemSelection( idx, idx ), QItemSelectionModel::ClearAndSelect ); -} - -void KDeclarativeMainView::setSelectedAccount( int row ) -{ - d->mBnf->selectionModel()->clearSelection(); - if ( row < 0 ) - return; - - d->mBnf->selectChild( row ); -} - -Akonadi::EntityTreeModel* KDeclarativeMainView::entityTreeModel() const -{ - return d->mEtm; -} - -QAbstractItemModel* KDeclarativeMainView::itemModel() const -{ - return d->mListProxy ? static_cast( d->mListProxy ) : static_cast( d->mItemModel ); -} - -void KDeclarativeMainView::launchAccountWizard() -{ -#ifdef Q_OS_UNIX - const QString inProcessAccountWizard = KStandardDirs::locate( "module", QLatin1String("accountwizard_plugin.so") ); - kDebug() << inProcessAccountWizard; - if ( !inProcessAccountWizard.isEmpty() ) { - QPluginLoader loader( inProcessAccountWizard ); - if ( loader.load() ) { - QObject *instance = loader.instance(); - // TODO error handling - QMetaObject::invokeMethod( instance, "run", Qt::DirectConnection, Q_ARG( QStringList, d->mChangeRecorder->mimeTypesMonitored() ), Q_ARG( QWidget*, this ) ); - loader.unload(); - return; - } else { - kDebug() << loader.fileName() << loader.errorString(); - } - } -#endif - - QStringList args; - args << QLatin1String( "--type" ) << d->mChangeRecorder->mimeTypesMonitored().join( QLatin1String(",") ); - - int pid = KProcess::startDetached( QLatin1String( "accountwizard" ), args ); - if ( !pid ) { - // Handle error - kDebug() << "error creating accountwizard"; - } -} - -void KDeclarativeMainView::synchronizeAllItems() -{ - if ( !d->mAgentInstanceFilterModel ) - return; - - for ( int row = 0; row < d->mAgentInstanceFilterModel->rowCount(); ++row ) { - const QModelIndex index = d->mAgentInstanceFilterModel->index( row, 0 ); - if ( !index.isValid() ) - continue; - - Akonadi::AgentInstance instance = index.data( Akonadi::AgentInstanceModel::InstanceRole ).value(); - if ( !instance.isValid() ) - continue; - - instance.synchronize(); - } -} - -void KDeclarativeMainView::saveFavorite() -{ - QString collectionName; - if ( regularSelectionModel()->hasSelection() ) { - const QModelIndexList indexes = regularSelectionModel()->selectedRows(); - if ( indexes.count() == 1 ) { - const Akonadi::Collection collection = indexes.first().data( Akonadi::EntityTreeModel::CollectionRole ).value(); - collectionName = collection.displayName(); - } - } - - bool ok; - const QString name = KInputDialog::getText( i18n( "Select name for favorite" ), - i18n( "Favorite name" ), - collectionName, &ok, this ); - - if ( !ok || name.isEmpty() ) - return; - - d->mFavoritesEditor->saveFavorite( name ); -} - -void KDeclarativeMainView::loadFavorite( const QString &name ) -{ - d->mFavoritesEditor->loadFavorite( name ); -} - -void KDeclarativeMainView::multipleSelectionFinished() -{ - const QModelIndexList list = d->mMultiBnf->checkModel()->selectedRows(); - - QItemSelection selection; - foreach ( const QModelIndex &index, list ) - selection.select( index, index ); - - d->mBnf->selectionModel()->select( selection, QItemSelectionModel::ClearAndSelect ); -} - -QItemSelectionModel* KDeclarativeMainView::regularSelectionModel() const -{ - if ( !d->mBnf ) - return 0; - - return d->mBnf->selectionModel(); -} - -Akonadi::Item KDeclarativeMainView::itemFromId( quint64 id ) const -{ - const QModelIndexList list = EntityTreeModel::modelIndexesForItem( d->mEtm, Item( id ) ); - if ( list.isEmpty() ) - return Akonadi::Item(); - - return list.first().data( EntityTreeModel::ItemRole ).value(); -} - -QItemSelectionModel* KDeclarativeMainView::itemSelectionModel() const -{ - return d->mItemNavigationSelectionModel; -} - -QItemSelectionModel* KDeclarativeMainView::itemActionModel() const -{ - return d->mItemActionSelectionModel; -} - -void KDeclarativeMainView::persistCurrentSelection( const QString &key ) -{ - ETMViewStateSaver saver; - saver.setSelectionModel( d->mBnf->selectionModel() ); - - const QStringList selection = saver.selectionKeys(); - d->mPersistedSelections.insert( key, selection ); -} - -void KDeclarativeMainView::clearPersistedSelection( const QString &key ) -{ - d->mPersistedSelections.remove( key ); -} - -void KDeclarativeMainView::restorePersistedSelection( const QString &key ) -{ - if ( !d->mPersistedSelections.contains( key ) ) - return; - - const QStringList selection = d->mPersistedSelections.take( key ); - ETMViewStateSaver *restorer = new ETMViewStateSaver; - - QItemSelectionModel *selectionModel = d->mBnf->selectionModel(); - selectionModel->clearSelection(); - - restorer->setSelectionModel( selectionModel ); - restorer->restoreSelection( selection ); -} - -void KDeclarativeMainView::importItems() -{ - ImportHandlerBase *handler = importHandler(); - if ( !handler ) - return; - - handler->setSelectionModel( regularSelectionModel() ); - handler->exec(); -} - -void KDeclarativeMainView::exportItems() -{ - ExportHandlerBase *handler = exportHandler(); - if ( !handler ) - return; - - handler->setSelectionModel( regularSelectionModel() ); - handler->exec(); -} - -void KDeclarativeMainView::exportSingleItem() -{ - ExportHandlerBase *handler = exportHandler(); - if ( !handler ) - return; - - handler->setItemSelectionModel( itemSelectionModel() ); - handler->exec(); -} - -/* - * Copied from kdelibs/kdoctools/kio_help.cpp - */ -static QString lookupDocumentation( const QString &fileName ) -{ - QStringList searches; - - // assemble the local search paths - // all files on /usr/share/doc are deleted instantly on maemo5 by docpurge - // therefore manual must be installed in data dir - const QStringList localDirectories = KGlobal::dirs()->resourceDirs( "data" ); - - QStringList languages = KGlobal::locale()->languageList(); - languages.append( QLatin1String("en") ); - languages.removeAll( QLatin1String("C") ); - - // this is kind of compat hack as we install our docs in en/ but the - // default language is en_US - for ( QStringList::Iterator it = languages.begin(); it != languages.end(); ++it ) { - if ( *it == QLatin1String("en_US") ) - *it = QLatin1String("en"); - } - - // look up the different languages - foreach ( const QString &directory, localDirectories ) { - foreach ( const QString &language, languages ) { - searches.append( QString::fromLatin1( "%1%2/%3/%4" ).arg( directory, QLatin1String("kontact-touch"), language, fileName ) ); - } - } - - foreach ( const QString &search, searches ) { - const QFileInfo info( search ); - if ( info.exists() && info.isFile() && info.isReadable() ) - return search; - } - - return QString(); -} - -void KDeclarativeMainView::openManual() -{ - const QString path = lookupDocumentation( QLatin1String("manual/index.html") ); - const KUrl url = path; - const bool isValid = url.isValid(); - - if ( !isValid ) { - KMessageBox::error( this, - i18n( "The manual could not be found on your system." ), - i18n( "Manual not found" ) ); - return; - } - - d->openHtml( path ); -} - -void KDeclarativeMainView::openDocumentation( const QString &relativePath ) -{ - const QString path = lookupDocumentation( relativePath ); - const KUrl url = path; - const bool isValid = url.isValid(); - - if ( !isValid ) { - KMessageBox::error( this, - i18n( "The documentation could not be found on your system." ), - i18n( "Documentation not found" ) ); - return; - } - - d->openHtml( path ); -} - -void KDeclarativeMainView::openLicenses() -{ - KDeclarativeMainView::openAttachment( KGlobal::dirs()->findResource( "data", QLatin1String("kontact-touch/licenses.pdf") ), - QLatin1String( "application/pdf" ) ); -} - -void KDeclarativeMainView::openAttachment( const QString &url, const QString &mimeType ) -{ - qDebug() << "opening attachment: " << url; - - KRun::runUrl( KUrl( url ), mimeType, this ); -} - -void KDeclarativeMainView::saveAttachment( const QString &url, const QString &defaultFileName ) -{ - QString fileName = defaultFileName; - if ( defaultFileName.isEmpty() ) { - fileName = KUrl( url ).fileName(); - if ( fileName.isEmpty() ) { - fileName = i18nc( "filename for an unnamed attachment", "attachment.1" ); - } - } - QStringList patterns = KMimeType::findByUrl( url, 0, true, true, 0 )->patterns(); - QString filter; - if ( !patterns.isEmpty() ) { - filter += patterns.join( QLatin1String( "\n" ) ); - filter += i18n( "\n*|all files" ); - } - const QString targetFile = KFileDialog::getSaveFileName( KUrl( QLatin1String("kfiledialog:///saveAttachment/") + fileName ), - filter, - this, - i18n( "Save Attachment" ) ); - if ( targetFile.isEmpty() ) { - return; - } - - if ( QFile::exists( targetFile ) ) { - if ( KMessageBox::warningContinueCancel( this, - i18n( "A file named
%1
already exists.

Do you want to overwrite it?", - targetFile ), - i18n( "File Already Exists" ), KGuiItem(i18n("&Overwrite")) ) == KMessageBox::Cancel) { - return; - } - - QFile::remove( targetFile ); - } - - QFile file( url ); - bool success = file.open( QFile::ReadOnly ); - if ( success ) - success = file.copy( targetFile ); - - if ( !success ) { - KMessageBox::error( this, - i18nc( "1 = file name, 2 = error string", - "Could not write to the file
%1

%2", - targetFile, - file.errorString() ), - i18n( "Error saving attachment" ) ); - } - - file.close(); -} - - -int KDeclarativeMainView::numSelectedAccounts() -{ - const QModelIndexList list = d->mBnf->selectionModel()->selectedRows(); - if ( list.isEmpty() ) - return 0; - - QSet resources; - - foreach ( const QModelIndex &index, list ) { - const Collection collection = index.data( EntityTreeModel::CollectionRole ).value(); - if ( !collection.isValid() ) - continue; - - resources.insert( collection.resource() ); - } - - return resources.size(); -} - -QAbstractItemModel* KDeclarativeMainView::selectedItemsModel() const -{ - return d->mBnf->selectedItemModel(); -} - -bool KDeclarativeMainView::isLoadingSelected() -{ - const QModelIndex index = d->mBnf->selectedItemModel()->index( 0, 0 ); - if ( !index.isValid() ) - return false; - - const QVariant fetchStateData = index.data( EntityTreeModel::FetchStateRole ); - Q_ASSERT( fetchStateData.isValid() ); - - const EntityTreeModel::FetchState fetchState = static_cast( fetchStateData.toInt() ); - return (fetchState == EntityTreeModel::FetchingState); -} - -void KDeclarativeMainView::setupStandardActionManager( QItemSelectionModel *collectionSelectionModel, - QItemSelectionModel *itemSelectionModel ) -{ - Akonadi::StandardActionManager *standardActionManager = new Akonadi::StandardActionManager( actionCollection(), this ); - standardActionManager->setItemSelectionModel( itemSelectionModel ); - standardActionManager->setCollectionSelectionModel( collectionSelectionModel ); - standardActionManager->createAllActions(); -} - -QAbstractProxyModel* KDeclarativeMainView::itemFilterModel() const -{ - return d->mItemFilterModel; -} - -QAbstractProxyModel* KDeclarativeMainView::listProxy() const -{ - return d->mListProxy; -} - -QAbstractProxyModel* KDeclarativeMainView::createMainProxyModel() const -{ - return 0; -} - -QAbstractProxyModel* KDeclarativeMainView::createItemFilterModel() const -{ - return 0; -} - -void KDeclarativeMainView::setItemFilterModel(QAbstractProxyModel* model) -{ - d->mItemFilterModel = model; -} - -ImportHandlerBase* KDeclarativeMainView::importHandler() const -{ - return 0; -} - -ExportHandlerBase* KDeclarativeMainView::exportHandler() const -{ - return 0; -} - -GuiStateManager* KDeclarativeMainView::createGuiStateManager() const -{ - return new GuiStateManager(); -} - -QString KDeclarativeMainView::version() const -{ - const static QString svn_rev = QLatin1String( KDEPIM_GIT_REVISION_STRING ); - if ( svn_rev.isEmpty() ) { - return i18n( "Version: %1", QLatin1String( KDEPIM_VERSION ) ); - } else { - return i18n( "Version: %1 (%2)\nLast change: %3", QLatin1String( KDEPIM_VERSION ), QLatin1String(KDEPIM_GIT_REVISION_STRING), QLatin1String(KDEPIM_GIT_LAST_CHANGE) ); - } -} - -QString KDeclarativeMainView::name() const -{ - const static QString app_name = QString( KGlobal::mainComponent().aboutData()->programName() ); - return app_name; -} - -Akonadi::ChangeRecorder* KDeclarativeMainView::monitor() const -{ - return d->mChangeRecorder; -} - -GuiStateManager* KDeclarativeMainView::guiStateManager() const -{ - return d->mGuiStateManager; -} - -void KDeclarativeMainView::setFilterLineEdit( KLineEdit *lineEdit ) -{ - Q_ASSERT( !d->mFilterLineEdit ); - - d->mFilterLineEdit = lineEdit; - d->mFilterLineEdit->setFixedHeight( 0 ); - d->mFilterLineEdit->setClearButtonShown( true ); - connect( d->mFilterLineEdit, SIGNAL(textChanged(QString)), - this, SLOT(filterLineEditChanged(QString)) ); - connect( d->mFilterLineEdit, SIGNAL(textChanged(QString)), - d->mItemFilterModel, SLOT(setFilterString(QString)) ); -} - -void KDeclarativeMainView::setBulkActionFilterLineEdit( KLineEdit *lineEdit ) -{ - Q_ASSERT( !d->mBulkActionFilterLineEdit ); - - d->mBulkActionFilterLineEdit = lineEdit; - d->mBulkActionFilterLineEdit->setFixedHeight( 0 ); - d->mBulkActionFilterLineEdit->setClearButtonShown( true ); - connect( d->mBulkActionFilterLineEdit, SIGNAL(textChanged(QString)), - this, SLOT(bulkActionFilterLineEditChanged(QString)) ); - connect( d->mBulkActionFilterLineEdit, SIGNAL(textChanged(QString)), - d->mItemFilterModel, SLOT(setFilterString(QString)) ); -} - -void KDeclarativeMainView::keyPressEvent( QKeyEvent *event ) -{ - static bool isSendingEvent = false; - - KLineEdit *lineEdit = (d->mGuiStateManager->inBulkActionScreenState() ? d->mBulkActionFilterLineEdit.data() : d->mFilterLineEdit.data()); - - if ( !isSendingEvent && // do not end up in a recursion - (d->mGuiStateManager->inAccountScreenState() || - d->mGuiStateManager->inSingleFolderScreenState() || - d->mGuiStateManager->inMultipleFolderScreenState() || - d->mGuiStateManager->inBulkActionScreenState() || - useFilterLineEditInCurrentState()) && // only in the right state - !event->text().isEmpty() && // only react on character input - lineEdit && // only if a filter line edit has been set - !doNotUseFilterLineEditInCurrentState() && - d->mItemFilterModel ) { // and a filter model is used - isSendingEvent = true; - QCoreApplication::sendEvent( lineEdit, event ); - isSendingEvent = false; - } else { - KDeclarativeFullScreenView::keyPressEvent( event ); - } -} - -void KDeclarativeMainView::reportBug() -{ - QString kde_version = QString::fromLatin1( KDE_VERSION_STRING ); - - struct utsname unameBuf; - uname( &unameBuf ); - QString os = QString::fromLatin1( unameBuf.sysname ) + - QLatin1String(" (") + QString::fromLatin1( unameBuf.machine ) + QLatin1String(") ") + - QLatin1String("release ") + QString::fromLatin1( unameBuf.release ); - KUrl url = KUrl( QLatin1String("https://bugs.kde.org/wizard.cgi") ); - url.addQueryItem( QLatin1String("os"), os ); - url.addQueryItem( QLatin1String("kdeVersion"), kde_version ); - url.addQueryItem( QLatin1String("appVersion"), KGlobal::mainComponent().aboutData()->version() ); - url.addQueryItem( QLatin1String("package"), KGlobal::mainComponent().aboutData()->productName() ); - url.addQueryItem( QLatin1String("kbugreport"), QLatin1String("1") ); - - KToolInvocation::invokeBrowser( url.url() ); -} - -void KDeclarativeMainView::checkAllBulkActionItems( bool check ) -{ - if ( check ) { - d->mItemActionSelectionModel->select( QItemSelection( d->mListProxy->index( 0, 0 ), - d->mListProxy->index( d->mListProxy->rowCount() - 1, 0 ) ), - QItemSelectionModel::Select ); - } else { - d->mItemActionSelectionModel->select( QItemSelection( d->mListProxy->index( 0, 0 ), - d->mListProxy->index( d->mListProxy->rowCount() - 1, 0 ) ), - QItemSelectionModel::Deselect ); - } -} - -AgentActionManager* KDeclarativeMainView::createAgentActionManager(QItemSelectionModel* agentSelectionModel) -{ - Akonadi::AgentActionManager *manager = new Akonadi::AgentActionManager( actionCollection(), this ); - manager->setSelectionModel( agentSelectionModel ); - manager->createAllActions(); - - manager->action( Akonadi::AgentActionManager::CreateAgentInstance )->setText( i18n( "Add" ) ); - manager->action( Akonadi::AgentActionManager::DeleteAgentInstance )->setText( i18n( "Delete" ) ); - manager->action( Akonadi::AgentActionManager::ConfigureAgentInstance )->setText( i18n( "Edit" ) ); - - manager->interceptAction( AgentActionManager::CreateAgentInstance ); - connect( manager->action( AgentActionManager::CreateAgentInstance ), SIGNAL(triggered(bool)), - this, SLOT(launchAccountWizard()) ); - - manager->interceptAction( Akonadi::AgentActionManager::ConfigureAgentInstance ); - connect( manager->action( Akonadi::AgentActionManager::ConfigureAgentInstance ), SIGNAL(triggered()), - d, SLOT(configureAgentInstance()) ); - - return manager; -} - -#include "moc_kdeclarativemainview.cpp" diff --git a/kdepim/mobile/lib/kdeclarativemainview.h b/kdepim/mobile/lib/kdeclarativemainview.h deleted file mode 100644 index 695eed2c..00000000 --- a/kdepim/mobile/lib/kdeclarativemainview.h +++ /dev/null @@ -1,344 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 KDECLARATIVEMAINVIEW_H -#define KDECLARATIVEMAINVIEW_H - -#include "kdeclarativefullscreenview.h" - -#include - -class ExportHandlerBase; -class GuiStateManager; -class ImportHandlerBase; -class KLineEdit; -class ListProxy; -class QAbstractItemModel; -class QAbstractProxyModel; - -namespace Akonadi { -class AgentActionManager; -class ChangeRecorder; -class EntityTreeModel; -class Item; -class ItemFetchScope; -} - -class KDeclarativeMainViewPrivate; - -/** - * Main view for mobile applications. This class is just to share code and therefore - * should not be instantiated by itself. - */ -class MOBILEUI_EXPORT KDeclarativeMainView : public KDeclarativeFullScreenView -{ - Q_OBJECT - Q_PROPERTY( int numSelectedAccounts READ numSelectedAccounts NOTIFY numSelectedAccountsChanged ) - Q_PROPERTY( bool isLoadingSelected READ isLoadingSelected NOTIFY isLoadingSelectedChanged ) - Q_PROPERTY( QString version READ version CONSTANT ) - Q_PROPERTY( QString name READ name CONSTANT ) - Q_PROPERTY( QString state READ applicationState WRITE setApplicationState NOTIFY stateChanged ) - - public: - /** - * Destroys the declarative main view. - */ - virtual ~KDeclarativeMainView(); - - /** - * Item fetch scope to specify how much data should be loaded for the list view. - * By default nothing is loaded. - */ - Akonadi::ItemFetchScope& itemFetchScope(); - - /** - * Adds a mime type of the items handled by this application. - */ - void addMimeType( const QString &mimeType ); - - /** - * Returns the mime types of the items handled by this application. - */ - QStringList mimeTypes() const; - - /** - * Returns the number of selected accounts. - */ - int numSelectedAccounts(); - - /** - * Returns the version of the application. - */ - QString version() const; - - /** - * Returns the localized name of the application. - */ - QString name() const; - - /** - * Returns the monitor that is used by the application. - */ - Akonadi::ChangeRecorder* monitor() const; - - /** - * Returns the gui state manager that will be used to manage the visibility - * of the various gui elements of the application. - */ - GuiStateManager* guiStateManager() const; - - /** - * Sets the @p lineEdit that is used to filter the items in the listview. - */ - void setFilterLineEdit( KLineEdit *lineEdit ); - - /** - * Sets the @p lineEdit that is used to filter the items in the listview in bulk action mode. - */ - void setBulkActionFilterLineEdit( KLineEdit *lineEdit ); - - QString applicationState() const; - void setApplicationState( const QString &state ); - - public slots: - void setSelectedAccount( int row ); - - void setAgentInstanceListSelectedRow( int row ); - - /** - * Starts the account wizard to add and configure new resources. - */ - void launchAccountWizard(); - - /** - * Starts the synchronization of all collections. - */ - void synchronizeAllItems(); - - /** - * Opens the licenses.pdf in an external viewer - */ - void openLicenses(); - - void saveFavorite(); - void loadFavorite( const QString &name ); - void multipleSelectionFinished(); - - void persistCurrentSelection( const QString &key ); - void clearPersistedSelection( const QString &key ); - void restorePersistedSelection( const QString &key ); - - /** - * Starts the import of items to the application. - * - * The actual work is done by the ImportHandlerBase objects returned - * by the importHandler() method. - */ - void importItems(); - - /** - * Starts the export of items from the application. - * - * The actual work is done by the ExportHandlerBase objects returned - * by the exportHandler() method. - */ - void exportItems(); - - /** - * Starts the export of a single item from the application. - * - * The actual work is done by the ExportHandlerBase objects returned - * by the exportHandler() method. - */ - void exportSingleItem(); - - /** - * Opens the user manual of this application in an external web browser. - */ - void openManual(); - - /** - * Opens the HTML based documentation located at the given relative @p path. - */ - void openDocumentation( const QString &path ); - - void openAttachment( const QString &url, const QString &mimeType ); - void saveAttachment( const QString &url, const QString &defaultFileName = QString() ); - - void reportBug(); - - void checkAllBulkActionItems( bool select ); - - Q_SIGNALS: - void numSelectedAccountsChanged(); - void isLoadingSelectedChanged(); - void stateChanged(); - - /** - * This signal is emitted whenever the collection has been changed but - * before the item list is updated. - */ - void collectionSelectionChanged(); - - protected: - /** - * Creates a new main view for a mobile application. - * - * @param appName is used to find the QML file in ${DATA_DIR}/mobile/appname.qml - * @param listProxy proxy for the list view of the application. KDeclarativeMainView - * takes ownwership over the pointer. - * @param parent The parent widget. - */ - KDeclarativeMainView( const QString &appName, ListProxy *listProxy, QWidget *parent = 0 ); - - /** - * Returns the global entity tree model. - */ - Akonadi::EntityTreeModel* entityTreeModel() const; - - /** - * Returns the filtered and QML-adapted item model. - */ - QAbstractItemModel* itemModel() const; - - /** - * Returns whether the currently selected item is being loaded. - * Note that results appear asynchronously in chunks while loading the contents - * of a collection. That means that the number of items can be greater then zero - * while isLoadingSelected returns true. - */ - bool isLoadingSelected(); - - /** - * Initializes the standard action manager that will be used by the application. - * This is a point of extension to use a custom action manager. - * - * @param collectionSelectionModel The selection model for the collections. - * @param itemSelectionModel The selection model for the items. - */ - virtual void setupStandardActionManager( QItemSelectionModel *collectionSelectionModel, - QItemSelectionModel *itemSelectionModel ); - - /** - * Initializes the agent action manager that will be used by the application. - * This is a point of extension to use a custom action manager. - * - * @param selectionModel The selection model for the agent instances. - */ - virtual void setupAgentActionManager( QItemSelectionModel *selectionModel ) = 0; - - /** - * Returns the a proxy model that will be used on top of the entity tree model. - */ - virtual QAbstractProxyModel* createMainProxyModel() const; - - /** - * Returns the filter proxy model that will be used to filter the item list. - * If @c 0 is returned, no filtering is done. - * - * @note The model has to provide a public slot with the following signature: - * void setFilterString( const QString& ) - */ - virtual QAbstractProxyModel* createItemFilterModel() const; - - /** - * Set the filter proxy model that will be used to filter the item list. - * Call this when calling createItemFilterModel() manually in your code. - */ - void setItemFilterModel( QAbstractProxyModel* model ); - - /** - * Returns the object that will be used for importing data. - * If @c 0 is returned, no import functionality is offered. - */ - virtual ImportHandlerBase* importHandler() const; - - /** - * Returns the object that will be used for exporting data. - * If @c 0 is returned, no export functionality is offered. - */ - virtual ExportHandlerBase* exportHandler() const; - - /** - * Returns the gui state manager that will be used by the application. - * - * Subclasses should returns its custom gui state managers here. - */ - virtual GuiStateManager* createGuiStateManager() const; - - /** - * This method is called when a single @p item has been selected to view. - */ - virtual void viewSingleItem( const Akonadi::Item &item ); - - /** - * Returns whether the application is in a state where the filter line edit - * can be used. - */ - virtual bool useFilterLineEditInCurrentState() const; - - /** - * Returns whether the application is in a state where the filter line edit - * must not be used. - */ - virtual bool doNotUseFilterLineEditInCurrentState() const; - - protected Q_SLOTS: - void breadcrumbsSelectionChanged(); - void itemSelectionChanged(); - - protected: - /** - * The selection model that belongs to the item model returned by entityTreeModel() - * or to the one returned by createMainProxyModel(). - */ - QItemSelectionModel* regularSelectionModel() const; - - /** - * The selection model which provides the information about checked - * items in the bulk action screen. - */ - QItemSelectionModel* itemActionModel() const; - - QAbstractProxyModel* itemFilterModel() const; - QAbstractProxyModel* listProxy() const; - QItemSelectionModel* itemSelectionModel() const; - QAbstractItemModel* selectedItemsModel() const; - - Akonadi::Item itemFromId( quint64 id ) const; - - virtual void keyPressEvent( QKeyEvent *event ); - - virtual QAbstractItemModel* createItemModelContext( QDeclarativeContext *context, QAbstractItemModel *model ); - void setItemNaigationAndActionSelectionModels( QItemSelectionModel *itemNavigationSelectionModel, QItemSelectionModel *itemActionSelectionModel ); - - /** - * Returns a newly created AgentActionMananger with standard setup. - * Use inside setupAgentActionManager(); - */ - Akonadi::AgentActionManager *createAgentActionManager( QItemSelectionModel* agentSelectionModel ); - - private: - void doDelayedInitInternal(); - KDeclarativeMainViewPrivate * const d; - - Q_PRIVATE_SLOT( d, void filterLineEditChanged( const QString& ) ) - Q_PRIVATE_SLOT( d, void bulkActionFilterLineEditChanged( const QString& ) ) -}; - -#endif // KDECLARATIVEMAINVIEW_H diff --git a/kdepim/mobile/lib/kdeclarativemainview_p.cpp b/kdepim/mobile/lib/kdeclarativemainview_p.cpp deleted file mode 100644 index 8391e8ab..00000000 --- a/kdepim/mobile/lib/kdeclarativemainview_p.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 "kdeclarativemainview_p.h" -#include "guistatemanager.h" -#include "stylesheetloader.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -KDeclarativeMainViewPrivate::KDeclarativeMainViewPrivate( KDeclarativeMainView *qq ) - : q( qq ) - , mChangeRecorder( 0 ) - , mCollectionFilter( 0 ) - , mItemFilterModel( 0 ) - , mBnf( 0 ) - , mAgentStatusMonitor( 0 ) - , mGuiStateManager( 0 ) - , mStateMachine( 0 ) - , mFavoritesEditor( 0 ) -{ } - -void KDeclarativeMainViewPrivate::initializeStateSaver() -{ - restoreState(); - connect( mEtm, SIGNAL(modelAboutToBeReset()), this, SLOT(saveState()) ); - connect( mEtm, SIGNAL(modelReset()), this, SLOT(restoreState()) ); -} - -void KDeclarativeMainViewPrivate::restoreState() -{ - Akonadi::ETMViewStateSaver *saver = new Akonadi::ETMViewStateSaver; - saver->setSelectionModel( mBnf->selectionModel() ); - KConfigGroup cfg( KGlobal::config(), "SelectionState" ); - saver->restoreState( cfg ); -} - -void KDeclarativeMainViewPrivate::saveState() -{ - Akonadi::ETMViewStateSaver saver; - saver.setSelectionModel( mBnf->selectionModel() ); - - KConfigGroup cfg( KGlobal::config(), "SelectionState" ); - saver.saveState( cfg ); - cfg.sync(); -} - -void KDeclarativeMainViewPrivate::filterLineEditChanged( const QString &text ) -{ - if ( !text.isEmpty() ) { - mFilterLineEdit->setFixedHeight( 40 ); - mFilterLineEdit->show(); - mFilterLineEdit->setFocus(); - } else if ( text.isEmpty() ) { - mFilterLineEdit->setFixedHeight( 0 ); - mFilterLineEdit->hide(); - } -} - -void KDeclarativeMainViewPrivate::bulkActionFilterLineEditChanged( const QString &text ) -{ - if ( !text.isEmpty() ) { - mBulkActionFilterLineEdit->setFixedHeight( 40 ); - mBulkActionFilterLineEdit->show(); - mBulkActionFilterLineEdit->setFocus(); - } else if ( text.isEmpty() ) { - mBulkActionFilterLineEdit->setFixedHeight( 0 ); - mBulkActionFilterLineEdit->hide(); - } -} - -void KDeclarativeMainViewPrivate::searchStarted( const Akonadi::Collection &searchCollection ) -{ - q->persistCurrentSelection( QLatin1String("SelectionBeforeSearchStarted") ); - - const QStringList selection = QStringList() << QLatin1String( "c1" ) // the 'Search' collection - << QString::fromLatin1( "c%1" ).arg( searchCollection.id() ); - Akonadi::ETMViewStateSaver *restorer = new Akonadi::ETMViewStateSaver; - - mGuiStateManager->pushState( GuiStateManager::SearchResultScreenState ); - - QItemSelectionModel *selectionModel = mBnf->selectionModel(); - selectionModel->clearSelection(); - - restorer->setSelectionModel( selectionModel ); - restorer->restoreSelection( selection ); -} - -void KDeclarativeMainViewPrivate::searchStopped() -{ - mGuiStateManager->popState(); - - q->restorePersistedSelection( QLatin1String("SelectionBeforeSearchStarted") ); - q->clearPersistedSelection( QLatin1String("SelectionBeforeSearchStarted") ); -} - -void KDeclarativeMainViewPrivate::guiStateChanged( int oldState, int newState ) -{ - /** - * If we come back from the BulkActionScreen and we had a filter string - * entered before we entered the BulkActionScreen, we'll refresh this - * filter string now. - */ - if ( oldState == GuiStateManager::BulkActionScreenState ) { - if ( newState == GuiStateManager::AccountScreenState || - newState == GuiStateManager::SingleFolderScreenState || - newState == GuiStateManager::MultipleFolderScreenState ) { - - KLineEdit *lineEdit = mFilterLineEdit.data(); - if ( lineEdit && mItemFilterModel ) { - const QString text = lineEdit->text(); - if ( text.isEmpty() ) { - // just trigger a refresh of the item view - QMetaObject::invokeMethod( mItemFilterModel, "setFilterString", Qt::DirectConnection, Q_ARG( QString, text ) ); - } else { - // trigger a refresh of the line edit and item view - lineEdit->clear(); - lineEdit->setText( text ); - } - } - } - } -} - -void KDeclarativeMainViewPrivate::openHtml( const QString &path ) -{ - q->openAttachment( path, QLatin1String( "text/html" ) ); -} - -DeclarativeBulkActionFilterLineEdit::DeclarativeBulkActionFilterLineEdit( QGraphicsItem *parent ) - : DeclarativeWidgetBase( parent ) -{ -} - -DeclarativeBulkActionFilterLineEdit::~DeclarativeBulkActionFilterLineEdit() -{ -} - -void DeclarativeBulkActionFilterLineEdit::clear() -{ - widget()->clear(); -} - -void KDeclarativeMainViewPrivate::configureAgentInstance() -{ - if (mAgentInstanceSelectionModel->selectedRows().isEmpty()) - return; - Akonadi::AgentInstance instance = mAgentInstanceSelectionModel->selectedRows().first().data( Akonadi::AgentInstanceModel::InstanceRole ).value(); - - instance.configure( q ); -} diff --git a/kdepim/mobile/lib/kdeclarativemainview_p.h b/kdepim/mobile/lib/kdeclarativemainview_p.h deleted file mode 100644 index 2b0884d6..00000000 --- a/kdepim/mobile/lib/kdeclarativemainview_p.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 KDECLARATIVEMAINVIEW_P_H -#define KDECLARATIVEMAINVIEW_P_H - -#include "kdeclarativemainview.h" - -#include "akonadibreadcrumbnavigationfactory.h" -#include "declarativewidgetbase.h" -#include "favoriteseditor.h" -#include "searchmanager.h" -#include "statemachinebuilder.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -class AgentStatusMonitor; -class KActionCollection; - -class ListProxy; -class KDeclarativeMainViewPrivate : public QObject -{ - Q_OBJECT - -public: /// members - KDeclarativeMainView *q; - Akonadi::ChangeRecorder *mChangeRecorder; // Deleted by ~QObject - QAbstractItemModel *mCollectionFilter; // Deleted by ~QObject - Akonadi::EntityTreeModel *mEtm; - ListProxy *mListProxy; - QAbstractItemModel *mItemModel; - QAbstractProxyModel *mItemFilterModel; - Akonadi::AgentFilterProxyModel *mAgentInstanceFilterModel; - QItemSelectionModel *mAgentInstanceSelectionModel; - Akonadi::BreadcrumbNavigationFactory *mBnf; - Akonadi::BreadcrumbNavigationFactory *mMultiBnf; - QItemSelectionModel *mItemNavigationSelectionModel; - QItemSelectionModel *mItemActionSelectionModel; - QHash mPersistedSelections; - KViewStateMaintainer *mItemViewStateMaintainer; - QPointer mFilterLineEdit; - QPointer mBulkActionFilterLineEdit; - AgentStatusMonitor *mAgentStatusMonitor; - GuiStateManager *mGuiStateManager; - NotifyingStateMachine *mStateMachine; - SearchManager *mSearchManager; - FavoritesEditor *mFavoritesEditor; - -public: /// Methods - explicit KDeclarativeMainViewPrivate( KDeclarativeMainView* ); - - void openHtml( const QString &path ); - -public slots: - void initializeStateSaver(); - void saveState(); - void restoreState(); - void filterLineEditChanged( const QString &text ); - void bulkActionFilterLineEditChanged( const QString &text ); - void searchStarted( const Akonadi::Collection& ); - void searchStopped(); - void guiStateChanged( int oldState, int newState ); - void configureAgentInstance(); -}; - -class DeclarativeBulkActionFilterLineEdit : -#ifndef Q_MOC_RUN -public DeclarativeWidgetBase -#else -public QGraphicsProxyWidget -#endif -{ - Q_OBJECT - - public: - explicit DeclarativeBulkActionFilterLineEdit( QGraphicsItem *parent = 0 ); - ~DeclarativeBulkActionFilterLineEdit(); - - public Q_SLOTS: - void clear(); -}; - -#endif // KDECLARATIVEMAINVIEW_P_H diff --git a/kdepim/mobile/lib/kresettingproxymodel.cpp b/kdepim/mobile/lib/kresettingproxymodel.cpp deleted file mode 100644 index 02a4999f..00000000 --- a/kdepim/mobile/lib/kresettingproxymodel.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "kresettingproxymodel.h" - -KResettingProxyModel::KResettingProxyModel(QObject* parent) - : QSortFilterProxyModel(parent) -{ - -} - -void KResettingProxyModel::setSourceModel(QAbstractItemModel* sourceModel) -{ - connect(sourceModel, SIGNAL(layoutAboutToBeChanged()), this, SLOT(slotBeginReset())); - connect(sourceModel, SIGNAL(layoutChanged()), this, SLOT(slotEndReset())); - - QSortFilterProxyModel::setSourceModel(sourceModel); - - disconnect(sourceModel, SIGNAL(layoutAboutToBeChanged()), this, SLOT(_q_sourceLayoutAboutToBeChanged())); - disconnect(sourceModel, SIGNAL(layoutChanged()), this, SLOT(_q_sourceLayoutChanged())); -} - -void KResettingProxyModel::slotBeginReset() -{ - QMetaObject::invokeMethod(this, "_q_sourceAboutToBeReset", Qt::DirectConnection); -} - -void KResettingProxyModel::slotEndReset() -{ - QMetaObject::invokeMethod(this, "_q_sourceReset", Qt::DirectConnection); -} - diff --git a/kdepim/mobile/lib/kresettingproxymodel.h b/kdepim/mobile/lib/kresettingproxymodel.h deleted file mode 100644 index b2050cb5..00000000 --- a/kdepim/mobile/lib/kresettingproxymodel.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 KRESETTINGPROXYMODEL -#define KRESETTINGPROXYMODEL - -#include - -/** - * This class is a workaround for buggy handling of layout change signals in QML: - * http://bugreports.qt.nokia.com/browse/QTBUG-13146 - */ -class KResettingProxyModel : public QSortFilterProxyModel -{ - Q_OBJECT -public: - explicit KResettingProxyModel(QObject* parent = 0); - - virtual void setSourceModel(QAbstractItemModel* sourceModel); - -public slots: - -private slots: - void slotBeginReset(); - void slotEndReset(); - -}; - -#endif diff --git a/kdepim/mobile/lib/listproxy.cpp b/kdepim/mobile/lib/listproxy.cpp deleted file mode 100644 index 6bfc2f28..00000000 --- a/kdepim/mobile/lib/listproxy.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "listproxy.h" - -#include -#include - -ListProxy::ListProxy( QObject* parent ) : QSortFilterProxyModel( parent ) -{ -} - -qint64 ListProxy::itemId( int row ) const -{ - if ( row < 0 || row >= rowCount() ) - return -1; - - QModelIndex idx = index( row, 0 ); - if ( !idx.isValid() ) - return -1; - - const Akonadi::Item item = QSortFilterProxyModel::data( idx, Akonadi::EntityTreeModel::ItemRole ).value(); - return item.id(); -} - -void ListProxy::setSourceModel(QAbstractItemModel* sourceModel) -{ - QSortFilterProxyModel::setSourceModel(sourceModel); -} - - diff --git a/kdepim/mobile/lib/listproxy.h b/kdepim/mobile/lib/listproxy.h deleted file mode 100644 index 7b9444ff..00000000 --- a/kdepim/mobile/lib/listproxy.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 LISTPROXY_H -#define LISTPROXY_H - -#include - -#include "mobileui_export.h" - -/** Proxy model to provide roles for accessing Akonadi::Items properties from QML. */ -class MOBILEUI_EXPORT ListProxy : public QSortFilterProxyModel -{ - Q_OBJECT - Q_PROPERTY( int itemCount READ rowCount ) - - public: - explicit ListProxy( QObject* parent = 0 ); - - /** Make sure that reimplementing classes implement data for their own needs */ - virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const = 0; - - virtual void setSourceModel(QAbstractItemModel* sourceModel); - - Q_INVOKABLE qint64 itemId( int row ) const; -}; - -#endif diff --git a/kdepim/mobile/lib/mobileui_export.h b/kdepim/mobile/lib/mobileui_export.h deleted file mode 100644 index 18dc9a8f..00000000 --- a/kdepim/mobile/lib/mobileui_export.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2007 David Faure - - 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 MOBILEUI_EXPORT_H -#define MOBILEUI_EXPORT_H - -/* needed for KDE_EXPORT and KDE_IMPORT macros */ -#include - -#ifndef MOBILEUI_EXPORT -# if defined(KDEPIM_STATIC_LIBS) - /* No export/import for static libraries */ -# define MOBILEUI_EXPORT -# elif defined(MAKE_KDEPIMMOBILEUI_LIB) - /* We are building this library */ -# define MOBILEUI_EXPORT KDE_EXPORT -# else - /* We are using this library */ -# define MOBILEUI_EXPORT KDE_IMPORT -# endif -#endif - -#endif // MOBILEUI_EXPORT_H diff --git a/kdepim/mobile/lib/modelselectiontransition.cpp b/kdepim/mobile/lib/modelselectiontransition.cpp deleted file mode 100644 index bc20fc57..00000000 --- a/kdepim/mobile/lib/modelselectiontransition.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "modelselectiontransition.h" - -class ModelSelectionTransitionPrivate -{ - ModelSelectionTransitionPrivate(ModelSelectionTransition *qq, QItemSelectionModel *selectionModel, ModelSelectionTransition::Type type) - : q_ptr(qq), m_selectionModel(selectionModel), m_type(type) - { - - } - Q_DECLARE_PUBLIC(ModelSelectionTransition) - ModelSelectionTransition * const q_ptr; - - QItemSelectionModel * const m_selectionModel; - ModelSelectionTransition::Type m_type; -}; - -ModelSelectionTransition::ModelSelectionTransition(QItemSelectionModel* selectionModel, ModelSelectionTransition::Type type, QState* sourceState) - : QSignalTransition(selectionModel, - SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - sourceState), - d_ptr(new ModelSelectionTransitionPrivate(this, selectionModel, type)) -{ - -} - -ModelSelectionTransition::~ModelSelectionTransition() -{ - delete d_ptr; -} - -bool ModelSelectionTransition::eventTest(QEvent* event) -{ - Q_D(ModelSelectionTransition); - if (!QSignalTransition::eventTest(event)) - return false; - - // Yes, it does feel wrong to use a switch statement in a state machine. - // Oh well. - switch (d->m_type) { - case AcceptNoSelection: - return !d->m_selectionModel->hasSelection(); - case AcceptMultiSelection: - return d->m_selectionModel->selectedRows().size() > 1; - case AcceptSingleSelection: - return d->m_selectionModel->selectedRows().size() == 1; - case AcceptSingleTopLevelSelection: { - const QModelIndexList list = d->m_selectionModel->selectedRows(); - return list.size() == 1 && !list.first().parent().isValid(); - } - } - Q_ASSERT(!"Unknown type"); - return false; -} - diff --git a/kdepim/mobile/lib/modelselectiontransition.h b/kdepim/mobile/lib/modelselectiontransition.h deleted file mode 100644 index 05723d46..00000000 --- a/kdepim/mobile/lib/modelselectiontransition.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 MODELSELECTIONTRANSITION_H -#define MODELSELECTIONTRANSITION_H - -#include "mobileui_export.h" - -#include -#include - -class ModelSelectionTransitionPrivate; - -class MOBILEUI_EXPORT ModelSelectionTransition : public QSignalTransition -{ - Q_OBJECT -public: - enum Type { - AcceptNoSelection, - AcceptSingleSelection, - AcceptMultiSelection, - AcceptSingleTopLevelSelection - }; - ModelSelectionTransition(QItemSelectionModel *folderModel, Type type, QState* sourceState = 0); - virtual ~ModelSelectionTransition(); -protected: - virtual bool eventTest(QEvent* event); - -private: - Q_DECLARE_PRIVATE(ModelSelectionTransition) - ModelSelectionTransitionPrivate * const d_ptr; -}; - -#endif diff --git a/kdepim/mobile/lib/orderedchildcollectionsmodel.cpp b/kdepim/mobile/lib/orderedchildcollectionsmodel.cpp deleted file mode 100644 index 99182f33..00000000 --- a/kdepim/mobile/lib/orderedchildcollectionsmodel.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "orderedchildcollectionsmodel.h" -#include -#include -#include - -OrderedChildCollectionsModel::OrderedChildCollectionsModel( QObject* parent ) - : QSortFilterProxyModel( parent ) -{ - setDynamicSortFilter( true ); - setSortCaseSensitivity( Qt::CaseInsensitive ); - setSortLocaleAware( true ); - // TODO: This does not actually work. The id() of each special collection is -1. - specialCollectionOrder << - Akonadi::SpecialMailCollections::self()->defaultCollection( Akonadi::SpecialMailCollections::Inbox ).id() - << Akonadi::SpecialMailCollections::self()->defaultCollection( Akonadi::SpecialMailCollections::Outbox ).id() - << Akonadi::SpecialMailCollections::self()->defaultCollection( Akonadi::SpecialMailCollections::Trash ).id() - << Akonadi::SpecialMailCollections::self()->defaultCollection( Akonadi::SpecialMailCollections::Drafts ).id() - << Akonadi::SpecialMailCollections::self()->defaultCollection( Akonadi::SpecialMailCollections::Templates ).id() - << Akonadi::SpecialMailCollections::self()->defaultCollection( Akonadi::SpecialMailCollections::SentMail ).id(); -} - -bool OrderedChildCollectionsModel::lessThan( const QModelIndex &left, const QModelIndex &right ) const -{ - const Akonadi::Entity::Id leftId = left.data( Akonadi::EntityTreeModel::CollectionIdRole ).toLongLong(); - const Akonadi::Entity::Id rightId = right.data( Akonadi::EntityTreeModel::CollectionIdRole ).toLongLong(); - if ( const int leftIndex = specialCollectionOrder.indexOf( leftId ) >= 0 ) { - if ( const int rightIndex = specialCollectionOrder.indexOf( rightId ) >= 0 ) { - return leftIndex < rightIndex; - } - // Left is a special collection, right is not. - return true; - } else { - if ( const int rightIndex = specialCollectionOrder.indexOf( rightId ) >= 0 ) { - // Right is a special collection, left is not. - return false; - } - } - // Neither is special. - - // First put inbox on top, - - const Akonadi::Collection leftCol = left.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( leftCol.name().compare( QLatin1String( "inbox" ), Qt::CaseInsensitive ) == 0 ) { - // If we have two collections called inbox make sure they have total order. - const Akonadi::Collection rightCol = right.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( rightCol.name().compare( QLatin1String( "inbox" ), Qt::CaseInsensitive ) == 0 ) - return leftId < rightId; - return true; - } else { - const Akonadi::Collection rightCol = right.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( rightCol.name().compare( QLatin1String( "inbox" ), Qt::CaseInsensitive ) == 0 ) - return false; - } - // ... then let QSFPM sort by display data - return QSortFilterProxyModel::lessThan( left, right ); -} diff --git a/kdepim/mobile/lib/orderedchildcollectionsmodel.h b/kdepim/mobile/lib/orderedchildcollectionsmodel.h deleted file mode 100644 index b297a1c4..00000000 --- a/kdepim/mobile/lib/orderedchildcollectionsmodel.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 ORDEREDCHILDCOLLECTIONSMODEL_H -#define ORDEREDCHILDCOLLECTIONSMODEL_H - -#include -#include - -class OrderedChildCollectionsModel : public QSortFilterProxyModel -{ - Q_OBJECT -public: - explicit OrderedChildCollectionsModel(QObject* parent = 0); - - virtual bool lessThan(const QModelIndex& left, const QModelIndex& right) const; - -private: - QVector specialCollectionOrder; - -}; - -#endif diff --git a/kdepim/mobile/lib/qmlcheckableproxymodel.h b/kdepim/mobile/lib/qmlcheckableproxymodel.h deleted file mode 100644 index 7c341eab..00000000 --- a/kdepim/mobile/lib/qmlcheckableproxymodel.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 QMLCHECKABLEPROXYMODEL_H -#define QMLCHECKABLEPROXYMODEL_H - -#include - -class QMLCheckableItemProxyModel : public KCheckableProxyModel -{ -public: - enum MoreRoles { - CheckOn = Qt::UserRole + 3000 - }; - explicit QMLCheckableItemProxyModel (QObject* parent = 0) - : KCheckableProxyModel(parent) - { - } - - virtual void setSourceModel(QAbstractItemModel* sourceModel) - { - KCheckableProxyModel::setSourceModel(sourceModel); - - QHash roles = roleNames(); - roles.insert( CheckOn, "checkOn" ); - setRoleNames(roles); - } - - virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const - { - if ( role == CheckOn ) - return (index.data(Qt::CheckStateRole) == Qt::Checked); - return KCheckableProxyModel::data(index, role); - } - -}; - -#endif diff --git a/kdepim/mobile/lib/qmldir b/kdepim/mobile/lib/qmldir deleted file mode 100644 index e50c5eb4..00000000 --- a/kdepim/mobile/lib/qmldir +++ /dev/null @@ -1,44 +0,0 @@ -Button 4.5 Button.qml -Button2 4.5 Button2.qml -BulkActionScreen 4.5 BulkActionScreen.qml -BulkActionList 4.5 BulkActionList.qml -Action 4.5 Action.qml -ActionList 4.5 ActionList.qml -ActiveActionMenuItemDelegate 4.5 ActiveActionMenuItemDelegate.qml -ReorderList 4.5 ReorderList.qml -ReorderListContainer 4.5 ReorderListContainer.qml -ActionListItem 4.5 ActionListItem.qml -AttachmentList 4.5 AttachmentList.qml -CompletionSlider 4.5 CompletionSlider.qml -VerticalSelector 4.5 VerticalSelector.qml -Clock 4.5 Clock.qml -TimeSelector 4.5 TimeSelector.qml -Calendar 4.5 Calendar.qml -CalendarDaay 4.5 CalendarDay.qml -ItemListView 4.5 ItemListView.qml -ItemListViewDelegate 4.5 ItemListViewDelegate.qml -MainView 4.5 MainView.qml -StartCanvas 4.5 StartCanvas.qml -ActionMenuContainer 4.5 ActionMenuContainer.qml -FakeAction 4.5 FakeAction.qml -AboutDialog 4.5 AboutDialog.qml -ApplicationGeneralActions 4.5 ApplicationGeneralActions.qml -MultipleSelectionComponent 4.5 MultipleSelectionComponent.qml -MultipleSelectionScreen 4.5 MultipleSelectionScreen.qml -ScriptAction 4.5 ScriptAction.qml -ScriptActionItem 4.5 ScriptActionItem.qml -AgentInstanceList 4.5 AgentInstanceList.qml -AgentInstanceListContainer 4.5 AgentInstanceListContainer.qml -AgentInstanceStatusIndicator 4.5 AgentInstanceStatusIndicator.qml -FavoriteManager 4.5 FavoriteManager.qml -ReorderListDelegate 4.5 ReorderListDelegate.qml -AgentStatusIndicator 4.5 AgentStatusIndicator.qml -MorePanel 4.5 MorePanel.qml -CalendarDialog 4.5 CalendarDialog.qml -ClockDialog 4.5 ClockDialog.qml -SearchDialog 4.5 SearchDialog.qml -SearchResultScreen 4.5 SearchResultScreen.qml -ActionButton 4.5 ActionButton.qml -ItemEditButton 4.5 ItemEditButton.qml -DecoratedListView 4.5 DecoratedListView.qml -Switch 4.5 Switch.qml diff --git a/kdepim/mobile/lib/qmllistselectionmodel.cpp b/kdepim/mobile/lib/qmllistselectionmodel.cpp deleted file mode 100644 index b1a5588a..00000000 --- a/kdepim/mobile/lib/qmllistselectionmodel.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "qmllistselectionmodel.h" - -#include -#include - -QMLListSelectionModel::QMLListSelectionModel(QItemSelectionModel *selectionModel, QObject* parent) - : QObject(parent), m_selectionModel(selectionModel) -{ - connect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(selectionChanged())); -} - -QMLListSelectionModel::QMLListSelectionModel(QAbstractItemModel* model, QObject* parent) - : QObject(parent), m_selectionModel(new QItemSelectionModel(model, this)) -{ - connect(m_selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(selectionChanged())); -} - -QItemSelectionModel* QMLListSelectionModel::selectionModel() const -{ - return m_selectionModel; -} - -QList< int > QMLListSelectionModel::selection() const -{ - QList< int > list; - const QModelIndexList indexes = m_selectionModel->selectedRows(); - foreach (const QModelIndex &index, indexes) - list << index.row(); - return list; -} - -bool QMLListSelectionModel::hasSelection() const -{ - return m_selectionModel->hasSelection(); -} - -int QMLListSelectionModel::currentRow() const -{ - const QModelIndexList indexes = m_selectionModel->selectedRows(); - if (indexes.size() != 1) - return -1; - Q_ASSERT(indexes.first().isValid()); - return indexes.first().row(); -} - -void QMLListSelectionModel::setCurrentRow(int row) -{ - select(row, QItemSelectionModel::ClearAndSelect); -} - -qint64 QMLListSelectionModel::currentItemId() const -{ - const QModelIndexList indexes = m_selectionModel->selectedRows(); - if (indexes.size() != 1) - return -1; - Q_ASSERT(indexes.first().isValid()); - return indexes.first().data(Akonadi::EntityTreeModel::ItemIdRole).toLongLong(); -} - -void QMLListSelectionModel::setCurrentItemId(qint64 itemId) -{ - const QModelIndexList list = Akonadi::EntityTreeModel::modelIndexesForItem(m_selectionModel->model(), Akonadi::Item(itemId)); - if (list.size() == 1) { - const QModelIndex idx = list.first(); - m_selectionModel->select(QItemSelection(idx, idx), QItemSelectionModel::ClearAndSelect); - } -} - -void QMLListSelectionModel::select(int row, int command) -{ - if (row < 0) { - clearSelection(); - return; - } - static const int column = 0; - const QModelIndex idx = m_selectionModel->model()->index(row, column); - Q_ASSERT(idx.isValid()); - QItemSelection sel(idx, idx); - QItemSelectionModel::SelectionFlags flags = static_cast(command); - m_selectionModel->select(sel, flags); -} - -bool QMLListSelectionModel::requestNext() -{ - const QModelIndexList list = m_selectionModel->selectedRows(); - if (list.isEmpty() || list.size() != 1) - return false; - - const QModelIndex idx = list.first(); - Q_ASSERT(idx.isValid()); - const QModelIndex next = idx.sibling(idx.row() + 1, idx.column()); - if (!next.isValid()) - return false; - - m_selectionModel->select(QItemSelection(next, next), QItemSelectionModel::ClearAndSelect); - return true; -} - -bool QMLListSelectionModel::requestPrevious() -{ - const QModelIndexList list = m_selectionModel->selectedRows(); - if (list.isEmpty() || list.size() != 1) - return false; - - const QModelIndex idx = list.first(); - Q_ASSERT(idx.isValid()); - if (idx.row() == 0) - return false; - - const QModelIndex previous = idx.sibling(idx.row() - 1, idx.column()); - m_selectionModel->select(QItemSelection(previous, previous), QItemSelectionModel::ClearAndSelect); - return true; -} - -void QMLListSelectionModel::clearSelection() -{ - // Don't call QItemSelectionModel::clearSelection. It is non-virtual so - // item selection models in chains can't react to it properly. - m_selectionModel->select(QItemSelection(), QItemSelectionModel::Clear); -} - diff --git a/kdepim/mobile/lib/qmllistselectionmodel.h b/kdepim/mobile/lib/qmllistselectionmodel.h deleted file mode 100644 index f5a8db9a..00000000 --- a/kdepim/mobile/lib/qmllistselectionmodel.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 QMLLISTSELECTIONMODEL_H -#define QMLLISTSELECTIONMODEL_H - -#include - -#include "mobileui_export.h" - -class MOBILEUI_EXPORT QMLListSelectionModel : public QObject -{ - Q_OBJECT - Q_PROPERTY(QList selection READ selection NOTIFY selectionChanged) - Q_PROPERTY(int currentRow READ currentRow WRITE setCurrentRow NOTIFY selectionChanged) - Q_PROPERTY(bool hasSelection READ hasSelection NOTIFY selectionChanged) - Q_PROPERTY(qint64 currentItemIdHack READ currentItemId WRITE setCurrentItemId NOTIFY selectionChanged) -public: - enum SelectionFlag { - NoUpdate = 0x0000, - Clear = 0x0001, - Select = 0x0002, - Deselect = 0x0004, - Toggle = 0x0008, - Current = 0x0010, - Rows = 0x0020, - Columns = 0x0040, - SelectCurrent = Select | Current, - ToggleCurrent = Toggle | Current, - ClearAndSelect = Clear | Select - }; - //Q_DECLARE_FLAGS(SelectionFlags, SelectionFlag) - - explicit QMLListSelectionModel(QItemSelectionModel *selectionModel, QObject* parent = 0); - explicit QMLListSelectionModel(QAbstractItemModel *model, QObject* parent = 0); - - QItemSelectionModel* selectionModel() const; - - QList selection() const; - - int currentRow() const; - void setCurrentRow(int row); - - qint64 currentItemId() const; - void setCurrentItemId(qint64 itemId); - -public slots: - void clearSelection(); - void select(int row, int command); - bool hasSelection() const; - - bool requestNext(); - bool requestPrevious(); - -signals: - void selectionChanged(); - -private: - QItemSelectionModel * const m_selectionModel; -}; - -#endif - diff --git a/kdepim/mobile/lib/rangemanager.cpp b/kdepim/mobile/lib/rangemanager.cpp deleted file mode 100644 index 16e3bc43..00000000 --- a/kdepim/mobile/lib/rangemanager.cpp +++ /dev/null @@ -1,85 +0,0 @@ - -#include "rangemanager_p.h" - -#include - -RangeManager::RangeManager() -{ -} - -RangeManager::~RangeManager() -{ -} - -int RangeManager::count() const -{ - return mRangeSizes.count(); -} - -void RangeManager::clear() -{ - mRangeSizes.clear(); -} - -void RangeManager::insertRange( int range, int size ) -{ - mRangeSizes.insert( range, size ); -} - -void RangeManager::removeRange( int range ) -{ - mRangeSizes.remove( range ); -} - -void RangeManager::increaseRange( int range, int elements ) -{ - mRangeSizes[ range ] += elements; -} - -void RangeManager::decreaseRange( int range, int elements ) -{ - mRangeSizes[ range ] -= elements; -} - -int RangeManager::rangeStart( int range ) const -{ - int start = 0; - - for ( int i = 0; i < range; ++i ) - start += mRangeSizes.at( i ); - - return start; -} - -int RangeManager::rangeSize( int range ) const -{ - return mRangeSizes.at( range ); -} - -int RangeManager::rangeForPosition( int position ) const -{ - int start = 0; - for ( int range = 0; range < mRangeSizes.size(); ++range ) { - start += mRangeSizes.at( range ); - if ( start > position ) - return range; - } - - return -1; -} - -void RangeManager::dump() const -{ - QStringList output; - int counter = 0; - for ( int range = 0; range < mRangeSizes.size(); ++range ) { - QStringList foo; - for ( int i = 0; i < mRangeSizes.at( range ); ++i ) { - foo += QString::number( counter ); - counter++; - } - output += foo.join(QLatin1String(" ")); - } - - qDebug("[%s]", qPrintable( output.join(QLatin1String(" | ")) ) ); -} diff --git a/kdepim/mobile/lib/rangemanager_p.h b/kdepim/mobile/lib/rangemanager_p.h deleted file mode 100644 index 3e207c0a..00000000 --- a/kdepim/mobile/lib/rangemanager_p.h +++ /dev/null @@ -1,78 +0,0 @@ - -#ifndef RANGEMANAGER_P_H -#define RANGEMANAGER_P_H - -#include - -/** - * @short A class that manages a list of ranges. - * - */ -class RangeManager -{ - public: - /** - * Creates a new range manager. - */ - RangeManager(); - - /** - * Destroys the range manager. - */ - ~RangeManager(); - - /** - * Returns the number of ranges. - */ - int count() const; - - /** - * Removes all ranges from the range manager. - */ - void clear(); - - /** - * Inserts a new range of the given @p size before @p range. - */ - void insertRange( int range, int size ); - - /** - * Removes the given @p range. - */ - void removeRange( int range ); - - /** - * Increases the given range by @p elements. - */ - void increaseRange( int range, int elements ); - - /** - * Decreases the given range by @p elements. - */ - void decreaseRange( int range, int elements ); - - /** - * Returns the absolute start position of the given @p range. - */ - int rangeStart( int range ) const; - - /** - * Returns the number of elements of the given @p range. - */ - int rangeSize( int range ) const; - - /** - * Returns the range that contains the given absolute @p position. - */ - int rangeForPosition( int position ) const; - - /** - * Dumps the current range layout to console. Useful for debugging. - */ - void dump() const; - - private: - QVector mRangeSizes; -}; - -#endif diff --git a/kdepim/mobile/lib/searchmanager.cpp b/kdepim/mobile/lib/searchmanager.cpp deleted file mode 100644 index 8ccc52c8..00000000 --- a/kdepim/mobile/lib/searchmanager.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "searchmanager.h" - -#include -#include -#include - -#include - -SearchManager::SearchManager( QObject *parent ) - : QObject( parent ), - mCurrentSearchCollection( -1 ) -{ -} - -SearchManager::~SearchManager() -{ - cleanUpSearch(); -} - -void SearchManager::startSearch( const QString &query ) -{ - cleanUpSearch(); - - const QString searchName = i18n( "Search Results" ) + QLatin1String( " " ) + QUuid::createUuid().toString(); - Akonadi::SearchCreateJob *job = new Akonadi::SearchCreateJob( searchName, query ); - connect( job, SIGNAL(result(KJob*)), this, SLOT(result(KJob*)) ); -} - -void SearchManager::stopSearch() -{ - cleanUpSearch(); - - emit searchStopped(); -} - -void SearchManager::result( KJob *job ) -{ - if ( job->error() ) { - kWarning() << "Unable to create search collection:" << job->errorText(); - return; - } - - const Akonadi::SearchCreateJob *searchJob = qobject_cast( job ); - - const Akonadi::Collection collection = searchJob->createdCollection(); - mCurrentSearchCollection = collection.id(); - - emit searchStarted( collection ); -} - -void SearchManager::cleanUpSearch() -{ - // cleanup search collection - if ( mCurrentSearchCollection != -1 ) - new Akonadi::CollectionDeleteJob( Akonadi::Collection( mCurrentSearchCollection ) ); - - mCurrentSearchCollection = -1; -} - diff --git a/kdepim/mobile/lib/searchmanager.h b/kdepim/mobile/lib/searchmanager.h deleted file mode 100644 index 9195f400..00000000 --- a/kdepim/mobile/lib/searchmanager.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 SEARCHMANAGER_H -#define SEARCHMANAGER_H - -#include - -#include - -class KJob; - -/** - * @short A class that manages the searches in mobile apps. - * - * A mobile app can have exactly one persistent search running - * at a time. This class will create this search and remove it - * on destruction or when a new search is started. - * - * @author Tobias Koenig - */ -class SearchManager : public QObject -{ - Q_OBJECT - - public: - /** - * Creates a new search manager. - * - * @param parent The parent object. - */ - explicit SearchManager( QObject *parent = 0 ); - - /** - * Destroys the search manager. - * - * The running search will be stopped and its search collection removed. - */ - ~SearchManager(); - - public Q_SLOTS: - /** - * Starts a new search. - * A previous search will be stopped and its search collection will be removed. - * - * @param query The Sparql or XESAM query of the search. - */ - void startSearch( const QString &query ); - - /** - * Stops the currently running search and removes its search collection. - */ - void stopSearch(); - - Q_SIGNALS: - /** - * This signal is emitted whenever a new search has successfully been started. - * - * @param collection The search collection of this search. - */ - void searchStarted( const Akonadi::Collection &collection ); - - /** - * This signal is emitted whenever a search has explicitly been stopped by - * calling stopSearch(). - */ - void searchStopped(); - - private Q_SLOTS: - void result( KJob* ); - - private: - void cleanUpSearch(); - - Akonadi::Collection::Id mCurrentSearchCollection; -}; - -#endif diff --git a/kdepim/mobile/lib/statemachinebuilder.cpp b/kdepim/mobile/lib/statemachinebuilder.cpp deleted file mode 100644 index 6801906f..00000000 --- a/kdepim/mobile/lib/statemachinebuilder.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "statemachinebuilder.h" - -#include "modelselectiontransition.h" - -const char stateIdentifier[] = "state"; - -NotifyingStateMachine::NotifyingStateMachine(QObject* parent) - : QStateMachine(parent) -{ - -} - -void NotifyingStateMachine::requestState(const QString& state) -{ - emit stateRequested(state); -} - -RequestNamedTransition::RequestNamedTransition(QStateMachine *stateMachine, QState* sourceState) - : QSignalTransition(stateMachine, SIGNAL(stateRequested(QString)), sourceState) -{ - -} - - -bool RequestNamedTransition::eventTest(QEvent* event) -{ - if (!QSignalTransition::eventTest(event)) - return false; - - QStateMachine::SignalEvent *se = static_cast(event); - const QString name = se->arguments().first().toString(); - return !name.isEmpty() && name == targetState()->objectName(); -} - - -class StateMachineBuilderPrivate -{ - StateMachineBuilderPrivate(StateMachineBuilder *qq) - : q_ptr(qq), - m_navigationModel(0), - m_itemSelectionModel(0) - { - - } - Q_DECLARE_PUBLIC(StateMachineBuilder) - StateMachineBuilder * const q_ptr; - - QItemSelectionModel *m_navigationModel; - QItemSelectionModel *m_itemSelectionModel; -}; - -StateMachineBuilder::StateMachineBuilder() - : d_ptr(new StateMachineBuilderPrivate(this)) -{ - -} - -StateMachineBuilder::~StateMachineBuilder() -{ - delete d_ptr; -} - - -void StateMachineBuilder::setItemSelectionModel(QItemSelectionModel* model) -{ - Q_D(StateMachineBuilder); - d->m_itemSelectionModel = model; -} - -void StateMachineBuilder::setNavigationModel(QItemSelectionModel* model) -{ - Q_D(StateMachineBuilder); - d->m_navigationModel = model; -} - -NotifyingStateMachine* StateMachineBuilder::getMachine(QObject *parent) const -{ - Q_D(const StateMachineBuilder); - NotifyingStateMachine *machine = new NotifyingStateMachine(parent); - QState *mainWorkState = new QState(machine); - machine->setInitialState(mainWorkState); - mainWorkState->setObjectName(QLatin1String("MainWork")); - QObject::connect(mainWorkState, SIGNAL(entered()), machine, SIGNAL(stateChanged())); - QState *homeState = new QState(mainWorkState); - mainWorkState->setInitialState(homeState); - homeState->setObjectName(QLatin1String("Home")); - homeState->assignProperty(parent, stateIdentifier, QLatin1String("Home")); - QObject::connect(homeState, SIGNAL(entered()), machine, SIGNAL(stateChanged())); - QState *accountState = new QState(mainWorkState); - accountState->assignProperty(parent, stateIdentifier, QLatin1String("Account")); - QObject::connect(accountState, SIGNAL(entered()), machine, SIGNAL(stateChanged())); - accountState->setObjectName(QLatin1String("Account")); - QState *folderState = new QState(mainWorkState); - folderState->assignProperty(parent, stateIdentifier, QLatin1String("Folder")); - QObject::connect(folderState, SIGNAL(entered()), machine, SIGNAL(stateChanged())); - folderState->setObjectName(QLatin1String("Folder")); - QState *multiFolderState = new QState(mainWorkState); - multiFolderState->assignProperty(parent, stateIdentifier, QLatin1String("MultiFolder")); - QObject::connect(multiFolderState, SIGNAL(entered()), machine, SIGNAL(stateChanged())); - multiFolderState->setObjectName(QLatin1String("MultiFolder")); - QState *singleItemState = new QState(mainWorkState); - singleItemState->assignProperty(parent, stateIdentifier, QLatin1String("SingleItem")); - QObject::connect(singleItemState, SIGNAL(entered()), machine, SIGNAL(stateChanged())); - singleItemState->setObjectName(QLatin1String("SingleItem")); - - QState *selectState = new QState(machine); - selectState->assignProperty(parent, stateIdentifier, QLatin1String("Select")); - QObject::connect(selectState, SIGNAL(entered()), machine, SIGNAL(stateChanged())); - selectState->setObjectName(QLatin1String("Select")); - QState *bulkActionState = new QState(machine); - bulkActionState->assignProperty(parent, stateIdentifier, QLatin1String("BulkAction")); - QObject::connect(bulkActionState, SIGNAL(entered()), machine, SIGNAL(stateChanged())); - bulkActionState->setObjectName(QLatin1String("BulkAction")); - - { - ModelSelectionTransition *homeToAccount = new ModelSelectionTransition(d->m_navigationModel, - ModelSelectionTransition::AcceptSingleTopLevelSelection, - homeState); - homeToAccount->setTargetState(accountState); - } - { - ModelSelectionTransition *accountToFolder = new ModelSelectionTransition(d->m_navigationModel, - ModelSelectionTransition::AcceptSingleSelection, - accountState); - accountToFolder->setTargetState(folderState); - } - { - ModelSelectionTransition *accountToHome = new ModelSelectionTransition(d->m_navigationModel, - ModelSelectionTransition::AcceptNoSelection, - accountState); - accountToHome->setTargetState(homeState); - } - { - ModelSelectionTransition *accountToSingleItem = new ModelSelectionTransition(d->m_itemSelectionModel, - ModelSelectionTransition::AcceptSingleSelection, - accountState); - accountToSingleItem->setTargetState(singleItemState); - } - { - ModelSelectionTransition *singleItemToAccount = new ModelSelectionTransition(d->m_itemSelectionModel, - ModelSelectionTransition::AcceptNoSelection, - singleItemState); - singleItemToAccount->setTargetState(accountState); - } - { - ModelSelectionTransition *folderToSingleItem = new ModelSelectionTransition(d->m_itemSelectionModel, - ModelSelectionTransition::AcceptSingleSelection, - folderState); - folderToSingleItem->setTargetState(singleItemState); - } - { - ModelSelectionTransition *singleItemToFolder = new ModelSelectionTransition(d->m_itemSelectionModel, - ModelSelectionTransition::AcceptNoSelection, - singleItemState); - singleItemToFolder->setTargetState(folderState); - } - { - ModelSelectionTransition *folderToHome = new ModelSelectionTransition(d->m_navigationModel, - ModelSelectionTransition::AcceptNoSelection, - folderState); - folderToHome->setTargetState(homeState); - } - { - ModelSelectionTransition *homeToMulti = new ModelSelectionTransition(d->m_navigationModel, - ModelSelectionTransition::AcceptMultiSelection, - homeState); - homeToMulti->setTargetState(accountState); - } - { - ModelSelectionTransition *multiToHome = new ModelSelectionTransition(d->m_navigationModel, - ModelSelectionTransition::AcceptNoSelection, - multiFolderState); - multiToHome->setTargetState(homeState); - } - { - ModelSelectionTransition *multiToSingleItem = new ModelSelectionTransition(d->m_itemSelectionModel, - ModelSelectionTransition::AcceptSingleSelection, - multiFolderState); - multiToSingleItem->setTargetState(singleItemState); - } - { - ModelSelectionTransition *singleItemToMulti = new ModelSelectionTransition(d->m_itemSelectionModel, - ModelSelectionTransition::AcceptNoSelection, - singleItemState); - singleItemToMulti->setTargetState(multiFolderState); - } - { - ModelSelectionTransition *multiToFolder = new ModelSelectionTransition(d->m_navigationModel, - ModelSelectionTransition::AcceptSingleSelection, - multiFolderState); - multiToFolder->setTargetState(folderState); - } - { - ModelSelectionTransition *multiToAccount = new ModelSelectionTransition(d->m_navigationModel, - ModelSelectionTransition::AcceptSingleTopLevelSelection, - multiFolderState); - multiToAccount->setTargetState(folderState); - } - { - RequestNamedTransition *transition = new RequestNamedTransition(machine, mainWorkState); - transition->setTargetState(selectState); - } - { - RequestNamedTransition *transition = new RequestNamedTransition(machine, selectState); - transition->setTargetState(mainWorkState); - } - { - RequestNamedTransition *transition = new RequestNamedTransition(machine, mainWorkState); - transition->setTargetState(bulkActionState); - } - { - RequestNamedTransition *transition = new RequestNamedTransition(machine, bulkActionState); - transition->setTargetState(mainWorkState); - } - return machine; -} - diff --git a/kdepim/mobile/lib/statemachinebuilder.h b/kdepim/mobile/lib/statemachinebuilder.h deleted file mode 100644 index 305b1080..00000000 --- a/kdepim/mobile/lib/statemachinebuilder.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 STATEMACHINEBUILDER_H -#define STATEMACHINEBUILDER_H - -#include "mobileui_export.h" - -#include -#include - -class QObject; -class QItemSelectionModel; - -class StateMachineBuilderPrivate; - - -class MOBILEUI_EXPORT NotifyingStateMachine : public QStateMachine -{ - Q_OBJECT -public: - explicit NotifyingStateMachine(QObject *parent = 0); - - void requestState(const QString &state); - -signals: - void stateRequested(const QString &state); - void stateChanged(); -}; - -class RequestNamedTransition : public QSignalTransition -{ - Q_OBJECT -public: - explicit RequestNamedTransition(QStateMachine *stateMachine, QState* sourceState = 0); - - virtual bool eventTest(QEvent* event); - -}; - -/** - Machines must be built by builders. -*/ -class MOBILEUI_EXPORT StateMachineBuilder -{ -public: - StateMachineBuilder(); - virtual ~StateMachineBuilder(); - - void setNavigationModel(QItemSelectionModel *model); - void setItemSelectionModel(QItemSelectionModel *model); - // TODO: Decide on granularity of the interface. - virtual NotifyingStateMachine* getMachine(QObject *parent) const; - -private: - Q_DECLARE_PRIVATE(StateMachineBuilder) - StateMachineBuilderPrivate * const d_ptr; -}; - -#endif diff --git a/kdepim/mobile/lib/stylesheet.css.cmake b/kdepim/mobile/lib/stylesheet.css.cmake deleted file mode 100644 index 5c4b7ee6..00000000 --- a/kdepim/mobile/lib/stylesheet.css.cmake +++ /dev/null @@ -1,296 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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. -*/ - - -/* - * Generic settings - */ - -/* font colors */ -QCheckBox, -QComboBox:editable, -QLabel, -QPushButton, -QRadioButton:off, -KPIM--KDateEdit, -KPIM--KTimeEdit -{ - color: black -} - - -/* idle button background */ -QCheckBox, -QComboBox, -QDateTimeEdit::down-button, -QDateTimeEdit::up-button, -QRadioButton, -QPushButton, -QSpinBox::down-button, -QSpinBox::up-button, -QToolButton -{ - border-image: url(@STYLE_IMAGE_PATH@/button-border.png) 14 14 14 14 repeat stretch; - border-top: 10px; - border-bottom: 10px; - border-left: 10px; - border-right: 10px; - min-height: 32px; -} - -/* active button background */ -QCheckBox:pressed, -QComboBox:!editable:pressed, -QDateTimeEdit::down-button:pressed, -QDateTimeEdit::up-button:pressed, -QPushButton:pressed, -QRadioButton:on, -QSpinBox::down-button:pressed, -QSpinBox::up-button:pressed, -QToolButton:pressed -{ - border-image: url(@STYLE_IMAGE_PATH@/button-border-active.png) 14 14 14 14 repeat stretch; - color: white; -} - -/* text input frames */ -QDateTimeEdit, -QLineEdit, -QTextEdit, -QSpinBox -{ - background-color: white; - border: 2px; - border-color: grey; - border-radius: 8px; - border-style: inset; - padding: 4px; -} - -KLineEdit -{ - background-color: white; - border: 2px; - border-color: grey; - border-radius: 8px; - border-style: inset; - padding: 4px; - padding-right: 48px -} - - -/* - * Widget specific settings - */ - -/* QCheckBox */ -QCheckBox:disabled { - color: grey; -} - -QCheckBox::indicator:disabled { - background-color: rgba(0,0,0,0); -} - - -/* QColumnView, QListView and hacks for column view internals - TODO: find a way to style stand-alone QListView's but not those of a combo box -*/ -QColumnView, -QColumnView .QWidget, -QColumnView .QAbstractItemView, -QColumnView QListView, -.QListWidget, -.QListWidget::item:!selected -{ - background-color: rgba(0,0,0,0); - color: black; -} - -KCompletionBox, -KCompletionBox::item:!selected -{ - background-color: white; -} - -/* QComboBox */ -QComboBox::drop-down, QComboBox::down-arrow { - background-color: rgba(0,0,0,0); -} - - -/* QRadioButton */ -QRadioButton::indicator { - background-color: rgba(0,0,0,0); - width: 0; -} - - -/* QScrollArea */ -QScrollArea { - background-color: rgba(0,0,0,0); -} - - -/* QSpinBox and QDateTimeEdit */ -QDateTimeEdit, QSpinBox { - margin-left: 52px; - margin-right: 52px; - margin-top: 16px; - margin-bottom: 16px; - text-align: center; - /* for some reason padding is increased by margin here... */ - padding-left: -52px; - padding-right: -52px; -} - -QDateTimeEdit::down-button, -QDateTimeEdit::up-button, -QSpinBox::down-button, -QSpinBox::up-button -{ - subcontrol-origin: margin; - height: 32px; - width: 32px; -} - -QDateTimeEdit::down-button, -QSpinBox::down-button -{ - subcontrol-position: left; -} - -QDateTimeEdit::up-button, -QSpinBox::up-button -{ - subcontrol-position: right; -} - -QDateTimeEdit::down-arrow, -QSpinBox::down-arrow -{ - image: url(@STYLE_IMAGE_PATH@/button-minus.png); -} - -QDateTimeEdit::down-arrow:pressed, -QSpinBox::down-arrow:pressed -{ - image: url(@STYLE_IMAGE_PATH@/button-minus-active.png); -} - -QDateTimeEdit::down-arrow:disabled, -QDateTimeEdit::down-arrow:off, -QSpinBox::down-arrow:disabled, -QSpinBox::down-arrow:off -{ - image: url(@STYLE_IMAGE_PATH@/button-minus-disabled.png); -} - -QDateTimeEdit::up-arrow, -QSpinBox::up-arrow -{ - image: url(@STYLE_IMAGE_PATH@/button-plus.png); -} - -QDateTimeEdit::up-arrow:pressed, -QSpinBox::up-arrow:pressed -{ - image: url(@STYLE_IMAGE_PATH@/button-plus-active.png); -} - -QDateTimeEdit::up-arrow:disabled, -QDateTimeEdit::up-arrow:off, -QSpinBox::up-arrow:disabled, -QSpinBox::up-arrow:off -{ - image: url(@STYLE_IMAGE_PATH@/button-plus-disabled.png); -} - - -/** Buttons */ -QPushButton, QToolButton: -{ - qproperty-iconSize: 32px 32px; -} - -QToolButton -{ - min-width: 32px; - padding: 1px; -} - -/** Menus */ -QMenu -{ - background-color: white; - margin: 2px; /* some spacing around the menu */ -} - -QMenu::item -{ - padding: 2px 25px 2px 20px; - border: 1px solid transparent; /* reserve space for selection border */ - color: #000001; -} - -QMenu::item:selected { /* when user selects item using mouse or keyboard */ - background-color: #654321; - color: white; -} - - -/* - * KDGantt - */ -KDGantt--HeaderWidget, -EventViews--TimelineView QHeaderView -{ - background-color: lightgray; - color: black; -} - -EventViews--TimelineView QTreeWidget:item -{ - background-color: white; - color: black; -} - - -/* - * Hacks that should not be necessary at all - */ - -/* Recipients editor does not have a transparent background by default on Maemo and tries very hard to avoid getting one :-/ */ -MessageComposer--RecipientLine, -MessageComposer--RecipientsView > * > QWidget, -KPIM--MultiplyingLineView > * > QWidget -{ - background-color: rgba(0,0,0,0); -} - -/* category label in incidence editor has an ugly frame by default */ -KSqueezedTextLabel#mCategoriesLabel -{ - background-color: white; - border: 2px; - border-color: grey; - border-radius: 8px; - border-style: inset; - padding: 4px; -} diff --git a/kdepim/mobile/lib/stylesheetloader.cpp b/kdepim/mobile/lib/stylesheetloader.cpp deleted file mode 100644 index a6fb571d..00000000 --- a/kdepim/mobile/lib/stylesheetloader.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "stylesheetloader.h" - -#include -#include -#include -#include -#include -#include - -class StyleSheetLoaderPrivate -{ - public: - StyleSheetLoaderPrivate() : appliedGlobally(false) - { - QFile f( KStandardDirs::locate( "data", QLatin1String("mobileui/stylesheet.css") ) ); - if ( f.open( QFile::ReadOnly ) ) { - styleSheet = QString::fromUtf8( f.readAll() ); - kDebug() << "loaded stylesheet" << f.fileName(); - } else { - kError() << "failed to read stylesheet: " << f.fileName(); - } - } - - QString styleSheet; - bool appliedGlobally; -}; - -K_GLOBAL_STATIC( StyleSheetLoaderPrivate, s_styleSheetLoader ) - -void StyleSheetLoader::applyStyle(QWidget* widget) -{ -#ifndef QT_NO_STYLE_STYLESHEET - if ( widget && !s_styleSheetLoader->appliedGlobally && !s_styleSheetLoader->styleSheet.isEmpty() ) - widget->setStyleSheet( s_styleSheetLoader->styleSheet ); -#endif -} - -void StyleSheetLoader::applyStyle(QApplication* app) -{ -#ifndef QT_NO_STYLE_STYLESHEET - if ( app && !s_styleSheetLoader->styleSheet.isEmpty() ) - app->setStyleSheet( s_styleSheetLoader->styleSheet ); -#endif -} - -QString StyleSheetLoader::styleSheet() -{ - return s_styleSheetLoader->styleSheet; -} - diff --git a/kdepim/mobile/lib/stylesheetloader.h b/kdepim/mobile/lib/stylesheetloader.h deleted file mode 100644 index 08ebc1a5..00000000 --- a/kdepim/mobile/lib/stylesheetloader.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 STYLESHEETLOADER_H -#define STYLESHEETLOADER_H - -#include "mobileui_export.h" - -class QApplication; -class QWidget; - -/** Applies style sheets to widgets embedded in QML */ -namespace StyleSheetLoader -{ - /** - * Applies the style sheet to @p widget, if it hasn't been set globally anyway. - */ - MOBILEUI_EXPORT void applyStyle( QWidget *widget ); - - /** - * Globally apply the style sheet. - * Only use on platforms that don't have a sensible native widget style, such as Maemo >= 6. - */ - MOBILEUI_EXPORT void applyStyle( QApplication *app ); - - /** - * Returns the style sheet. - * @internal - */ - QString styleSheet(); -} - -#endif diff --git a/kdepim/mobile/lib/tests/CMakeLists.txt b/kdepim/mobile/lib/tests/CMakeLists.txt deleted file mode 100644 index 7cd3c019..00000000 --- a/kdepim/mobile/lib/tests/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -add_subdirectory(bnf_selection) - -set( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} ) - -# Convenience macro to add unit tests. -macro( add_mobileui_test _source ) - set( _test ${_source} ) - get_filename_component( _name ${_source} NAME_WE ) - kde4_add_unit_test( ${_name} TESTNAME mobileui-${_name} ${_test} ) - target_link_libraries( ${_name} ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ) -endmacro() - -add_mobileui_test( rangemanagertest.cpp ) diff --git a/kdepim/mobile/lib/tests/bnf_selection/CMakeLists.txt b/kdepim/mobile/lib/tests/bnf_selection/CMakeLists.txt deleted file mode 100644 index d0595160..00000000 --- a/kdepim/mobile/lib/tests/bnf_selection/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ - -project(bnf_selection) - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/../../ -) - -set( bnf_selection_srcs - main.cpp - mainwindow.cpp -) - -kde4_add_executable(bnf_selection - ${bnf_selection_srcs} -) - -target_link_libraries(bnf_selection - kdepimmobileui - ${QT_QTGUI_LIBRARIES} - ${QT_QTCORE_LIBRARIES} -) - diff --git a/kdepim/mobile/lib/tests/bnf_selection/main.cpp b/kdepim/mobile/lib/tests/bnf_selection/main.cpp deleted file mode 100644 index ca08ec89..00000000 --- a/kdepim/mobile/lib/tests/bnf_selection/main.cpp +++ /dev/null @@ -1,15 +0,0 @@ - -#include - -#include "mainwindow.h" - -int main(int argc, char **argv) -{ - QApplication app(argc, argv); - - MainWindow mw; - mw.show(); - - return app.exec(); -} - diff --git a/kdepim/mobile/lib/tests/bnf_selection/mainwindow.cpp b/kdepim/mobile/lib/tests/bnf_selection/mainwindow.cpp deleted file mode 100644 index 21ad5223..00000000 --- a/kdepim/mobile/lib/tests/bnf_selection/mainwindow.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -#include "mainwindow.h" - -#include "breadcrumbnavigationcontext.h" - -MainWindow::MainWindow(QWidget *parent) - : QWidget(parent) -{ - m_model = new QStandardItemModel(this); - - int counter = 0; - QStandardItem *parentItem = m_model->invisibleRootItem(); - for (int i = 0; i < 4; ++i) { - QStandardItem *topItem = new QStandardItem(QString::fromLatin1("item %1").arg(++counter)); - - parentItem->appendRow(topItem); - for (int i = 0; i < 4; ++i) { - QStandardItem *childItem = new QStandardItem(QString::fromLatin1("item %1").arg(++counter)); - topItem->appendRow(childItem); - for (int i = 0; i < 4; ++i) { - QStandardItem *grandChildItem = new QStandardItem(QString::fromLatin1("item %1").arg(++counter)); - childItem->appendRow(grandChildItem); - } - } - } - - QHBoxLayout *layout = new QHBoxLayout(this); - - QTreeView *tree = new QTreeView; - layout->addWidget(tree); - - tree->setModel(m_model); - - m_bnf = new KBreadcrumbNavigationFactory(this); - - m_bnf->createBreadcrumbContext(m_model); - - tree->setSelectionModel(m_bnf->selectionModel()); - - tree->expandAll(); - tree->setSelectionMode(QTreeView::ExtendedSelection); - - QVBoxLayout *vLayout = new QVBoxLayout; - - QListView *breadcrumbList = new QListView; - vLayout->addWidget(breadcrumbList); - breadcrumbList->setModel(m_bnf->breadcrumbItemModel()); - QListView *selectedList = new QListView; - vLayout->addWidget(selectedList); - selectedList->setModel(m_bnf->selectedItemModel()); - QListView *childList = new QListView; - vLayout->addWidget(childList); - childList->setModel(m_bnf->childItemModel()); - - layout->addLayout(vLayout); - - QTimer::singleShot(2000, this, SLOT(doSelects())); -} - -void MainWindow::doSelects() -{ - QModelIndex first = m_model->index(0, 0, m_model->index(0, 0)); - QModelIndex second = m_model->index(0, 0, m_model->index(1, 0)); - m_bnf->selectionModel()->select( first, QItemSelectionModel::Select ); - m_bnf->selectionModel()->select(second, QItemSelectionModel::Select ); -} diff --git a/kdepim/mobile/lib/tests/bnf_selection/mainwindow.h b/kdepim/mobile/lib/tests/bnf_selection/mainwindow.h deleted file mode 100644 index abff8724..00000000 --- a/kdepim/mobile/lib/tests/bnf_selection/mainwindow.h +++ /dev/null @@ -1,25 +0,0 @@ - -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include - -class KBreadcrumbNavigationFactory; - -class MainWindow : public QWidget -{ - Q_OBJECT -public: - MainWindow(QWidget *parent = 0); - -private slots: - void doSelects(); - -private: - KBreadcrumbNavigationFactory *m_bnf; - QStandardItemModel *m_model; - -}; - -#endif - diff --git a/kdepim/mobile/lib/tests/rangemanagertest.cpp b/kdepim/mobile/lib/tests/rangemanagertest.cpp deleted file mode 100644 index 0119318c..00000000 --- a/kdepim/mobile/lib/tests/rangemanagertest.cpp +++ /dev/null @@ -1,161 +0,0 @@ -#include - -#include "../rangemanager_p.h" -#include "../rangemanager.cpp" - -class RangeManagerTest : public QObject -{ - Q_OBJECT - - private Q_SLOTS: - void basicTest() - { - RangeManager manager; - QCOMPARE( manager.count(), 0 ); - - manager.insertRange( 0, 5 ); - QCOMPARE( manager.count(), 1 ); - - manager.clear(); - QCOMPARE( manager.count(), 0 ); - } - - void countTest() - { - RangeManager manager; - manager.insertRange( 0, 5 ); - manager.insertRange( manager.count(), 5 ); - manager.insertRange( manager.count(), 5 ); - manager.insertRange( manager.count(), 5 ); - manager.insertRange( manager.count(), 5 ); - - QCOMPARE( manager.count(), 5 ); - } - - void clearTest() - { - RangeManager manager; - - manager.clear(); - QCOMPARE( manager.count(), 0 ); - - manager.insertRange( 0, 5 ); - manager.insertRange( manager.count(), 5 ); - manager.insertRange( manager.count(), 5 ); - manager.insertRange( manager.count(), 5 ); - manager.insertRange( manager.count(), 5 ); - - manager.clear(); - QCOMPARE( manager.count(), 0 ); - } - - void insertRangeTest() - { - RangeManager manager; - - manager.insertRange( 0, 5 ); - manager.insertRange( 1, 3 ); - manager.insertRange( 2, 7 ); - - QCOMPARE( manager.rangeStart( 2 ), 8 ); - - manager.insertRange( 1, 5 ); - - QCOMPARE( manager.rangeStart( 3 ), 13 ); - } - - void removeRangeTest() - { - RangeManager manager; - - manager.insertRange( 0, 5 ); - manager.insertRange( 1, 5 ); - manager.insertRange( 2, 3 ); - manager.insertRange( 3, 7 ); - - QCOMPARE( manager.rangeStart( 3 ), 13 ); - - manager.removeRange( 1 ); - QCOMPARE( manager.rangeStart( 2 ), 8 ); - } - - void increaseRangeTest() - { - RangeManager manager; - - manager.insertRange( 0, 5 ); - manager.insertRange( 1, 4 ); - manager.insertRange( 2, 3 ); - - QCOMPARE( manager.rangeStart( 2 ), 9 ); - - manager.increaseRange( 1, 2 ); - QCOMPARE( manager.rangeStart( 2 ), 11 ); - } - - void decreaseRangeTest() - { - RangeManager manager; - - manager.insertRange( 0, 5 ); - manager.insertRange( 1, 4 ); - manager.insertRange( 2, 3 ); - - QCOMPARE( manager.rangeStart( 2 ), 9 ); - - manager.decreaseRange( 1, 2 ); - QCOMPARE( manager.rangeStart( 2 ), 7 ); - } - - void rangeStartTest() - { - RangeManager manager; - - manager.insertRange( 0, 5 ); - manager.insertRange( 1, 4 ); - manager.insertRange( 2, 3 ); - manager.insertRange( 3, 8 ); - - QCOMPARE( manager.rangeStart( 0 ), 0 ); - QCOMPARE( manager.rangeStart( 1 ), 5 ); - QCOMPARE( manager.rangeStart( 2 ), 9 ); - QCOMPARE( manager.rangeStart( 3 ), 12 ); - } - - void rangeSizeTest() - { - RangeManager manager; - - manager.insertRange( 0, 5 ); - manager.insertRange( 1, 4 ); - manager.insertRange( 2, 3 ); - manager.insertRange( 3, 8 ); - - QCOMPARE( manager.rangeSize( 0 ), 5 ); - QCOMPARE( manager.rangeSize( 1 ), 4 ); - QCOMPARE( manager.rangeSize( 2 ), 3 ); - QCOMPARE( manager.rangeSize( 3 ), 8 ); - } - - void rangeForPositionTest() - { - RangeManager manager; - - manager.insertRange( 0, 5 ); - manager.insertRange( 1, 4 ); - manager.insertRange( 2, 3 ); - manager.insertRange( 3, 8 ); - - QCOMPARE( manager.rangeForPosition( 0 ), 0 ); - QCOMPARE( manager.rangeForPosition( 2 ), 0 ); - QCOMPARE( manager.rangeForPosition( 4 ), 0 ); - QCOMPARE( manager.rangeForPosition( 5 ), 1 ); - QCOMPARE( manager.rangeForPosition( 10 ), 2 ); - QCOMPARE( manager.rangeForPosition( 19 ), 3 ); - QCOMPARE( manager.rangeForPosition( 20 ), -1 ); - } -}; - -QTEST_MAIN( RangeManagerTest ) - -#include "rangemanagertest.moc" diff --git a/kdepim/mobile/lib/threadgroupermodel.cpp b/kdepim/mobile/lib/threadgroupermodel.cpp deleted file mode 100644 index d05d147b..00000000 --- a/kdepim/mobile/lib/threadgroupermodel.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "threadgroupermodel.h" - -#include "hierarchyresolver.h" - -class ThreadGrouperModelPrivate -{ - public: - ThreadGrouperModelPrivate( ThreadGrouperComparator *comparator, ThreadGrouperModel *qq ) - : q_ptr( qq ), m_comparator( comparator ), m_threadingEnabled( true ), m_dynamicModelRepopulation( false ) - { - Q_ASSERT( m_comparator ); - - m_comparator->m_grouper = this; - } - - Q_DECLARE_PUBLIC( ThreadGrouperModel ) - ThreadGrouperModel* const q_ptr; - - Akonadi::Item getThreadItem( const Akonadi::Item &item ) const; - - Akonadi::Item threadRoot( const QModelIndex &index ) const; - - void populateThreadGrouperModel() const; - void resort(); - - mutable QHash m_childParentMap; // maps an item to its thread leader item - mutable QHash > m_parentChildrenMap; // maps a thread leader item to all its descendant items - mutable QHash m_items; - - ThreadGrouperComparator *m_comparator; - bool m_threadingEnabled; - bool m_dynamicModelRepopulation; -}; - -ThreadGrouperComparator::ThreadGrouperComparator() -{ -} - -ThreadGrouperComparator::~ThreadGrouperComparator() -{ -} - -QString ThreadGrouperComparator::grouperString( const Akonadi::Item& ) const -{ - return QString(); -} - -Akonadi::Item ThreadGrouperComparator::threadItem( const Akonadi::Item &item ) const -{ - Q_ASSERT( m_grouper ); - - return m_grouper->getThreadItem( item ); -} - -Akonadi::Item ThreadGrouperComparator::itemForIdentifier( const QByteArray &identifier ) const -{ - Q_ASSERT( m_grouper ); - - return m_grouper->m_items.value( identifier ); -} - -QSet ThreadGrouperComparator::threadDescendants( const QByteArray &identifier ) const -{ - Q_ASSERT( m_grouper ); - - return m_grouper->m_parentChildrenMap.value( identifier ); -} - -void ThreadGrouperComparator::invalidate() -{ - Q_ASSERT( m_grouper ); - - m_grouper->q_ptr->invalidate(); -} - -void ThreadGrouperComparator::resetCaches() -{ -} - - -Akonadi::Item ThreadGrouperModelPrivate::getThreadItem( const Akonadi::Item &item ) const -{ - const QByteArray identifier = m_comparator->identifierForItem( item ); - const QByteArray parentIdentifier = m_childParentMap.value( identifier ); - - /** - * If threading is disabled, we treat each item like it is its own thread leader. - */ - if ( !m_threadingEnabled ) - return item; - - if ( !m_items.contains( parentIdentifier ) ) { - /** - * The model knows nothing about the referenced parent item, this can happen - * when importing and viewing only a part of a mail thread for example. - * In this case we handle the item as standalone thread top node. - */ - return m_items.value( identifier ); - } - - return m_items.value( parentIdentifier ); -} - -void ThreadGrouperModelPrivate::populateThreadGrouperModel() const -{ - Q_Q( const ThreadGrouperModel ); - m_childParentMap.clear(); - m_parentChildrenMap.clear(); - m_items.clear(); - - if ( !q->sourceModel() ) - return; - - HierarchyResolver resolver; - - const int rowCount = q->sourceModel()->rowCount(); - - for ( int row = 0; row < rowCount; ++row ) { - const QModelIndex index = q->sourceModel()->index( row, 0 ); - Q_ASSERT( index.isValid() ); - - const Akonadi::Item item = index.data( Akonadi::EntityTreeModel::ItemRole ).value(); - Q_ASSERT( item.isValid() ); - - const QByteArray identifier = m_comparator->identifierForItem( item ); - - m_items[ identifier ] = item; - - const QByteArray parentIdentifier = m_comparator->parentIdentifierForItem( item ); - if ( parentIdentifier.isEmpty() ) - resolver.addNode( identifier ); - else - resolver.addRelation( identifier, parentIdentifier ); - - } - - resolver.resolve( m_items.keys().toSet() ); - - m_childParentMap = resolver.childParentMap(); - m_parentChildrenMap = resolver.parentChildrenMap(); - - m_comparator->resetCaches(); -} - -void ThreadGrouperModelPrivate::resort() -{ - Q_Q( ThreadGrouperModel ); - - q->sort( 0, q->sortOrder() ); -} - -ThreadGrouperModel::ThreadGrouperModel( ThreadGrouperComparator *comparator, QObject *parent ) - : QSortFilterProxyModel( parent ), d_ptr( new ThreadGrouperModelPrivate( comparator, this ) ) -{ - setDynamicSortFilter( true ); - sort( 0, Qt::AscendingOrder ); -} - -ThreadGrouperModel::~ThreadGrouperModel() -{ - delete d_ptr; -} - -Akonadi::Item ThreadGrouperModelPrivate::threadRoot( const QModelIndex &index ) const -{ - const Akonadi::Item item = index.data( Akonadi::EntityTreeModel::ItemRole ).value(); - Q_ASSERT( item.isValid() ); - return getThreadItem( item ); -} - -QVariant ThreadGrouperModel::data( const QModelIndex &index, int role ) const -{ - Q_D( const ThreadGrouperModel ); - - if ( !index.isValid() ) - return QVariant(); - - if ( role == ThreadIdRole ) - return d->threadRoot( index ).id(); - else if ( role == GrouperRole ) { - return d->m_comparator->grouperString( index.data( Akonadi::EntityTreeModel::ItemRole ).value() ); - } - - return QSortFilterProxyModel::data( index, role ); -} - -void ThreadGrouperModel::setSourceModel( QAbstractItemModel *sourceModel ) -{ - Q_D( ThreadGrouperModel ); - d->populateThreadGrouperModel(); - - connect( sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(populateThreadGrouperModel()) ); - connect( sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(resort()) ); - - connect( sourceModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SLOT(populateThreadGrouperModel()) ); - - connect( sourceModel, SIGNAL(layoutChanged()), - this, SLOT(populateThreadGrouperModel()) ); - - QSortFilterProxyModel::setSourceModel( sourceModel ); - - if ( d->m_dynamicModelRepopulation ) - connect( sourceModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(populateThreadGrouperModel()) ); - - QHash names = roleNames(); - names.insert( GrouperRole, "grouperString" ); - setRoleNames( names ); -} - -bool ThreadGrouperModel::lessThan( const QModelIndex &left, const QModelIndex &right ) const -{ - Q_D( const ThreadGrouperModel ); - - const Akonadi::Item leftItem = left.data( Akonadi::EntityTreeModel::ItemRole ).value(); - const Akonadi::Item rightItem = right.data( Akonadi::EntityTreeModel::ItemRole ).value(); - - return d->m_comparator->lessThan( leftItem, rightItem ); -} - -void ThreadGrouperModel::setThreadingEnabled( bool enabled ) -{ - Q_D( ThreadGrouperModel ); - - d->m_threadingEnabled = enabled; - - d->populateThreadGrouperModel(); - invalidate(); -} - -bool ThreadGrouperModel::threadingEnabled() const -{ - Q_D( const ThreadGrouperModel ); - - return d->m_threadingEnabled; -} - -void ThreadGrouperModel::setDynamicModelRepopulation( bool enabled ) -{ - Q_D( ThreadGrouperModel ); - - d->m_dynamicModelRepopulation = enabled; -} - -#include "moc_threadgroupermodel.cpp" diff --git a/kdepim/mobile/lib/threadgroupermodel.h b/kdepim/mobile/lib/threadgroupermodel.h deleted file mode 100644 index a6efd154..00000000 --- a/kdepim/mobile/lib/threadgroupermodel.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 THREADGROUPERMODEL_H -#define THREADGROUPERMODEL_H - -#include "mobileui_export.h" - -#include - -#include -#include - -class ThreadGrouperModelPrivate; - -/** - * @short A base class for custom comperators, used by ThreadGrouperModel for sorting. - */ -class MOBILEUI_EXPORT ThreadGrouperComparator -{ - public: - /** - * Creates a thread grouper comparator. - */ - ThreadGrouperComparator(); - - /** - * Destroys the thread grouper comparator. - */ - virtual ~ThreadGrouperComparator(); - - /** - * Reimplement to return the unique identifier for the given @p item. - */ - virtual QByteArray identifierForItem( const Akonadi::Item &item ) const = 0; - - /** - * Reimplement to return the parent identifier for the given @p item. - */ - virtual QByteArray parentIdentifierForItem( const Akonadi::Item &item ) const = 0; - - /** - * Reimplement to return if the @p left item is smaller than the @p right item. - */ - virtual bool lessThan( const Akonadi::Item &left, const Akonadi::Item &right ) const = 0; - - /** - * Returns the grouper string for the given @p item. - */ - virtual QString grouperString( const Akonadi::Item &item ) const; - - protected: - /** - * Returns the thread item for @p item. - */ - Akonadi::Item threadItem( const Akonadi::Item &item ) const; - - /** - * Returns the item for the given item @p identifier. - */ - Akonadi::Item itemForIdentifier( const QByteArray &identifier ) const; - - /** - * Returns the set of descendants identifiers for the given thread @p identifier. - */ - QSet threadDescendants( const QByteArray &identifier ) const; - - /** - * Invalidates the ThreadGrouperModel to trigger a refresh. - */ - void invalidate(); - - /** - * This method is called whenever the comparator should reset its caches. - */ - virtual void resetCaches(); - - private: - Q_DISABLE_COPY( ThreadGrouperComparator ) - ThreadGrouperModelPrivate *m_grouper; - - friend class ThreadGrouperModelPrivate; -}; - -class MOBILEUI_EXPORT ThreadGrouperModel : public QSortFilterProxyModel -{ - Q_OBJECT - - public: - enum CustomRoles { - // FIXME Fix custom role handling in proxies. - ThreadIdRole = Akonadi::EntityTreeModel::UserRole + 30, - GrouperRole - }; - - /** - * Creates a new thread grouper model. - * - * @param comparator The comparator object, which abstracts type specific comparison. - * @param parent The parent object. - * - * @note The model does not take ownership of the comparator. - */ - explicit ThreadGrouperModel( ThreadGrouperComparator *comparator, QObject* parent = 0 ); - - virtual ~ThreadGrouperModel(); - - virtual void setSourceModel( QAbstractItemModel *sourceModel ); - - virtual bool lessThan( const QModelIndex &left, const QModelIndex &right ) const; - virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - - /** - * Set whether threading will be @p enabled. - */ - void setThreadingEnabled( bool enabled ); - - /** - * Returns whether threading is enabled. - */ - bool threadingEnabled() const; - - /** - * Sets whether the model shall be repopulated on data change. - * - * @note Must be called before setSourceModel() to have any effect. - */ - void setDynamicModelRepopulation( bool enabled ); - - private: - Q_DECLARE_PRIVATE( ThreadGrouperModel ) - ThreadGrouperModelPrivate* const d_ptr; - Q_PRIVATE_SLOT( d_func(), void populateThreadGrouperModel() ) - Q_PRIVATE_SLOT( d_func(), void resort() ) -}; - -#endif diff --git a/kdepim/mobile/lib/threadmodel.cpp b/kdepim/mobile/lib/threadmodel.cpp deleted file mode 100644 index 30333bc2..00000000 --- a/kdepim/mobile/lib/threadmodel.cpp +++ /dev/null @@ -1,325 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "threadmodel.h" - -#include "rangemanager_p.h" -#include "threadgroupermodel.h" - -#include -#include - -class ThreadModelPrivate -{ - ThreadModelPrivate( QAbstractItemModel *emailModel, ThreadModel *qq ) - : q_ptr( qq ), m_emailModel( emailModel ) - { - } - - Q_DECLARE_PUBLIC( ThreadModel ) - ThreadModel* const q_ptr; - - void slotRowsInserted( const QModelIndex&, int, int ); - void slotRowsRemoved( const QModelIndex&, int, int ); - void slotResetModel(); - void populateThreadModel(); - - QAbstractItemModel *m_emailModel; - RangeManager m_rangeManager; -}; - -void ThreadModelPrivate::slotRowsInserted( const QModelIndex&, int start, int end ) -{ - /** - * At this point the m_emailModel contains the new rows already, but the range manager - * is not updated yet. - * - * Example: - * The m_emailModel contained two threads each with two messages - * EM[t1 t1 t2 t2] - * so the range manager contains the same information - * RM[t1 t1 t2 t2] - * Now 4 new rows are inserted into the m_emailModel with one new message belonging to t1, - * one new message belonging to t2 and 2 new messages that are thread leaders themself. - * The m_emailModel will look like the following now - * EM[t1 t1 t1 t2 t3 t4 t4 t4] - * and we have to adapt the range manager to match this. - */ - - // At first find out if there exists a row before 'start' and what its thread id and associated range is - Akonadi::Item::Id previousThreadId = -1; - if ( start != 0 ) { - const QModelIndex index = m_emailModel->index( start - 1, 0 ); - Q_ASSERT( index.isValid() ); - previousThreadId = index.data( ThreadGrouperModel::ThreadIdRole ).toLongLong(); - } - - // check if there exists a row after 'end' and what its thread id and associated range is - Akonadi::Item::Id nextThreadId = -1; - if ( end != (m_emailModel->rowCount() - 1) ) { - const QModelIndex index = m_emailModel->index( end + 1, 0 ); - Q_ASSERT( index.isValid() ); - nextThreadId = index.data( ThreadGrouperModel::ThreadIdRole ).toLongLong(); - } - - // iterate over the new rows - Akonadi::Item::Id currentThreadId = previousThreadId; - int currentRange = (start == 0 ? -1 : m_rangeManager.rangeForPosition( start - 1 )); - - for ( int row = start; row <= end; ++row ) { - const QModelIndex index = m_emailModel->index( row, 0 ); - Q_ASSERT( index.isValid() ); - - const Akonadi::Item::Id threadRootId = index.data( ThreadGrouperModel::ThreadIdRole ).toLongLong(); - if ( threadRootId == currentThreadId ) { // belongs to the current thread - m_rangeManager.increaseRange( currentRange, 1 ); - - const QModelIndex threadIndex = q_ptr->index( currentRange, 0 ); //TODO: cache it - emit q_ptr->dataChanged( threadIndex, threadIndex ); - } else { // threadRootId != currentThreadId - if ( (row == end) && (threadRootId == nextThreadId) ) { - const int nextRange = currentRange + 1; - m_rangeManager.increaseRange( nextRange, 1 ); - - const QModelIndex threadIndex = q_ptr->index( nextRange, 0 ); - emit q_ptr->dataChanged( threadIndex, threadIndex ); - } else { - currentRange++; - q_ptr->beginInsertRows( QModelIndex(), currentRange, currentRange ); - m_rangeManager.insertRange( currentRange, 1 ); - q_ptr->endInsertRows(); - } - } - - currentThreadId = threadRootId; - } -} - -void ThreadModelPrivate::slotRowsRemoved( const QModelIndex&, int start, int end ) -{ - const int startRange = m_rangeManager.rangeForPosition( start ); - const int endRange = m_rangeManager.rangeForPosition( end ); - - const int startRangeSize = m_rangeManager.rangeSize( startRange ); - const int endRangeSize = m_rangeManager.rangeSize( endRange ); - - if ( startRange == endRange ) { - // the rows to be removed are covered by one range - - const int rowCount = (end - start + 1); - if ( (rowCount - startRangeSize) == 0 ) { // all messages of this thread are removed -> remove the thread - q_ptr->beginRemoveRows( QModelIndex(), startRange, startRange ); - m_rangeManager.removeRange( startRange ); - q_ptr->endRemoveRows(); - } else { // some messages are left in the thread -> adapt thread size - m_rangeManager.decreaseRange( startRange, rowCount ); - - const QModelIndex index = q_ptr->index( startRange, 0 ); - emit q_ptr->dataChanged( index, index ); // the number of thread children has changed -> trigger view update - } - } else { - // the rows to be removed are covered by two or more ranges - - // first check how many rows of the start range are affected - const int startRangeStart = m_rangeManager.rangeStart( startRange + 1 ); - const int affectedStartRows = (startRangeStart - start); - - // check how many rows of the end range are affected - const int endRangeStart = m_rangeManager.rangeStart( endRange ); - const int affectedEndRows = (end - endRangeStart + 1); - - // we can't delete the ranges one by one, but have to remove them in one go, - // so store which is the first and last range to be deleted - int startRangeToDelete = startRange + 1; - int endRangeToDelete = endRange - 1; - - // we can't update the indexes before the rows are removed, so delay it - bool updateStartRange = false; - bool updateEndRange = false; - - if ( (affectedStartRows - startRangeSize) == 0 ) { // all messages of this thread are removed -> remove the thread - startRangeToDelete = startRange; - } else { // some messages are left in the thread -> adapt thread size - updateStartRange = true; - } - - if ( (affectedEndRows - endRangeSize) == 0 ) { // all messages of this thread are removed -> remove the thread - endRangeToDelete = endRange; - } else { // some messages are left in the thread -> adapt thread size - updateEndRange = true; - } - - // check if there are ranges that must be removed - if ( (endRangeToDelete - startRangeToDelete) >= 0 ) { - q_ptr->beginRemoveRows( QModelIndex(), startRangeToDelete, endRangeToDelete ); - for ( int range = startRangeToDelete; range <= endRangeToDelete; ++range ) { - m_rangeManager.removeRange( startRangeToDelete ); - } - q_ptr->endRemoveRows(); - } - - // no update the start range and end range as well - if ( updateStartRange ) { - m_rangeManager.decreaseRange( startRange, affectedStartRows ); - - const QModelIndex index = q_ptr->index( startRange, 0 ); - emit q_ptr->dataChanged( index, index ); // the number of thread children has changed -> trigger view update - } - - if ( updateEndRange ) { - // we need to update the end range here, since the ranges between start and end have been removed already - const int updatedEndRange = (endRange - (endRangeToDelete - startRangeToDelete) - 1); - m_rangeManager.decreaseRange( updatedEndRange, affectedEndRows ); - - const QModelIndex index = q_ptr->index( updatedEndRange, 0 ); - emit q_ptr->dataChanged( index, index ); // the number of thread children has changed -> trigger view update - } - } -} - -void ThreadModelPrivate::slotResetModel() -{ - populateThreadModel(); -} - -void ThreadModelPrivate::populateThreadModel() -{ - Q_Q( ThreadModel ); - q->beginResetModel(); - - m_rangeManager.clear(); - const int rowCount = m_emailModel->rowCount(); - if ( rowCount == 0 ) { - q->endResetModel(); - return; - } - - const QModelIndex firstIndex = m_emailModel->index( 0, 0 ); - Akonadi::Item::Id currentThreadId = firstIndex.data( ThreadGrouperModel::ThreadIdRole ).toLongLong(); - - int startRow = 0; - static const int column = 0; - for ( int row = 1; row < rowCount; ++row ) { - const QModelIndex index = m_emailModel->index( row, column ); - Q_ASSERT( index.isValid() ); - - const Akonadi::Item::Id threadRoot = index.data( ThreadGrouperModel::ThreadIdRole ).toLongLong(); - if ( threadRoot != currentThreadId ) { - m_rangeManager.insertRange( m_rangeManager.count(), row - startRow ); - startRow = row; - } - - currentThreadId = threadRoot; - } - - m_rangeManager.insertRange( m_rangeManager.count(), rowCount - startRow ); - q->endResetModel(); -} - -ThreadModel::ThreadModel( QAbstractItemModel *emailModel, QObject *parent ) - : QAbstractListModel( parent ), d_ptr( new ThreadModelPrivate( emailModel, this ) ) -{ - connect( emailModel, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(slotRowsInserted(QModelIndex,int,int)) ); - - connect( emailModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SLOT(slotRowsRemoved(QModelIndex,int,int)) ); - - connect( emailModel, SIGNAL(layoutChanged()), - this, SLOT(slotResetModel()) ); - - connect( emailModel, SIGNAL(modelReset()), - this, SLOT(slotResetModel()) ); - - QHash roleNames = emailModel->roleNames(); - roleNames.insert( ThreadSizeRole, "threadSize" ); - roleNames.insert( ThreadUnreadCountRole, "threadUnreadCount" ); - setRoleNames( roleNames ); -} - -ThreadModel::~ThreadModel() -{ - delete d_ptr; -} - -QVariant ThreadModel::data( const QModelIndex &index, int role ) const -{ - Q_D( const ThreadModel ); - - if ( !index.isValid() ) - return QVariant(); - - const int indexRow = index.row(); - if ( indexRow < d->m_rangeManager.count() ) { - const int range = indexRow; - - const int rangeStartRow = d->m_rangeManager.rangeStart( range ); - const int rangeSize = d->m_rangeManager.rangeSize( range ); - const QModelIndex firstMailIndex = d->m_emailModel->index( rangeStartRow, 0 ); - Q_ASSERT( firstMailIndex.isValid() ); - - if ( role == ThreadRangeStartRole ) - return rangeStartRow; - if ( role == ThreadRangeEndRole ) - return (rangeStartRow + rangeSize - 1); - if ( role == ThreadSizeRole ) - return rangeSize; - if ( role == ThreadUnreadCountRole ) { - int unreadCount = 0; - for ( int row = rangeStartRow; row <= (rangeStartRow + rangeSize - 1); ++row ) { - static const int column = 0; - - const QModelIndex index = d->m_emailModel->index( row, column ); - Q_ASSERT( index.isValid() ); - - const Akonadi::Item item = index.data( Akonadi::EntityTreeModel::ItemRole ).value(); - Q_ASSERT( item.isValid() ); - Q_ASSERT( item.hasPayload() ); - - const KMime::Message::Ptr message = item.payload(); - Akonadi::MessageStatus status; - status.setStatusFromFlags( item.flags() ); - if ( !status.isRead() ) - ++unreadCount; - } - - return unreadCount; - } - - if ( role == Qt::DisplayRole ) { - const QString displayString = firstMailIndex.data( role ).toString(); - return QString(QLatin1Char('(') + QString::number( rangeSize ) + QLatin1Char(')') + displayString); - } - - return firstMailIndex.data( role ); - } - - return QVariant(); -} - -int ThreadModel::rowCount( const QModelIndex& ) const -{ - Q_D( const ThreadModel ); - - return d->m_rangeManager.count(); -} - -#include "moc_threadmodel.cpp" diff --git a/kdepim/mobile/lib/threadmodel.h b/kdepim/mobile/lib/threadmodel.h deleted file mode 100644 index e072e392..00000000 --- a/kdepim/mobile/lib/threadmodel.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 THREADMODEL_H -#define THREADMODEL_H - -#include "mobileui_export.h" - -#include - -#include -#include -#include - -class ThreadModelPrivate; - -class MOBILEUI_EXPORT ThreadModel : public QAbstractListModel -{ - Q_OBJECT - - public: - - enum Roles { - ThreadRangeStartRole = Akonadi::EntityTreeModel::UserRole + 20, - ThreadRangeEndRole, - ThreadSizeRole, - ThreadUnreadCountRole - }; - - explicit ThreadModel( QAbstractItemModel *emailModel, QObject *parent = 0 ); - virtual ~ThreadModel(); - - virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const; - virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - - private: - Q_DECLARE_PRIVATE( ThreadModel ) - ThreadModelPrivate* const d_ptr; - Q_PRIVATE_SLOT( d_func(), void populateThreadModel() ) - Q_PRIVATE_SLOT( d_func(), void slotRowsInserted( QModelIndex, int, int ) ) - Q_PRIVATE_SLOT( d_func(), void slotRowsRemoved( QModelIndex, int, int ) ) - Q_PRIVATE_SLOT( d_func(), void slotResetModel() ) -}; - -#endif diff --git a/kdepim/mobile/lib/threadselectionmodel.cpp b/kdepim/mobile/lib/threadselectionmodel.cpp deleted file mode 100644 index 22dab6e0..00000000 --- a/kdepim/mobile/lib/threadselectionmodel.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "threadselectionmodel.h" - -#include "threadmodel.h" - -class ThreadSelectionModelPrivate -{ - ThreadSelectionModelPrivate(ThreadSelectionModel *qq, QItemSelectionModel *contentSelectionModel, QItemSelectionModel* navigationModel) - : q_ptr(qq), m_contentSelectionModel(contentSelectionModel), m_navigationModel(navigationModel) - { - - } - Q_DECLARE_PUBLIC(ThreadSelectionModel) - ThreadSelectionModel * const q_ptr; - - void contentSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); - - QItemSelectionModel * const m_contentSelectionModel; - QItemSelectionModel * const m_navigationModel; - -}; - -ThreadSelectionModel::ThreadSelectionModel(QAbstractItemModel* model, QItemSelectionModel* contentSelectionModel, QItemSelectionModel* navigationModel, QObject *parent) - : QItemSelectionModel(model, parent), - d_ptr(new ThreadSelectionModelPrivate(this, contentSelectionModel, navigationModel)) -{ - connect(contentSelectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - SLOT(contentSelectionChanged(QItemSelection,QItemSelection))); -} - -ThreadSelectionModel::~ThreadSelectionModel() -{ - delete d_ptr; -} - -void ThreadSelectionModel::select(const QModelIndex& index, QItemSelectionModel::SelectionFlags command) -{ - select(QItemSelection(index, index), command); -} - -void ThreadSelectionModel::select(const QItemSelection& selection, QItemSelectionModel::SelectionFlags command) -{ - Q_D(ThreadSelectionModel); - QItemSelectionModel::select(selection, command); - QItemSelection thread; - foreach(const QItemSelectionRange &range, selection) { - for (int row = range.top(); row <= range.bottom(); ++row) { - static const int column = 0; - const QModelIndex idx = model()->index(row, column); - const int threadStartRow = idx.data(ThreadModel::ThreadRangeStartRole).toInt(); - const int threadEndRow = idx.data(ThreadModel::ThreadRangeEndRole).toInt(); - const QModelIndex threadStart = d->m_contentSelectionModel->model()->index(threadStartRow, column); - const QModelIndex threadEnd = d->m_contentSelectionModel->model()->index(threadEndRow, column); - Q_ASSERT(threadStart.isValid()); - Q_ASSERT(threadEnd.isValid()); - thread.select(threadStart, threadEnd); - } - } - d->m_contentSelectionModel->select(thread, ClearAndSelect); -} - -void ThreadSelectionModelPrivate::contentSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected) -{ - Q_UNUSED(selected) - Q_UNUSED(deselected) - - const QModelIndexList list = m_contentSelectionModel->selectedRows(); - if (list.isEmpty()) - m_navigationModel->clearSelection(); - if (list.size() == 1) { - m_navigationModel->select(list.first(), QItemSelectionModel::ClearAndSelect); - } -} - -#include "moc_threadselectionmodel.cpp" diff --git a/kdepim/mobile/lib/threadselectionmodel.h b/kdepim/mobile/lib/threadselectionmodel.h deleted file mode 100644 index d4cffa1f..00000000 --- a/kdepim/mobile/lib/threadselectionmodel.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 THREADSELECTIONMODEL_H -#define THREADSELECTIONMODEL_H - -#include - -#include "mobileui_export.h" - -class ThreadSelectionModelPrivate; - -class MOBILEUI_EXPORT ThreadSelectionModel : public QItemSelectionModel -{ - Q_OBJECT -public: - explicit ThreadSelectionModel(QAbstractItemModel* model, QItemSelectionModel *contentSelectionModel, QItemSelectionModel *navigationModel, QObject *parent = 0); - virtual ~ThreadSelectionModel(); - virtual void select(const QModelIndex& index, SelectionFlags command); - virtual void select(const QItemSelection& selection, SelectionFlags command); -private: - Q_DECLARE_PRIVATE(ThreadSelectionModel) - ThreadSelectionModelPrivate * const d_ptr; - Q_PRIVATE_SLOT(d_func(), void contentSelectionChanged(QItemSelection,QItemSelection)) -}; - -#endif diff --git a/kdepim/mobile/licenses/CMakeLists.txt b/kdepim/mobile/licenses/CMakeLists.txt deleted file mode 100644 index eeaa5f66..00000000 --- a/kdepim/mobile/licenses/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -find_program(DBLATEX_EXECUTABLE dblatex) -add_feature_info("Kontact Touch license information" DBLATEX_EXECUTABLE "Dblatex is needed for building the Kontact Touch license information.") - -if(DBLATEX_EXECUTABLE) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/licenses.pdf - COMMAND ${DBLATEX_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/licenses.xml - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/licenses.xml - ) - - add_custom_target(licences_pdf DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/licenses.pdf) -endif() - -install(FILES licenses.pdf DESTINATION ${DATA_INSTALL_DIR}/kontact-touch/) \ No newline at end of file diff --git a/kdepim/mobile/licenses/licenses.pdf b/kdepim/mobile/licenses/licenses.pdf deleted file mode 100644 index 81980a54..00000000 Binary files a/kdepim/mobile/licenses/licenses.pdf and /dev/null differ diff --git a/kdepim/mobile/licenses/licenses.xml b/kdepim/mobile/licenses/licenses.xml deleted file mode 100644 index 981e7533..00000000 --- a/kdepim/mobile/licenses/licenses.xml +++ /dev/null @@ -1,4931 +0,0 @@ - -
- - Licenses of Kontact Touch - -
- Licenses - - - Licenses - - - - Component - Checked Version - Licenses - - - - - Akonadi - akonadi-1.4.52.svn1183813 - lgpl21 - - - aspell - win32libs-sources-aspell-src-0.60.6 - lgpl21 - - - Attica - attica-0.1.4.20101015 - lgpl21 - - - Boost - win32libs-sources-boost-src-20100728 - boost - - - Cyrus SASL - win32libs-sources-cyrus-sasl-src-2.1.22 - bsd4-cmake - - - expat - win32libs-sources-expat-src-2.0.1 - mit - - - gettext - testing-gettext-src-0.18 - gpl3 - - - giflib - win32libs-sources-giflib-src-4.1.6 - mit - - - GnuPG2 - gnupg-2.1.0-svn5461 - gpl3 - - - gpgme - gpgme-1.3.1-svn1492 - gpl2 - - - iconv - win32libs-sources-win_iconv-src-20100328 - netbsd - - - libjpeg - win32libs-sources-jpeg-src-8.0 - jpeg - - - kde-l10n - kde-l10n_4.5~20101008.1183812 - gpl2 - - - kde4libs - kde4libs-4.5+20101018.1187059 - gpl2 - - - kdebase-runtime - kdebase-runtime-4.5+20101015.1186249 - gpl2, - lgpl21 - - - kdepim - kdepim-4.6~20101020.1187659 - gpl2, - lgpl21 - - - kdepimlibs - kdepimlibs-4.6~20101020.1187658 - gpl2, - lgpl21, - netbsd - - - libassuan - libassuan-2.0.2-svn389 - gpl3, - lgpl21 - - - libbzip2 - win32libs-sources-libbzip2-src-1.0.6 - bsd4-cmake - - - libcurl - win32libs-sources-libcurl-src-7.20.0 - mit - - - libdbusmenu-qt - libdbusmenu-qt-0.5.1 - gpl2 - - - libgcrypt - libgcrypt-1.5.0-svn1447 - lgpl21 - - - libgpg-error - libgpg-error-1.8-svn234 - gpl2, - lgpl21 - - - libical - win32libs-sources-libical-src-0.44 - mpl11, - lgpl2 - - - libpng - win32libs-sources-libpng-src-1.4.4 - zlib - - - libksba - libksba-1.1.0-svn326 - gpl3 - - - libxml2 - win32libs-sources-libxml2-src-2.7.7 - mit - - - libxslt - win32libs-sources-libxslt-src-1.1.26 - mit - - - maemo-optify - maemo-optify-0.2.2 - do-what-you-want - - - OpenSSL - win32libs-sources-openssl-src-1.0.0 - openssl - - - Phonon - kdesupport-phonon-4.3.1.20090227 - lgpl21 - - - PCRE - win32libs-sources-pcre-src-8.02win32libs-sources-pcre-src-8.02 - bsd3 - - - oxygen-icons - oxygen-icons_4.6~20101005.1175741-1maemo1 - lgpl3 - - - pinentry-qt - pinentry-qt-0.8.1 - gpl2 - - - pinentry - pinentry-0.9.0+20100917 - gpl2 - - - qt - qt4-maemo5_4.7.0~git20100329-0maemo1komo1 - lgpl21, - nokia-lgpl, - bsd3, - nokia-tech - - - Redland - win32libs-sources-redland-src-1.0.8.20090124 - lgpl21 - - - shared-desktop-ontologies - 0.2.0 - bsd3, - cc-by, - dcmi, - wc3 - - - shared-mime-info - shared-mime-info-0.71 - gpl2 - - - soprano - soprano-2.5.2.20101015 - gpl2, - lgpl2 - - - sqlite3 - sqlite3_3.7.2-1.debian - pd - - - strigi - strigi-0.7.2.20101001 - lgpl2 - - - virtuoso - virtuoso-opensource-6.1.2 - gpl2 - - - wcecompat - win32libs-sources-wcecompat-src-20100122 - lgpl21 - - - wincetools - testing-wincetools-0.01 - lgpl21 - - - zlib - win32libs-sources-zlib-src-1.2.5 - zlib - - - -
-
- -
-
- GNU LESSER GENERAL PUBLIC LICENSE Version 2 - - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor - Boston, MA 02110-1301, USA. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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 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 - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - -
-
- GNU LESSER GENERAL PUBLIC LICENSE Version 2.1 - - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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 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 - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - -
-
- GNU LESSER GENERAL PUBLIC LICENSE Version 3 - - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. - -
-
- GNU GENERAL PUBLIC LICENSE Version 2 - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - -
-
- GNU GENERAL PUBLIC LICENSE Version 3 - - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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 3 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, see <http://www.gnu.org/licenses/>. - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - <program> Copyright (C) <year> <name of author> - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -<http://www.gnu.org/licenses/>. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -<http://www.gnu.org/philosophy/why-not-lgpl.html>. - -
-
- Nokia Qt LGPL Exception version 1.1 - -Nokia Qt LGPL Exception version 1.1 - -As an additional permission to the GNU Lesser General Public License version -2.1, the object code form of a "work that uses the Library" may incorporate -material from a header file that is part of the Library. You may distribute -such object code under terms of your choice, provided that: - (i) the header files of the Library have not been modified; and - (ii) the incorporated material is limited to numerical parameters, data - structure layouts, accessors, macros, inline functions and - templates; and - (iii) you comply with the terms of Section 6 of the GNU Lesser General - Public License version 2.1. - -Moreover, you may apply this exception to a modified version of the Library, -provided that such modification does not involve copying material from the -Library into the modified Library's header files unless such material is -limited to (i) numerical parameters; (ii) data structure layouts; -(iii) accessors; and (iv) small macros, templates and inline functions of -five lines or less in length. - -Furthermore, you are not required to apply this additional permission to a -modified version of the Library. - -
-
- The NetBSD Foundation's (TNF) "2 clause" Berkeley-style license - -License: - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -
-
- "3 clause" Berkeley-style license - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the <organization> nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -
-
- Kitware's "4 clause" Berkeley-style license - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - * The names of Kitware, Inc., the Insight Consortium, or the names of - any consortium members, or of any contributors, may not be used to - endorse or promote products derived from this software without - specific prior written permission. - - * Modified source versions must be plainly marked as such, and must - not be misrepresented as being the original software. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -
-
- Creative Commons Attribution-ShareAlike 3.0 Unported - -Creative Commons Attribution-ShareAlike 3.0 Unported - -THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS -PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR -OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS -LICENSE OR COPYRIGHT LAW IS PROHIBITED. - -BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE -BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED -TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN -CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. - -1. Definitions - - 1. "Adaptation" means a work based upon the Work, or upon the Work and other -pre-existing works, such as a translation, adaptation, derivative work, -arrangement of music or other alterations of a literary or artistic work, or -phonogram or performance and includes cinematographic adaptations or any other -form in which the Work may be recast, transformed, or adapted including in any -form recognizably derived from the original, except that a work that constitutes -a Collection will not be considered an Adaptation for the purpose of this -License. For the avoidance of doubt, where the Work is a musical work, -performance or phonogram, the synchronization of the Work in timed-relation with -a moving image ("synching") will be considered an Adaptation for the purpose of -this License. - 2. "Collection" means a collection of literary or artistic works, such as -encyclopedias and anthologies, or performances, phonograms or broadcasts, or -other works or subject matter other than works listed in Section 1(f) below, -which, by reason of the selection and arrangement of their contents, constitute -intellectual creations, in which the Work is included in its entirety in -unmodified form along with one or more other contributions, each constituting -separate and independent works in themselves, which together are assembled into -a collective whole. A work that constitutes a Collection will not be considered -an Adaptation (as defined above) for the purposes of this License. - 3. "Distribute" means to make available to the public the original and copies -of the Work or Adaptation, as appropriate, through sale or other transfer of -ownership. - 4. "Licensor" means the individual, individuals, entity or entities that -offer(s) the Work under the terms of this License. - 5. "Original Author" means, in the case of a literary or artistic work, the -individual, individuals, entity or entities who created the Work or if no -individual or entity can be identified, the publisher; and in addition (i) in -the case of a performance the actors, singers, musicians, dancers, and other -persons who act, sing, deliver, declaim, play in, interpret or otherwise perform -literary or artistic works or expressions of folklore; (ii) in the case of a -phonogram the producer being the person or legal entity who first fixes the -sounds of a performance or other sounds; and, (iii) in the case of broadcasts, -the organization that transmits the broadcast. - 6. "Work" means the literary and/or artistic work offered under the terms of -this License including without limitation any production in the literary, -scientific and artistic domain, whatever may be the mode or form of its -expression including digital form, such as a book, pamphlet and other writing; a -lecture, address, sermon or other work of the same nature; a dramatic or -dramatico-musical work; a choreographic work or entertainment in dumb show; a -musical composition with or without words; a cinematographic work to which are -assimilated works expressed by a process analogous to cinematography; a work of -drawing, painting, architecture, sculpture, engraving or lithography; a -photographic work to which are assimilated works expressed by a process -analogous to photography; a work of applied art; an illustration, map, plan, -sketch or three-dimensional work relative to geography, topography, architecture -or science; a performance; a broadcast; a phonogram; a compilation of data to -the extent it is protected as a copyrightable work; or a work performed by a -variety or circus performer to the extent it is not otherwise considered a -literary or artistic work. - 7. "You" means an individual or entity exercising rights under this License -who has not previously violated the terms of this License with respect to the -Work, or who has received express permission from the Licensor to exercise -rights under this License despite a previous violation. - 8. "Publicly Perform" means to perform public recitations of the Work and to -communicate to the public those public recitations, by any means or process, -including by wire or wireless means or public digital performances; to make -available to the public Works in such a way that members of the public may -access these Works from a place and at a place individually chosen by them; to -perform the Work to the public by any means or process and the communication to -the public of the performances of the Work, including by public digital -performance; to broadcast and rebroadcast the Work by any means including signs, -sounds or images. - 9. "Reproduce" means to make copies of the Work by any means including -without limitation by sound or visual recordings and the right of fixation and -reproducing fixations of the Work, including storage of a protected performance -or phonogram in digital form or other electronic medium. - -2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or -restrict any uses free from copyright or rights arising from limitations or -exceptions that are provided for in connection with the copyright protection -under copyright law or other applicable laws. - -3. License Grant. Subject to the terms and conditions of this License, Licensor -hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the -duration of the applicable copyright) license to exercise the rights in the Work -as stated below: - - 1. to Reproduce the Work, to incorporate the Work into one or more -Collections, and to Reproduce the Work as incorporated in the Collections; - 2. to create and Reproduce Adaptations provided that any such Adaptation, -including any translation in any medium, takes reasonable steps to clearly -label, demarcate or otherwise identify that changes were made to the original -Work. For example, a translation could be marked "The original work was -translated from English to Spanish," or a modification could indicate "The -original work has been modified."; - 3. to Distribute and Publicly Perform the Work including as incorporated in -Collections; and, - 4. to Distribute and Publicly Perform Adaptations. - 5. - - For the avoidance of doubt: - 1. Non-waivable Compulsory License Schemes. In those jurisdictions in -which the right to collect royalties through any statutory or compulsory -licensing scheme cannot be waived, the Licensor reserves the exclusive right to -collect such royalties for any exercise by You of the rights granted under this -License; - 2. Waivable Compulsory License Schemes. In those jurisdictions in which -the right to collect royalties through any statutory or compulsory licensing -scheme can be waived, the Licensor waives the exclusive right to collect such -royalties for any exercise by You of the rights granted under this License; and, - 3. Voluntary License Schemes. The Licensor waives the right to collect -royalties, whether individually or, in the event that the Licensor is a member -of a collecting society that administers voluntary licensing schemes, via that -society, from any exercise by You of the rights granted under this License. - -The above rights may be exercised in all media and formats whether now known or -hereafter devised. The above rights include the right to make such modifications -as are technically necessary to exercise the rights in other media and formats. -Subject to Section 8(f), all rights not expressly granted by Licensor are hereby -reserved. - -4. Restrictions. The license granted in Section 3 above is expressly made -subject to and limited by the following restrictions: - - 1. You may Distribute or Publicly Perform the Work only under the terms of -this License. You must include a copy of, or the Uniform Resource Identifier -(URI) for, this License with every copy of the Work You Distribute or Publicly -Perform. You may not offer or impose any terms on the Work that restrict the -terms of this License or the ability of the recipient of the Work to exercise -the rights granted to that recipient under the terms of the License. You may not -sublicense the Work. You must keep intact all notices that refer to this License -and to the disclaimer of warranties with every copy of the Work You Distribute -or Publicly Perform. When You Distribute or Publicly Perform the Work, You may -not impose any effective technological measures on the Work that restrict the -ability of a recipient of the Work from You to exercise the rights granted to -that recipient under the terms of the License. This Section 4(a) applies to the -Work as incorporated in a Collection, but this does not require the Collection -apart from the Work itself to be made subject to the terms of this License. If -You create a Collection, upon notice from any Licensor You must, to the extent -practicable, remove from the Collection any credit as required by Section 4(b), -as requested. If You create an Adaptation, upon notice from any Licensor You -must, to the extent practicable, remove from the Adaptation any credit as -required by Section 4(b), as requested. - 2. If You Distribute, or Publicly Perform the Work or any Adaptations or -Collections, You must, unless a request has been made pursuant to Section 4(a), -keep intact all copyright notices for the Work and provide, reasonable to the -medium or means You are utilizing: (i) the name of the Original Author (or -pseudonym, if applicable) if supplied, and/or if the Original Author and/or -Licensor designate another party or parties (e.g., a sponsor institute, -publishing entity, journal) for attribution ("Attribution Parties") in -Licensor's copyright notice, terms of service or by other reasonable means, the -name of such party or parties; (ii) the title of the Work if supplied; (iii) to -the extent reasonably practicable, the URI, if any, that Licensor specifies to -be associated with the Work, unless such URI does not refer to the copyright -notice or licensing information for the Work; and (iv) , consistent with Section -3(b), in the case of an Adaptation, a credit identifying the use of the Work in -the Adaptation (e.g., "French translation of the Work by Original Author," or -"Screenplay based on original Work by Original Author"). The credit required by -this Section 4 (b) may be implemented in any reasonable manner; provided, -however, that in the case of a Adaptation or Collection, at a minimum such -credit will appear, if a credit for all contributing authors of the Adaptation -or Collection appears, then as part of these credits and in a manner at least as -prominent as the credits for the other contributing authors. For the avoidance -of doubt, You may only use the credit required by this Section for the purpose -of attribution in the manner set out above and, by exercising Your rights under -this License, You may not implicitly or explicitly assert or imply any -connection with, sponsorship or endorsement by the Original Author, Licensor -and/or Attribution Parties, as appropriate, of You or Your use of the Work, -without the separate, express prior written permission of the Original Author, -Licensor and/or Attribution Parties. - 3. Except as otherwise agreed in writing by the Licensor or as may be -otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly -Perform the Work either by itself or as part of any Adaptations or Collections, -You must not distort, mutilate, modify or take other derogatory action in -relation to the Work which would be prejudicial to the Original Author's honor -or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in -which any exercise of the right granted in Section 3(b) of this License (the -right to make Adaptations) would be deemed to be a distortion, mutilation, -modification or other derogatory action prejudicial to the Original Author's -honor and reputation, the Licensor will waive or not assert, as appropriate, -this Section, to the fullest extent permitted by the applicable national law, to -enable You to reasonably exercise Your right under Section 3(b) of this License -(right to make Adaptations) but not otherwise. - -5. Representations, Warranties and Disclaimer - -UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS -THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING -THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT -LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR -PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, -OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME -JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH -EXCLUSION MAY NOT APPLY TO YOU. - -6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN -NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, -INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS -LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - -7. Termination - - 1. This License and the rights granted hereunder will terminate automatically -upon any breach by You of the terms of this License. Individuals or entities who -have received Adaptations or Collections from You under this License, however, -will not have their licenses terminated provided such individuals or entities -remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 -will survive any termination of this License. - 2. Subject to the above terms and conditions, the license granted here is -perpetual (for the duration of the applicable copyright in the Work). -Notwithstanding the above, Licensor reserves the right to release the Work under -different license terms or to stop distributing the Work at any time; provided, -however that any such election will not serve to withdraw this License (or any -other license that has been, or is required to be, granted under the terms of -this License), and this License will continue in full force and effect unless -terminated as stated above. - -8. Miscellaneous - - 1. Each time You Distribute or Publicly Perform the Work or a Collection, the -Licensor offers to the recipient a license to the Work on the same terms and -conditions as the license granted to You under this License. - 2. Each time You Distribute or Publicly Perform an Adaptation, Licensor -offers to the recipient a license to the original Work on the same terms and -conditions as the license granted to You under this License. - 3. If any provision of this License is invalid or unenforceable under -applicable law, it shall not affect the validity or enforceability of the -remainder of the terms of this License, and without further action by the -parties to this agreement, such provision shall be reformed to the minimum -extent necessary to make such provision valid and enforceable. - 4. No term or provision of this License shall be deemed waived and no breach -consented to unless such waiver or consent shall be in writing and signed by the -party to be charged with such waiver or consent. - 5. This License constitutes the entire agreement between the parties with -respect to the Work licensed here. There are no understandings, agreements or -representations with respect to the Work not specified here. Licensor shall not -be bound by any additional provisions that may appear in any communication from -You. This License may not be modified without the mutual written agreement of -the Licensor and You. - 6. The rights granted under, and the subject matter referenced, in this -License were drafted utilizing the terminology of the Berne Convention for the -Protection of Literary and Artistic Works (as amended on September 28, 1979), -the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO -Performances and Phonograms Treaty of 1996 and the Universal Copyright -Convention (as revised on July 24, 1971). These rights and subject matter take -effect in the relevant jurisdiction in which the License terms are sought to be -enforced according to the corresponding provisions of the implementation of -those treaty provisions in the applicable national law. If the standard suite of -rights granted under applicable copyright law includes additional rights not -granted under this License, such additional rights are deemed to be included in -the License; this License is not intended to restrict the license of any rights -under applicable law. - -
-
- Creative Commons Creative Commons Legal Code - - Creative Commons - -Creative Commons Legal Code - -Attribution 3.0 Unported - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL - SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT - RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" - BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION - PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE. - -License - -THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE -COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY -COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS -AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. - -BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE -BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE -CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE -IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. - -1. Definitions - - a. "Adaptation" means a work based upon the Work, or upon the Work and other - pre-existing works, such as a translation, adaptation, derivative work, - arrangement of music or other alterations of a literary or artistic work, - or phonogram or performance and includes cinematographic adaptations or any - other form in which the Work may be recast, transformed, or adapted - including in any form recognizably derived from the original, except that a - work that constitutes a Collection will not be considered an Adaptation for - the purpose of this License. For the avoidance of doubt, where the Work is - a musical work, performance or phonogram, the synchronization of the Work - in timed-relation with a moving image ("synching") will be considered an - Adaptation for the purpose of this License. - b. "Collection" means a collection of literary or artistic works, such as - encyclopedias and anthologies, or performances, phonograms or broadcasts, - or other works or subject matter other than works listed in Section 1(f) - below, which, by reason of the selection and arrangement of their contents, - constitute intellectual creations, in which the Work is included in its - entirety in unmodified form along with one or more other contributions, - each constituting separate and independent works in themselves, which - together are assembled into a collective whole. A work that constitutes a - Collection will not be considered an Adaptation (as defined above) for the - purposes of this License. - c. "Distribute" means to make available to the public the original and copies - of the Work or Adaptation, as appropriate, through sale or other transfer - of ownership. - d. "Licensor" means the individual, individuals, entity or entities that offer - (s) the Work under the terms of this License. - e. "Original Author" means, in the case of a literary or artistic work, the - individual, individuals, entity or entities who created the Work or if no - individual or entity can be identified, the publisher; and in addition (i) - in the case of a performance the actors, singers, musicians, dancers, and - other persons who act, sing, deliver, declaim, play in, interpret or - otherwise perform literary or artistic works or expressions of folklore; - (ii) in the case of a phonogram the producer being the person or legal - entity who first fixes the sounds of a performance or other sounds; and, - (iii) in the case of broadcasts, the organization that transmits the - broadcast. - f. "Work" means the literary and/or artistic work offered under the terms of - this License including without limitation any production in the literary, - scientific and artistic domain, whatever may be the mode or form of its - expression including digital form, such as a book, pamphlet and other - writing; a lecture, address, sermon or other work of the same nature; a - dramatic or dramatico-musical work; a choreographic work or entertainment - in dumb show; a musical composition with or without words; a - cinematographic work to which are assimilated works expressed by a process - analogous to cinematography; a work of drawing, painting, architecture, - sculpture, engraving or lithography; a photographic work to which are - assimilated works expressed by a process analogous to photography; a work - of applied art; an illustration, map, plan, sketch or three-dimensional - work relative to geography, topography, architecture or science; a - performance; a broadcast; a phonogram; a compilation of data to the extent - it is protected as a copyrightable work; or a work performed by a variety - or circus performer to the extent it is not otherwise considered a literary - or artistic work. - g. "You" means an individual or entity exercising rights under this License - who has not previously violated the terms of this License with respect to - the Work, or who has received express permission from the Licensor to - exercise rights under this License despite a previous violation. - h. "Publicly Perform" means to perform public recitations of the Work and to - communicate to the public those public recitations, by any means or - process, including by wire or wireless means or public digital - performances; to make available to the public Works in such a way that - members of the public may access these Works from a place and at a place - individually chosen by them; to perform the Work to the public by any means - or process and the communication to the public of the performances of the - Work, including by public digital performance; to broadcast and rebroadcast - the Work by any means including signs, sounds or images. - i. "Reproduce" means to make copies of the Work by any means including without - limitation by sound or visual recordings and the right of fixation and - reproducing fixations of the Work, including storage of a protected - performance or phonogram in digital form or other electronic medium. - -2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, -or restrict any uses free from copyright or rights arising from limitations or -exceptions that are provided for in connection with the copyright protection -under copyright law or other applicable laws. - -3. License Grant. Subject to the terms and conditions of this License, Licensor -hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the -duration of the applicable copyright) license to exercise the rights in the -Work as stated below: - - a. to Reproduce the Work, to incorporate the Work into one or more - Collections, and to Reproduce the Work as incorporated in the Collections; - b. to create and Reproduce Adaptations provided that any such Adaptation, - including any translation in any medium, takes reasonable steps to clearly - label, demarcate or otherwise identify that changes were made to the - original Work. For example, a translation could be marked "The original - work was translated from English to Spanish," or a modification could - indicate "The original work has been modified."; - c. to Distribute and Publicly Perform the Work including as incorporated in - Collections; and, - d. to Distribute and Publicly Perform Adaptations. - e. For the avoidance of doubt: - - i. Non-waivable Compulsory License Schemes. In those jurisdictions in - which the right to collect royalties through any statutory or - compulsory licensing scheme cannot be waived, the Licensor reserves the - exclusive right to collect such royalties for any exercise by You of - the rights granted under this License; - ii. Waivable Compulsory License Schemes. In those jurisdictions in which - the right to collect royalties through any statutory or compulsory - licensing scheme can be waived, the Licensor waives the exclusive right - to collect such royalties for any exercise by You of the rights granted - under this License; and, - iii. Voluntary License Schemes. The Licensor waives the right to collect - royalties, whether individually or, in the event that the Licensor is a - member of a collecting society that administers voluntary licensing - schemes, via that society, from any exercise by You of the rights - granted under this License. - -The above rights may be exercised in all media and formats whether now known or -hereafter devised. The above rights include the right to make such -modifications as are technically necessary to exercise the rights in other -media and formats. Subject to Section 8(f), all rights not expressly granted by -Licensor are hereby reserved. - -4. Restrictions. The license granted in Section 3 above is expressly made -subject to and limited by the following restrictions: - - a. You may Distribute or Publicly Perform the Work only under the terms of - this License. You must include a copy of, or the Uniform Resource - Identifier (URI) for, this License with every copy of the Work You - Distribute or Publicly Perform. You may not offer or impose any terms on - the Work that restrict the terms of this License or the ability of the - recipient of the Work to exercise the rights granted to that recipient - under the terms of the License. You may not sublicense the Work. You must - keep intact all notices that refer to this License and to the disclaimer of - warranties with every copy of the Work You Distribute or Publicly Perform. - When You Distribute or Publicly Perform the Work, You may not impose any - effective technological measures on the Work that restrict the ability of a - recipient of the Work from You to exercise the rights granted to that - recipient under the terms of the License. This Section 4(a) applies to the - Work as incorporated in a Collection, but this does not require the - Collection apart from the Work itself to be made subject to the terms of - this License. If You create a Collection, upon notice from any Licensor You - must, to the extent practicable, remove from the Collection any credit as - required by Section 4(b), as requested. If You create an Adaptation, upon - notice from any Licensor You must, to the extent practicable, remove from - the Adaptation any credit as required by Section 4(b), as requested. - b. If You Distribute, or Publicly Perform the Work or any Adaptations or - Collections, You must, unless a request has been made pursuant to Section 4 - (a), keep intact all copyright notices for the Work and provide, reasonable - to the medium or means You are utilizing: (i) the name of the Original - Author (or pseudonym, if applicable) if supplied, and/or if the Original - Author and/or Licensor designate another party or parties (e.g., a sponsor - institute, publishing entity, journal) for attribution ("Attribution - Parties") in Licensor's copyright notice, terms of service or by other - reasonable means, the name of such party or parties; (ii) the title of the - Work if supplied; (iii) to the extent reasonably practicable, the URI, if - any, that Licensor specifies to be associated with the Work, unless such - URI does not refer to the copyright notice or licensing information for the - Work; and (iv) , consistent with Section 3(b), in the case of an - Adaptation, a credit identifying the use of the Work in the Adaptation - (e.g., "French translation of the Work by Original Author," or "Screenplay - based on original Work by Original Author"). The credit required by this - Section 4 (b) may be implemented in any reasonable manner; provided, - however, that in the case of a Adaptation or Collection, at a minimum such - credit will appear, if a credit for all contributing authors of the - Adaptation or Collection appears, then as part of these credits and in a - manner at least as prominent as the credits for the other contributing - authors. For the avoidance of doubt, You may only use the credit required - by this Section for the purpose of attribution in the manner set out above - and, by exercising Your rights under this License, You may not implicitly - or explicitly assert or imply any connection with, sponsorship or - endorsement by the Original Author, Licensor and/or Attribution Parties, as - appropriate, of You or Your use of the Work, without the separate, express - prior written permission of the Original Author, Licensor and/or - Attribution Parties. - c. Except as otherwise agreed in writing by the Licensor or as may be - otherwise permitted by applicable law, if You Reproduce, Distribute or - Publicly Perform the Work either by itself or as part of any Adaptations or - Collections, You must not distort, mutilate, modify or take other - derogatory action in relation to the Work which would be prejudicial to the - Original Author's honor or reputation. Licensor agrees that in those - jurisdictions (e.g. Japan), in which any exercise of the right granted in - Section 3(b) of this License (the right to make Adaptations) would be - deemed to be a distortion, mutilation, modification or other derogatory - action prejudicial to the Original Author's honor and reputation, the - Licensor will waive or not assert, as appropriate, this Section, to the - fullest extent permitted by the applicable national law, to enable You to - reasonably exercise Your right under Section 3(b) of this License (right to - make Adaptations) but not otherwise. - -5. Representations, Warranties and Disclaimer - -UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS -THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND -CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, -WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A -PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, -ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. -SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH -EXCLUSION MAY NOT APPLY TO YOU. - -6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN -NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, -INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS -LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - -7. Termination - - a. This License and the rights granted hereunder will terminate automatically - upon any breach by You of the terms of this License. Individuals or - entities who have received Adaptations or Collections from You under this - License, however, will not have their licenses terminated provided such - individuals or entities remain in full compliance with those licenses. - Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. - b. Subject to the above terms and conditions, the license granted here is - perpetual (for the duration of the applicable copyright in the Work). - Notwithstanding the above, Licensor reserves the right to release the Work - under different license terms or to stop distributing the Work at any time; - provided, however that any such election will not serve to withdraw this - License (or any other license that has been, or is required to be, granted - under the terms of this License), and this License will continue in full - force and effect unless terminated as stated above. - -8. Miscellaneous - - a. Each time You Distribute or Publicly Perform the Work or a Collection, the - Licensor offers to the recipient a license to the Work on the same terms - and conditions as the license granted to You under this License. - b. Each time You Distribute or Publicly Perform an Adaptation, Licensor offers - to the recipient a license to the original Work on the same terms and - conditions as the license granted to You under this License. - c. If any provision of this License is invalid or unenforceable under - applicable law, it shall not affect the validity or enforceability of the - remainder of the terms of this License, and without further action by the - parties to this agreement, such provision shall be reformed to the minimum - extent necessary to make such provision valid and enforceable. - d. No term or provision of this License shall be deemed waived and no breach - consented to unless such waiver or consent shall be in writing and signed - by the party to be charged with such waiver or consent. - e. This License constitutes the entire agreement between the parties with - respect to the Work licensed here. There are no understandings, agreements - or representations with respect to the Work not specified here. Licensor - shall not be bound by any additional provisions that may appear in any - communication from You. This License may not be modified without the mutual - written agreement of the Licensor and You. - f. The rights granted under, and the subject matter referenced, in this - License were drafted utilizing the terminology of the Berne Convention for - the Protection of Literary and Artistic Works (as amended on September 28, - 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the - WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright - Convention (as revised on July 24, 1971). These rights and subject matter - take effect in the relevant jurisdiction in which the License terms are - sought to be enforced according to the corresponding provisions of the - implementation of those treaty provisions in the applicable national law. - If the standard suite of rights granted under applicable copyright law - includes additional rights not granted under this License, such additional - rights are deemed to be included in the License; this License is not - intended to restrict the license of any rights under applicable law. - - Creative Commons Notice - - Creative Commons is not a party to this License, and makes no warranty - whatsoever in connection with the Work. Creative Commons will not be liable - to You or any party on any legal theory for any damages whatsoever, - including without limitation any general, special, incidental or - consequential damages arising in connection to this license. - Notwithstanding the foregoing two (2) sentences, if Creative Commons has - expressly identified itself as the Licensor hereunder, it shall have all - rights and obligations of Licensor. - - Except for the limited purpose of indicating to the public that the Work is - licensed under the CCPL, Creative Commons does not authorize the use by - either party of the trademark "Creative Commons" or any related trademark - or logo of Creative Commons without the prior written consent of Creative - Commons. Any permitted use will be in compliance with Creative Commons' - then-current trademark usage guidelines, as may be published on its website - or otherwise made available upon request from time to time. For the - avoidance of doubt, this trademark restriction does not form part of this - License. - - Creative Commons may be contacted at http://creativecommons.org/. - -
-
- Public Domain - -The author disclaims all copyright. The library is in the public domain. - -
-
- DO WHAT YOU WANT TO PUBLIC LICENSE v 1 (Sounds like public domain) - - DO WHAT YOU WANT TO PUBLIC LICENSE - Version 1, September 2009 - - Copyright (C) 2009 Marius Vollmer - Copyright (C) 2004 Sam Hocevar - 14 rue de Plaisance, 75014 Paris, France - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - - DO WHAT YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT YOU WANT TO. - -
-
- W3C Software Notice and License - -W3C Software Notice and License - -This work (and included software, documentation such as READMEs, or other -related items) is being provided by the copyright holders under the following -license. - -License - -By obtaining, using and/or copying this work, you (the licensee) agree that you -have read, understood, and will comply with the following terms and conditions. - -Permission to copy, modify, and distribute this software and its documentation, -with or without modification, for any purpose and without fee or royalty is -hereby granted, provided that you include the following on ALL copies of the -software and documentation or portions thereof, including modifications: - - • The full text of this NOTICE in a location viewable to users of the - redistributed or derivative work. - • Any pre-existing intellectual property disclaimers, notices, or terms and - conditions. If none exist, the W3C Software Short Notice should be included - (hypertext is preferred, text is permitted) within the body of any - redistributed or derivative code. - • Notice of any changes or modifications to the files, including the date - changes were made. (We recommend you provide URIs to the location from - which the code is derived.) - -Disclaimers - -THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE -NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT -THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY -PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. - -COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. - -The name and trademarks of copyright holders may NOT be used in advertising or -publicity pertaining to the software without specific, written prior -permission. Title to copyright in this software and any associated -documentation will at all times remain with copyright holders. - -Notes - -This version: http://www.w3.org/Consortium/Legal/2002/ -copyright-software-20021231 - -This formulation of W3C's notice and license became active on December 31 2002. -This version removes the copyright ownership notice such that this license can -be used with materials other than those owned by the W3C, reflects that ERCIM -is now a host of the W3C, includes references to this specific dated version of -the license, and removes the ambiguous grant of "use". Otherwise, this version -is the same as the previous version and is written so as to preserve the Free -Software Foundation's assessment of GPL compatibility and OSI's certification -under the Open Source Definition. - -
-
- TECHNOLOGY PREVIEW LICENSE AGREEMENT - -TECHNOLOGY PREVIEW LICENSE AGREEMENT - -For individuals and/or legal entities resident in the Americas (North -America, Central America and South America), the applicable licensing -terms are specified under the heading "Technology Preview License -Agreement: The Americas". - -For individuals and/or legal entities not resident in The Americas, the -applicable licensing terms are specified under the heading "Technology -Preview License Agreement: Rest of the World". - - -TECHNOLOGY PREVIEW LICENSE AGREEMENT: The Americas -Agreement version 2.4 - -This Technology Preview License Agreement ("Agreement") is a legal -agreement between Nokia Inc. ("Nokia"), with its registered office at -102 Corporate Park Drive, White Plains, N.Y., U.S.A. 10604 and you (either an -individual or a legal entity) ("Licensee") for the Licensed Software (as -defined below). - -1. DEFINITIONS - -"Affiliate" of a Party shall mean an entity (i) which is directly or -indirectly controlling such Party; (ii) which is under the same direct -or indirect ownership or control as such Party; or (iii) which is -directly or indirectly owned or controlled by such Party. For these -purposes, an entity shall be treated as being controlled by another if -that other entity has fifty percent (50 %) or more of the votes in such -entity, is able to direct its affairs and/or to control the composition -of its board of directors or equivalent body. - -"Applications" shall mean Licensee's software products created using the -Licensed Software which may include portions of the Licensed Software. - -"Term" shall mean the period of time six (6) months from the later of -(a) the Effective Date; or (b) the date the Licensed Software was -initially delivered to Licensee by Nokia. If no specific Effective Date -is set forth in the Agreement, the Effective Date shall be deemed to be -the date the Licensed Software was initially delivered to Licensee. - -"Licensed Software" shall mean the computer software, "online" or -electronic documentation, associated media and printed materials, -including the source code, example programs and the documentation -delivered by Nokia to Licensee in conjunction with this Agreement. - -"Party" or "Parties" shall mean Licensee and/or Nokia. - - -2. OWNERSHIP - -The Licensed Software is protected by copyright laws and international -copyright treaties, as well as other intellectual property laws and -treaties. The Licensed Software is licensed, not sold. - -If Licensee provides any findings, proposals, suggestions or other -feedback ("Feedback") to Nokia regarding the Licensed Software, Nokia -shall own all right, title and interest including the intellectual -property rights in and to such Feedback, excluding however any existing -patent rights of Licensee. To the extent Licensee owns or controls any -patents for such Feedback Licensee hereby grants to Nokia and its -Affiliates, a worldwide, perpetual, non-transferable, sublicensable, -royalty-free license to (i) use, copy and modify Feedback and to create -derivative works thereof, (ii) to make (and have made), use, import, -sell, offer for sale, lease, dispose, offer for disposal or otherwise -exploit any products or services of Nokia containing Feedback,, and -(iii) sublicense all the foregoing rights to third party licensees and -customers of Nokia and/or its Affiliates. - - -3. VALIDITY OF THE AGREEMENT - -By installing, copying, or otherwise using the Licensed Software, -Licensee agrees to be bound by the terms of this Agreement. If Licensee -does not agree to the terms of this Agreement, Licensee may not install, -copy, or otherwise use the Licensed Software. Upon Licensee's acceptance -of the terms and conditions of this Agreement, Nokia grants Licensee the -right to use the Licensed Software in the manner provided below. - - -4. LICENSES - -4.1. Using and Copying - -Nokia grants to Licensee a non-exclusive, non-transferable, time-limited -license to use and copy the Licensed Software for sole purpose of -designing, developing and testing Applications, and evaluating and the -Licensed Software during the Term. - -Licensee may install copies of the Licensed Software on an unlimited -number of computers provided that (a) if an individual, only such -individual; or (b) if a legal entity only its employees; use the -Licensed Software for the authorized purposes. - -4.2 No Distribution or Modifications - -Licensee may not disclose, modify, sell, market, commercialise, -distribute, loan, rent, lease, or license the Licensed Software or any -copy of it or use the Licensed Software for any purpose that is not -expressly granted in this Section 4. Licensee may not alter or remove -any details of ownership, copyright, trademark or other property right -connected with the Licensed Software. Licensee may not distribute any -software statically or dynamically linked with the Licensed Software. - -4.3 No Technical Support - -Nokia has no obligation to furnish Licensee with any technical support -whatsoever. Any such support is subject to separate agreement between -the Parties. - - -5. PRE-RELEASE CODE -The Licensed Software contains pre-release code that is not at the level -of performance and compatibility of a final, generally available, -product offering. The Licensed Software may not operate correctly and -may be substantially modified prior to the first commercial product -release, if any. Nokia is not obligated to make this or any later -version of the Licensed Software commercially available. The License -Software is "Not for Commercial Use" and may only be used for the -purposes described in Section 4. The Licensed Software may not be used -in a live operating environment where it may be relied upon to perform -in the same manner as a commercially released product or with data that -has not been sufficiently backed up. - -6. THIRD PARTY SOFTWARE - -The Licensed Software may provide links to third party libraries or code -(collectively "Third Party Software") to implement various functions. -Third Party Software does not comprise part of the Licensed Software. In -some cases, access to Third Party Software may be included along with -the Licensed Software delivery as a convenience for development and -testing only. Such source code and libraries may be listed in the -".../src/3rdparty" source tree delivered with the Licensed Software or -documented in the Licensed Software where the Third Party Software is -used, as may be amended from time to time, do not comprise the Licensed -Software. Licensee acknowledges (1) that some part of Third Party -Software may require additional licensing of copyright and patents from -the owners of such, and (2) that distribution of any of the Licensed -Software referencing any portion of a Third Party Software may require -appropriate licensing from such third parties. - - -7. LIMITED WARRANTY AND WARRANTY DISCLAIMER - -The Licensed Software is licensed to Licensee "as is". To the maximum -extent permitted by applicable law, Nokia on behalf of itself and its -suppliers, disclaims all warranties and conditions, either express or -implied, including, but not limited to, implied warranties of -merchantability, fitness for a particular purpose, title and -non-infringement with regard to the Licensed Software. - - -8. LIMITATION OF LIABILITY - -If, Nokia's warranty disclaimer notwithstanding, Nokia is held liable to -Licensee, whether in contract, tort or any other legal theory, based on -the Licensed Software, Nokia's entire liability to Licensee and -Licensee's exclusive remedy shall be, at Nokia's option, either (A) -return of the price Licensee paid for the Licensed Software, or (B) -repair or replacement of the Licensed Software, provided Licensee -returns to Nokia all copies of the Licensed Software as originally -delivered to Licensee. Nokia shall not under any circumstances be liable -to Licensee based on failure of the Licensed Software if the failure -resulted from accident, abuse or misapplication, nor shall Nokia under -any circumstances be liable for special damages, punitive or exemplary -damages, damages for loss of profits or interruption of business or for -loss or corruption of data. Any award of damages from Nokia to Licensee -shall not exceed the total amount Licensee has paid to Nokia in -connection with this Agreement. - - -9. CONFIDENTIALITY - -Each party acknowledges that during the Term of this Agreement it shall -have access to information about the other party's business, business -methods, business plans, customers, business relations, technology, and -other information, including the terms of this Agreement, that is -confidential and of great value to the other party, and the value of -which would be significantly reduced if disclosed to third parties (the -"Confidential Information"). Accordingly, when a party (the "Receiving -Party") receives Confidential Information from another party (the -"Disclosing Party"), the Receiving Party shall, and shall obligate its -employees and agents and employees and agents of its Affiliates to: (i) -maintain the Confidential Information in strict confidence; (ii) not -disclose the Confidential Information to a third party without the -Disclosing Party's prior written approval; and (iii) not, directly or -indirectly, use the Confidential Information for any purpose other than -for exercising its rights and fulfilling its responsibilities pursuant -to this Agreement. Each party shall take reasonable measures to protect -the Confidential Information of the other party, which measures shall -not be less than the measures taken by such party to protect its own -confidential and proprietary information. - -"Confidential Information" shall not include information that (a) is or -becomes generally known to the public through no act or omission of the -Receiving Party; (b) was in the Receiving Party's lawful possession -prior to the disclosure hereunder and was not subject to limitations on -disclosure or use; (c) is developed by the Receiving Party without -access to the Confidential Information of the Disclosing Party or by -persons who have not had access to the Confidential Information of the -Disclosing Party as proven by the written records of the Receiving -Party; (d) is lawfully disclosed to the Receiving Party without -restrictions, by a third party not under an obligation of -confidentiality; or (e) the Receiving Party is legally compelled to -disclose the information, in which case the Receiving Party shall assert -the privileged and confidential nature of the information and cooperate -fully with the Disclosing Party to protect against and prevent -disclosure of any Confidential Information and to limit the scope of -disclosure and the dissemination of disclosed Confidential Information -by all legally available means. - -The obligations of the Receiving Party under this Section shall continue -during the Initial Term and for a period of five (5) years after -expiration or termination of this Agreement. To the extent that the -terms of the Non-Disclosure Agreement between Nokia and Licensee -conflict with the terms of this Section 9, this Section 9 shall be -controlling over the terms of the Non-Disclosure Agreement. - - -10. GENERAL PROVISIONS - -10.1 No Assignment - -Licensee shall not be entitled to assign or transfer all or any of its -rights, benefits and obligations under this Agreement without the prior -written consent of Nokia, which shall not be unreasonably withheld. - -10.2 Termination - -Nokia may terminate the Agreement at any time immediately upon written -notice by Nokia to Licensee if Licensee breaches this Agreement. - -Upon termination of this Agreement, Licensee shall return to Nokia all -copies of Licensed Software that were supplied by Nokia. All other -copies of Licensed Software in the possession or control of Licensee -must be erased or destroyed. An officer of Licensee must promptly -deliver to Nokia a written confirmation that this has occurred. - -10.3 Surviving Sections - -Any terms and conditions that by their nature or otherwise reasonably -should survive a cancellation or termination of this Agreement shall -also be deemed to survive. Such terms and conditions include, but are -not limited to the following Sections: 2, 5, 6, 7, 8, 9, 10.2, 10.3, 10.4, -10.5, 10.6, 10.7, and 10.8 of this Agreement. - -10.4 Entire Agreement - -This Agreement constitutes the complete agreement between the parties -and supersedes all prior or contemporaneous discussions, -representations, and proposals, written or oral, with respect to the -subject matters discussed herein, with the exception of the -non-disclosure agreement executed by the parties in connection with this -Agreement ("Non-Disclosure Agreement"), if any, shall be subject to -Section 9. No modification of this Agreement shall be effective unless -contained in a writing executed by an authorized representative of each -party. No term or condition contained in Licensee's purchase order shall -apply unless expressly accepted by Nokia in writing. If any provision of -the Agreement is found void or unenforceable, the remainder shall remain -valid and enforceable according to its terms. If any remedy provided is -determined to have failed for its essential purpose, all limitations of -liability and exclusions of damages set forth in this Agreement shall -remain in effect. - -10.5 Export Control - -Licensee acknowledges that the Licensed Software may be subject to -export control restrictions of various countries. Licensee shall fully -comply with all applicable export license restrictions and requirements -as well as with all laws and regulations relating to the importation of -the Licensed Software and shall procure all necessary governmental -authorizations, including without limitation, all necessary licenses, -approvals, permissions or consents, where necessary for the -re-exportation of the Licensed Software., - -10.6 Governing Law and Legal Venue - -This Agreement shall be governed by and construed in accordance with the -federal laws of the United States of America and the internal laws of -the State of New York without given effect to any choice of law rule -that would result in the application of the laws of any other -jurisdiction. The United Nations Convention on Contracts for the -International Sale of Goods (CISG) shall not apply. Each Party (a) -hereby irrevocably submits itself to and consents to the jurisdiction of -the United States District Court for the Southern District of New York -(or if such court lacks jurisdiction, the state courts of the State of -New York) for the purposes of any action, claim, suit or proceeding -between the Parties in connection with any controversy, claim, or -dispute arising out of or relating to this Agreement; and (b) hereby -waives, and agrees not to assert by way of motion, as a defense or -otherwise, in any such action, claim, suit or proceeding, any claim that -is not personally subject to the jurisdiction of such court(s), that the -action, claim, suit or proceeding is brought in an inconvenient forum or -that the venue of the action, claim, suit or proceeding is improper. -Notwithstanding the foregoing, nothing in this Section 9.6 is intended -to, or shall be deemed to, constitute a submission or consent to, or -selection of, jurisdiction, forum or venue for any action for patent -infringement, whether or not such action relates to this Agreement. - -10.7 No Implied License - -There are no implied licenses or other implied rights granted under this -Agreement, and all rights, save for those expressly granted hereunder, -shall remain with Nokia and its licensors. In addition, no licenses or -immunities are granted to the combination of the Licensed Software with -any other software or hardware not delivered by Nokia under this -Agreement. - -10.8 Government End Users - -A "U.S. Government End User" shall mean any agency or entity of the -government of the United States. The following shall apply if Licensee -is a U.S. Government End User. The Licensed Software is a "commercial -item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), -consisting of "commercial computer software" and "commercial computer -software documentation," as such terms are used in 48 C.F.R. 12.212 -(Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 -through 227.7202-4 (June 1995), all U.S. Government End Users acquire -the Licensed Software with only those rights set forth herein. The -Licensed Software (including related documentation) is provided to U.S. -Government End Users: (a) only as a commercial end item; and (b) only -pursuant to this Agreement. - - - - - -TECHNOLOGY PREVIEW LICENSE AGREEMENT: Rest of the World -Agreement version 2.4 - -This Technology Preview License Agreement ("Agreement") is a legal -agreement between Nokia Corporation ("Nokia"), with its registered -office at Keilalahdentie 4, 02150 Espoo, Finland and you (either an -individual or a legal entity) ("Licensee") for the Licensed Software (as -defined below). - -1. DEFINITIONS - -"Affiliate" of a Party shall mean an entity (i) which is directly or -indirectly controlling such Party; (ii) which is under the same direct -or indirect ownership or control as such Party; or (iii) which is -directly or indirectly owned or controlled by such Party. For these -purposes, an entity shall be treated as being controlled by another if -that other entity has fifty percent (50 %) or more of the votes in such -entity, is able to direct its affairs and/or to control the composition -of its board of directors or equivalent body. - -"Applications" shall mean Licensee's software products created using the -Licensed Software which may include portions of the Licensed Software. - -"Term" shall mean the period of time six (6) months from the later of -(a) the Effective Date; or (b) the date the Licensed Software was -initially delivered to Licensee by Nokia. If no specific Effective Date -is set forth in the Agreement, the Effective Date shall be deemed to be -the date the Licensed Software was initially delivered to Licensee. - -"Licensed Software" shall mean the computer software, "online" or -electronic documentation, associated media and printed materials, -including the source code, example programs and the documentation -delivered by Nokia to Licensee in conjunction with this Agreement. - -"Party" or "Parties" shall mean Licensee and/or Nokia. - - -2. OWNERSHIP - -The Licensed Software is protected by copyright laws and international -copyright treaties, as well as other intellectual property laws and -treaties. The Licensed Software is licensed, not sold. - -If Licensee provides any findings, proposals, suggestions or other -feedback ("Feedback") to Nokia regarding the Licensed Software, Nokia -shall own all right, title and interest including the intellectual -property rights in and to such Feedback, excluding however any existing -patent rights of Licensee. To the extent Licensee owns or controls any -patents for such Feedback Licensee hereby grants to Nokia and its -Affiliates, a worldwide, perpetual, non-transferable, sublicensable, -royalty-free license to (i) use, copy and modify Feedback and to create -derivative works thereof, (ii) to make (and have made), use, import, -sell, offer for sale, lease, dispose, offer for disposal or otherwise -exploit any products or services of Nokia containing Feedback,, and -(iii) sublicense all the foregoing rights to third party licensees and -customers of Nokia and/or its Affiliates. - -3. VALIDITY OF THE AGREEMENT - -By installing, copying, or otherwise using the Licensed Software, -Licensee agrees to be bound by the terms of this Agreement. If Licensee -does not agree to the terms of this Agreement, Licensee may not install, -copy, or otherwise use the Licensed Software. Upon Licensee's acceptance -of the terms and conditions of this Agreement, Nokia grants Licensee the -right to use the Licensed Software in the manner provided below. - - -4. LICENSES - -4.1. Using and Copying - -Nokia grants to Licensee a non-exclusive, non-transferable, time-limited -license to use and copy the Licensed Software for sole purpose of -designing, developing and testing Applications, and evaluating and the -Licensed Software during the Term. - -Licensee may install copies of the Licensed Software on an unlimited -number of computers provided that (a) if an individual, only such -individual; or (b) if a legal entity only its employees; use the -Licensed Software for the authorized purposes. - -4.2 No Distribution or Modifications - -Licensee may not disclose, modify, sell, market, commercialise, -distribute, loan, rent, lease, or license the Licensed Software or any -copy of it or use the Licensed Software for any purpose that is not -expressly granted in this Section 4. Licensee may not alter or remove -any details of ownership, copyright, trademark or other property right -connected with the Licensed Software. Licensee may not distribute any -software statically or dynamically linked with the Licensed Software. - -4.3 No Technical Support - -Nokia has no obligation to furnish Licensee with any technical support -whatsoever. Any such support is subject to separate agreement between -the Parties. - - -5. PRE-RELEASE CODE - -The Licensed Software contains pre-release code that is not at the level -of performance and compatibility of a final, generally available, -product offering. The Licensed Software may not operate correctly and -may be substantially modified prior to the first commercial product -release, if any. Nokia is not obligated to make this or any later -version of the Licensed Software commercially available. The License -Software is "Not for Commercial Use" and may only be used for the -purposes described in Section 4. The Licensed Software may not be used -in a live operating environment where it may be relied upon to perform -in the same manner as a commercially released product or with data that -has not been sufficiently backed up. - -6. THIRD PARTY SOFTWARE - -The Licensed Software may provide links to third party libraries or code -(collectively "Third Party Software") to implement various functions. -Third Party Software does not comprise part of the Licensed Software. In -some cases, access to Third Party Software may be included along with -the Licensed Software delivery as a convenience for development and -testing only. Such source code and libraries may be listed in the -".../src/3rdparty" source tree delivered with the Licensed Software or -documented in the Licensed Software where the Third Party Software is -used, as may be amended from time to time, do not comprise the Licensed -Software. Licensee acknowledges (1) that some part of Third Party -Software may require additional licensing of copyright and patents from -the owners of such, and (2) that distribution of any of the Licensed -Software referencing any portion of a Third Party Software may require -appropriate licensing from such third parties. - - -7. LIMITED WARRANTY AND WARRANTY DISCLAIMER - -The Licensed Software is licensed to Licensee "as is". To the maximum -extent permitted by applicable law, Nokia on behalf of itself and its -suppliers, disclaims all warranties and conditions, either express or -implied, including, but not limited to, implied warranties of -merchantability, fitness for a particular purpose, title and -non-infringement with regard to the Licensed Software. - - -8. LIMITATION OF LIABILITY - -If, Nokia's warranty disclaimer notwithstanding, Nokia is held liable to -Licensee, whether in contract, tort or any other legal theory, based on -the Licensed Software, Nokia's entire liability to Licensee and -Licensee's exclusive remedy shall be, at Nokia's option, either (A) -return of the price Licensee paid for the Licensed Software, or (B) -repair or replacement of the Licensed Software, provided Licensee -returns to Nokia all copies of the Licensed Software as originally -delivered to Licensee. Nokia shall not under any circumstances be liable -to Licensee based on failure of the Licensed Software if the failure -resulted from accident, abuse or misapplication, nor shall Nokia under -any circumstances be liable for special damages, punitive or exemplary -damages, damages for loss of profits or interruption of business or for -loss or corruption of data. Any award of damages from Nokia to Licensee -shall not exceed the total amount Licensee has paid to Nokia in -connection with this Agreement. - - -9. CONFIDENTIALITY - -Each party acknowledges that during the Term of this Agreement it shall -have access to information about the other party's business, business -methods, business plans, customers, business relations, technology, and -other information, including the terms of this Agreement, that is -confidential and of great value to the other party, and the value of -which would be significantly reduced if disclosed to third parties (the -"Confidential Information"). Accordingly, when a party (the "Receiving -Party") receives Confidential Information from another party (the -"Disclosing Party"), the Receiving Party shall, and shall obligate its -employees and agents and employees and agents of its Affiliates to: (i) -maintain the Confidential Information in strict confidence; (ii) not -disclose the Confidential Information to a third party without the -Disclosing Party's prior written approval; and (iii) not, directly or -indirectly, use the Confidential Information for any purpose other than -for exercising its rights and fulfilling its responsibilities pursuant -to this Agreement. Each party shall take reasonable measures to protect -the Confidential Information of the other party, which measures shall -not be less than the measures taken by such party to protect its own -confidential and proprietary information. - -"Confidential Information" shall not include information that (a) is or -becomes generally known to the public through no act or omission of the -Receiving Party; (b) was in the Receiving Party's lawful possession -prior to the disclosure hereunder and was not subject to limitations on -disclosure or use; (c) is developed by the Receiving Party without -access to the Confidential Information of the Disclosing Party or by -persons who have not had access to the Confidential Information of the -Disclosing Party as proven by the written records of the Receiving -Party; (d) is lawfully disclosed to the Receiving Party without -restrictions, by a third party not under an obligation of -confidentiality; or (e) the Receiving Party is legally compelled to -disclose the information, in which case the Receiving Party shall assert -the privileged and confidential nature of the information and cooperate -fully with the Disclosing Party to protect against and prevent -disclosure of any Confidential Information and to limit the scope of -disclosure and the dissemination of disclosed Confidential Information -by all legally available means. - -The obligations of the Receiving Party under this Section shall continue -during the Initial Term and for a period of five (5) years after -expiration or termination of this Agreement. To the extent that the -terms of the Non-Disclosure Agreement between Nokia and Licensee -conflict with the terms of this Section 9, this Section 9 shall be -controlling over the terms of the Non-Disclosure Agreement. - - -10. GENERAL PROVISIONS - -10.1 No Assignment - -Licensee shall not be entitled to assign or transfer all or any of its -rights, benefits and obligations under this Agreement without the prior -written consent of Nokia, which shall not be unreasonably withheld. - -10.2 Termination - -Nokia may terminate the Agreement at any time immediately upon written -notice by Nokia to Licensee if Licensee breaches this Agreement. - -Upon termination of this Agreement, Licensee shall return to Nokia all -copies of Licensed Software that were supplied by Nokia. All other -copies of Licensed Software in the possession or control of Licensee -must be erased or destroyed. An officer of Licensee must promptly -deliver to Nokia a written confirmation that this has occurred. - -10.3 Surviving Sections - -Any terms and conditions that by their nature or otherwise reasonably -should survive a cancellation or termination of this Agreement shall -also be deemed to survive. Such terms and conditions include, but are -not limited to the following Sections: 2, 5, 6, 7, 8, 9, 10.2, 10.3, 10.4, -10.5, 10.6, 10.7, and 10.8 of this Agreement. - -10.4 Entire Agreement - -This Agreement constitutes the complete agreement between the parties -and supersedes all prior or contemporaneous discussions, -representations, and proposals, written or oral, with respect to the -subject matters discussed herein, with the exception of the -non-disclosure agreement executed by the parties in connection with this -Agreement ("Non-Disclosure Agreement"), if any, shall be subject to -Section 9. No modification of this Agreement shall be effective unless -contained in a writing executed by an authorized representative of each -party. No term or condition contained in Licensee's purchase order shall -apply unless expressly accepted by Nokia in writing. If any provision of -the Agreement is found void or unenforceable, the remainder shall remain -valid and enforceable according to its terms. If any remedy provided is -determined to have failed for its essential purpose, all limitations of -liability and exclusions of damages set forth in this Agreement shall -remain in effect. - -10.5 Export Control - -Licensee acknowledges that the Licensed Software may be subject to -export control restrictions of various countries. Licensee shall fully -comply with all applicable export license restrictions and requirements -as well as with all laws and regulations relating to the importation of -the Licensed Software and shall procure all necessary governmental -authorizations, including without limitation, all necessary licenses, -approvals, permissions or consents, where necessary for the -re-exportation of the Licensed Software., - -10.6 Governing Law and Legal Venue - -This Agreement shall be construed and interpreted in accordance with the -laws of Finland, excluding its choice of law provisions. Any disputes -arising out of or relating to this Agreement shall be resolved in -arbitration under the Rules of Arbitration of the Chamber of Commerce of -Helsinki, Finland. The arbitration tribunal shall consist of one (1), or -if either Party so requires, of three (3), arbitrators. The award shall -be final and binding and enforceable in any court of competent -jurisdiction. The arbitration shall be held in Helsinki, Finland and the -process shall be conducted in the English language. - -10.7 No Implied License - -There are no implied licenses or other implied rights granted under this -Agreement, and all rights, save for those expressly granted hereunder, -shall remain with Nokia and its licensors. In addition, no licenses or -immunities are granted to the combination of the Licensed Software with -any other software or hardware not delivered by Nokia under this -Agreement. - -10.8 Government End Users - -A "U.S. Government End User" shall mean any agency or entity of the -government of the United States. The following shall apply if Licensee -is a U.S. Government End User. The Licensed Software is a "commercial -item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), -consisting of "commercial computer software" and "commercial computer -software documentation," as such terms are used in 48 C.F.R. 12.212 -(Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 -through 227.7202-4 (June 1995), all U.S. Government End Users acquire -the Licensed Software with only those rights set forth herein. The -Licensed Software (including related documentation) is provided to U.S. -Government End Users: (a) only as a commercial end item; and (b) only -pursuant to this Agreement. - -
-
- The MIT License - -The MIT License - -Copyright (c) <year> <copyright holders> - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -
-
- zlib License - - Copyright (C) 1995-2004 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly jloup@gzip.org - Mark Adler madler@alumni.caltech.edu - -
-
- The Mozilla Public License Version 1.1 - - MOZILLA PUBLIC LICENSE - Version 1.1 - - --------------- - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the - Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to - the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Code, prior Modifications used by a Contributor, and the Modifications - made by that particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the - combination of the Original Code and Modifications, in each case - including portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally - accepted in the software development community for the electronic - transfer of data. - - 1.5. "Executable" means Covered Code in any form other than Source - Code. - - 1.6. "Initial Developer" means the individual or entity identified - as the Initial Developer in the Source Code notice required by Exhibit - A. - - 1.7. "Larger Work" means a work which combines Covered Code or - portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the - substance or structure of either the Original Code or any previous - Modifications. When Covered Code is released as a series of files, a - Modification is: - A. Any addition to or deletion from the contents of a file - containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or - previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code - which is described in the Source Code notice required by Exhibit A as - Original Code, and which, at the time of its release under this - License is not already Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for - making modifications to it, including all modules it contains, plus - any associated interface definition files, scripts used to control - compilation and installation of an Executable, or source code - differential comparisons against either the Original Code or another - well known, available Covered Code of the Contributor's choice. The - Source Code can be in a compressed or archival form, provided the - appropriate decompression or de-archiving software is widely available - for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, this - License or a future version of this License issued under Section 6.1. - For legal entities, "You" includes any entity which controls, is - controlled by, or is under common control with You. For purposes of - this definition, "control" means (a) the power, direct or indirect, - to cause the direction or management of such entity, whether by - contract or otherwise, or (b) ownership of more than fifty percent - (50%) of the outstanding shares or beneficial ownership of such - entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, - non-exclusive license, subject to third party intellectual property - claims: - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Code (or portions thereof) with or without Modifications, and/or - as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or - selling of Original Code, to make, have made, use, practice, - sell, and offer for sale, and/or otherwise dispose of the - Original Code (or portions thereof). - - (c) the licenses granted in this Section 2.1(a) and (b) are - effective on the date Initial Developer first distributes - Original Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: 1) for code that You delete from the Original Code; 2) - separate from the Original Code; or 3) for infringements caused - by: i) the modification of the Original Code or ii) the - combination of the Original Code with other software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor - hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor, to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof) either on an - unmodified basis, with other Modifications, as Covered Code - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or - selling of Modifications made by that Contributor either alone - and/or in combination with its Contributor Version (or portions - of such combination), to make, use, sell, offer for sale, have - made, and/or otherwise dispose of: 1) Modifications made by that - Contributor (or portions thereof); and 2) the combination of - Modifications made by that Contributor with its Contributor - Version (or portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are - effective on the date Contributor first makes Commercial Use of - the Covered Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: 1) for any code that Contributor has deleted from the - Contributor Version; 2) separate from the Contributor Version; - 3) for infringements caused by: i) third party modifications of - Contributor Version or ii) the combination of Modifications made - by that Contributor with other software (except as part of the - Contributor Version) or other devices; or 4) under Patent Claims - infringed by Covered Code in the absence of Modifications made by - that Contributor. - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are - governed by the terms of this License, including without limitation - Section 2.2. The Source Code version of Covered Code may be - distributed only under the terms of this License or a future version - of this License released under Section 6.1, and You must include a - copy of this License with every copy of the Source Code You - distribute. You may not offer or impose any terms on any Source Code - version that alters or restricts the applicable version of this - License or the recipients' rights hereunder. However, You may include - an additional document offering the additional rights described in - Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be - made available in Source Code form under the terms of this License - either on the same media as an Executable version or via an accepted - Electronic Distribution Mechanism to anyone to whom you made an - Executable version available; and if made available via Electronic - Distribution Mechanism, must remain available for at least twelve (12) - months after the date it initially became available, or at least six - (6) months after a subsequent version of that particular Modification - has been made available to such recipients. You are responsible for - ensuring that the Source Code version remains available even if the - Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a - file documenting the changes You made to create that Covered Code and - the date of any change. You must include a prominent statement that - the Modification is derived, directly or indirectly, from Original - Code provided by the Initial Developer and including the name of the - Initial Developer in (a) the Source Code, and (b) in any notice in an - Executable version or related documentation in which You describe the - origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's - intellectual property rights is required to exercise the rights - granted by such Contributor under Sections 2.1 or 2.2, - Contributor must include a text file with the Source Code - distribution titled "LEGAL" which describes the claim and the - party making the claim in sufficient detail that a recipient will - know whom to contact. If Contributor obtains such knowledge after - the Modification is made available as described in Section 3.2, - Contributor shall promptly modify the LEGAL file in all copies - Contributor makes available thereafter and shall take other steps - (such as notifying appropriate mailing lists or newsgroups) - reasonably calculated to inform those who received the Covered - Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming - interface and Contributor has knowledge of patent licenses which - are reasonably necessary to implement that API, Contributor must - also include this information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to - Section 3.4(a) above, Contributor believes that Contributor's - Modifications are Contributor's original creation(s) and/or - Contributor has sufficient rights to grant the rights conveyed by - this License. - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source - Code. If it is not possible to put such notice in a particular Source - Code file due to its structure, then You must include such notice in a - location (such as a relevant directory) where a user would be likely - to look for such a notice. If You created one or more Modification(s) - You may add your name as a Contributor to the notice described in - Exhibit A. You must also duplicate this License in any documentation - for the Source Code where You describe recipients' rights or ownership - rights relating to Covered Code. You may choose to offer, and to - charge a fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Code. However, You - may do so only on Your own behalf, and not on behalf of the Initial - Developer or any Contributor. You must make it absolutely clear than - any such warranty, support, indemnity or liability obligation is - offered by You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred by the - Initial Developer or such Contributor as a result of warranty, - support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the - requirements of Section 3.1-3.5 have been met for that Covered Code, - and if You include a notice stating that the Source Code version of - the Covered Code is available under the terms of this License, - including a description of how and where You have fulfilled the - obligations of Section 3.2. The notice must be conspicuously included - in any notice in an Executable version, related documentation or - collateral in which You describe recipients' rights relating to the - Covered Code. You may distribute the Executable version of Covered - Code or ownership rights under a license of Your choice, which may - contain terms different from this License, provided that You are in - compliance with the terms of this License and that the license for the - Executable version does not attempt to limit or alter the recipient's - rights in the Source Code version from the rights set forth in this - License. If You distribute the Executable version under a different - license You must make it absolutely clear that any terms which differ - from this License are offered by You alone, not by the Initial - Developer or any Contributor. You hereby agree to indemnify the - Initial Developer and every Contributor for any liability incurred by - the Initial Developer or such Contributor as a result of any such - terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code - not governed by the terms of this License and distribute the Larger - Work as a single product. In such a case, You must make sure the - requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Code due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description - must be included in the LEGAL file described in Section 3.4 and must - be included with all distributions of the Source Code. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has - attached the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised - and/or new versions of the License from time to time. Each version - will be given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the - License, You may always continue to use it under the terms of that - version. You may also choose to use such Covered Code under the terms - of any subsequent version of the License published by Netscape. No one - other than Netscape has the right to modify the terms applicable to - Covered Code created under this License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may - only do in order to apply it to code which is not already Covered Code - governed by this License), You must (a) rename Your license so that - the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", - "MPL", "NPL" or any confusingly similar phrase do not appear in your - license (except to note that your license differs from this License) - and (b) otherwise make it clear that Your version of the license - contains terms which differ from the Mozilla Public License and - Netscape Public License. (Filling in the name of the Initial - Developer, Original Code or Contributor in the notice described in - Exhibit A shall not of themselves be deemed to be modifications of - this License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF - DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. - THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE - IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, - YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE - COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER - OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to cure - such breach within 30 days of becoming aware of the breach. All - sublicenses to the Covered Code which are properly granted shall - survive any termination of this License. Provisions which, by their - nature, must remain in effect beyond the termination of this License - shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement - claim (excluding declatory judgment actions) against Initial Developer - or a Contributor (the Initial Developer or Contributor against whom - You file such action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly - infringes any patent, then any and all rights granted by such - Participant to You under Sections 2.1 and/or 2.2 of this License - shall, upon 60 days notice from Participant terminate prospectively, - unless if within 60 days after receipt of notice You either: (i) - agree in writing to pay Participant a mutually agreeable reasonable - royalty for Your past and future use of Modifications made by such - Participant, or (ii) withdraw Your litigation claim with respect to - the Contributor Version against such Participant. If within 60 days - of notice, a reasonable royalty and payment arrangement are not - mutually agreed upon in writing by the parties or the litigation claim - is not withdrawn, the rights granted by Participant to You under - Sections 2.1 and/or 2.2 automatically terminate at the expiration of - the 60 day notice period specified above. - - (b) any software, hardware, or device, other than such Participant's - Contributor Version, directly or indirectly infringes any patent, then - any rights granted to You by such Participant under Sections 2.1(b) - and 2.2(b) are revoked effective as of the date You first made, used, - sold, distributed, or had made, Modifications made by that - Participant. - - 8.3. If You assert a patent infringement claim against Participant - alleging that such Participant's Contributor Version directly or - indirectly infringes any patent where such claim is resolved (such as - by license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, - all end user license agreements (excluding distributors and resellers) - which have been validly granted by You or any distributor hereunder - prior to termination shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL - DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, - OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR - ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY - CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, - WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY - RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW - PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE - EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO - THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in - 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" and "commercial computer software documentation," as such - terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 - C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), - all U.S. Government End Users acquire Covered Code with only those - rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - California law provisions (except to the extent applicable law, if - any, provides otherwise), excluding its conflict-of-law provisions. - With respect to disputes in which at least one party is a citizen of, - or an entity chartered or registered to do business in the United - States of America, any litigation relating to this License shall be - subject to the jurisdiction of the Federal Courts of the Northern - District of California, with venue lying in Santa Clara County, - California, with the losing party responsible for costs, including - without limitation, court costs and reasonable attorneys' fees and - expenses. The application of the United Nations Convention on - Contracts for the International Sale of Goods is expressly excluded. - Any law or regulation which provides that the language of a contract - shall be construed against the drafter shall not apply to this - License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as - "Multiple-Licensed". "Multiple-Licensed" means that the Initial - Developer permits you to utilize portions of the Covered Code under - Your choice of the NPL or the alternative licenses, if any, specified - by the Initial Developer in the file described in Exhibit A. - -EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. - Portions created by ______________________ are Copyright (C) ______ - _______________________. All Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms - of the _____ license (the "[___] License"), in which case the - provisions of [______] License are applicable instead of those - above. If you wish to allow use of your version of this file only - under the terms of the [____] License and not to allow others to use - your version of this file under the MPL, indicate your decision by - deleting the provisions above and replace them with the notice and - other provisions required by the [___] License. If you do not delete - the provisions above, a recipient may use your version of this file - under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of - the notices in the Source Code files of the Original Code. You should - use the text of this Exhibit A rather than the text found in the - Original Code Source Code for Your Modifications.] - -
-
- OpenSSL License - - LICENSE ISSUES - ============== - - The OpenSSL toolkit stays under a dual license, i.e. both the conditions of - the OpenSSL License and the original SSLeay license apply to the toolkit. - See below for the actual license texts. Actually both licenses are BSD-style - Open Source licenses. In case of any license issues related to OpenSSL - please contact openssl-core@openssl.org. - - OpenSSL License - --------------- - -/* ==================================================================== - * Copyright (c) 1998-2008 The OpenSSL Project. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit. (http://www.openssl.org/)" - * - * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * openssl-core@openssl.org. - * - * 5. Products derived from this software may not be called "OpenSSL" - * nor may "OpenSSL" appear in their names without prior written - * permission of the OpenSSL Project. - * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: - * "This product includes software developed by the OpenSSL Project - * for use in the OpenSSL Toolkit (http://www.openssl.org/)" - * - * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * ==================================================================== - * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * - */ - - Original SSLeay License - ----------------------- - -/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -
-
- Boost Software License Version 1.0 - -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. - -
-
- The Independent JPEG Group's JPEG software - -The Independent JPEG Group's JPEG software -========================================== - -README for release 6b of 27-Mar-1998 -==================================== - -This distribution contains the sixth public release of the Independent JPEG -Group's free JPEG software. You are welcome to redistribute this software and -to use it for any purpose, subject to the conditions under LEGAL ISSUES, below. - -Serious users of this software (particularly those incorporating it into -larger programs) should contact IJG at jpeg-info@uunet.uu.net to be added to -our electronic mailing list. Mailing list members are notified of updates -and have a chance to participate in technical discussions, etc. - -This software is the work of Tom Lane, Philip Gladstone, Jim Boucher, -Lee Crocker, Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, -Guido Vollbeding, Ge' Weijers, and other members of the Independent JPEG -Group. - -IJG is not affiliated with the official ISO JPEG standards committee. - - -DOCUMENTATION ROADMAP -===================== - -This file contains the following sections: - -OVERVIEW General description of JPEG and the IJG software. -LEGAL ISSUES Copyright, lack of warranty, terms of distribution. -REFERENCES Where to learn more about JPEG. -ARCHIVE LOCATIONS Where to find newer versions of this software. -RELATED SOFTWARE Other stuff you should get. -FILE FORMAT WARS Software *not* to get. -TO DO Plans for future IJG releases. - -Other documentation files in the distribution are: - -User documentation: - install.doc How to configure and install the IJG software. - usage.doc Usage instructions for cjpeg, djpeg, jpegtran, - rdjpgcom, and wrjpgcom. - *.1 Unix-style man pages for programs (same info as usage.doc). - wizard.doc Advanced usage instructions for JPEG wizards only. - change.log Version-to-version change highlights. -Programmer and internal documentation: - libjpeg.doc How to use the JPEG library in your own programs. - example.c Sample code for calling the JPEG library. - structure.doc Overview of the JPEG library's internal structure. - filelist.doc Road map of IJG files. - coderules.doc Coding style rules --- please read if you contribute code. - -Please read at least the files install.doc and usage.doc. Useful information -can also be found in the JPEG FAQ (Frequently Asked Questions) article. See -ARCHIVE LOCATIONS below to find out where to obtain the FAQ article. - -If you want to understand how the JPEG code works, we suggest reading one or -more of the REFERENCES, then looking at the documentation files (in roughly -the order listed) before diving into the code. - - -OVERVIEW -======== - -This package contains C software to implement JPEG image compression and -decompression. JPEG (pronounced "jay-peg") is a standardized compression -method for full-color and gray-scale images. JPEG is intended for compressing -"real-world" scenes; line drawings, cartoons and other non-realistic images -are not its strong suit. JPEG is lossy, meaning that the output image is not -exactly identical to the input image. Hence you must not use JPEG if you -have to have identical output bits. However, on typical photographic images, -very good compression levels can be obtained with no visible change, and -remarkably high compression levels are possible if you can tolerate a -low-quality image. For more details, see the references, or just experiment -with various compression settings. - -This software implements JPEG baseline, extended-sequential, and progressive -compression processes. Provision is made for supporting all variants of these -processes, although some uncommon parameter settings aren't implemented yet. -For legal reasons, we are not distributing code for the arithmetic-coding -variants of JPEG; see LEGAL ISSUES. We have made no provision for supporting -the hierarchical or lossless processes defined in the standard. - -We provide a set of library routines for reading and writing JPEG image files, -plus two sample applications "cjpeg" and "djpeg", which use the library to -perform conversion between JPEG and some other popular image file formats. -The library is intended to be reused in other applications. - -In order to support file conversion and viewing software, we have included -considerable functionality beyond the bare JPEG coding/decoding capability; -for example, the color quantization modules are not strictly part of JPEG -decoding, but they are essential for output to colormapped file formats or -colormapped displays. These extra functions can be compiled out of the -library if not required for a particular application. We have also included -"jpegtran", a utility for lossless transcoding between different JPEG -processes, and "rdjpgcom" and "wrjpgcom", two simple applications for -inserting and extracting textual comments in JFIF files. - -The emphasis in designing this software has been on achieving portability and -flexibility, while also making it fast enough to be useful. In particular, -the software is not intended to be read as a tutorial on JPEG. (See the -REFERENCES section for introductory material.) Rather, it is intended to -be reliable, portable, industrial-strength code. We do not claim to have -achieved that goal in every aspect of the software, but we strive for it. - -We welcome the use of this software as a component of commercial products. -No royalty is required, but we do ask for an acknowledgement in product -documentation, as described under LEGAL ISSUES. - - -LEGAL ISSUES -============ - -In plain English: - -1. We don't promise that this software works. (But if you find any bugs, - please let us know!) -2. You can use this software for whatever you want. You don't have to pay us. -3. You may not pretend that you wrote this software. If you use it in a - program, you must acknowledge somewhere in your documentation that - you've used the IJG code. - -In legalese: - -The authors make NO WARRANTY or representation, either express or implied, -with respect to this software, its quality, accuracy, merchantability, or -fitness for a particular purpose. This software is provided "AS IS", and you, -its user, assume the entire risk as to its quality and accuracy. - -This software is copyright (C) 1991-1998, Thomas G. Lane. -All Rights Reserved except as specified below. - -Permission is hereby granted to use, copy, modify, and distribute this -software (or portions thereof) for any purpose, without fee, subject to these -conditions: -(1) If any part of the source code for this software is distributed, then this -README file must be included, with this copyright and no-warranty notice -unaltered; and any additions, deletions, or changes to the original files -must be clearly indicated in accompanying documentation. -(2) If only executable code is distributed, then the accompanying -documentation must state that "this software is based in part on the work of -the Independent JPEG Group". -(3) Permission for use of this software is granted only if the user accepts -full responsibility for any undesirable consequences; the authors accept -NO LIABILITY for damages of any kind. - -These conditions apply to any software derived from or based on the IJG code, -not just to the unmodified library. If you use our work, you ought to -acknowledge us. - -Permission is NOT granted for the use of any IJG author's name or company name -in advertising or publicity relating to this software or products derived from -it. This software may be referred to only as "the Independent JPEG Group's -software". - -We specifically permit and encourage the use of this software as the basis of -commercial products, provided that all warranty or liability claims are -assumed by the product vendor. - - -ansi2knr.c is included in this distribution by permission of L. Peter Deutsch, -sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA. -ansi2knr.c is NOT covered by the above copyright and conditions, but instead -by the usual distribution terms of the Free Software Foundation; principally, -that you must include source code if you redistribute it. (See the file -ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part -of any program generated from the IJG code, this does not limit you more than -the foregoing paragraphs do. - -The Unix configuration script "configure" was produced with GNU Autoconf. -It is copyright by the Free Software Foundation but is freely distributable. -The same holds for its supporting scripts (config.guess, config.sub, -ltconfig, ltmain.sh). Another support script, install-sh, is copyright -by M.I.T. but is also freely distributable. - -It appears that the arithmetic coding option of the JPEG spec is covered by -patents owned by IBM, AT&T, and Mitsubishi. Hence arithmetic coding cannot -legally be used without obtaining one or more licenses. For this reason, -support for arithmetic coding has been removed from the free JPEG software. -(Since arithmetic coding provides only a marginal gain over the unpatented -Huffman mode, it is unlikely that very many implementations will support it.) -So far as we are aware, there are no patent restrictions on the remaining -code. - -The IJG distribution formerly included code to read and write GIF files. -To avoid entanglement with the Unisys LZW patent, GIF reading support has -been removed altogether, and the GIF writer has been simplified to produce -"uncompressed GIFs". This technique does not use the LZW algorithm; the -resulting GIF files are larger than usual, but are readable by all standard -GIF decoders. - -We are required to state that - "The Graphics Interchange Format(c) is the Copyright property of - CompuServe Incorporated. GIF(sm) is a Service Mark property of - CompuServe Incorporated." - - -REFERENCES -========== - -We highly recommend reading one or more of these references before trying to -understand the innards of the JPEG software. - -The best short technical introduction to the JPEG compression algorithm is - Wallace, Gregory K. "The JPEG Still Picture Compression Standard", - Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. -(Adjacent articles in that issue discuss MPEG motion picture compression, -applications of JPEG, and related topics.) If you don't have the CACM issue -handy, a PostScript file containing a revised version of Wallace's article is -available at ftp://ftp.uu.net/graphics/jpeg/wallace.ps.gz. The file (actually -a preprint for an article that appeared in IEEE Trans. Consumer Electronics) -omits the sample images that appeared in CACM, but it includes corrections -and some added material. Note: the Wallace article is copyright ACM and IEEE, -and it may not be used for commercial purposes. - -A somewhat less technical, more leisurely introduction to JPEG can be found in -"The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by -M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1. This book provides -good explanations and example C code for a multitude of compression methods -including JPEG. It is an excellent source if you are comfortable reading C -code but don't know much about data compression in general. The book's JPEG -sample code is far from industrial-strength, but when you are ready to look -at a full implementation, you've got one here... - -The best full description of JPEG is the textbook "JPEG Still Image Data -Compression Standard" by William B. Pennebaker and Joan L. Mitchell, published -by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1. Price US$59.95, 638 pp. -The book includes the complete text of the ISO JPEG standards (DIS 10918-1 -and draft DIS 10918-2). This is by far the most complete exposition of JPEG -in existence, and we highly recommend it. - -The JPEG standard itself is not available electronically; you must order a -paper copy through ISO or ITU. (Unless you feel a need to own a certified -official copy, we recommend buying the Pennebaker and Mitchell book instead; -it's much cheaper and includes a great deal of useful explanatory material.) -In the USA, copies of the standard may be ordered from ANSI Sales at (212) -642-4900, or from Global Engineering Documents at (800) 854-7179. (ANSI -doesn't take credit card orders, but Global does.) It's not cheap: as of -1992, ANSI was charging $95 for Part 1 and $47 for Part 2, plus 7% -shipping/handling. The standard is divided into two parts, Part 1 being the -actual specification, while Part 2 covers compliance testing methods. Part 1 -is titled "Digital Compression and Coding of Continuous-tone Still Images, -Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS -10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of -Continuous-tone Still Images, Part 2: Compliance testing" and has document -numbers ISO/IEC IS 10918-2, ITU-T T.83. - -Some extensions to the original JPEG standard are defined in JPEG Part 3, -a newer ISO standard numbered ISO/IEC IS 10918-3 and ITU-T T.84. IJG -currently does not support any Part 3 extensions. - -The JPEG standard does not specify all details of an interchangeable file -format. For the omitted details we follow the "JFIF" conventions, revision -1.02. A copy of the JFIF spec is available from: - Literature Department - C-Cube Microsystems, Inc. - 1778 McCarthy Blvd. - Milpitas, CA 95035 - phone (408) 944-6300, fax (408) 944-6314 -A PostScript version of this document is available by FTP at -ftp://ftp.uu.net/graphics/jpeg/jfif.ps.gz. There is also a plain text -version at ftp://ftp.uu.net/graphics/jpeg/jfif.txt.gz, but it is missing -the figures. - -The TIFF 6.0 file format specification can be obtained by FTP from -ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme -found in the TIFF 6.0 spec of 3-June-92 has a number of serious problems. -IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6). -Instead, we recommend the JPEG design proposed by TIFF Technical Note #2 -(Compression tag 7). Copies of this Note can be obtained from ftp.sgi.com or -from ftp://ftp.uu.net/graphics/jpeg/. It is expected that the next revision -of the TIFF spec will replace the 6.0 JPEG design with the Note's design. -Although IJG's own code does not support TIFF/JPEG, the free libtiff library -uses our library to implement TIFF/JPEG per the Note. libtiff is available -from ftp://ftp.sgi.com/graphics/tiff/. - - -ARCHIVE LOCATIONS -================= - -The "official" archive site for this software is ftp.uu.net (Internet -address 192.48.96.9). The most recent released version can always be found -there in directory graphics/jpeg. This particular version will be archived -as ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz. If you don't have -direct Internet access, UUNET's archives are also available via UUCP; contact -help@uunet.uu.net for information on retrieving files that way. - -Numerous Internet sites maintain copies of the UUNET files. However, only -ftp.uu.net is guaranteed to have the latest official version. - -You can also obtain this software in DOS-compatible "zip" archive format from -the SimTel archives (ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/), or -on CompuServe in the Graphics Support forum (GO CIS:GRAPHSUP), library 12 -"JPEG Tools". Again, these versions may sometimes lag behind the ftp.uu.net -release. - -The JPEG FAQ (Frequently Asked Questions) article is a useful source of -general information about JPEG. It is updated constantly and therefore is -not included in this distribution. The FAQ is posted every two weeks to -Usenet newsgroups comp.graphics.misc, news.answers, and other groups. -It is available on the World Wide Web at http://www.faqs.org/faqs/jpeg-faq/ -and other news.answers archive sites, including the official news.answers -archive at rtfm.mit.edu: ftp://rtfm.mit.edu/pub/usenet/news.answers/jpeg-faq/. -If you don't have Web or FTP access, send e-mail to mail-server@rtfm.mit.edu -with body - send usenet/news.answers/jpeg-faq/part1 - send usenet/news.answers/jpeg-faq/part2 - - -RELATED SOFTWARE -================ - -Numerous viewing and image manipulation programs now support JPEG. (Quite a -few of them use this library to do so.) The JPEG FAQ described above lists -some of the more popular free and shareware viewers, and tells where to -obtain them on Internet. - -If you are on a Unix machine, we highly recommend Jef Poskanzer's free -PBMPLUS software, which provides many useful operations on PPM-format image -files. In particular, it can convert PPM images to and from a wide range of -other formats, thus making cjpeg/djpeg considerably more useful. The latest -version is distributed by the NetPBM group, and is available from numerous -sites, notably ftp://wuarchive.wustl.edu/graphics/graphics/packages/NetPBM/. -Unfortunately PBMPLUS/NETPBM is not nearly as portable as the IJG software is; -you are likely to have difficulty making it work on any non-Unix machine. - -A different free JPEG implementation, written by the PVRG group at Stanford, -is available from ftp://havefun.stanford.edu/pub/jpeg/. This program -is designed for research and experimentation rather than production use; -it is slower, harder to use, and less portable than the IJG code, but it -is easier to read and modify. Also, the PVRG code supports lossless JPEG, -which we do not. (On the other hand, it doesn't do progressive JPEG.) - - -FILE FORMAT WARS -================ - -Some JPEG programs produce files that are not compatible with our library. -The root of the problem is that the ISO JPEG committee failed to specify a -concrete file format. Some vendors "filled in the blanks" on their own, -creating proprietary formats that no one else could read. (For example, none -of the early commercial JPEG implementations for the Macintosh were able to -exchange compressed files.) - -The file format we have adopted is called JFIF (see REFERENCES). This format -has been agreed to by a number of major commercial JPEG vendors, and it has -become the de facto standard. JFIF is a minimal or "low end" representation. -We recommend the use of TIFF/JPEG (TIFF revision 6.0 as modified by TIFF -Technical Note #2) for "high end" applications that need to record a lot of -additional data about an image. TIFF/JPEG is fairly new and not yet widely -supported, unfortunately. - -The upcoming JPEG Part 3 standard defines a file format called SPIFF. -SPIFF is interoperable with JFIF, in the sense that most JFIF decoders should -be able to read the most common variant of SPIFF. SPIFF has some technical -advantages over JFIF, but its major claim to fame is simply that it is an -official standard rather than an informal one. At this point it is unclear -whether SPIFF will supersede JFIF or whether JFIF will remain the de-facto -standard. IJG intends to support SPIFF once the standard is frozen, but we -have not decided whether it should become our default output format or not. -(In any case, our decoder will remain capable of reading JFIF indefinitely.) - -Various proprietary file formats incorporating JPEG compression also exist. -We have little or no sympathy for the existence of these formats. Indeed, -one of the original reasons for developing this free software was to help -force convergence on common, open format standards for JPEG files. Don't -use a proprietary file format! - - -TO DO -===== - -The major thrust for v7 will probably be improvement of visual quality. -The current method for scaling the quantization tables is known not to be -very good at low Q values. We also intend to investigate block boundary -smoothing, "poor man's variable quantization", and other means of improving -quality-vs-file-size performance without sacrificing compatibility. - -In future versions, we are considering supporting some of the upcoming JPEG -Part 3 extensions --- principally, variable quantization and the SPIFF file -format. - -As always, speeding things up is of great interest. - -Please send bug reports, offers of help, etc. to jpeg-info@uunet.uu.net - -
- -
diff --git a/kdepim/mobile/mail/AboutPage.qml b/kdepim/mobile/mail/AboutPage.qml deleted file mode 100644 index 4ffc80fb..00000000 --- a/kdepim/mobile/mail/AboutPage.qml +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2013 Michael Bohlender - * Copyright (C) 2010 Klarälvdalens Datakonsult AB, - * a KDAB Group company, info@kdab.net, - * author Stephen Kelly - * - * 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.plasma.components 0.1 as PlasmaComponets -import org.kde.plasma.extras 0.1 as PlasmaExtras - -PlasmaComponets.Page { - - implicitWidth: pageRow.width * 2 /3 - - tools: PlasmaComponets.ToolBarLayout { - PlasmaComponets.ToolButton { - anchors.left: parent.left - iconSource: "go-previous" - onClicked: pageRow.pop() - } - } - - PlasmaExtras.ScrollArea { - - anchors.fill: parent - - flickableItem: Flickable { - anchors.fill: parent - - contentHeight: 1000; - clip: true - - Column{ - id: _content - anchors.fill: parent - anchors.margins: 30 - PlasmaExtras.Title{ - id: caption - text: KDE.i18n( "About %1", application.name ) - wrapMode: Text.WordWrap - width: parent.width - } - PlasmaComponets.Label{ - id:version - text: "\n" + application.version + "\n" - wrapMode: Text.WordWrap - width: parent.width - } - - PlasmaExtras.Heading { - text: KDE.i18n("Contributors") - } - - PlasmaExtras.Paragraph { - text: KDE.i18n("Development team in alphabetical order:") + "\n\n" + - "\t" + KDE.i18n("Andras Mantia (KDAB)") + "\n" + - "\t" + KDE.i18n("Andre Heinecke (Intevation)") + "\n" + - "\t" + KDE.i18n("Andreas Holzammer (KDAB)") + "\n" + - "\t" + KDE.i18n("Bernhard Reiter, Intevation") + "\n" + - "\t" + KDE.i18n("Bertjan Broeksema (KDAB)") + "\n" + - "\t" + KDE.i18n("Björn Balazs (Apliki)") + "\n" + - "\t" + KDE.i18n("Björn Ricks (Intevation)") + "\n" + - "\t" + KDE.i18n("Casey Link (KDAB)") + "\n" + - "\t" + KDE.i18n("David Faure (KDAB)") + "\n" + - "\t" + KDE.i18n("Felix Wolfsteller (Intevation)") + "\n" + - "\t" + KDE.i18n("Kevin Krammer (KDAB)") + "\n" + - "\t" + KDE.i18n("Kevin Ottens (KDAB)") + "\n" + - "\t" + KDE.i18n("Laurent Montel (KDAB)") + "\n" + - "\t" + KDE.i18n("Leo Franchi (KDAB)") + "\n" + - "\t" + KDE.i18n("Ludwig Reiter (Intevation)") + "\n" + - "\t" + KDE.i18n("Marc Mutz (KDAB)") + "\n" + - "\t" + KDE.i18n("Marcus Brinkmann (g10 Code)") + "\n" + - "\t" + KDE.i18n("Michael Bohlender (KDE)") + "\n" + - "\t" + KDE.i18n("Nuno Pinheiro (KDAB)") + "\n" + - "\t" + KDE.i18n("Patrick Spendrin (KDAB)") + "\n" + - "\t" + KDE.i18n("Romain Pokrzywka (KDAB)") + "\n" + - "\t" + KDE.i18n("Sabine Faure (KDAB)") + "\n" + - "\t" + KDE.i18n("Sascha L. Teichmann (Intevation)") + "\n" + - "\t" + KDE.i18n("Sergio Martins (KDAB)") + "\n" + - "\t" + KDE.i18n("Stephen Kelly (KDAB)") + "\n" + - "\t" + KDE.i18n("Till Adam (KDAB)") + "\n" + - "\t" + KDE.i18n("Tobias Koenig (KDAB)") + "\n" + - "\t" + KDE.i18n("Volker Krause (KDAB)") + "\n" + - "\t" + KDE.i18n("Werner Koch (g10 Code)") + "\n" - wrapMode: Text.WordWrap - width: parent.width - } - - PlasmaExtras.Paragraph { - text : KDE.i18n("Kontact Touch is licensed under the GNU GPL version 2 or later and other Free Software licenses. " + - "See %1 for details.", "licenses.pdf") + "\n" - wrapMode: Text.WordWrap - width: parent.width - } - - PlasmaComponets.Button { - id: licenseButton - - text: i18n( "Show Licenses" ) - onClicked: application.openLicenses() - } - } - } - } -} diff --git a/kdepim/mobile/mail/AccountSettingsPage.qml b/kdepim/mobile/mail/AccountSettingsPage.qml deleted file mode 100644 index f500df61..00000000 --- a/kdepim/mobile/mail/AccountSettingsPage.qml +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2013 Michael Bohlender - * - * 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 . - */ - - -import QtQuick 1.1 -import org.kde.plasma.components 0.1 as PlasmaComponets -import org.kde.pim.mobileui 4.5 as KPIM - -PlasmaComponets.Page { - id: root - - implicitWidth: pageRow.width * 2 /3 - - //BEGIN: Tools - tools: PlasmaComponets.ToolBarLayout { - PlasmaComponets.ToolButton { - anchors.left: parent.left - iconSource: "go-previous" - onClicked: pageRow.pop() - } - } - //END: Tools - - - KPIM.AgentInstanceListContainer { - anchors.fill: parent - - actionItemHeight: root.height * 0.2 - - model: agentInstanceList - } -} \ No newline at end of file diff --git a/kdepim/mobile/mail/AccountsPage.qml b/kdepim/mobile/mail/AccountsPage.qml deleted file mode 100644 index b484fb77..00000000 --- a/kdepim/mobile/mail/AccountsPage.qml +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2013 Michael Bohlender - * - * 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 . - */ - -import QtQuick 1.1 -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.plasma.extras 0.1 as PlasmaExtras -import org.kde.pim.mobileui 4.5 as KPIM -import org.kde.qtextracomponents 0.1 as QtExtra - - -PlasmaComponents.Page { - id: root - - implicitWidth: pageRow.width * 2 /3 - - //BEGIN: Tools - tools: PlasmaComponents.ToolBarLayout { - - PlasmaComponents.ToolButton { - iconSource: "preferences-system" - - onClicked: pageRow.push(Qt.resolvedUrl("SettingsPage.qml")) - } - } - //END: Tools - - ListView { - id: listView - - anchors.fill: parent - - clip: true - - model: agentInstanceList - - //BEGIN: Delegate - delegate : PlasmaComponents.ListItem { - id: listItem - - height: root.height * 0.12 - - enabled: true - checked: listView.currentIndex == index - - //TODO create FoldersListPage.qml - onClicked: { - pageRow.pop(root) - pageRow.push(Qt.resolvedUrl("FolderPage.qml")) - } - - KPIM.AgentInstanceStatusIndicator { - id: iconItem - - anchors { - verticalCenter: parent.verticalCenter - left: parent.left - leftMargin: units.gridUnit - } - - online: model.online - status: model.status - } - - PlasmaExtras.Heading { - id: textItem - - anchors { - left: iconItem.right - leftMargin: units.gridUnit - verticalCenter: parent.verticalCenter - } - - level: 4 - text: model.display - } - - } - //END: Delegate - - //BEGIN: Footer - footer: PlasmaComponents.ListItem { - - height: root.height * 0.12 - - enabled: true - - onClicked: application.launchAccountWizard() - - //FIXME show a black plus button instead of the green one? - QtExtra.QIconItem { - id: iconItem - - anchors { - verticalCenter: parent.verticalCenter - left: parent.left - leftMargin: units.gridUnit - } - - height: parent.height * 0.6 - width: height - - icon: QIcon("list-add") - - } - - PlasmaExtras.Heading { - id: textItem - - anchors { - left: iconItem.right - leftMargin: units.gridUnit - verticalCenter: parent.verticalCenter - } - - text: i18n("Add Account") - level: 4 - } - } - //END: Footer - } -} \ No newline at end of file diff --git a/kdepim/mobile/mail/AclEditor.qml b/kdepim/mobile/mail/AclEditor.qml deleted file mode 100644 index b46bcfb9..00000000 --- a/kdepim/mobile/mail/AclEditor.qml +++ /dev/null @@ -1,105 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 - -QML.Rectangle { - anchors.fill: parent - z: 10 - - function load() { - aclEditor.load() - } - - QML.Text { - id: headLine - - anchors { - left: parent.left - top: parent.top - leftMargin: 30 - topMargin: 40 - } - - text: KDE.i18n( "Access Control List for '%1'", aclEditor.collectionName ) - } - - KPIM.ReorderListContainer { - id: aclView - - anchors { - left: parent.left - top: headLine.bottom - right: parent.right - bottom: okButton.top - leftMargin: 30 - topMargin: 10 - } - - model: aclModel - - onCurrentIndexChanged: aclEditor.setRowSelected( index ) - - KPIM.ActionButton { - icon: KDE.locate( "data", "mobileui/add-button.png" ) - actionName: "acleditor_add" - } - - KPIM.ActionButton { - icon: KDE.locate( "data", "mobileui/edit-button.png" ) - actionName: "acleditor_edit" - } - - KPIM.ActionButton { - icon: KDE.locate( "data", "mobileui/delete-button.png" ) - actionName: "acleditor_delete" - } - } - - KPIM.Button2 { - id: okButton - anchors { - left: parent.left - bottom: parent.bottom - leftMargin: 30 - } - width: 150 - buttonText: KDE.i18n( "Save" ) - onClicked: { - aclEditor.save(); - guiStateManager.popState(); - } - } - - KPIM.Button2 { - id: cancelButton - anchors { - left: okButton.right - bottom: parent.bottom - leftMargin: 10 - } - width: 150 - buttonText: KDE.i18n( "Cancel" ) - onClicked: guiStateManager.popState() - } -} diff --git a/kdepim/mobile/mail/AttachmentEditor.qml b/kdepim/mobile/mail/AttachmentEditor.qml deleted file mode 100644 index f0e6b59d..00000000 --- a/kdepim/mobile/mail/AttachmentEditor.qml +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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.pim.mobileui 4.5 as KPIM - -KPIM.ReorderListContainer { - width: 600 - model: attachmentModel - - onCurrentIndexChanged: attachmentEditor.setRowSelected( index ) - - delegate: Item { - id: wrapper - width: parent.width - height: 70 - clip: true - - Rectangle { - id: background - anchors.fill: parent - opacity: (wrapper.ListView.isCurrentItem ? 0.25 : 0) - color: "lightsteelblue" - } - - Text { - id: attachmentName - anchors.fill: parent; - text: model.attachmentName; - horizontalAlignment: "AlignLeft"; - verticalAlignment: "AlignTop"; - } - - Row { - id: cryptoIcons - anchors { - right: parent.right - bottom: parent.bottom - } - Image { - width: 22 - height: 22 - source: KDE.locate( "data", "libmessageviewer/pics/mobile_status_signed.png" ) - visible: model.attachmentIsSigned - } - - Image { - width: 22 - height: 22 - source: KDE.locate( "data", "libmessageviewer/pics/mobile_status_encrypted.png" ) - visible: model.attachmentIsEncrypted - } - } - - Text { - anchors { - left: parent.left - bottom: parent.bottom - } - text: model.attachmentSize - } - - MouseArea { - anchors.fill: parent - onClicked: wrapper.ListView.view.currentIndex = model.index - } - } - - KPIM.ActionButton { - icon: KDE.locate( "data", "kmail-mobile/add-attachment-button.png" ) - actionName: "attach" - } - - KPIM.ActionButton { - icon: KDE.locate( "data", "kmail-mobile/remove-attachment-button.png" ) - actionName: "remove" - } - - KPIM.ActionButton { - icon: KDE.locate( "data", "kmail-mobile/toggle-signature-button.png" ) - actionName: "toggle_attachment_signed" - } - - KPIM.ActionButton { - icon: KDE.locate( "data", "kmail-mobile/toggle-encryption-button.png" ) - actionName: "toggle_attachment_encrypted" - } -} diff --git a/kdepim/mobile/mail/CMakeLists.txt b/kdepim/mobile/mail/CMakeLists.txt deleted file mode 100644 index b1423a54..00000000 --- a/kdepim/mobile/mail/CMakeLists.txt +++ /dev/null @@ -1,140 +0,0 @@ -project(kmail-mobile) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}") - -add_subdirectory(docs) -add_subdirectory(tests) - -include_directories( - ${CMAKE_SOURCE_DIR}/libkleo/ - ${CMAKE_SOURCE_DIR}/libksieve/ - ${CMAKE_SOURCE_DIR}/libksieve/ksieveui/ - ${CMAKE_SOURCE_DIR}/kmail/ - ${CMAKE_BINARY_DIR}/kmail/kcm_kpimidentities/ - ${CMAKE_SOURCE_DIR}/kmail/kcm_kpimidentities/ - ${CMAKE_SOURCE_DIR}/templateparser - ${CMAKE_BINARY_DIR}/templateparser - ${CMAKE_SOURCE_DIR}/messagecore - ${CMAKE_SOURCE_DIR}/messagecomposer - ${CMAKE_BINARY_DIR}/messagecomposer - ${CMAKE_SOURCE_DIR}/messageviewer - ${CMAKE_BINARY_DIR}/messageviewer - ${CMAKE_SOURCE_DIR}/mailcommon - ${CMAKE_SOURCE_DIR}/pimcommon/ - ${CMAKE_SOURCE_DIR}/libkdepim/ - ${Boost_INCLUDE_DIR} -) - -set(kmail_mobile_srcs - acleditor.cpp - attachmenteditor.cpp - attachmentproxymodel.cpp - charsetselectiondialog.cpp - composerautoresizer.cpp - composerview.cpp - configwidget.cpp - cryptoformatselectiondialog.cpp - declarativeidentitycombobox.cpp - emailsexporthandler.cpp - emailsfilterproxymodel.cpp - emailsimporthandler.cpp - filtereditor.cpp - mailactionmanager.cpp - mailthreadgroupercomparator.cpp - mainview.cpp - main.cpp - messagelistproxy.cpp - messagelistsettings.cpp - messagelistsettingscontroller.cpp - messageviewitem.cpp - mobilekernel.cpp - savemailcommand.cpp - searchwidget.cpp - snippetseditor.cpp - templateemailmodel.cpp - vacationmanager.cpp -) - -qt4_wrap_ui(kmail_mobile_srcs configwidget.ui messagelistsettingseditor.ui searchwidget.ui) - -if(KDEPIM_ENTERPRISE_BUILD) - set(WARN_TOOMANY_RECIPIENTS_DEFAULT true) -else() - set(WARN_TOOMANY_RECIPIENTS_DEFAULT false) -endif() - -configure_file(settings.kcfg.cmake ${CMAKE_CURRENT_BINARY_DIR}/settings.kcfg) -kde4_add_kcfg_files(kmail_mobile_srcs settings.kcfgc) - -if(RUNTIME_PLUGINS_STATIC) - add_definitions(-DMAIL_SERIALIZER_PLUGIN_STATIC) -endif() - -kde4_add_app_icon(kmail_mobile_srcs "${CMAKE_CURRENT_SOURCE_DIR}/hi*-apps-kmail-mobile.png") - -kde4_add_executable(kmail-mobile ${kmail_mobile_srcs}) - -target_link_libraries(kmail-mobile - ${QT_QTDECLARATIVE_LIBRARY} - ${KDE4_KCMUTILS_LIBS} - ${KDEPIMLIBS_AKONADI_KMIME_LIBS} - ${KDEPIMLIBS_KMIME_LIBS} - ${KDEPIMLIBS_AKONADI_LIBS} - ${KDEPIMLIBS_MAILTRANSPORT_LIBS} - ${KDEPIMLIBS_KMBOX_LIBS} - akonadi-calendar - akonadi_next - kdepim - kdepimmobileui - kdepimmobileuicalendar - ksieveui - kleo - mailcommon - pimcommon - messagecomposer - messagecore - messageviewer - templateparser -) - -if(RUNTIME_PLUGINS_STATIC) - target_link_libraries(kmail-mobile - akonadi_serializer_mail - akonadi_serializer_addressee - akonadi_serializer_contactgroup - akonadi_serializer_kcalcore - ) -endif() - -install(TARGETS kmail-mobile ${INSTALL_TARGETS_DEFAULT_ARGS}) -install(PROGRAMS kmail-mobile.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) -install(FILES - AboutPage.qml - AccountSettingsPage.qml - AccountsPage.qml - AclEditor.qml - AttachmentEditor.qml - ConfigDialog.qml - FilterEditor.qml - FolderPage.qml - MailListPage.qml - MailViewPage.qml - EditorView.qml - FavoriteManagerPage.qml - kmail-composer.qml - kmail-mobile.qml - KMailComposerActions.qml - kmail-mobile.notifyrc - SettingsPage.qml - SnippetsEditor.qml - SnippetsList.qml - add-attachment-button.png - dummy-avatar.png - remove-attachment-button.png - toggle-signature-button.png - toggle-encryption-button.png - DESTINATION ${DATA_INSTALL_DIR}/kmail-mobile -) - -kde4_install_icons(${ICON_INSTALL_DIR}) - diff --git a/kdepim/mobile/mail/ConfigDialog.qml b/kdepim/mobile/mail/ConfigDialog.qml deleted file mode 100644 index ed91f760..00000000 --- a/kdepim/mobile/mail/ConfigDialog.qml +++ /dev/null @@ -1,84 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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.mail 4.5 as Mail -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; - - contentItem.children: [ - QML.Item { // dummy item to make the widget visible with the broken QML version on the N900 - anchors.fill: parent - Mail.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() - } -} diff --git a/kdepim/mobile/mail/EditorView.qml b/kdepim/mobile/mail/EditorView.qml deleted file mode 100644 index d6ef5f9e..00000000 --- a/kdepim/mobile/mail/EditorView.qml +++ /dev/null @@ -1,172 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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.pim.mobileui 4.5 as KPIM -import org.kde.kpimidentities 4.5 as KPIMIdentities -import org.kde.messagecomposer 4.5 as MessageComposer -import "../mobileui/ScreenFunctions.js" as Screen -import org.kde.plasma.components 0.1 as PlasmaComponents - -Item { - id: root - property int contentHeight: subjectInput.height + messageContent.height + bottomContainer.height + 20; - property int screenHeight: 480 - anchors.topMargin: 12 - anchors.leftMargin: 48 - anchors.rightMargin: 2 - - PlasmaComponents.Label { - id: subjectLabel - - anchors { - verticalCenter: subjectInput.verticalCenter - left: parent.left - } - - text: KDE.i18n( "Subject:" ) - } - - PlasmaComponents.TextField { - id: subjectInput - - anchors { - left: subjectLabel.right - top: parent.top - right: parent.right - } - - text: window.subject - clearButtonShown: true - } - - Binding { target: window; property: "subject"; value: subjectInput.text } - - Rectangle { - id: cryptoIndicator - visible: window.isSigned || window.isEncrypted - anchors.top: subjectInput.bottom - anchors.topMargin: 2 - anchors.left: parent.left - anchors.right: parent.right - height: (window.isSigned || window.isEncrypted) ? 20 : 0 - - Row { - anchors.fill: parent - spacing: 2 - - Rectangle { - id: signedIndicator - visible: window.isSigned - color: "#BAF9CE" - width: (window.isEncrypted ? parent.width / 2 : parent.width) - height: 20 - - Text { - anchors.fill: parent - text: KDE.i18n( "Message will be signed" ) - horizontalAlignment: Text.AlignHCenter - } - } - - Rectangle { - id: encryptedIndicator - visible: window.isEncrypted - color: "#0080FF" - width: (window.isSigned ? parent.width / 2 : parent.width) - height: 20 - - Text { - anchors.fill: parent - text: KDE.i18n( "Message will be encrypted" ) - horizontalAlignment: Text.AlignHCenter - } - } - } - } - - MessageComposer.Editor { - id: messageContent - availableScreenHeight: root.screenHeight - bottomContainer.height - subjectInput.height - cryptoIndicator.height - cryptoIndicator.anchors.topMargin - root.anchors.topMargin - 2 - anchors { - top: cryptoIndicator.bottom - left: parent.left - right: parent.right - topMargin: 2 - } - } - - Item { - id: bottomContainer; - height: Screen.fingerSize - anchors { - left: parent.left - right: parent.right - top: messageContent.bottom - } - - PlasmaComponents.Label { - id: identityLabel - anchors { - left: parent.left - bottom: parent.bottom - top: parent.top - } - text: KDE.i18n( "Identity:" ) - verticalAlignment: Text.AlignVCenter - } - - KPIMIdentities.IdentityComboBox { - id: identityCombo - anchors { - left: identityLabel.right - top: parent.top - bottom: parent.bottom - right: cancelButton.left - } - // HACK: the style sheet currently enforces a way to big minimum height on < 200 dpi - // not trivial to remove there unfortunately, so work around that in places where the layout - // is already DPI-aware - styleSheet: styleSheet + " QComboBox { min-height: 0px }" - } - - KPIM.Button2 { - id: cancelButton - anchors.bottom: parent.bottom - anchors.right: sendButton.left - width: height * 1.5 - height: identityCombo.height - icon: KDE.iconPath( "dialog-cancel", 64 ) - onClicked: window.close() - } - - KPIM.Button2 { - id: sendButton; - anchors.bottom: parent.bottom; - anchors.right: parent.right; - width: height * 1.5; - height: identityCombo.height - icon: KDE.iconPath( "mail-folder-outbox", 64 ); - color: window.tooManyRecipients ? "red" : "#00000000" - buttonText: window.recipientsCount == 0 ? "" : window.recipientsCount - onClicked: window.send(); - } - } - -} diff --git a/kdepim/mobile/mail/FavoriteManagerPage.qml b/kdepim/mobile/mail/FavoriteManagerPage.qml deleted file mode 100644 index 3db552a1..00000000 --- a/kdepim/mobile/mail/FavoriteManagerPage.qml +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2013 (C) Michael Bohlender - * - * 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 . - */ - -import QtQuick 1.1 -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.pim.mobileui 4.5 as KPIM - -PlasmaComponents.Page { - id: root - - implicitWidth: pageRow.width * 2 /3 - - //BEGIN: Tools - tools: PlasmaComponents.ToolBarLayout { - PlasmaComponents.ToolButton { - anchors.left: parent.left - iconSource: "go-previous" - onClicked: pageRow.pop() - } - } - //END: Tools - - KPIM.ReorderListContainer { - anchors.fill: parent - - model : favoritesList - actionItemHeight: root.height * 0.2 - - KPIM.ActionButton { - icon : "images/moveup.png" - actionName : "favoriteseditor_moveup" - } - - KPIM.ActionButton { - icon : "images/movedown.png" - actionName : "favoriteseditor_movedown" - } - - KPIM.ActionButton { - icon : KDE.locate( "data", "mobileui/delete-button.png" ) - actionName : "favoriteseditor_remove" - } - - onCurrentIndexChanged: favoritesEditor.setRowSelected( index ) - } -} \ No newline at end of file diff --git a/kdepim/mobile/mail/FilterEditor.qml b/kdepim/mobile/mail/FilterEditor.qml deleted file mode 100644 index 9c5908f5..00000000 --- a/kdepim/mobile/mail/FilterEditor.qml +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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.plasma.components 0.1 as PlasmaComponents -import org.kde 4.5 -import org.kde.pim.mobileui 4.5 as KPIM - -PlasmaComponents.Page { - - implicitWidth: pageRow.width * 2 /3 - - - //BEGIN: Tools - tools: PlasmaComponents.ToolBarLayout { - PlasmaComponents.ToolButton { - - anchors.left: parent.left - - iconSource: "go-previous" - - onClicked: pageRow.pop() - } - } - //END: Tools - - KPIM.ReorderListContainer { - id: root - - anchors.fill: parent - - actionItemHeight: parent.height * 0.2 - model: filterModel - - delegate: QML.Item { - id: filterDelegate - clip: true - width: parent.width - height: root.actionItemHeight - - QML.Rectangle { - id: background - anchors.fill: parent - opacity: filterDelegate.QML.ListView.isCurrentItem ? 0.25 : 0 - color: "lightsteelblue" - } - - QML.Text { - anchors.fill: parent - text: model.display - horizontalAlignment: QML.Text.AlignHCenter - verticalAlignment: QML.Text.AlignVCenter - } - - QML.MouseArea { - anchors.fill: parent - onClicked: filterDelegate.QML.ListView.view.currentIndex = model.index - } - } - - KPIM.ActionButton { - icon : KDE.locate( "data", "mobileui/add-button.png" ) - actionName : "filtereditor_add" - } - - KPIM.ActionButton { - icon : KDE.locate( "data", "mobileui/edit-button.png" ) - actionName : "filtereditor_edit" - } - - KPIM.ActionButton { - icon : KDE.locate( "data", "mobileui/delete-button.png" ) - actionName : "filtereditor_delete" - } - - KPIM.ActionButton { - icon : KDE.locate( "data", "mobileui/moveup-button.png" ) - actionName : "filtereditor_moveup" - } - - KPIM.ActionButton { - icon : KDE.locate( "data", "mobileui/movedown-button.png" ) - actionName : "filtereditor_movedown" - } - - onCurrentIndexChanged: filterEditor.setRowSelected( index ) - } -} \ No newline at end of file diff --git a/kdepim/mobile/mail/FolderPage.qml b/kdepim/mobile/mail/FolderPage.qml deleted file mode 100644 index f015c87b..00000000 --- a/kdepim/mobile/mail/FolderPage.qml +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2013 (C) Michael Bohlender - * - * 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 . - */ - -import QtQuick 1.1 -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.pim.mobileui 4.5 as KPIM -import org.kde.akonadi 4.5 as Akonadi - -PlasmaComponents.Page { - id: root - - implicitWidth: pageRow.width * 2 /3 - - //BEGIN Tools - tools: PlasmaComponents.ToolBarLayout{ - - PlasmaComponents.ToolButton{ - iconSource: "preferences-system" - - onClicked: pageRow.push(Qt.resolvedUrl("SettingsPage.qml") ) - } - - //FIXME remove this button and push the page when a folder gets selected (requires actual favorite/folderpage) - PlasmaComponents.ToolButton { - iconSource: "go-next" - - onClicked: pageRow.push(Qt.resolvedUrl("MailListPage.qml")) - } - } - //END Tools - - Akonadi.AkonadiBreadcrumbNavigationView { - id : collectionView - - anchors.fill: parent - - showUnread : true - - itemHeight: root.height / 7 - - breadcrumbComponentFactory : _breadcrumbNavigationFactory - - KPIM.AgentStatusIndicator { - id: agentStatusIndicator - anchors { top: parent.top; right: parent.right; rightMargin: 10; topMargin: 10 } - } - } - -} diff --git a/kdepim/mobile/mail/KMailComposerActions.qml b/kdepim/mobile/mail/KMailComposerActions.qml deleted file mode 100644 index 0cb4371d..00000000 --- a/kdepim/mobile/mail/KMailComposerActions.qml +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Volker Krause - Copyright (C) 2010 Andras Mantia - - 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 { - id: root - menuStyle : true - - actionItemHeight: Screen.partition( height, 6 ) - actionItemSpacing - actionItemWidth : 200 - actionItemSpacing : 2 - - ActionList { - category : "composer" - name : "message_menu" - text : KDE.i18n( "Message" ) - ActionListItem { name: "send_later" } - ActionListItem { name: "save_in_drafts" } - ActionListItem { name: "save_as_template" } - } - - ActionList { - category : "composer" - name : "edit_menu" - text : KDE.i18n( "Edit" ) - ActionListItem { name : "composer_search" } - ActionListItem { name : "composer_search_next" } - ActionListItem { name : "composer_replace" } - ActionListItem { name : "composer_clean_spaces" } - ActionListItem { name : "composer_add_quote_char" } - ActionListItem { name : "composer_remove_quote_char" } - ActionListItem { name : "composer_spell_check" } - } - - ActionList { - category : "composer" - name : "options_menu" - text : KDE.i18n( "Options" ) - ActionListItem { name : "options_mark_as_urgent" } - ActionListItem { name : "options_request_mdn" } - ActionListItem { name : "options_wordwrap" } - ActionListItem { name : "options_fixedfont" } - ActionListItem { name : "attach_public_key" } - ActionListItem { name : "options_set_cryptoformat" } - } - - ActionList { - category : "composer" - name : "signature_menu" - text : KDE.i18n( "Signature" ) - ActionListItem { name : "composer_append_signature" } - ActionListItem { name : "composer_prepend_signature" } - ActionListItem { name : "composer_insert_signature" } - } - - ActionList { - category : "composer" - name : "security_menu" - text : KDE.i18n( "Security" ) - ActionListItem { name : "sign_email" } - ActionListItem { name : "encrypt_email" } - } - - SnippetsList { - category : "composer" - name : "snippets_menu" - text : KDE.i18n( "Snippets" ) - actionItemHeight: root.actionItemHeight - } - - ActionList { - category : "composer" - name : "composer_menu" - text : KDE.i18n( "Composer" ) - ScriptActionItem { name : "composer_configure_identity"; title: KDE.i18n( "Configure Identity" ) } - ScriptActionItem { name : "composer_configure_transport"; title: KDE.i18n( "Configure Transport" ) } - ScriptActionItem { name : "composer_close"; title: KDE.i18n( "Close Composer" ) } - ActionListItem { name : "wm_task_switch" } - } - -} diff --git a/kdepim/mobile/mail/MailListPage.qml b/kdepim/mobile/mail/MailListPage.qml deleted file mode 100644 index 1ca6d6d9..00000000 --- a/kdepim/mobile/mail/MailListPage.qml +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright 2013 (C) Michael Bohlender - * - * 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 . - */ - -import QtQuick 1.1 -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.plasma.extras 0.1 as PlasmaExtras - -PlasmaComponents.Page { - id: root - - property variant navigationModel: _threadSelector - property variant checkModel: _itemActionModel - - function mailStatusIconSource(mail) { - if (mail.is_important) { - return "mail-mark-important" - } else if (mail.is_replied) { - return "mail-replied" - } else if (mail.is_forwarded) { - return "mail-forwarded" - } else if (mail.is_unread) { - return "mail-unread-new" - } else { - return "mail-read" - } - } - - implicitWidth: pageRow.width * 2 /3 - - //BEGIN Tools - tools: PlasmaComponents.ToolBarLayout { - - PlasmaComponents.ToolButton { - iconSource: "go-previous" - - onClicked: pageRow.pop() - } - - //TODO (de)select-all checkbox - Row { - - anchors.horizontalCenter: parent.horizontalCenter - - spacing: root.width * 0.03 - - PlasmaComponents.ToolButton { - iconSource: "mail-mark-unread" - - enabled: checkModel.hasSelection - - onClicked: application.getAction("akonadi_mark_as_read", "").trigger() - } - - PlasmaComponents.ToolButton { - iconSource: "mail-mark-important" - - enabled: checkModel.hasSelection - - onClicked: application.getAction("akonadi_mark_as_important", "").trigger() - } - - //TODO usability feature: offer to undo deletion - PlasmaComponents.ToolButton { - iconSource: "edit-delete" - - enabled: checkModel.hasSelection - - onClicked: application.getAction("akonadi_move_to_trash", "").trigger() - } - } - - - //TODO add new mail from template once the multiple actions button is ready - PlasmaComponents.ToolButton { - - anchors.right: parent.right - - iconSource: "mail-message-new" - - onClicked: application.startComposer() - } - } - //END Tools - - ListView { - id : threadView - - anchors.fill: parent - - property int currentItemId: -1 - property int currentRow : -1 - - model: _threads - - focus: true - clip: true - currentIndex: -1 - - - onCurrentRowChanged: { - if (navigationModel != undefined) - navigationModel.select(currentRow, 3) - } - - Connections { - target : navigationModel - onCurrentRowChanged: currentRow = navigationModel.currentRow - } - - //BEGIN Delegate - delegate: PlasmaComponents.ListItem { - id: headerListDelegate - - height: label.height * 2.5 - - opacity: model.is_important || model.is_unread ? 1 : 0.65 - clip: true - enabled: true - checked: threadView.currentIndex == index - - onClicked: { - if (root == pageRow.currentPage) { - pageRow.push(Qt.resolvedUrl("MailViewPage.qml")) - } - threadView.currentIndex = index - navigationModel.select(model.index, 3) - } - - onPressAndHold: threadView.currentIndex = index - - Rectangle { - id: itemBackground - - anchors.fill: parent - color: checked ? "lightgrey" : "white" - opacity: 0.5 - } - - PlasmaComponents.CheckBox { - id: checkBox - - anchors { - left: parent.left - leftMargin: label.width - verticalCenter: parent.verticalCenter - } - - visible: root == pageRow.currentPage - checked: model.checkOn - - onClicked: checkModel.select(model.index, 8) - } - - Image { - id: avatar - - anchors { - left: root == pageRow.currentPage ? checkBox.right : parent.left - leftMargin: label.width - verticalCenter: parent.verticalCenter - } - - height: parent.height * 0.7 - width: height - - source: "dummy-avatar.png" - fillMode: Image.PreserveAspectFit - smooth: true - } - - PlasmaComponents.Label { - id: fromLabel - - anchors { - top : parent.top - left : avatar.right - leftMargin: label.width - right: dateLabel.left - } - - text : model.from - elide: "ElideRight" - font.weight: Font.Light - color : "#0C55BB" - } - - PlasmaComponents.Label { - id: dateLabel - - anchors { - top: parent.top - right: statusIcon.left - } - - text: model.date - horizontalAlignment: "AlignRight" - font.weight: Font.Light - color : "#0C55BB" - } - - PlasmaExtras.Heading { - id: subjectLabel - - anchors { - bottom: parent.bottom - left: avatar.right - leftMargin: label.width - right: statusIcon.left - } - - level: 4 - text: model.subject - elide: "ElideRight" - color: "#3B3B3B" - } - - PlasmaComponents.ToolButton { - id: statusIcon - - anchors{ - right: parent.right - verticalCenter: parent.verticalCenter - } - - height: parent.height * 0.7 - - iconSource: mailStatusIconSource(model) - - onClicked: dialog.open() - - //BEGIN Dialog - PlasmaComponents.Dialog { - id: dialog - - visualParent: parent - - buttons: Column { - - spacing: root.width * 0.03 - - PlasmaComponents.ToolButton { - - iconSource: "mail-mark-unread" - - onClicked: { - checkModel.select(model.index, 3) - application.getAction("akonadi_mark_as_read", "").trigger() - checkModel.select(-1, 1) - } - - } - - PlasmaComponents.ToolButton { - - iconSource: "mail-mark-important" - - onClicked: { - checkModel.select(model.index, 3) - application.getAction("akonadi_mark_as_important", "").trigger() - checkModel.select(-1, 1) - } - - } - - PlasmaComponents.ToolButton { - - iconSource: "edit-delete" - - onClicked: { - checkModel.select(model.index, 3) - application.getAction("akonadi_move_to_trash", "").trigger() - checkModel.select(-1, 1) - } - - } - } - } - //END Dialog - } - } - //END Delegate - } - - PlasmaComponents.Label { - id: label - - text: " " - } -} \ No newline at end of file diff --git a/kdepim/mobile/mail/MailViewPage.qml b/kdepim/mobile/mail/MailViewPage.qml deleted file mode 100644 index ee2843be..00000000 --- a/kdepim/mobile/mail/MailViewPage.qml +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2013 (C) Michael Bohlender - * - * 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 . - */ - -import QtQuick 1.1 -import org.kde.messageviewer 4.5 as MessageViewer -import org.kde.plasma.components 0.1 as PlasmaComponents - -PlasmaComponents.Page { - id: root - - implicitWidth: pageRow.width * 2 /3 - - //BEGIN Tools - tools: PlasmaComponents.ToolBarLayout{ - PlasmaComponents.ToolButton{ - iconSource: "go-previous" - - onClicked: pageRow.pop() - } - - Row { - - spacing: root.width * 0.03 - - //TODO add forward-as-attachment and redirect when the "multiple actions" button is ready - PlasmaComponents.ToolButton { - iconSource: "mail-forward" - - onClicked: application.forwardMessage() - } - - //TODO add reply-to-list and (maybe) reply-without quoting when the "multiple actions" button is ready - PlasmaComponents.ToolButton { - iconSource: "mail-reply-sender" - - onClicked: application.replyToAuthor() - } - - PlasmaComponents.ToolButton { - iconSource: "mail-reply-all" - - onClicked: application.replyToAll() - } - } - } - //END Tools - - //BEGIN MessageView - MessageViewer.MessageView { - id: messageView - - anchors { - fill: parent - leftMargin: parent.width * 0.05 - rightMargin: parent.width * 0.05 - } - - clip: true - } - //END MessageView - -} diff --git a/kdepim/mobile/mail/Messages.sh b/kdepim/mobile/mail/Messages.sh deleted file mode 100644 index c2a76003..00000000 --- a/kdepim/mobile/mail/Messages.sh +++ /dev/null @@ -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/kmail-mobile.pot -$XGETTEXT -ktranslate `find . -name '*.qml'` -j -L Java -o $podir/kmail-mobile.pot -rm -f rc.cpp diff --git a/kdepim/mobile/mail/SettingsPage.qml b/kdepim/mobile/mail/SettingsPage.qml deleted file mode 100644 index 79b90893..00000000 --- a/kdepim/mobile/mail/SettingsPage.qml +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2013 (C) Michael Bohlender - * - * 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 . - */ - -import QtQuick 1.1 -import org.kde.plasma.components 0.1 as PlasmaComponents - -PlasmaComponents.Page { - id: root - - implicitWidth: pageRow.width * 2 /3 - - //BEGIN: Tools - tools: PlasmaComponents.ToolBarLayout { - PlasmaComponents.ToolButton { - - anchors.left: parent.left - - iconSource: "go-previous" - - onClicked: pageRow.pop() - } - } - //END: Tools - - Column { - anchors.centerIn: parent - - spacing: 20 - - PlasmaComponents.Button { - text: i18n("Accounts") - - onClicked: { - pageRow.pop(root) - pageRow.push(Qt.resolvedUrl("AccountSettingsPage.qml")) - } - } - PlasmaComponents.Button { - text: i18n("Identities") - - onClicked: application.configureIdentity() - } - PlasmaComponents.Button { - text: i18n("Favorites") - - onClicked: { - pageRow.pop(root) - pageRow.push(Qt.resolvedUrl("FavoriteManagerPage.qml")) - } - } - PlasmaComponents.Button { - text: i18n("Filter") - - onClicked: { - pageRow.pop(root) - pageRow.push(Qt.resolvedUrl("FilterEditor.qml")) - } - } - PlasmaComponents.Button { - text: i18n( "About" ) - - onClicked: { - pageRow.pop(root) - pageRow.push(Qt.resolvedUrl("AboutPage.qml")) - } - } - } -} \ No newline at end of file diff --git a/kdepim/mobile/mail/SnippetsEditor.qml b/kdepim/mobile/mail/SnippetsEditor.qml deleted file mode 100644 index 85a77343..00000000 --- a/kdepim/mobile/mail/SnippetsEditor.qml +++ /dev/null @@ -1,124 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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.plasma.extras 0.1 as PlasmaExtras - -QML.Rectangle { - id : _topLevel - color : "#00000000" - property int actionItemHeight : 70 - property int actionItemWidth : 200 - property int actionItemSpacing : 0 - property int bottomMargin - anchors.bottomMargin : bottomMargin - - property alias model : snippetsView.model - - property alias customActions : actionColumn.content - - signal triggered(string triggeredName) - signal doCollapse() - - PlasmaExtras.ScrollArea { - - anchors { - top: parent.top - bottom: parent.bottom - left: parent.left - } - width: parent.width - actionColumn.width - - flickableItem: QML.ListView { - id: snippetsView - - model: snippetsModel - focus: true - clip: true - - delegate: QML.Item { - id: snippetDelegate - clip: true - width: parent.width - height: _topLevel.actionItemHeight - - QML.Rectangle { - id: background - anchors.fill: parent - opacity: snippetDelegate.QML.ListView.isCurrentItem ? 0.25 : 0 - color: "lightsteelblue" - } - - QML.Text { - anchors.fill: parent - anchors.leftMargin: model.isSnippetGroup ? 5 : 25 - text: model.display - font.bold: model.isSnippetGroup - horizontalAlignment: QML.Text.AlignLeft - verticalAlignment: QML.Text.AlignVCenter - } - - QML.MouseArea { - anchors.fill: parent - onClicked: snippetDelegate.QML.ListView.view.currentIndex = model.index - } - } - - onCurrentIndexChanged: snippetsEditor.setRowSelected( currentIndex ) - } - } - - KPIM.ActionMenuContainer { - id : actionColumn - width : _topLevel.actionItemWidth - anchors.top : parent.top - anchors.bottom : parent.bottom - anchors.right : parent.right - actionItemWidth : width - actionItemHeight : _topLevel.actionItemHeight - - content : [ - KPIM.ActionListItem { name : "snippetseditor_insert_snippet"; title: KDE.i18n("Insert\nSnippet") }, - KPIM.ActionListItem { name : "snippetseditor_add_snippet"; title: KDE.i18n("Add\nSnippet") }, - KPIM.ActionListItem { name : "snippetseditor_edit_snippet"; title: KDE.i18n("Edit\nSnippet") }, - KPIM.ActionListItem { name : "snippetseditor_delete_snippet"; title: KDE.i18n("Delete\nSnippet") }, - KPIM.ActionListItem { name : "snippetseditor_add_snippetgroup"; title: KDE.i18n("Add\nGroup") }, - KPIM.ActionListItem { name : "snippetseditor_edit_snippetgroup"; title: KDE.i18n("Edit\nGroup") }, - KPIM.ActionListItem { name : "snippetseditor_delete_snippetgroup"; title: KDE.i18n("Delete\nGroup") } - ] - - onTriggered: { - if ( triggeredName == "snippetseditor_insert_snippet" ) { - parent.doCollapse() - } - } - } - - onActionItemSpacingChanged : { - actionColumn.refresh(); - } - - onActionItemHeightChanged : { - actionColumn.refresh(); - } -} diff --git a/kdepim/mobile/mail/SnippetsList.qml b/kdepim/mobile/mail/SnippetsList.qml deleted file mode 100644 index 85c233ec..00000000 --- a/kdepim/mobile/mail/SnippetsList.qml +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 - - -QML.Item { - id : snippetsList_top - width : parent.width - - property string category - property string name - - property alias text : nameItem.buttonText - property alias totalWidth : _listContent.width - property alias columnHeight : _listContent.height - property alias depth : _listContent.bottomMargin - property alias actionItemHeight: _listContent.actionItemHeight - - property alias showChildren : _listContent.visible - signal triggered(string triggeredName) - signal doCollapse() - - onVisibleChanged : - { - if (!visible) - height = -actionItemSpacing - else - height = actionItemHeight - } - - - KPIM.Button { - id : nameItem - height : parent.height - width : parent.width - - onClicked : { - snippetsList_top.triggered(snippetsList_top.name) - showChildren = true - } - } - - SnippetsEditor { - id : _listContent - anchors.left : nameItem.right - anchors.bottom : nameItem.top - - property int bottomMargin - anchors.bottomMargin : bottomMargin - visible : false - - onTriggered : { - snippetsList_top.triggered(triggeredName) - } - - onDoCollapse : { - snippetsList_top.doCollapse(); - } - } -} diff --git a/kdepim/mobile/mail/acleditor.cpp b/kdepim/mobile/mail/acleditor.cpp deleted file mode 100644 index 50400d5c..00000000 --- a/kdepim/mobile/mail/acleditor.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "acleditor.h" - -#include -#include -#include -#include -#include - -#include -#include - -AclEditor::AclEditor( KActionCollection *actionCollection, QObject *parent ) - : QObject( parent ), mAclManager( new PimCommon::AclManager( this ) ) -{ - Akonadi::AttributeFactory::registerAttribute(); - - actionCollection->addAction( QLatin1String("acleditor_add"), mAclManager->addAction() ); - actionCollection->addAction( QLatin1String("acleditor_edit"), mAclManager->editAction() ); - actionCollection->addAction( QLatin1String("acleditor_delete"), mAclManager->deleteAction() ); -} - -void AclEditor::setCollection( const Akonadi::Collection &collection ) -{ - mCollection = collection; - - emit collectionChanged( mCollection ); -} - -QString AclEditor::collectionName() const -{ - if ( mCollection.isValid() ) - return mCollection.displayName(); - else - return QString(); -} - -bool AclEditor::collectionHasAcls() const -{ - if ( !mCollection.isValid() ) - return false; - - return mCollection.hasAttribute(); -} - -void AclEditor::load() -{ - mAclManager->setCollection( mCollection ); -} - -void AclEditor::save() -{ - mAclManager->save(); -} - -QAbstractItemModel* AclEditor::model() const -{ - return mAclManager->model(); -} - -void AclEditor::setRowSelected( int row ) -{ - const QAbstractItemModel *model = mAclManager->model(); - QItemSelectionModel *selectionModel = mAclManager->selectionModel(); - - Q_ASSERT( row >= 0 && row < model->rowCount() ); - - selectionModel->select( model->index( row, 0 ), QItemSelectionModel::ClearAndSelect ); -} - diff --git a/kdepim/mobile/mail/acleditor.h b/kdepim/mobile/mail/acleditor.h deleted file mode 100644 index 63919aac..00000000 --- a/kdepim/mobile/mail/acleditor.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 ACLEDITOR_H -#define ACLEDITOR_H - -#include - -#include - -namespace PimCommon { -class AclManager; -} - -class KActionCollection; -class QAbstractItemModel; -class QAction; - -/** - * @short The C++ part of the ACL editor for mobile apps. - * - * This class encapsulates the logic of the acl viewing/editing - * and the UI is provided by AclEditor.qml. - */ -class AclEditor : public QObject -{ - Q_OBJECT - - Q_PROPERTY( QString collectionName READ collectionName NOTIFY collectionChanged ) - Q_PROPERTY( bool collectionHasAcls READ collectionHasAcls NOTIFY collectionChanged ) - - public: - /** - * Creates a new ACL editor. - * - * @param actionCollection The action collection to register the manipulation - * actions (e.g. add, edit, delete) at - * @param parent The parent object. - */ - explicit AclEditor( KActionCollection *actionCollection, QObject *parent = 0 ); - - /** - * Sets the @p collection whose ACLs shall be edited. - * - * @note This does not load the collection into the editor, load - * must be called explicitly. - */ - void setCollection( const Akonadi::Collection &collection ); - - /** - * Returns the name of the current collection. - */ - QString collectionName() const; - - /** - * Returns whether the current collection provides ACLs. - * - * That's mostly only true for collections that represent IMAP folders. - */ - bool collectionHasAcls() const; - - public Q_SLOTS: - /** - * Loads the current collection into the editor. - */ - void load(); - - /** - * Saves changes to the ACLs back to the current collection. - */ - void save(); - - /** - * Returns the ACL list model of the current collection. - */ - QAbstractItemModel* model() const; - - /** - * Sets the row of the ACL the user has selected in the UI. - */ - void setRowSelected( int row ); - - Q_SIGNALS: - /** - * This signal is emitted whenever the current collection has been - * changed. - * - * @param collection The new current collection. - */ - void collectionChanged( const Akonadi::Collection &collection ); - - private: - PimCommon::AclManager *mAclManager; - Akonadi::Collection mCollection; -}; - -#endif diff --git a/kdepim/mobile/mail/add-attachment-button.png b/kdepim/mobile/mail/add-attachment-button.png deleted file mode 100644 index c13536a4..00000000 Binary files a/kdepim/mobile/mail/add-attachment-button.png and /dev/null differ diff --git a/kdepim/mobile/mail/attachmenteditor.cpp b/kdepim/mobile/mail/attachmenteditor.cpp deleted file mode 100644 index df552c67..00000000 --- a/kdepim/mobile/mail/attachmenteditor.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "attachmenteditor.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -AttachmentEditor::AttachmentEditor( KActionCollection *actionCollection, MessageComposer::AttachmentModel *model, - MessageComposer::AttachmentControllerBase *controller, QObject *parent ) - : QObject( parent ), - mModel( model ), - mSelectionModel( new QItemSelectionModel( mModel ) ), - mAttachmentController( controller ) -{ - mAddAction = actionCollection->action( QLatin1String("attach") ); - mAddAction->setText( i18n( "Add Attachment" ) ); - mDeleteAction = actionCollection->action( QLatin1String("remove") ); - mDeleteAction->setText( i18n( "Remove Attachment" ) ); - - mSignAction = new QAction( this ); - mSignAction->setText( i18n( "Sign" ) ); - mSignAction->setCheckable( true ); - connect( mSignAction, SIGNAL(triggered(bool)), SLOT(signAttachment(bool)) ); - - mEncryptAction = new QAction( this ); - mEncryptAction->setText( i18n( "Encrypt" ) ); - mEncryptAction->setCheckable( true ); - connect( mEncryptAction, SIGNAL(triggered(bool)), SLOT(encryptAttachment(bool)) ); - - actionCollection->addAction( QLatin1String("toggle_attachment_signed"), mSignAction ); - actionCollection->addAction( QLatin1String("toggle_attachment_encrypted"), mEncryptAction ); - - connect( mSelectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - this, SLOT(selectionChanged()) ); - - selectionChanged(); -} - -void AttachmentEditor::setRowSelected( int row ) -{ - Q_ASSERT( row >= 0 && row < mModel->rowCount() ); - - mSelectionModel->select( mModel->index( row, 0, QModelIndex() ), QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows ); -} - -void AttachmentEditor::selectionChanged() -{ - mAddAction->setEnabled( true ); - - if ( mSelectionModel->hasSelection() ) { - mDeleteAction->setEnabled( true ); - mSignAction->setEnabled( true ); - mEncryptAction->setEnabled( true ); - - const QModelIndex signIndex = mModel->index( mSelectionModel->selectedIndexes().first().row(), MessageComposer::AttachmentModel::SignColumn ); - const QModelIndex encryptIndex = mModel->index( mSelectionModel->selectedIndexes().first().row(), MessageComposer::AttachmentModel::EncryptColumn ); - - mSignAction->setChecked( signIndex.data( Qt::CheckStateRole ).toBool() ); - mEncryptAction->setChecked( encryptIndex.data( Qt::CheckStateRole ).toBool() ); - } else { - mDeleteAction->setEnabled( false ); - mSignAction->setEnabled( false ); - mEncryptAction->setEnabled( false ); - } - - const QModelIndexList selectedRows = mSelectionModel->selectedRows(); - MessageCore::AttachmentPart::List selectedParts; - foreach( const QModelIndex &index, selectedRows ) { - const MessageCore::AttachmentPart::Ptr part = index.data( MessageComposer::AttachmentModel::AttachmentPartRole ).value(); - selectedParts.append( part ); - } - - mAttachmentController->setSelectedParts( selectedParts ); -} - -void AttachmentEditor::signAttachment( bool value ) -{ - if ( !mSelectionModel->hasSelection() ) - return; - - const QModelIndex index = mModel->index( mSelectionModel->selectedIndexes().first().row(), MessageComposer::AttachmentModel::SignColumn ); - mModel->setData( index, value, Qt::CheckStateRole ); -} - -void AttachmentEditor::encryptAttachment( bool value ) -{ - if ( !mSelectionModel->hasSelection() ) - return; - - const QModelIndex index = mModel->index( mSelectionModel->selectedIndexes().first().row(), MessageComposer::AttachmentModel::EncryptColumn ); - mModel->setData( index, value, Qt::CheckStateRole ); -} - diff --git a/kdepim/mobile/mail/attachmenteditor.h b/kdepim/mobile/mail/attachmenteditor.h deleted file mode 100644 index f839ea00..00000000 --- a/kdepim/mobile/mail/attachmenteditor.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 ATTACHMENTEDITOR_H -#define ATTACHMENTEDITOR_H - -#include - -namespace MessageComposer { -class AttachmentModel; -class AttachmentControllerBase; -} - -class KActionCollection; -class QAbstractItemModel; -class QAction; -class QItemSelectionModel; - -/** - * @short The C++ part of the attachment editor for mobile apps. - * - * This class encapsulates the logic of the attachment viewing/editing - * and the UI is provided by AttachmentEditor.qml. - */ -class AttachmentEditor : public QObject -{ - Q_OBJECT - - public: - /** - * Creates a new attachment editor. - * - * @param actionCollection The action collection to register the manipulation - * actions (e.g. add, delete, sign, encrypt) at. - * @param model The attachment model. - * @param controller The attachment controller to use for composing the message. - * @param parent The parent object. - */ - AttachmentEditor( KActionCollection *actionCollection, MessageComposer::AttachmentModel *model, - MessageComposer::AttachmentControllerBase *controller, QObject *parent = 0 ); - - public Q_SLOTS: - /** - * Sets the row of the attachment the user has selected in the UI. - */ - void setRowSelected( int row ); - - private Q_SLOTS: - void selectionChanged(); - void signAttachment( bool value ); - void encryptAttachment( bool value ); - - private: - MessageComposer::AttachmentModel *mModel; - QItemSelectionModel *mSelectionModel; - - MessageComposer::AttachmentControllerBase *mAttachmentController; - QAction *mAddAction; - QAction *mDeleteAction; - QAction *mSignAction; - QAction *mEncryptAction; -}; - -#endif diff --git a/kdepim/mobile/mail/attachmentproxymodel.cpp b/kdepim/mobile/mail/attachmentproxymodel.cpp deleted file mode 100644 index e837a31e..00000000 --- a/kdepim/mobile/mail/attachmentproxymodel.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "attachmentproxymodel.h" - -#include - -#include - -Q_DECLARE_METATYPE( KMime::Content* ) - -AttachmentProxyModel::AttachmentProxyModel( QObject* parent ) - : QSortFilterProxyModel( parent ), - m_nodeHelper( new MessageViewer::NodeHelper ) -{ - connect( this, SIGNAL(modelReset()), SLOT(slotModelReset()) ); -} - -AttachmentProxyModel::~AttachmentProxyModel() -{ - delete m_nodeHelper; -} - -bool AttachmentProxyModel::filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const -{ - const QModelIndex sourceIndex = sourceModel()->index( sourceRow, 0, sourceParent ); - const QString mimeType = sourceIndex.data( MessageViewer::MimeTreeModel::MimeTypeRole ).toString(); - - // filter out structutral nodes and crypto stuff - const QStringList blacklist = QStringList() - << QLatin1String( "application/pgp-encrypted" ) - << QLatin1String( "application/pkcs7-mime" ) - << QLatin1String( "application/pgp-signature" ) - << QLatin1String( "application/pkcs7-signature" ) - << QLatin1String( "application/x-pkcs7-signature" ); - if ( mimeType.startsWith( QLatin1String( "multipart/" ) ) || blacklist.contains( mimeType ) ) - return false; - - // filter out the main body part - if ( sourceIndex.data( MessageViewer::MimeTreeModel::MainBodyPartRole ).toBool() - || sourceIndex.data( MessageViewer::MimeTreeModel::AlternativeBodyPartRole ).toBool() ) { - return false; - } - - return QSortFilterProxyModel::filterAcceptsRow( sourceRow, sourceParent ); -} - -void AttachmentProxyModel::setSourceModel( QAbstractItemModel *sourceModel ) -{ - QSortFilterProxyModel::setSourceModel( sourceModel ); - - QHash names = roleNames(); - names.insert( MessageViewer::MimeTreeModel::MimeTypeRole, "mimeType" ); - names.insert( AttachmentProxyModel::AttachmentUrlRole, "attachmentUrl" ); - setRoleNames( names ); -} - -QVariant AttachmentProxyModel::data( const QModelIndex &index, int role ) const -{ - if ( role == AttachmentUrlRole ) { - KMime::Content *content = index.data( MessageViewer::MimeTreeModel::ContentRole ).value(); - return m_nodeHelper->writeNodeToTempFile( content ); - } - - return QSortFilterProxyModel::data( index, role ); -} - -void AttachmentProxyModel::slotModelReset() -{ - m_nodeHelper->removeTempFiles(); - m_nodeHelper->clear(); - // moc doesn't allow property NOTIFY to use signals in the base class apparently... - emit rowCountChanged(); -} - diff --git a/kdepim/mobile/mail/attachmentproxymodel.h b/kdepim/mobile/mail/attachmentproxymodel.h deleted file mode 100644 index 3de847a8..00000000 --- a/kdepim/mobile/mail/attachmentproxymodel.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 MESSAGEVIEWER_ATTACHMENTPROXYMODEL_H -#define MESSAGEVIEWER_ATTACHMENTPROXYMODEL_H - -#include - -#include - -namespace MessageViewer { - class NodeHelper; -} - -/** - * @short A proxy model to provide roles for accessing attachment properties from QML. - */ -class AttachmentProxyModel : public QSortFilterProxyModel -{ - Q_OBJECT - Q_PROPERTY( int attachmentCount READ rowCount NOTIFY rowCountChanged ) - - public: - enum Role { - AttachmentUrlRole = MessageViewer::MimeTreeModel::UserRole - }; - - explicit AttachmentProxyModel( QObject *parent = 0 ); - ~AttachmentProxyModel(); - - bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const; - void setSourceModel( QAbstractItemModel *sourceModel ); - QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; - - Q_SIGNALS: - void rowCountChanged(); - - private Q_SLOTS: - void slotModelReset(); - - private: - MessageViewer::NodeHelper *m_nodeHelper; -}; - -#endif diff --git a/kdepim/mobile/mail/charsetselectiondialog.cpp b/kdepim/mobile/mail/charsetselectiondialog.cpp deleted file mode 100644 index f3526897..00000000 --- a/kdepim/mobile/mail/charsetselectiondialog.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "charsetselectiondialog.h" - -#include - -#include -#include - -CharsetSelectionDialog::CharsetSelectionDialog( QWidget *parent ) - : KDialog( parent ) -{ - setButtons( Ok | Cancel ); - - mCharsetCombo = new KComboBox; - setMainWidget( mCharsetCombo ); - - QStringList charsets = MessageViewer::NodeHelper::supportedEncodings( false ); - charsets.prepend( i18n( "Auto" ) ); - - mCharsetCombo->addItems( charsets ); -} - -CharsetSelectionDialog::~CharsetSelectionDialog() -{ -} - -void CharsetSelectionDialog::setCharset( const QString &charset ) -{ - for ( int i = 0; i < mCharsetCombo->count(); ++i ) { - if ( charset ==MessageViewer::NodeHelper::encodingForName( mCharsetCombo->itemText( i ) ) ) { - mCharsetCombo->setCurrentIndex( i ); - return; - } - } - - mCharsetCombo->setCurrentIndex( 0 ); -} - -QString CharsetSelectionDialog::charset() const -{ - if ( mCharsetCombo->currentIndex() == 0 ) - return QString(); - else - return MessageViewer::NodeHelper::encodingForName( mCharsetCombo->currentText() ); -} diff --git a/kdepim/mobile/mail/charsetselectiondialog.h b/kdepim/mobile/mail/charsetselectiondialog.h deleted file mode 100644 index b4e0bdfe..00000000 --- a/kdepim/mobile/mail/charsetselectiondialog.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 CHARSETSELECTIONDIALOG_H -#define CHARSETSELECTIONDIALOG_H - -#include - -class KComboBox; - -/** - * @short A dialog to select a charset. - * - * This dialog is used to select an override charset - * for the message viewer. - */ -class CharsetSelectionDialog : public KDialog -{ - public: - /** - * Creates a new charset selection dialog. - * - * @param parent The parent widget. - */ - explicit CharsetSelectionDialog( QWidget *parent = 0 ); - - /** - * Destroys the charset selection dialog. - */ - ~CharsetSelectionDialog(); - - /** - * Sets the currently selected @p charset. - */ - void setCharset( const QString &charset ); - - /** - * Returns the currently selected charset. - */ - QString charset() const; - - private: - KComboBox *mCharsetCombo; -}; - -#endif diff --git a/kdepim/mobile/mail/composerautoresizer.cpp b/kdepim/mobile/mail/composerautoresizer.cpp deleted file mode 100644 index 8731384a..00000000 --- a/kdepim/mobile/mail/composerautoresizer.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (c) 2010 Anselmo Lacerda S. de Melo - Copyright (c) 2010 Artur Duque de Souza - - 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 "composerautoresizer.h" - -#include - -ComposerAutoResizer::ComposerAutoResizer( QTextEdit* parent ) - : QObject( parent ), - mComposer( parent ), - mFlickable( 0 ) -{ - Q_ASSERT( mComposer ); - - // detect when the text changes - connect( parent, SIGNAL(textChanged()), this, SLOT(textEditChanged()) ); - connect( parent, SIGNAL(cursorPositionChanged()), this, SLOT(textEditChanged()) ); -} - -QDeclarativeItem *ComposerAutoResizer::findFlickable( QGraphicsItem *parent ) const -{ - // looks for a QML Flickable Item based on the name of the class - // It's not optimal but it's the only way as - // QDeclarativeFlickable is not public - const QString flickableClassName( QLatin1String("QDeclarativeFlickable") ); - while ( parent ) { - QDeclarativeItem *item = qobject_cast( parent ); - if ( item ) { - if ( !flickableClassName.compare( QLatin1String(item->metaObject()->className()) ) ) { - return item; - } - } - parent = parent->parentItem(); - } - - return 0; -} - -void ComposerAutoResizer::textEditChanged() -{ - QTextDocument *document = mComposer->document(); - const QRect cursor = mComposer->cursorRect(); - const QSize size = document->size().toSize(); - const QRect frameRect = mComposer->frameRect(); - const QRect contentsRect = mComposer->contentsRect(); - - // sets the size of the widget dynamically - int minHeight = mComposer->property( "availableScreenHeight" ).toInt(); - mComposer->setMinimumHeight( qMax( minHeight, size.height() + (frameRect.height() - contentsRect.height()) ) ); - mComposer->setMaximumHeight( qMax( minHeight, size.height() + (frameRect.height() - contentsRect.height()) ) ); - - const QGraphicsProxyWidget *proxy = mComposer->graphicsProxyWidget(); - QGraphicsItem *proxyItem = proxy->parentItem(); - - // position of the widget - const QPointF pos = proxy->pos(); - - // make sure the cursor is visible so the user doesn't loose track of the kb focus - if ( mFlickable || (mFlickable = findFlickable( proxyItem )) ) { - const int dy = cursor.center().y(); - const int y = pos.y() + dy - minHeight; - if ( y >= 0 ) { - mFlickable->setProperty( "contentY", y ); - } else { - mFlickable->setProperty( "contentY", 0 ); - } - } -} - diff --git a/kdepim/mobile/mail/composerautoresizer.h b/kdepim/mobile/mail/composerautoresizer.h deleted file mode 100644 index cce5606d..00000000 --- a/kdepim/mobile/mail/composerautoresizer.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (c) 2010 Anselmo Lacerda S. de Melo - Copyright (c) 2010 Artur Duque de Souza - - 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 COMPOSERAUTORESIZER_H -#define COMPOSERAUTORESIZER_H - -#include -#include - -class ComposerAutoResizer : public QObject -{ - Q_OBJECT - - public: - explicit ComposerAutoResizer( QTextEdit *parent ); - - QDeclarativeItem *findFlickable( QGraphicsItem *parent ) const; - - private Q_SLOTS: - void textEditChanged(); - - private: - QTextEdit *mComposer; - QDeclarativeItem *mFlickable; -}; - -#endif diff --git a/kdepim/mobile/mail/composerview.cpp b/kdepim/mobile/mail/composerview.cpp deleted file mode 100644 index 36a7f879..00000000 --- a/kdepim/mobile/mail/composerview.cpp +++ /dev/null @@ -1,655 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "composerview.h" - -#include "attachmenteditor.h" -#include "composerautoresizer.h" -#include "cryptoformatselectiondialog.h" -#include "declarativeidentitycombobox.h" -#include "declarativewidgetbase.h" -#include "mobilekernel.h" -#include "settings.h" -#include "snippetseditor.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -class DeclarativeEditor : public DeclarativeWidgetBase -{ - Q_OBJECT - Q_PROPERTY( int availableScreenHeight READ availableScreenHeight WRITE setAvailableScreenHeight ) - public: - int availableScreenHeight() { return widget()->property( "availableScreenHeight" ).toInt(); } - void setAvailableScreenHeight( int height ) { widget()->setProperty( "availableScreenHeight", height ); } -}; - -typedef DeclarativeWidgetBase DeclarativeRecipientsEditor; - -QML_DECLARE_TYPE( DeclarativeEditor ) -QML_DECLARE_TYPE( DeclarativeIdentityComboBox ) -QML_DECLARE_TYPE( DeclarativeRecipientsEditor ) - -ComposerView::ComposerView(QWidget* parent) : - KDeclarativeFullScreenView( QLatin1String( "kmail-composer" ), parent ), - m_composerBase( 0 ), - m_jobCount( 0 ), - m_sign( false ), - m_encrypt( false ), - m_busy( false ), - m_draft( false ), - m_urgent( false ), - m_mdnRequested( Settings::self()->composerRequestMDN() ), - m_cryptoFormat( Kleo::AutoFormat ), - m_presetIdentity( 0 ), - m_mayAutoSign( true ) -{ - setSubject( QString() ); - setAttribute(Qt::WA_DeleteOnClose); -} - -void ComposerView::doDelayedInit() -{ - kDebug(); - qmlRegisterType( "org.kde.messagecomposer", 4, 5, "Editor" ); - qmlRegisterType( "org.kde.kpimidentities", 4, 5, "IdentityComboBox" ); - qmlRegisterType( "org.kde.messagecomposer", 4, 5, "RecipientsEditor" ); - - engine()->rootContext()->setContextProperty( QLatin1String("application"), QVariant::fromValue( static_cast( this ) ) ); - connect( this, SIGNAL(statusChanged(QDeclarativeView::Status)), SLOT(qmlLoaded(QDeclarativeView::Status)) ); - - m_snippetsEditor = new SnippetsEditor( actionCollection(), this ); - engine()->rootContext()->setContextProperty( QLatin1String("snippetsEditor"), m_snippetsEditor ); - engine()->rootContext()->setContextProperty( QLatin1String("snippetsModel"), m_snippetsEditor->model() ); - - // ### TODO: make this happens later to show the composer as fast as possible - m_composerBase = new MessageComposer::ComposerViewBase( this ); - m_composerBase->setIdentityManager( MobileKernel::self()->identityManager() ); - - // Temporarily only in c++, use from QML when ready. - MailTransport::TransportComboBox* transportCombo = new MailTransport::TransportComboBox( this ); - transportCombo->hide(); - m_composerBase->setTransportCombo( transportCombo ); - - /* - Akonadi::CollectionComboBox* fcc = new Akonadi::CollectionComboBox( this ); - fcc->setMimeTypeFilter( QStringList()<< "message/rfc822" ); - fcc->setAccessRightsFilter( Akonadi::Collection::CanCreateItem ); - fcc->setToolTip( i18n( "Select the sent-mail folder where a copy of this message will be saved" ) ); - fcc->hide(); - m_composerBase->setFccCombo( fcc ); - */ - - - connect( m_composerBase, SIGNAL(disableHtml(MessageComposer::ComposerViewBase::Confirmation)), - this, SLOT(disableHtml(MessageComposer::ComposerViewBase::Confirmation)) ); - connect( m_composerBase, SIGNAL(enableHtml()),this, SLOT(enableHtml()) ); - - connect( m_composerBase, SIGNAL(sentSuccessfully()), this, SLOT(sendSuccessful()) ); - connect( m_composerBase, SIGNAL(failed(QString)), this, SLOT(failed(QString)) ); - connect( m_composerBase, SIGNAL(sentSuccessfully()), this, SLOT(success()) ); - - MessageComposer::AttachmentModel* attachmentModel = new MessageComposer::AttachmentModel(this); - engine()->rootContext()->setContextProperty( QLatin1String("attachmentModel"), QVariant::fromValue( static_cast( attachmentModel ) ) ); - MessageComposer::AttachmentControllerBase* attachmentController = new MessageComposer::AttachmentControllerBase(attachmentModel, this, actionCollection()); - attachmentController->createActions(); - m_composerBase->setAttachmentModel( attachmentModel ); - m_composerBase->setAttachmentController( attachmentController ); - - AttachmentEditor *attachmentEditor = new AttachmentEditor( actionCollection(), attachmentModel, attachmentController, this ); - engine()->rootContext()->setContextProperty( QLatin1String("attachmentEditor"), attachmentEditor ); - - KAction *action = actionCollection()->addAction(QLatin1String("sign_email")); - action->setText( i18n( "Sign" ) ); - action->setIcon( KIcon( QLatin1String("document-sign") ) ); - action->setCheckable(true); - connect(action, SIGNAL(triggered(bool)), SLOT(signEmail(bool))); - - action = actionCollection()->addAction(QLatin1String("encrypt_email")); - action->setText( i18n( "Encrypt" ) ); - action->setIcon( KIcon( QLatin1String("mail-encrypt") ) ); - action->setCheckable(true); - connect(action, SIGNAL(triggered(bool)), SLOT(encryptEmail(bool))); - - action = actionCollection()->addAction( QLatin1String("send_later") ); - action->setText( i18n( "Send Later" ) ); - connect( action, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), SLOT(sendLater()) ); - - action = actionCollection()->addAction(QLatin1String("save_in_drafts")); - action->setText( i18n( "Save As Draft" ) ); - action->setIcon( KIcon( QLatin1String("document-save" )) ); - connect(action, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), SLOT(saveDraft())); - - action = actionCollection()->addAction(QLatin1String("save_as_template")); - action->setText( i18n( "Save As Template" ) ); - connect(action, SIGNAL(triggered(Qt::MouseButtons,Qt::KeyboardModifiers)), SLOT(saveAsTemplate())); - - action = actionCollection()->addAction(QLatin1String("composer_clean_spaces")); - action->setText( i18n( "Clean Spaces" ) ); - - action = actionCollection()->addAction( QLatin1String("composer_add_quote_char") ); - action->setText( i18n( "Add Quote Characters" ) ); - - action = actionCollection()->addAction( QLatin1String("composer_remove_quote_char") ); - action->setText( i18n( "Remove Quote Characters" ) ); - - action = actionCollection()->addAction( QLatin1String("composer_spell_check") ); - action->setText( i18n( "Check Spelling" ) ); - - action = actionCollection()->addAction( QLatin1String("composer_search") ); - action->setText( i18n( "Search in Email" ) ); - - action = actionCollection()->addAction( QLatin1String("composer_search_next") ); - action->setText( i18n( "Continue Search" ) ); - - action = actionCollection()->addAction( QLatin1String("composer_replace") ); - action->setText( i18n( "Replace" ) ); - - action = actionCollection()->addAction( QLatin1String("composer_append_signature") ); - action->setText( i18n( "Append Signature" ) ); - - action = actionCollection()->addAction( QLatin1String("composer_prepend_signature") ); - action->setText( i18n( "Prepend Signature" ) ); - - action = actionCollection()->addAction( QLatin1String("composer_insert_signature") ); - action->setText( i18n( "Insert Signature at Cursor Position" ) ); - - action = actionCollection()->addAction( QLatin1String("options_mark_as_urgent") ); - action->setText( i18n( "Urgent" ) ); - action->setCheckable( true ); - connect( action, SIGNAL(triggered(bool)), SLOT(urgentEmail(bool)) ); - - action = actionCollection()->addAction( QLatin1String("options_request_mdn") ); - action->setText( i18n( "Request Notification" ) ); - action->setCheckable( true ); - action->setChecked( m_mdnRequested ); - connect( action, SIGNAL(triggered(bool)), SLOT(requestMdn(bool)) ); - - action = actionCollection()->addAction( QLatin1String("options_wordwrap") ); - action->setText( i18n( "Wordwrap" ) ); - action->setCheckable( true ); - action->setChecked( MessageComposer::MessageComposerSettings::self()->wordWrap() ); - connect( action, SIGNAL(triggered(bool)), SLOT(toggleAutomaticWordWrap(bool)) ); - - action = actionCollection()->addAction( QLatin1String("options_fixedfont") ); - action->setText( i18n( "Use Fixed Font" ) ); - action->setCheckable( true ); - action->setChecked( MessageViewer::GlobalSettings::self()->useFixedFont() ); - connect( action, SIGNAL(triggered(bool)), SLOT(toggleUseFixedFont(bool)) ); - - action = actionCollection()->addAction( QLatin1String("options_set_cryptoformat")); - action->setText( i18n( "Crypto Message Format" ) ); - connect( action, SIGNAL(triggered(bool)), SLOT(setCryptoFormat()) ); - - actionCollection()->action( QLatin1String("attach_public_key") )->setText( i18n( "Attach Public Key" ) ); - actionCollection()->action( QLatin1String("composer_insert_signature") )->setText( i18n( "Insert Signature at Cursor Position" ) ); -} - -void ComposerView::setIdentityCombo( KPIMIdentities::IdentityCombo* combo ) -{ - m_composerBase->setIdentityCombo( combo ); - - if ( m_presetIdentity != 0 ) { - m_currentIdentity = m_presetIdentity; - m_composerBase->identityCombo()->setCurrentIdentity( m_presetIdentity ); - } else { - m_currentIdentity = m_composerBase->identityCombo()->currentIdentity(); - } - - connect( combo, SIGNAL(identityChanged(uint)), SLOT(identityChanged(uint)) ); -} - -void ComposerView::qmlLoaded ( QDeclarativeView::Status status ) -{ - if ( status != QDeclarativeView::Ready ) - return; - - Q_ASSERT( m_composerBase ); - Q_ASSERT( m_composerBase->editor() ); - Q_ASSERT( m_composerBase->identityCombo() ); - Q_ASSERT( m_composerBase->recipientsEditor() ); - Q_ASSERT( m_composerBase->transportComboBox() ); - Q_ASSERT( m_composerBase->attachmentModel() ); - Q_ASSERT( m_composerBase->attachmentController() ); - -// kDebug() << m_identityCombo; -// kDebug() << m_editor; - - MessageComposer::SignatureController *signatureController = new MessageComposer::SignatureController( this ); - signatureController->setEditor( m_composerBase->editor() ); - signatureController->setIdentityCombo( m_composerBase->identityCombo() ); - signatureController->suspend(); // ComposerView::identityChanged will update the signature - m_composerBase->setSignatureController( signatureController ); - - if ( MessageComposer::MessageComposerSettings::self()->autoTextSignature() == QLatin1String( "auto" ) && m_mayAutoSign ) { - if ( MessageComposer::MessageComposerSettings::self()->prependSignature() ) { - QTimer::singleShot( 0, m_composerBase->signatureController(), SLOT(prependSignature()) ); - } else { - QTimer::singleShot( 0, m_composerBase->signatureController(), SLOT(appendSignature()) ); - } - } - - connect( actionCollection()->action( QLatin1String("composer_clean_spaces") ), SIGNAL(triggered(bool)), signatureController, SLOT(cleanSpace()) ); - connect( actionCollection()->action( QLatin1String("composer_append_signature") ), SIGNAL(triggered(bool)), signatureController, SLOT(appendSignature()) ); - connect( actionCollection()->action( QLatin1String("composer_prepend_signature") ), SIGNAL(triggered(bool)), signatureController, SLOT(prependSignature()) ); - connect( actionCollection()->action( QLatin1String("composer_insert_signature") ), SIGNAL(triggered(bool)), signatureController, SLOT(insertSignatureAtCursor()) ); - - toggleAutomaticWordWrap( actionCollection()->action( QLatin1String("options_wordwrap") )->isChecked() ); - toggleUseFixedFont( actionCollection()->action( QLatin1String("options_fixedfont") )->isChecked() ); - - m_composerBase->recipientsEditor()->setAutoResizeView( true ); - - connect( m_composerBase->recipientsEditor(), SIGNAL(lineAdded(KPIM::MultiplyingLine*)), - SIGNAL(recipientsCountChanged()) ); - connect( m_composerBase->recipientsEditor(), SIGNAL(lineDeleted(int)), - SIGNAL(recipientsCountChanged()) ); - - m_snippetsEditor->setEditor( m_composerBase->editor(), "insertPlainText", SIGNAL(insertSnippet()) ); - - if ( m_message ) - setMessage( m_message, m_mayAutoSign ); - - connect( MailTransport::TransportManager::self(), SIGNAL(transportsChanged()), SLOT(transportsChanged()) ); -} - -void ComposerView::setMessage(const KMime::Message::Ptr& msg, bool mayAutoSign) -{ - m_message = msg; - m_mayAutoSign = mayAutoSign; - if ( status() != QDeclarativeView::Ready ) - return; - - m_subject = msg->subject()->asUnicodeString(); - m_composerBase->setMessage( msg ); - - //###: See comment in setAutoSaveFileName - if ( !m_fileName.isEmpty() ) - m_composerBase->setAutoSaveFileName( m_fileName ); - - emit changed(); -} - -void ComposerView::send( MessageComposer::MessageSender::SendMethod method, MessageComposer::MessageSender::SaveIn saveIn ) -{ - kDebug(); - - if ( !m_composerBase->editor()->checkExternalEditorFinished() ) - return; - - if ( m_composerBase->recipientsEditor()->recipients().isEmpty() - && saveIn != MessageComposer::MessageSender::SaveInDrafts && saveIn != MessageComposer::MessageSender::SaveInTemplates ) { - KMessageBox::sorry( this, - i18n("You should specify at least one recipient for this message."), - i18n("No recipients found")); - return; - } - - if ( m_subject.isEmpty() && saveIn != MessageComposer::MessageSender::SaveInDrafts && saveIn != MessageComposer::MessageSender::SaveInTemplates ) { - const int rc = KMessageBox::questionYesNo( this, - i18n("You did not specify a subject. Do you want to send the message without specifying one?"), - i18n("No subject")); - if ( rc == KMessageBox::No) { - return; - } - } - - m_composerBase->setSubject( m_subject ); //needed by checkForMissingAttachments - - if ( Settings::self()->composerDetectMissingAttachments() && m_composerBase->checkForMissingAttachments( MessageComposer::Util::AttachmentKeywords() ) ) { - return; - } - - setBusy(true); - - const KPIMIdentities::Identity identity = m_composerBase->identityManager()->identityForUoidOrDefault( m_composerBase->identityCombo()->currentIdentity() ); - m_composerBase->setFrom( identity.fullEmailAddr() ); - m_composerBase->setReplyTo( identity.replyToAddr() ); - - if ( !identity.fcc().isEmpty() ) { - const Akonadi::Collection customSentFolder( identity.fcc().toLongLong() ); - m_composerBase->setFcc( customSentFolder ); - } - - m_composerBase->setCryptoOptions( m_sign, m_encrypt, m_cryptoFormat ); - - // Default till UI exists - // m_composerBase->setCharsets( ); - m_composerBase->setUrgent( m_urgent ); - m_composerBase->setMDNRequested( m_mdnRequested ); - - m_composerBase->send( method, saveIn ); -} - -QString ComposerView::subject() const -{ - return m_subject; -} - -void ComposerView::setSubject ( const QString& subject ) -{ - m_subject = subject; - - if ( !subject.isEmpty() ) - setWindowTitle( subject ); - else - setWindowTitle( i18n( "New mail" ) ); -} - -bool ComposerView::busy() const -{ - return m_busy; -} - -void ComposerView::setBusy(bool busy) -{ - if (m_busy == busy) - return; - - m_busy = busy; - emit busyChanged(); -} - -QObject* ComposerView::getAction( const QString &name ) const -{ - kDebug() << actionCollection() << actionCollection()->action( name ); - return actionCollection()->action( name ); -} - -void ComposerView::configureIdentity() -{ - KCMultiDialog dlg; - dlg.addModule( QLatin1String("kcm_kpimidentities") ); - dlg.currentPage()->setHeader( QLatin1String( "" ) ); // hide header to save space - dlg.setButtons( KDialog::Ok | KDialog::Cancel ); - dlg.exec(); -} - -void ComposerView::sendSuccessful() -{ - // Removed successfully sent messages from autosave - m_composerBase->cleanupAutoSave(); - deleteLater(); -} - -void ComposerView::configureTransport() -{ - KCMultiDialog dlg; - dlg.addModule( QLatin1String("kcm_mailtransport") ); - dlg.currentPage()->setHeader( QLatin1String( "" ) ); // hide header to save space - dlg.setButtons( KDialog::Ok | KDialog::Cancel ); - dlg.exec(); -} - -void ComposerView::addAttachment(KMime::Content* part) -{ - if ( part ) { - m_composerBase->addAttachmentPart( part ); - } -} - -void ComposerView::success() -{ - if (m_draft) { - m_draft = false; - return; - } -} - -void ComposerView::failed( const QString &errorMessage ) -{ - QPixmap pix = KIcon(QLatin1String("kmail-mobile")).pixmap(KIconLoader::SizeSmall, KIconLoader::SizeSmall); - KNotification *notify = new KNotification(QLatin1String("sendfailed")); - notify->setComponentData(KComponentData("kmail-mobile")); - notify->setPixmap(pix); - notify->setText(i18nc("Notification when there was an error while trying to send an email", - "Error while trying to send email. %1", errorMessage)); - notify->sendEvent(); - setBusy( false ); -} - -void ComposerView::transportsChanged() -{ - if ( m_composerBase->transportComboBox() ) - m_composerBase->transportComboBox()->setCurrentTransport( MailTransport::TransportManager::self()->defaultTransportId() ); -} - -void ComposerView::identityChanged( uint newIdentity ) -{ - const KPIMIdentities::Identity identity = MobileKernel::self()->identityManager()->identityForUoid( newIdentity ); - const KPIMIdentities::Identity oldIdentity = MobileKernel::self()->identityManager()->identityForUoid( m_currentIdentity ); - m_composerBase->identityChanged( identity, oldIdentity ); - - if ( !identity.isNull() && !identity.transport().isEmpty() ) { - if ( m_composerBase->transportComboBox() ) - m_composerBase->transportComboBox()->setCurrentTransport( identity.transport().toInt() ); - } - - m_currentIdentity = newIdentity; -} - -void ComposerView::setEditor( MessageComposer::KMeditor* editor ) -{ - new ComposerAutoResizer(editor); - m_composerBase->setEditor( editor ); - m_composerBase->editor()->createActions( actionCollection() ); - m_composerBase->editor()->setAutocorrection(MobileKernel::self()->composerAutoCorrection()); - connect( actionCollection()->action( QLatin1String("composer_add_quote_char") ), SIGNAL(triggered(bool)), m_composerBase->editor(), SLOT(slotAddQuotes()) ); - connect( actionCollection()->action( QLatin1String("composer_remove_quote_char") ), SIGNAL(triggered(bool)), m_composerBase->editor(), SLOT(slotRemoveQuotes()) ); - connect( actionCollection()->action( QLatin1String("composer_spell_check") ), SIGNAL(triggered(bool)), m_composerBase->editor(), SLOT(checkSpelling()) ); - connect( actionCollection()->action( QLatin1String("composer_search") ), SIGNAL(triggered(bool)), m_composerBase->editor(), SLOT(slotFind()) ); - connect( actionCollection()->action( QLatin1String("composer_search_next") ), SIGNAL(triggered(bool)), m_composerBase->editor(), SLOT(slotFindNext()) ); - connect( actionCollection()->action( QLatin1String("composer_replace") ), SIGNAL(triggered(bool)), m_composerBase->editor(), SLOT(slotReplace()) ); -} - -void ComposerView::setRecipientsEditor( MessageComposer::RecipientsEditor *editor ) -{ - m_composerBase->setRecipientsEditor( editor ); -} - -void ComposerView::closeEvent( QCloseEvent * event ) -{ - if ( m_composerBase->editor()->document()->isModified() || m_composerBase->recipientsEditor()->isModified() || !m_subject.isEmpty() ) { - const QString saveButton = i18n("&Save as Draft"); - const QString saveText = i18n("Save this message in the Drafts folder. "); - - const int rc = KMessageBox::warningYesNoCancel( this, - i18n("Do you want to save the message for later or discard it?"), - i18n("Close Composer"), - KGuiItem(saveButton, QLatin1String("document-save"), QString(), saveText), - KStandardGuiItem::discard(), - KStandardGuiItem::cancel() ); - - if ( rc == KMessageBox::Yes ) { - connect( m_composerBase, SIGNAL(sentSuccessfully()), this, SLOT(deleteLater()) ); - saveDraft(); - event->ignore(); - return; - } else if (rc == KMessageBox::Cancel ) { - event->ignore(); - return; - } else { - // remove autosaves if the message was discarded - m_composerBase->cleanupAutoSave(); - } - } else { - // discard empty autosave files as well - m_composerBase->cleanupAutoSave(); - } - - event->accept(); -} - -void ComposerView::sendLater() -{ - const MessageComposer::MessageSender::SendMethod method = MessageComposer::MessageSender::SendLater; - const MessageComposer::MessageSender::SaveIn saveIn = MessageComposer::MessageSender::SaveInNone; - send ( method, saveIn ); -} - -void ComposerView::saveDraft() -{ - const MessageComposer::MessageSender::SendMethod method = MessageComposer::MessageSender::SendLater; - const MessageComposer::MessageSender::SaveIn saveIn = MessageComposer::MessageSender::SaveInDrafts; - m_draft = true; - send ( method, saveIn ); -} - -void ComposerView::saveAsTemplate() -{ - const MessageComposer::MessageSender::SendMethod method = MessageComposer::MessageSender::SendLater; - const MessageComposer::MessageSender::SaveIn saveIn = MessageComposer::MessageSender::SaveInTemplates; - send ( method, saveIn ); -} - -bool ComposerView::isSigned() const -{ - return m_sign; -} - -bool ComposerView::isEncrypted() const -{ - return m_encrypt; -} - -bool ComposerView::tooManyRecipients() const -{ - const int threshold = Settings::self()->recipientThreshold(); - return (recipientsCount() > threshold); -} - -int ComposerView::recipientsCount() const -{ - if ( !Settings::self()->tooManyRecipients() ) - return 0; - - if ( !m_composerBase->recipientsEditor() ) - return 0; - - return m_composerBase->recipientsEditor()->recipients().count(); -} - -void ComposerView::setIdentity( uint identity ) -{ - // cache the value here, because the QML identity combobox has not been created yet - m_presetIdentity = identity; -} - -void ComposerView::signEmail( bool sign ) -{ - m_sign = sign; - emit cryptoStateChanged(); -} - -void ComposerView::encryptEmail( bool encrypt ) -{ - m_encrypt = encrypt; - emit cryptoStateChanged(); -} - -void ComposerView::toggleUseFixedFont( bool use ) -{ - m_composerBase->editor()->setFontForWholeText( use ? KGlobalSettings::fixedFont() : KGlobalSettings::generalFont() ); -} - -void ComposerView::toggleAutomaticWordWrap( bool use ) -{ - if ( use ) - m_composerBase->editor()->enableWordWrap( MessageComposer::MessageComposerSettings::self()->lineWrapWidth() ); - else - m_composerBase->editor()->disableWordWrap(); -} - -void ComposerView::setCryptoFormat() -{ - CryptoFormatSelectionDialog dlg( this ); - dlg.setCryptoFormat( m_cryptoFormat ); - - if ( dlg.exec() ) - m_cryptoFormat = dlg.cryptoFormat(); -} - -void ComposerView::enableHtml() -{ - m_composerBase->editor()->enableRichTextMode(); - m_composerBase->editor()->updateActionStates(); - m_composerBase->editor()->setActionsEnabled( true ); -} - -void ComposerView::disableHtml( MessageComposer::ComposerViewBase::Confirmation confirmation ) -{ - if ( confirmation == MessageComposer::ComposerViewBase::LetUserConfirm && m_composerBase->editor()->isFormattingUsed() ) { - int choice = KMessageBox::warningContinueCancel( this, i18n( "Turning HTML mode off " - "will cause the text to lose the formatting. Are you sure?" ), - i18n( "Lose the formatting?" ), KGuiItem( i18n( "Lose Formatting" ) ), KStandardGuiItem::cancel(), - QLatin1String("LoseFormattingWarning") ); - if ( choice != KMessageBox::Continue ) { - enableHtml(); - return; - } - } - - m_composerBase->editor()->switchToPlainText(); - m_composerBase->editor()->setActionsEnabled( false ); -} - -void ComposerView::setAutoSaveFileName(const QString &fileName) -{ - m_fileName = fileName; - //###: the idea is to set the filename directly in ComposerViewBase, - // but it is not working as expected yet. - //m_composerBase->setAutoSaveFileName( fileName ); -} - - -#include "composerview.moc" - diff --git a/kdepim/mobile/mail/composerview.h b/kdepim/mobile/mail/composerview.h deleted file mode 100644 index 35d0dd63..00000000 --- a/kdepim/mobile/mail/composerview.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 COMPOSERVIEW_H -#define COMPOSERVIEW_H - -#include "kdeclarativefullscreenview.h" -#include -#include -#include -#include - - -namespace KPIMIdentities -{ - class IdentityCombo; -} - -namespace Message -{ - class KMeditor; -} - -namespace MessageComposer -{ - class RecipientsEditor; -} - -class SnippetsEditor; - -/** The new KMMainWidget ;-) */ -class ComposerView : public KDeclarativeFullScreenView -{ - Q_OBJECT - Q_PROPERTY( QString subject READ subject WRITE setSubject NOTIFY changed ) - Q_PROPERTY( bool busy READ busy WRITE setBusy NOTIFY busyChanged ) - Q_PROPERTY( bool isSigned READ isSigned NOTIFY cryptoStateChanged ) - Q_PROPERTY( bool isEncrypted READ isEncrypted NOTIFY cryptoStateChanged ) - Q_PROPERTY( bool tooManyRecipients READ tooManyRecipients NOTIFY recipientsCountChanged ) - Q_PROPERTY( int recipientsCount READ recipientsCount NOTIFY recipientsCountChanged ) - - public: - explicit ComposerView(QWidget* parent = 0); - - void setIdentityCombo( KPIMIdentities::IdentityCombo* combo ); - - void setEditor( MessageComposer::KMeditor* editor ); - void setRecipientsEditor( MessageComposer::RecipientsEditor *editor ); - - QString subject() const; - void setSubject( const QString &subject ); - - bool busy() const; - void setBusy(bool busy); - void setAutoSaveFileName(const QString &fileName); - - bool isSigned() const; - bool isEncrypted() const; - - bool tooManyRecipients() const; - int recipientsCount() const; - - void setIdentity( uint ); - - public slots: - void setMessage( const KMime::Message::Ptr &msg, bool mayAutoSign = true ); - QObject* getAction( const QString &name ) const; - - /// Send clicked in the user interface - void send( MessageComposer::MessageSender::SendMethod method = MessageComposer::MessageSender::SendDefault, - MessageComposer::MessageSender::SaveIn saveIn = MessageComposer::MessageSender::SaveInNone ); - - void configureIdentity(); - void configureTransport(); - void sendSuccessful(); - - void enableHtml(); - void disableHtml( MessageComposer::ComposerViewBase::Confirmation confirmation ); - void addAttachment( KMime::Content* part ); - - signals: - void changed(); - void busyChanged(); - void cryptoStateChanged(); - void recipientsCountChanged(); - - private slots: - void qmlLoaded ( QDeclarativeView::Status ); - void success(); - void failed( const QString &errorMessage ); - void transportsChanged(); - void identityChanged( uint ); - - void signEmail( bool sign ); - void encryptEmail( bool encrypt ); - void urgentEmail ( bool urgent ) { m_urgent = urgent; } - void requestMdn( bool value ) { m_mdnRequested = value; } - - void toggleUseFixedFont( bool ); - void toggleAutomaticWordWrap( bool ); - void setCryptoFormat(); - - void sendLater(); - void saveDraft(); - void saveAsTemplate(); - - protected: - void doDelayedInit(); - void closeEvent ( QCloseEvent * event ); - - private: - MessageComposer::ComposerViewBase* m_composerBase; - QString m_subject; - KMime::Message::Ptr m_message; - int m_jobCount; - bool m_sign; - bool m_encrypt; - bool m_busy; - bool m_draft; - bool m_urgent; - bool m_mdnRequested; - QString m_fileName; - SnippetsEditor *m_snippetsEditor; - Kleo::CryptoMessageFormat m_cryptoFormat; - uint m_presetIdentity; - uint m_currentIdentity; - bool m_mayAutoSign; -}; - -#endif diff --git a/kdepim/mobile/mail/configwidget.cpp b/kdepim/mobile/mail/configwidget.cpp deleted file mode 100644 index 1a9692a5..00000000 --- a/kdepim/mobile/mail/configwidget.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 "messagecomposer/settings/messagecomposersettings.h" -#include "messagelistsettings.h" -#include "messageviewer/settings/globalsettings.h" -#include "settings.h" -#include "stylesheetloader.h" -#include "templateparser/globalsettings_base.h" -#include "ui_configwidget.h" - -#include -#include -#include -#include -#include - -#include - -using namespace MessageComposer; - -ConfigWidget::ConfigWidget( QWidget *parent ) - : QWidget( parent ) -{ - Ui_ConfigWidget ui; - ui.setupUi( this ); - - ui.kcfg_ComposerTemplatesNewMessage->setProperty( "kcfg_property", QByteArray( "plainText" ) ); - ui.kcfg_ComposerTemplatesReplyToSender->setProperty( "kcfg_property", QByteArray( "plainText" ) ); - ui.kcfg_ComposerTemplatesReplyToAll->setProperty( "kcfg_property", QByteArray( "plainText" ) ); - ui.kcfg_ComposerTemplatesForwardMessage->setProperty( "kcfg_property", QByteArray( "plainText" ) ); - - { - QLineEdit *lineEdit = ui.kcfg_ComposerWordWrapColumn->findChild(); - if ( lineEdit ) - lineEdit->setReadOnly( true ); - } - - mManager = new KConfigDialogManager( this, Settings::self() ); - - connect( ui.configureCompletionOrderButton, SIGNAL(clicked()), - this, SLOT(configureCompletionOrder()) ); - connect( ui.editRecentAddressesButton, SIGNAL(clicked()), - this, SLOT(editRecentAddresses()) ); - - ui.howDoesThisWorkLabel->setText( i18n( "How does this work?" ) ); - connect( ui.howDoesThisWorkLabel, SIGNAL(linkActivated(QString)), - this, SIGNAL(showTemplatesHelp()) ); - - ui.helpLabel->setVisible( false ); -} - -void ConfigWidget::load() -{ - loadFromExternalSettings(); - mManager->updateWidgets(); -} - -void ConfigWidget::save() -{ - mManager->updateSettings(); - saveToExternalSettings(); - - emit configChanged(); -} - -void ConfigWidget::configureCompletionOrder() -{ - KLDAP::LdapClientSearch search; - KPIM::CompletionOrderEditor editor( &search, 0 ); - editor.exec(); -} - -void ConfigWidget::editRecentAddresses() -{ - KPIM::RecentAddressDialog dlg( 0 ); - dlg.setAddresses( KPIM::RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->addresses() ); - if ( dlg.exec() ) { - KPIM::RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->clear(); - foreach ( const QString &address, dlg.addresses() ) { - KPIM::RecentAddresses::self( MessageComposer::MessageComposerSettings::self()->config() )->add( address ); - } - } -} - -void ConfigWidget::loadFromExternalSettings() -{ - // Appearance - Settings::self()->setAppearanceShowHtmlStatusBar( MessageViewer::GlobalSettings::showColorBar() ); - Settings::self()->setAppearanceReplaceSmileys( MessageViewer::GlobalSettings::showEmoticons() ); - Settings::self()->setAppearanceReduceQuotedFontSize( MessageViewer::GlobalSettings::shrinkQuotes() ); - - // Composer - Settings::self()->setComposerInsertSignature( MessageComposerSettings::self()->autoTextSignature() == QLatin1String( "auto" ) ); - Settings::self()->setComposertInsertSignatureAboveQuote( MessageComposerSettings::self()->prependSignature() ); - Settings::self()->setComposerPrependSeparator( MessageComposerSettings::self()->dashDashSignature() ); - Settings::self()->setComposerUseSmartQuoting( TemplateParser::GlobalSettings::self()->smartQuote() ); - Settings::self()->setComposerUseRecentAddressCompletion( MessageComposerSettings::self()->showRecentAddressesInComposer() ); - Settings::self()->setComposerWordWrapAtColumn( MessageComposerSettings::self()->wordWrap() ); - Settings::self()->setComposerWordWrapColumn( MessageComposerSettings::self()->lineWrapWidth() ); - Settings::self()->setComposerReplaceReplyPrefixes( MessageComposerSettings::self()->replaceReplyPrefix() ); - Settings::self()->setComposerReplaceForwardPrefixes( MessageComposerSettings::self()->replaceForwardPrefix() ); - Settings::self()->setComposerOutlookCompatibleNaming( MessageComposerSettings::self()->outlookCompatibleAttachments() ); - Settings::self()->setComposerTemplatesNewMessage( TemplateParser::GlobalSettings::self()->templateNewMessage() ); - Settings::self()->setComposerTemplatesReplyToSender( TemplateParser::GlobalSettings::self()->templateReply() ); - Settings::self()->setComposerTemplatesReplyToAll( TemplateParser::GlobalSettings::self()->templateReplyAll() ); - Settings::self()->setComposerTemplatesForwardMessage( TemplateParser::GlobalSettings::self()->templateForward() ); - - // Invitations - Settings::self()->setInvitationsOutlookCompatible( MessageViewer::GlobalSettings::self()->legacyMangleFromToHeaders() && - MessageViewer::GlobalSettings::self()->legacyBodyInvites() && - MessageViewer::GlobalSettings::self()->exchangeCompatibleInvitations() && - MessageViewer::GlobalSettings::self()->outlookCompatibleInvitationReplyComments() && - MessageViewer::GlobalSettings::self()->outlookCompatibleInvitationComparisons() ); - Settings::self()->setInvitationsAutomaticSending( MessageViewer::GlobalSettings::self()->automaticSending() ); - Settings::self()->setInvitationsDeleteAfterReply( MessageViewer::GlobalSettings::self()->deleteInvitationEmailsAfterSendingReply() ); - - // MDN - Settings::self()->setMDNPolicy( MessageViewer::GlobalSettings::self()->defaultPolicy() ); - Settings::self()->setMDNQuoteType( MessageViewer::GlobalSettings::self()->quoteMessage() ); -} - -void ConfigWidget::saveToExternalSettings() -{ - // Appearance - MessageViewer::GlobalSettings::self()->setShowColorBar( Settings::self()->appearanceShowHtmlStatusBar() ); - MessageViewer::GlobalSettings::self()->setShowEmoticons( Settings::self()->appearanceReplaceSmileys() ); - MessageViewer::GlobalSettings::self()->setShrinkQuotes( Settings::self()->appearanceReduceQuotedFontSize() ); - - // Composer - MessageComposerSettings::self()->setAutoTextSignature( Settings::self()->composerInsertSignature() ? QLatin1String("auto") : QLatin1String("manual") ); - MessageComposerSettings::self()->setPrependSignature( Settings::self()->composertInsertSignatureAboveQuote() ); - MessageComposerSettings::self()->setDashDashSignature( Settings::self()->composerPrependSeparator() ); - TemplateParser::GlobalSettings::self()->setSmartQuote( Settings::self()->composerUseSmartQuoting() ); - MessageComposerSettings::self()->setShowRecentAddressesInComposer( Settings::self()->composerUseRecentAddressCompletion() ); - MessageComposerSettings::self()->setWordWrap( Settings::self()->composerWordWrapAtColumn() ); - MessageComposerSettings::self()->setLineWrapWidth( Settings::self()->composerWordWrapColumn() ); - MessageComposerSettings::self()->setReplaceReplyPrefix( Settings::self()->composerReplaceReplyPrefixes() ); - MessageComposerSettings::self()->setReplaceForwardPrefix( Settings::self()->composerReplaceForwardPrefixes() ); - MessageComposerSettings::self()->setOutlookCompatibleAttachments( Settings::self()->composerOutlookCompatibleNaming() ); - TemplateParser::GlobalSettings::self()->setTemplateNewMessage( Settings::self()->composerTemplatesNewMessage() ); - TemplateParser::GlobalSettings::self()->setTemplateReply( Settings::self()->composerTemplatesReplyToSender() ); - TemplateParser::GlobalSettings::self()->setTemplateReplyAll( Settings::self()->composerTemplatesReplyToAll() ); - TemplateParser::GlobalSettings::self()->setTemplateForward( Settings::self()->composerTemplatesForwardMessage() ); - - // Invitations - MessageViewer::GlobalSettings::self()->setLegacyMangleFromToHeaders( Settings::self()->invitationsOutlookCompatible() ); - MessageViewer::GlobalSettings::self()->setLegacyBodyInvites( Settings::self()->invitationsOutlookCompatible() ); - MessageViewer::GlobalSettings::self()->setExchangeCompatibleInvitations( Settings::self()->invitationsOutlookCompatible() ); - MessageViewer::GlobalSettings::self()->setOutlookCompatibleInvitationReplyComments( Settings::self()->invitationsOutlookCompatible() ); - MessageViewer::GlobalSettings::self()->setOutlookCompatibleInvitationComparisons( Settings::self()->invitationsOutlookCompatible() ); - MessageViewer::GlobalSettings::self()->setAutomaticSending( Settings::self()->invitationsAutomaticSending() ); - MessageViewer::GlobalSettings::self()->setDeleteInvitationEmailsAfterSendingReply( Settings::self()->invitationsDeleteAfterReply() ); - - // MDN - MessageViewer::GlobalSettings::self()->setDefaultPolicy( Settings::self()->mDNPolicy() ); - MessageViewer::GlobalSettings::self()->setQuoteMessage( Settings::self()->mDNQuoteType() ); - - Settings::self()->writeConfig(); - MessageViewer::GlobalSettings::self()->writeConfig(); - TemplateParser::GlobalSettings::self()->writeConfig(); -} - - -DeclarativeConfigWidget::DeclarativeConfigWidget( QGraphicsItem *parent ) - : DeclarativeWidgetBase( parent ) -{ - connect( this, SIGNAL(configChanged()), widget(), SIGNAL(configChanged()) ); -} - -DeclarativeConfigWidget::~DeclarativeConfigWidget() -{ -} - -void DeclarativeConfigWidget::load() -{ - widget()->load(); -} - -void DeclarativeConfigWidget::save() -{ - widget()->save(); -} - diff --git a/kdepim/mobile/mail/configwidget.h b/kdepim/mobile/mail/configwidget.h deleted file mode 100644 index a1c43c02..00000000 --- a/kdepim/mobile/mail/configwidget.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 -#include - -class KConfigDialogManager; - -class ConfigWidget : public QWidget -{ - Q_OBJECT - - public: - explicit ConfigWidget( QWidget *parent = 0 ); - - public Q_SLOTS: - void load(); - void save(); - - private Q_SLOTS: - void configureCompletionOrder(); - void editRecentAddresses(); - - Q_SIGNALS: - void configChanged(); - void showTemplatesHelp(); - - private: - void loadFromExternalSettings(); - void saveToExternalSettings(); - - KConfigDialogManager *mManager; -}; - -class DeclarativeConfigWidget : -#ifndef Q_MOC_RUN -public DeclarativeWidgetBase -#else -public QGraphicsProxyWidget -#endif -{ - Q_OBJECT - - public: - explicit DeclarativeConfigWidget( QGraphicsItem *parent = 0 ); - ~DeclarativeConfigWidget(); - - public Q_SLOTS: - void load(); - void save(); - - Q_SIGNALS: - void configChanged(); - - private: - ConfigWidget *mConfigWidget; -}; - -#endif diff --git a/kdepim/mobile/mail/configwidget.ui b/kdepim/mobile/mail/configwidget.ui deleted file mode 100644 index e2c6d8e8..00000000 --- a/kdepim/mobile/mail/configwidget.ui +++ /dev/null @@ -1,651 +0,0 @@ - - - ConfigWidget - - - - 0 - 0 - 450 - 1452 - - - - - - - - - - 75 - true - - - - Appearance - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - Show HTML statusbar - - - - - - - Replace smileys by emoticons - - - - - - - Reduce font size for quoted text - - - - - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - 75 - true - - - - Composer - - - - - - - - - Automatically insert signature - - - - - - - Insert signature above quoted text - - - - - - - Prepend separator to signature - - - - - - - Use smart quoting - - - - - - - Automatically request MDN - - - - - - - Use recent addresses for autocompletion - - - - - - - - - Word wrap at column - - - - - - - false - - - 30 - - - 998 - - - 78 - - - - - - - - - Configure completion order - - - - - - - Edit recent addresses - - - - - - - - - - - Replace recognized reply prefixes - - - - - - - Replace recognized forward prefixes - - - - - - - Outlook compatible attachment naming - - - - - - - Enable detection of missing attachments - - - - - - - - - - - - 75 - true - - - - Templates - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - New Message: - - - - - - - - 0 - 0 - - - - - 16777215 - 80 - - - - QTextEdit::NoWrap - - - false - - - - - - - - 0 - 0 - - - - - 16777215 - 80 - - - - QTextEdit::NoWrap - - - false - - - - - - - Reply to All / Reply to List: - - - - - - - - 0 - 0 - - - - - 16777215 - 80 - - - - QTextEdit::NoWrap - - - false - - - - - - - Forward Message: - - - - - - - - 0 - 0 - - - - - 16777215 - 80 - - - - QTextEdit::NoWrap - - - false - - - - - - - - - How does this work? - - - Qt::TextBrowserInteraction - - - - - - - - - - - - - - - - Reply to Sender: - - - - - - - - - - - - - - 75 - true - - - - Invitations - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - - - Outlook compatible invitations - - - - - - - Automatic invitation sending - - - - - - - Delete invitation emails after the reply -to them has been sent - - - - - - - - - - - - - - 75 - true - - - - Misc - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - Empty local trash folder on program exit - - - - - - - - - Close to quota threshold: - - - - - - - % - - - 1 - - - 100 - - - - - - - - - - - - - - 75 - true - - - - Message Disposition Notifications - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - Send policy: - - - - - - - - Ignore - - - - - Ask - - - - - Deny - - - - - Always send - - - - - - - - Quote original message: - - - - - - - - Nothing - - - - - Full message - - - - - Only headers - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 40 - - - - - - - - - KTextEdit - QTextEdit -
ktextedit.h
-
-
- - - - kcfg_ComposerWordWrapAtColumn - toggled(bool) - kcfg_ComposerWordWrapColumn - setEnabled(bool) - - - 155 - 382 - - - 222 - 379 - - - - -
diff --git a/kdepim/mobile/mail/cryptoformatselectiondialog.cpp b/kdepim/mobile/mail/cryptoformatselectiondialog.cpp deleted file mode 100644 index edf6f4a9..00000000 --- a/kdepim/mobile/mail/cryptoformatselectiondialog.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "cryptoformatselectiondialog.h" - -#include -#include - -CryptoFormatSelectionDialog::CryptoFormatSelectionDialog( QWidget *parent ) - : KDialog( parent ) -{ - setButtons( Ok | Cancel ); - - mCryptoFormatCombo = new KComboBox; - setMainWidget( mCryptoFormatCombo ); - - for ( int i = 0; i < numCryptoMessageFormats; ++i ) { - if ( cryptoMessageFormats[ i ] != Kleo::InlineOpenPGPFormat ) // deprecated - mCryptoFormatCombo->addItem( Kleo::cryptoMessageFormatToLabel( cryptoMessageFormats[ i ] ), static_cast( cryptoMessageFormats[ i ] ) ); - } -} - -CryptoFormatSelectionDialog::~CryptoFormatSelectionDialog() -{ -} - -void CryptoFormatSelectionDialog::setCryptoFormat( Kleo::CryptoMessageFormat format ) -{ - mCryptoFormatCombo->setCurrentIndex( mCryptoFormatCombo->findData( static_cast( format ) ) ); -} - -Kleo::CryptoMessageFormat CryptoFormatSelectionDialog::cryptoFormat() const -{ - return static_cast( mCryptoFormatCombo->itemData( mCryptoFormatCombo->currentIndex() ).toInt() ); -} diff --git a/kdepim/mobile/mail/cryptoformatselectiondialog.h b/kdepim/mobile/mail/cryptoformatselectiondialog.h deleted file mode 100644 index 1601ec4a..00000000 --- a/kdepim/mobile/mail/cryptoformatselectiondialog.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 CRYPTOFORMATSELECTIONDIALOG_H -#define CRYPTOFORMATSELECTIONDIALOG_H - -#include - -#include - -class KComboBox; - -/** - * @short A dialog to select a crypto format. - * - * This dialog is used to select a crypto format - * for the message viewer. - */ -class CryptoFormatSelectionDialog : public KDialog -{ - public: - /** - * Creates a new crypto format selection dialog. - * - * @param parent The parent widget. - */ - explicit CryptoFormatSelectionDialog( QWidget *parent = 0 ); - - /** - * Destroys the crypto format selection dialog. - */ - ~CryptoFormatSelectionDialog(); - - /** - * Sets the currently selected @p crypto format. - */ - void setCryptoFormat( Kleo::CryptoMessageFormat format ); - - /** - * Returns the currently selected crypto format. - */ - Kleo::CryptoMessageFormat cryptoFormat() const; - - private: - KComboBox *mCryptoFormatCombo; -}; - -#endif diff --git a/kdepim/mobile/mail/declarativeidentitycombobox.cpp b/kdepim/mobile/mail/declarativeidentitycombobox.cpp deleted file mode 100644 index 7349d49b..00000000 --- a/kdepim/mobile/mail/declarativeidentitycombobox.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "declarativeidentitycombobox.h" -#include "mobilekernel.h" - -#include - -#include - -DeclarativeIdentityComboBox::DeclarativeIdentityComboBox ( QDeclarativeItem* parent ) : - DeclarativeWidgetBase< KPIMIdentities::IdentityCombo, ComposerView, &ComposerView::setIdentityCombo> - ( new KPIMIdentities::IdentityCombo( MobileKernel::self()->identityManager(), 0 ), parent ) -{ -} - diff --git a/kdepim/mobile/mail/declarativeidentitycombobox.h b/kdepim/mobile/mail/declarativeidentitycombobox.h deleted file mode 100644 index 24a5da83..00000000 --- a/kdepim/mobile/mail/declarativeidentitycombobox.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 DECLARATIVEIDENTITYCOMBOBOX_H -#define DECLARATIVEIDENTITYCOMBOBOX_H - -#include "declarativewidgetbase.h" -#include "composerview.h" - -#include - -class QDeclarativeItem; - -class DeclarativeIdentityComboBox : public DeclarativeWidgetBase -{ - Q_OBJECT - public: - explicit DeclarativeIdentityComboBox( QDeclarativeItem *parent = 0 ); -}; - -#endif // DECLRARATIVEIDENTITYCOMBOBOX_H - diff --git a/kdepim/mobile/mail/docs/CMakeLists.txt b/kdepim/mobile/mail/docs/CMakeLists.txt deleted file mode 100644 index 29471ce8..00000000 --- a/kdepim/mobile/mail/docs/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -install(FILES en/templateshelp.html DESTINATION ${DATA_INSTALL_DIR}/kontact-touch/en/mail/) -install(FILES de/templateshelp.html DESTINATION ${DATA_INSTALL_DIR}/kontact-touch/de/mail/) diff --git a/kdepim/mobile/mail/docs/de/templateshelp.html b/kdepim/mobile/mail/docs/de/templateshelp.html deleted file mode 100644 index 22933910..00000000 --- a/kdepim/mobile/mail/docs/de/templateshelp.html +++ /dev/null @@ -1,313 +0,0 @@ - - -

Hier können Sie Vorlagen erstellen und verwalten, die beim
- Erstellen, Antworten und Weiterleiten von Nachrichten verwendet werden.

-

Die Nachrichtenvorlagen unterstützen Ersetzungsbefehle, die zusammen mit
- den benutzerdefinierten Texten in die oberen Textfelder eingesetzt werden können.

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ursprüngliche Nachricht
BefehlBeschreibung
%QUOTEZitierter Nachrichtentext
%TEXTOriginal-Nachrichtentext
%OMSGIDNachrichtenkennung (Message ID)
%ODATEDatum
%ODATESHORTDatum im Kurzformat
%ODATEENDatum in C-Lokalisierung
%ODOWWochentag
%OTIMEUhrzeit
%OTIMELONGZeit im Langformat
%OTIMELONGENZeit im Langformat
%OTOADDRAdresse im „An“-Feld
%OTONAMEName im „An“-Feld
%OTOFNAMEVorname im „An“-Feld
%OTOLNAMENachname im „An“-Feld
%OCCADDRAdresse im „Kopie“-Feld
%OCCNAMEName im „Kopie“-Feld
%OCCFNAMEVorname im „Kopie“-Feld
%OCCLNAMENachname im „Kopie“-Feld
%OFROMADDRAdresse im „Von“-Feld
%OFROMNAMEName im „Von“-Feld
%OFROMFNAMEVorname im „Von“-Feld
%OFROMLNAMENachname im „Von“-Feld
%OADDRESSEESADDRAdressen aller Empfänger
%OFULLSUBJECTBetreff
%QHEADERSNachrichtenvorspann (als Zitat)
%HEADERSNachrichtenvorspann (unverändert)
%OHEADER=header-nameInhalt des Nachrichtenvorspanns
Aktuelle Nachricht
BefehlBeschreibung
%MSGIDNachrichtenkennung (Message ID)
%DATEDatum
%DATESHORTDatum im Kurzformat
%DATEENDatum in C-Lokalisierung
%DOWWochentag
%TIMEUhrzeit
%TIMELONGZeit im Langformat
%TIMELONGENZeit in C-Lokalisierung
%TOADDRAdresse im „An“-Feld
%TONAMEName im „An“-Feld
%TOFNAMEVorname im „An“-Feld
%TOLNAMENachname im „An“-Feld
%CCADDRAdresse im „Kopie“-Feld
%CCNAMEName im „Kopie“-Feld
%CCFNAMEVorname im „Kopie“-Feld
%CCLNAMENachname im „Kopie“-Feld
%FROMADDRAdresse im „Von“-Feld
%FROMNAMEName im „Von“-Feld
%FROMFNAMEVorname im „Von“-Feld
%FROMLNAMENachname im „Von“-Feld
%FULLSUBJECTBetreff
%HEADER=header-nameInhalt des Nachrichtenvorspanns
Mit externem Programm vorverarbeiten
BefehlBeschreibung
%SYSTEM=commandAusgabe des Programms einsetzen
%QUOTEPIPE=commandText der Originalnachricht an Programm übergeben und Ergebnis als Zitat einfügen
%TEXTPIPE=commandText der Originalnachricht an Programm übergeben und Ergebnis einfügen
%MSGPIPE=commandOriginalnachricht mit Vorspann an Programm übergeben und Ergebnis einfügen
%BODYPIPE=commandText dieser Nachricht an Programm übergeben und Ergebnis einfügen
%CLEARPIPE=commandText dieser Nachricht an Programm übergeben und durch Ergebnis ersetzen
Diverses
BefehlBeschreibung
%SIGNATURESignatur
%INSERT=file nameDateiinhalt einfügen
%-Verwerfen bis zur nächsten Zeile
%REM=commentKommentar zur Vorlage
%NOPKeine Aktion
%CLEARErzeugte Nachricht löschen
%DEBUGFehlersuche einschalten
%DEBUGOFFFehlersuche ausschalten
- - diff --git a/kdepim/mobile/mail/docs/en/templateshelp.html b/kdepim/mobile/mail/docs/en/templateshelp.html deleted file mode 100644 index a55fb338..00000000 --- a/kdepim/mobile/mail/docs/en/templateshelp.html +++ /dev/null @@ -1,313 +0,0 @@ - - -

Here you can create and manage templates to use when
- composing new messages, replies or forwarded messages.

-

The message templates support substitution commands,
- which can be used together with custom text inside the above text fields.

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Original Message
CommandDescription
%QUOTEQuoted Message Text
%TEXTMessage Text as Is
%OMSGIDMessage Id
%ODATEDate
%ODATESHORTDate in Short Format
%ODATEENDate in C Locale
%ODOWDay of Week
%OTIMETime
%OTIMELONGTime in Long Format
%OTIMELONGENTime in C Locale
%OTOADDRTo Field Address
%OTONAMETo Field Name
%OTOFNAMETo Field First Name
%OTOLNAMETo Field Last Name
%OCCADDRCC Field Address
%OCCNAMECC Field Name
%OCCFNAMECC Field First Name
%OCCLNAMECC Field Last Name
%OFROMADDRFrom Field Address
%OFROMNAMEFrom Field Name
%OFROMFNAMEFrom Field First Name
%OFROMLNAMEFrom Field Last Name
%OADDRESSEESADDRAddresses of all recipients
%OFULLSUBJECTSubject
%QHEADERSQuoted Headers
%HEADERSHeaders as Is
%OHEADER=header-nameHeader Content
Current Message
CommandDescription
%MSGIDMessage Id
%DATEDate
%DATESHORTDate in Short Format
%DATEENDate in C Locale
%DOWDay of Week
%TIMETime
%TIMELONGTime in Long Format
%TIMELONGENTime in C Locale
%TOADDRTo Field Address
%TONAMETo Field Name
%TOFNAMETo Field First Name
%TOLNAMETo Field Last Name
%CCADDRCC Field Address
%CCNAMECC Field Name
%CCFNAMECC Field First Name
%CCLNAMECC Field Last Name
%FROMADDRFrom Field Address
%FROMNAMEFrom Field Name
%FROMFNAMEFrom Field First Name
%FROMLNAMEFrom Field Last Name
%FULLSUBJECTSubject
%HEADER=header-nameHeader Content
Process with External Program
CommandDescription
%SYSTEM=commandArbitrary Command
%QUOTEPIPE=commandPipe Original Message Body and Insert Result as Quoted Text
%TEXTPIPE=commandPipe Original Message Body and Insert Result as Is
%MSGPIPE=commandPipe Original Message with Headers and Insert Result as Is
%BODYPIPE=commandPipe Current Message Body and Insert Result as Is
%CLEARPIPE=commandPipe Current Message Body and Replace with Result
Miscellaneous
CommandDescription
%SIGNATURESignature
%INSERT=file nameInsert File Content
%-Discard to Next Line
%REM=commentTemplate Comment
%NOPNo Operation
%CLEARClear Generated Message
%DEBUGTurn Debug On
%DEBUGOFFTurn Debug Off
- - diff --git a/kdepim/mobile/mail/dummy-avatar.png b/kdepim/mobile/mail/dummy-avatar.png deleted file mode 100644 index 7eff69dd..00000000 Binary files a/kdepim/mobile/mail/dummy-avatar.png and /dev/null differ diff --git a/kdepim/mobile/mail/emailsexporthandler.cpp b/kdepim/mobile/mail/emailsexporthandler.cpp deleted file mode 100644 index f29ea344..00000000 --- a/kdepim/mobile/mail/emailsexporthandler.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "emailsexporthandler.h" - -#include -#include -#include -#include -#include - -QString EmailsExportHandler::dialogText() const -{ - return i18n( "Which emails shall be exported?" ); -} - -QString EmailsExportHandler::dialogAllText() const -{ - return i18n( "All Emails" ); -} - -QString EmailsExportHandler::dialogLocalOnlyText() const -{ - return i18n( "Emails in current folder" ); -} - -QStringList EmailsExportHandler::mimeTypes() const -{ - return QStringList( KMime::Message::mimeType() ); -} - -bool EmailsExportHandler::exportItems( const Akonadi::Item::List &items ) -{ - QList messages; - - foreach ( const Akonadi::Item &item, items ) { - if ( item.hasPayload() ) - messages << item.payload(); - } - - const QString fileName = KFileDialog::getSaveFileName( KUrl( QLatin1String( "emails.mbox" ) ), QLatin1String( "*.mbox" ) ); - if ( fileName.isEmpty() ) // user canceled export - return true; - - KMBox::MBox mbox; - if ( !mbox.load( fileName ) ) { - KMessageBox::error( 0, i18n( "Unable to open MBox file %1", fileName ) ); - return false; - } - - foreach ( const KMime::Message::Ptr &message, messages ) { - mbox.appendMessage( message ); - } - - if ( !mbox.save() ) { - KMessageBox::error( 0, i18n( "Unable to save emails to MBox file %1", fileName ) ); - return false; - } - - return true; -} diff --git a/kdepim/mobile/mail/emailsexporthandler.h b/kdepim/mobile/mail/emailsexporthandler.h deleted file mode 100644 index 27e6edbf..00000000 --- a/kdepim/mobile/mail/emailsexporthandler.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 EMAILSEXPORTHANDLER_H -#define EMAILSEXPORTHANDLER_H - -#include "../lib/exporthandlerbase.h" - -class EmailsExportHandler : 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 diff --git a/kdepim/mobile/mail/emailsfilterproxymodel.cpp b/kdepim/mobile/mail/emailsfilterproxymodel.cpp deleted file mode 100644 index 34d5d3c1..00000000 --- a/kdepim/mobile/mail/emailsfilterproxymodel.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "emailsfilterproxymodel.h" - -#include -#include - -static bool emailMatchesFilter( const KMime::Message::Ptr &message, const QString &filterString ); - -using namespace Akonadi; - -class EmailsFilterProxyModel::Private -{ - public: - QString mFilter; -}; - -EmailsFilterProxyModel::EmailsFilterProxyModel( QObject *parent ) - : QSortFilterProxyModel( parent ), d( new Private ) -{ - setSortLocaleAware( true ); - setDynamicSortFilter( true ); -} - -EmailsFilterProxyModel::~EmailsFilterProxyModel() -{ - delete d; -} - -void EmailsFilterProxyModel::setFilterString( const QString &filter ) -{ - d->mFilter = filter; - invalidateFilter(); -} - -bool EmailsFilterProxyModel::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(); - - if ( item.hasPayload() ) { - const KMime::Message::Ptr message = item.payload(); - return emailMatchesFilter( message, d->mFilter ); - } - - return true; -} - -static bool emailMatchesFilter( const KMime::Message::Ptr &message, const QString &filterString ) -{ - if ( message->subject()->asUnicodeString().contains( filterString, Qt::CaseInsensitive ) ) - return true; - - foreach ( const KMime::Types::Mailbox &mailbox, message->from()->mailboxes() ) { - if ( mailbox.hasName() ) { - if ( mailbox.name().contains( filterString, Qt::CaseInsensitive ) ) - return true; - } else { - if ( mailbox.addrSpec().asPrettyString().contains( filterString, Qt::CaseInsensitive ) ) - return true; - } - } - - return false; -} - diff --git a/kdepim/mobile/mail/emailsfilterproxymodel.h b/kdepim/mobile/mail/emailsfilterproxymodel.h deleted file mode 100644 index 892b4cbf..00000000 --- a/kdepim/mobile/mail/emailsfilterproxymodel.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 EMAILSFILTERPROXYMODEL_H -#define EMAILSFILTERPROXYMODEL_H - -#include - -namespace Akonadi { - -/** - * @short A proxy model for \a EntityTreeModel based email models. - * - * This class provides a filter proxy model for a EntityTreeModel. - * The list of shown emails can be limited by settings a filter pattern. - * Only emails that contain this pattern as part of their data will be listed. - * - * Example: - * - * @code - * - * Akonadi::EmailsFilterProxyModel *filter = new Akonadi::EmailsFilterProxyModel; - * 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 - */ -class EmailsFilterProxyModel : public QSortFilterProxyModel -{ - Q_OBJECT - - public: - /** - * Creates a new emails filter proxy model. - * - * @param parent The parent object. - */ - explicit EmailsFilterProxyModel( QObject *parent = 0 ); - - /** - * Destroys the emails filter proxy model. - */ - ~EmailsFilterProxyModel(); - - public Q_SLOTS: - /** - * Sets the @p filter that is used to filter for matching emails. - */ - 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 diff --git a/kdepim/mobile/mail/emailsimporthandler.cpp b/kdepim/mobile/mail/emailsimporthandler.cpp deleted file mode 100644 index 7e622acd..00000000 --- a/kdepim/mobile/mail/emailsimporthandler.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "emailsimporthandler.h" - -#include -#include -#include -#include - -QString EmailsImportHandler::fileDialogNameFilter() const -{ - return QLatin1String( "*.mbox|MBox" ); -} - -QString EmailsImportHandler::fileDialogTitle() const -{ - return i18n( "Select MBox to Import" ); -} - -QString EmailsImportHandler::collectionDialogText() const -{ - return i18n( "Select the folder the imported email(s) shall be saved in:" ); -} - -QString EmailsImportHandler::collectionDialogTitle() const -{ - return i18n( "Select Folder" ); -} - -QString EmailsImportHandler::importDialogText( int count, const QString &collectionName ) const -{ - return i18np( "Importing one email to %2", "Importing %1 emails to %2", count, collectionName ); -} - -QString EmailsImportHandler::importDialogTitle() const -{ - return i18n( "Import Emails" ); -} - -QStringList EmailsImportHandler::mimeTypes() const -{ - return QStringList( KMime::Message::mimeType() ); -} - -Akonadi::Item::List EmailsImportHandler::createItems( const QStringList &fileNames, bool *ok ) -{ - *ok = true; - - Akonadi::Item::List items; - - QList messages; - - foreach ( const QString &fileName, fileNames ) { - KMBox::MBox mbox; - - if ( mbox.load( fileName ) ) { - - const KMBox::MBoxEntry::List entries = mbox.entries(); - mbox.lock(); - foreach ( const KMBox::MBoxEntry &entry, entries ) { - KMime::Message *message = mbox.readMessage( entry ); - if ( message ) - messages << KMime::Message::Ptr( message ); - } - mbox.unlock(); - } else { - const QString caption( i18n( "MBox Import Failed" ) ); - const QString msg = i18nc( "@info", - "When trying to read the MBox, there was an error opening the file %1:", - fileName ); - KMessageBox::error( 0, msg, caption ); - *ok = false; - } - } - - if ( messages.isEmpty() ) { - if ( !(*ok) && fileNames.count() > 1 ) - KMessageBox::information( 0, i18n( "No emails were imported, due to errors with the MBox." ) ); - else if ( *ok ) - KMessageBox::information( 0, i18n( "The MBox does not contain any emails." ) ); - - return items; // nothing to import - } - - foreach ( const KMime::Message::Ptr &message, messages ) { - Akonadi::Item item; - item.setPayload( message ); - item.setMimeType( KMime::Message::mimeType() ); - - items << item; - } - - return items; -} diff --git a/kdepim/mobile/mail/emailsimporthandler.h b/kdepim/mobile/mail/emailsimporthandler.h deleted file mode 100644 index 4796eb59..00000000 --- a/kdepim/mobile/mail/emailsimporthandler.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 EMAILSIMPORTHANDLER_H -#define EMAILSIMPORTHANDLER_H - -#include "../lib/importhandlerbase.h" - -class EmailsImportHandler : 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 diff --git a/kdepim/mobile/mail/filtereditor.cpp b/kdepim/mobile/mail/filtereditor.cpp deleted file mode 100644 index db47c8ac..00000000 --- a/kdepim/mobile/mail/filtereditor.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "filtereditor.h" - -#include -#include - -#include -#include - -FilterEditor::FilterEditor( KActionCollection *actionCollection, QObject *parent ) - : QObject( parent ), mFilterController( new MailCommon::FilterController( this ) ) -{ - actionCollection->addAction( QLatin1String("filtereditor_add"), mFilterController->addAction() ); - actionCollection->addAction( QLatin1String("filtereditor_edit"), mFilterController->editAction() ); - actionCollection->addAction( QLatin1String("filtereditor_delete"), mFilterController->removeAction() ); - - actionCollection->addAction( QLatin1String("filtereditor_moveup"), mFilterController->moveUpAction() ); - actionCollection->addAction( QLatin1String("filtereditor_movedown"), mFilterController->moveDownAction() ); -} - -QAbstractItemModel* FilterEditor::model() const -{ - return mFilterController->model(); -} - -void FilterEditor::setRowSelected( int row ) -{ - QItemSelectionModel *selectionModel = mFilterController->selectionModel(); - - selectionModel->select( mFilterController->model()->index( row, 0 ), QItemSelectionModel::ClearAndSelect ); -} - diff --git a/kdepim/mobile/mail/filtereditor.h b/kdepim/mobile/mail/filtereditor.h deleted file mode 100644 index b0d6722c..00000000 --- a/kdepim/mobile/mail/filtereditor.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 FILTEREDITOR_H -#define FILTEREDITOR_H - -#include - -namespace MailCommon { -class FilterController; -} - -class KActionCollection; -class QAbstractItemModel; -class QItemSelectionModel; - -/** - * @short The C++ part of the filter editor for mobile apps. - * - * This class encapsulates the logic of the filter viewing/editing - * and the UI is provided by FilterEditor.qml. - */ -class FilterEditor : public QObject -{ - Q_OBJECT - - public: - /** - * Creates a new filter editor. - * - * @param actionCollection The action collection to register the manipulation - * actions (e.g. add, edit, delete) at - * @param parent The parent object. - */ - explicit FilterEditor( KActionCollection *actionCollection, QObject *parent = 0 ); - - public Q_SLOTS: - /** - * Returns the filter list model. - */ - QAbstractItemModel* model() const; - - /** - * Sets the row of the filter the user has selected in the UI. - */ - void setRowSelected( int row ); - - private: - MailCommon::FilterController *mFilterController; -}; - -#endif diff --git a/kdepim/mobile/mail/hi48-apps-kmail-mobile.png b/kdepim/mobile/mail/hi48-apps-kmail-mobile.png deleted file mode 100644 index 8bb685d1..00000000 Binary files a/kdepim/mobile/mail/hi48-apps-kmail-mobile.png and /dev/null differ diff --git a/kdepim/mobile/mail/hi64-apps-kmail-mobile.png b/kdepim/mobile/mail/hi64-apps-kmail-mobile.png deleted file mode 100644 index 0f667cb1..00000000 Binary files a/kdepim/mobile/mail/hi64-apps-kmail-mobile.png and /dev/null differ diff --git a/kdepim/mobile/mail/hi80-apps-kmail-mobile-harmattan.png b/kdepim/mobile/mail/hi80-apps-kmail-mobile-harmattan.png deleted file mode 100644 index a2306085..00000000 Binary files a/kdepim/mobile/mail/hi80-apps-kmail-mobile-harmattan.png and /dev/null differ diff --git a/kdepim/mobile/mail/kmail-composer.qml b/kdepim/mobile/mail/kmail-composer.qml deleted file mode 100644 index 73d1b2e8..00000000 --- a/kdepim/mobile/mail/kmail-composer.qml +++ /dev/null @@ -1,167 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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.messagecomposer 4.5 as MessageComposer -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.plasma.extras 0.1 as PlasmaExtras - -KPIM.MainView { - id: root - - PlasmaExtras.ScrollArea { - id: flick - anchors.fill: parent - - flickableItem: Flickable { - - contentHeight: editorView.contentHeight; - - contentItem.children: [ - EditorView { - id: editorView - enabled: !window.busy - anchors.fill: parent - screenHeight: root.height - } - ] - } - } - - SlideoutPanelContainer { - enabled: !window.busy - anchors.fill: parent - - SlideoutPanel { - anchors.fill: parent - id: folderPanel - titleText: KDE.i18n( "Recipients" ) - handleHeight: 150 - handlePosition: 40 - content: [ - PlasmaExtras.ScrollArea { - - id: flickablerecipients - anchors.fill: parent - - flickableItem: Flickable { - contentHeight: recipientsEditor.height; - - contentItem.children: [ - Item { - id: recipientswrapper - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - - MessageComposer.RecipientsEditor { - id: recipientsEditor - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - } - } - ] - } - } - ] - } - - SlideoutPanel { - anchors.fill: parent - id: actionPanel - titleText: KDE.i18n( "Actions" ) - handleHeight: 150 - handlePosition: folderPanel.handlePosition + folderPanel.handleHeight - - Component.onCompleted: { - kmailComposerActions.showOnlyCategory( "composer" ) - actionPanel.expanded.connect( kmailComposerActions, kmailComposerActions.refresh ); - } - - content: [ - KMailComposerActions { - id : kmailComposerActions - anchors.fill : parent - - scriptActions : [ - - KPIM.ScriptAction { - name: "composer_configure_identity" - script: { - actionPanel.collapse(); - window.configureIdentity(); - } - }, - KPIM.ScriptAction { - name: "composer_configure_transport" - script: { - actionPanel.collapse(); - window.configureTransport(); - } - }, - KPIM.ScriptAction { - name: "composer_close" - script: { - actionPanel.collapse(); - window.close(); - } - } - ] - onDoCollapse : { - actionPanel.collapse(); - } - } - ] - } - - SlideoutPanel { - anchors.fill: parent - id: attachmentPanel - handleHeight: 100 - handlePosition: actionPanel.handlePosition + actionPanel.handleHeight - titleIcon: KDE.iconPath( "mail-attachment", 48 ); - contentWidth: attachmentEditorView.width - content: [ - AttachmentEditor { - id: attachmentEditorView - anchors.fill: parent - } - ] - } - } - - // ### Make it a general processing screen? - Rectangle { - id: busyView - visible: window.busy; - z: 99 - - PlasmaComponents.BusyIndicator { - anchors.centerIn: parent - running: parent.visible - } - - color: "grey" - opacity: 0.5 - anchors.fill: parent - } -} diff --git a/kdepim/mobile/mail/kmail-mobile.desktop b/kdepim/mobile/mail/kmail-mobile.desktop deleted file mode 100644 index 8260f0de..00000000 --- a/kdepim/mobile/mail/kmail-mobile.desktop +++ /dev/null @@ -1,81 +0,0 @@ -[Desktop Entry] -Version=1.0 -Name=Mail -Name[af]=Pos -Name[ar]=البريد -Name[be]=Пошта -Name[bg]=Mail -Name[br]=Lizher -Name[bs]=Elektronska pošta -Name[ca]=Correu -Name[ca@valencia]=Correu -Name[cs]=Pošta -Name[cy]=Ebost -Name[da]=E-mail -Name[de]=E-Mail -Name[el]=Αλληλογραφία -Name[en_GB]=Mail -Name[eo]=Retpoŝto -Name[es]=Correo -Name[et]=E-post -Name[eu]=Posta -Name[fa]=نامه -Name[fi]=Sähköposti -Name[fr]=Messages -Name[fy]=E-post -Name[ga]=Ríomhphost -Name[gl]=Correo electrónico -Name[he]=דוא"ל -Name[hr]=Pošta -Name[hu]=E-mail -Name[ia]=Posta -Name[is]=Póstur -Name[it]=Posta -Name[ja]=メール -Name[ka]=ფოსტა -Name[kk]=Пошта -Name[km]=សំបុត្រ -Name[ko]=이메일 -Name[lt]=Paštas -Name[lv]=Pasts -Name[mai]=डाक -Name[mk]=Е-пошта -Name[mr]=मेल -Name[ms]=Mel -Name[nb]=E-post -Name[nds]=Nettpost -Name[ne]=पत्र -Name[nl]=E-mail -Name[nn]=E-post -Name[oc]=Corrièl -Name[pa]=ਮੇਲ -Name[pl]=Poczta -Name[pt]=E-mail -Name[pt_BR]=E-mail -Name[ro]=Poștă -Name[ru]=Почта -Name[se]=E-boasta -Name[sk]=Pošta -Name[sl]=Pošta -Name[sr]=Пошта -Name[sr@ijekavian]=Пошта -Name[sr@ijekavianlatin]=Pošta -Name[sr@latin]=Pošta -Name[sv]=Brev -Name[ta]=அஞ்சல் -Name[tg]=Мактуб -Name[th]=จดหมาย -Name[tr]=E-Posta -Name[ug]=خەت -Name[uk]=Пошта -Name[uz]=Xat-xabar -Name[uz@cyrillic]=Хат-хабар -Name[wa]=Emile -Name[x-test]=xxMailxx -Name[zh_CN]=邮件 -Name[zh_TW]=郵件 -Exec=kmail-mobile - -Icon=kmail-mobile -Type=Application -Categories=Qt;KDE;Network;Email; diff --git a/kdepim/mobile/mail/kmail-mobile.ico b/kdepim/mobile/mail/kmail-mobile.ico deleted file mode 100644 index 8b133d52..00000000 Binary files a/kdepim/mobile/mail/kmail-mobile.ico and /dev/null differ diff --git a/kdepim/mobile/mail/kmail-mobile.notifyrc b/kdepim/mobile/mail/kmail-mobile.notifyrc deleted file mode 100644 index a6aa98e4..00000000 --- a/kdepim/mobile/mail/kmail-mobile.notifyrc +++ /dev/null @@ -1,180 +0,0 @@ -[Global] -IconName=mail-mobile -Comment=KDE Kontact Touch e-mail client -Comment[bs]=KDE Kontact Touch klijent za elektronsku poštu -Comment[ca]=Client de correu del Kontact Touch pel KDE -Comment[ca@valencia]=Client de correu del Kontact Touch del KDE -Comment[da]=KDE Kontact Touch e-mail-klient -Comment[de]=E-Mail-Programm für KDE Kontact Touch -Comment[el]=KDE Kontact Touch πελάτης αλληλογραφίας -Comment[en_GB]=KDE Kontact Touch e-mail client -Comment[es]=Cliente de correo KDE Kontact táctil -Comment[et]=KDE Kontact Touchi e-posti klient -Comment[fi]=KDE Kontact Touch -sähköpostiohjelma -Comment[fr]=Logiciel de courriel KDE Kontact Touch -Comment[ga]=Cliant ríomhphoist KDE Kontact Touch -Comment[gl]=Cliente de correo Touch do Kontact do KDE -Comment[hu]=KDE Kontact Touch e-mail -Comment[ia]=Cliente de e-posta de Touch de Kontact de KDE -Comment[it]=Programma per la posta elettronica di KDE Kontact Touch -Comment[ja]=KDE Kontact Touch メールクライアント -Comment[kk]=KDE Kontact Touch эл.пошта клиенті -Comment[km]=កម្មវិធី​អ៊ីមែល​របស់ Kontact Touch របស់ KDE -Comment[lt]=KDE Kontact Touch el. pašto klientas -Comment[mr]=केडीई कॉन्टेक्ट टच इ-मेल ग्राहक -Comment[nb]=KDE Kontact Touch e-postklient -Comment[nds]=Nettpostprogramm för Anröögschirm-Kontact för KDE -Comment[nl]=Aanraak-e-mailclient van KDE Kontact -Comment[pl]=Klient poczty Kontact Touch dla KDE -Comment[pt]=Cliente de e-mail do Kontact Touch para o KDE -Comment[pt_BR]=Cliente de e-mail do Kontact Touch para o KDE -Comment[ro]=Client de poștă Kontact Touch pentru KDE -Comment[ru]=Почтовый клиент KDE Kontact Touch -Comment[sk]=KDE Kontact Touch Poštový klient -Comment[sl]=KDE-jev poštni odjemalec Kontact Touch -Comment[sr]=КДЕ клијент е‑поште из Контакта додирног -Comment[sr@ijekavian]=КДЕ клијент е‑поште из Контакта додирног -Comment[sr@ijekavianlatin]=KDE klijent e‑pošte iz Kontacta dodirnog -Comment[sr@latin]=KDE klijent e‑pošte iz Kontacta dodirnog -Comment[sv]=KDE Kontact Touch e-postklient -Comment[tr]=KDE Kontact Touch e-posta istemcisi -Comment[uk]=Клієнт електронної пошти KDE Kontact Touch -Comment[wa]=Cliyint d' emilaedje KDE Kontact po toutchî -Comment[x-test]=xxKDE Kontact Touch e-mail clientxx -Comment[zh_CN]=KDE Kontach 触摸版邮件客户端 -Comment[zh_TW]=KDE Kontact Touch 收發信軟體 -Name=Kontact Touch Mail -Name[bs]=Kontact Touch pošta -Name[ca]=Correu del Kontact Touch -Name[ca@valencia]=Correu del Kontact Touch -Name[da]=Kontact Touch E-mail -Name[de]=Mail-Modul für Kontact Touch -Name[el]=Αλληλογραφία Kontact Touch -Name[en_GB]=Kontact Touch Mail -Name[es]=Correo Kontact táctil -Name[et]=Kontact Touchi e-post -Name[fi]=Kontact Touch Mail -Name[fr]=Messagerie Kontact Touch -Name[ga]=Ríomhphost Kontact Touch -Name[gl]=Correo Touch do Kontact -Name[hu]=Kontact Touch levelező -Name[ia]=Posta de Touch de Kontact -Name[it]=Kontact Touch Mail -Name[ja]=Kontact Touch メール -Name[kk]=Kontact Touch поштасы -Name[km]=សំបុត្រ​របស់ Kontact Touch -Name[lt]=Kontact Touch Paštas -Name[mr]=कॉन्टेक्ट टच मेल -Name[nb]=Kontact Touch e-post -Name[nds]=Nettpost för Anröögschirm-Kontact -Name[nl]=Aanraak-e-mail van Kontact -Name[pl]=Poczta Kontact Touch -Name[pt]=Correio do Kontact Touch -Name[pt_BR]=E-mail do Kontact Touch -Name[ro]=Poștă Kontact Touch -Name[ru]=Почта Kontact Touch -Name[sk]=Kontact Touch Mail -Name[sl]=Pošta Kontact Touch -Name[sr]=Поште Контакта додирног -Name[sr@ijekavian]=Поште Контакта додирног -Name[sr@ijekavianlatin]=Pošte Kontacta dodirnog -Name[sr@latin]=Pošte Kontacta dodirnog -Name[sv]=Kontact Touch e-post -Name[tr]=Kontact Touch Posta -Name[ug]=Kontact Touch خېتى -Name[uk]=Пошта Kontact Touch -Name[wa]=Kontact toutche -Name[x-test]=xxKontact Touch Mailxx -Name[zh_CN]=Kontact 触摸版邮件 -Name[zh_TW]=Kontact Touch Mail - -[Event/sendfailed] -Name=Error while sending email -Name[bs]=Greška u slanju pošte -Name[ca]=Error en enviar correu -Name[ca@valencia]=Error en enviar correu -Name[cs]=Chyba při odesílání emailu -Name[da]=Fejl ved afsendelsen af e-mail -Name[de]=Fehler beim Versenden der E-Mail -Name[el]=Σφάλμα κατά την αποστολή της αλληλογραφίας -Name[en_GB]=Error while sending email -Name[es]=Error al enviar correo -Name[et]=Viga kirja saatmisel -Name[fi]=Virhe lähetettäessä sähköpostia -Name[fr]=Erreur lors de l'envoi du courriel -Name[gl]=Produciuse un erro ao enviar o correo -Name[hu]=Hiba az e-mail küldése közben -Name[ia]=Error durante expedition de e-posta -Name[it]=Errore durante l'invio della posta elettronica -Name[ja]=メール送信中にエラー -Name[kk]=Поштаны жолдағанда қате орын алды -Name[km]=កំហុស​ពេល​ផ្ញើ​អ៊ីមែល -Name[lt]=Klaida siunčiant laišką -Name[mr]=मेल पाठवताना त्रुटी आढळली -Name[nb]=Feil under sending av e-post -Name[nds]=Fehler bi't Loosstüern vun'n Nettbreef -Name[nl]=Fout bij verzenden van e-mail -Name[pa]=ਮੇਲ ਭੇਜਣ ਦੌਰਾਨ ਗਲਤੀ -Name[pl]=Błąd podczas wysyłania e-maila -Name[pt]=Erro ao enviar o e-mail -Name[pt_BR]=Erro ao enviar o e-mail -Name[ro]=Eroare la trimiterea poștei -Name[ru]=Ошибка отправки электронной почты -Name[sk]=Chyba pri odosielaní e-mailu -Name[sl]=Napaka med pošiljanjem e-pošte -Name[sr]=Грешка при слању е‑поште -Name[sr@ijekavian]=Грешка при слању е‑поште -Name[sr@ijekavianlatin]=Greška pri slanju e‑pošte -Name[sr@latin]=Greška pri slanju e‑pošte -Name[sv]=Fel när e-post skulle skickas -Name[tr]=E-posta gönderilirken hata oldu -Name[uk]=Помилка під час спроби надсилання пошти -Name[wa]=Åk n' a nén stî come dj' evoyive l' emile -Name[x-test]=xxError while sending emailxx -Name[zh_CN]=发送邮件时出错 -Name[zh_TW]=傳送郵件時發生錯誤 -Comment=There was an error while trying to send the e-mail. -Comment[bs]=Desila se greška pri pokušaju slanja elektronske pošte -Comment[ca]=S'ha produït un error en provar d'enviar el correu electrònic. -Comment[ca@valencia]=S'ha produït un error en provar d'enviar el correu electrònic. -Comment[cs]=Nastala chyba při odesílání emailu. -Comment[da]=Der opstod en fejl under forsøg på at afsende e-mailen. -Comment[de]=Beim Senden der E-Mail ist ein Fehler aufgetreten. -Comment[el]=Παρουσιάστηκε ένα σφάλμα κατά την προσπάθεια αποστολής της αλληλογραφίας. -Comment[en_GB]=There was an error while trying to send the e-mail. -Comment[es]=Ocurrió un error mientras se intentaba enviar el correo. -Comment[et]=Kirja saatmisel tekkis viga. -Comment[fi]=Yritettäessä lähettää sähköpostia sattui virhe. -Comment[fr]=Il y a eu une erreur lors de l'envoi du courriel. -Comment[gl]=Produciuse un erro ao comprobar o correo novo -Comment[hu]=Hiba történt az e-mail küldése közben. -Comment[ia]=Un error occurreva durante le expedition del e-posta. -Comment[it]=Si è verificato un errore durante l'invio del messaggio di posta. -Comment[ja]=メールの送信中にエラーが発生しました -Comment[kk]=Эл.поштаны жолдау талпыныс кезде бір қате орын алды -Comment[km]=មាន​កំហុស​មួយ​ពេល​ព្យាយាម​ផ្ញើ​អ៊ីមែល ។ -Comment[lt]=Siunčiant laišką įvyko klaida -Comment[mr]=इ-मेल पाठविण्याचा प्रयत्न करताना त्रुटी आढळली. -Comment[nb]=Det oppsto en feil mens det ble forsøkt å sende e-posten. -Comment[nds]=Bi't Loosstüern vun'n Nettbreef hett dat en Fehler geven. -Comment[nl]=Er was een fout bij het proberen om e-mail te verzenden. -Comment[pa]=ਈਮੇਲ ਭੇਜਣ ਦੀ ਕੋਸ਼ਿਸ਼ ਦੌਰਾਨ ਗਲਤੀ ਆਈ ਸੀ। -Comment[pl]=Wystąpił błąd podczas próby wysłania e-maila. -Comment[pt]=Ocorreu um erro ao tentar enviar o e-mail. -Comment[pt_BR]=Ocorreu um erro ao tentar enviar o e-mail. -Comment[ro]=A avut loc o eroare la expedierea scrisorii. -Comment[ru]=Во время отправки письма произошла ошибка. -Comment[sk]=Došlo k chybe pri pokuse o odoslanie e-mailu. -Comment[sl]=Med poskusom pošiljanja e-pošte je prišlo do napake. -Comment[sr]=Грешка при покушају слања е‑поште. -Comment[sr@ijekavian]=Грешка при покушају слања е‑поште. -Comment[sr@ijekavianlatin]=Greška pri pokušaju slanja e‑pošte. -Comment[sr@latin]=Greška pri pokušaju slanja e‑pošte. -Comment[sv]=Ett fel uppstod vid försök att skicka e-post. -Comment[tr]=E-posta gönderilmeye çalışılırken hata oldu. -Comment[uk]=Під час спроби надсилання пошти сталася помилка. -Comment[wa]=Åk n' a nén stî come dji sayive d' evoyî l' emile. -Comment[x-test]=xxThere was an error while trying to send the e-mail.xx -Comment[zh_CN]=尝试发送邮件时发生错误。 -Comment[zh_TW]=傳送郵件時發生錯誤。 -Action=Popup diff --git a/kdepim/mobile/mail/kmail-mobile.qml b/kdepim/mobile/mail/kmail-mobile.qml deleted file mode 100644 index c5d8afa5..00000000 --- a/kdepim/mobile/mail/kmail-mobile.qml +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2013 Michael Bohlender - * - * 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 . - */ - -import QtQuick 1.1 -import org.kde.plasma.components 0.1 as PlasmaComponents -import org.kde.plasma.extras 0.1 as PlasmaExtras -import org.kde.pim.mobileui 4.5 as KPIM - -KPIM.MainView { - id: app - - PlasmaComponents.ToolBar { - id: toolBar - - anchors { - top: parent.top - left: parent.left - right: parent.right - } - } - - PlasmaExtras.PageRow { - id: pageRow - - anchors { - top: toolBar.bottom - left: parent.left - right: parent.right - bottom: parent.bottom - } - - clip: true - - toolBar: toolBar - - initialPage: Qt.resolvedUrl("FolderPage.qml") - } -} diff --git a/kdepim/mobile/mail/kmail-mobile.rc b/kdepim/mobile/mail/kmail-mobile.rc deleted file mode 100644 index ba920751..00000000 --- a/kdepim/mobile/mail/kmail-mobile.rc +++ /dev/null @@ -1 +0,0 @@ -KMAIL_MOBILE_ICON ICON "kmail-mobile.ico" diff --git a/kdepim/mobile/mail/kmailmobileoptions.h b/kdepim/mobile/mail/kmailmobileoptions.h deleted file mode 100644 index c6528498..00000000 --- a/kdepim/mobile/mail/kmailmobileoptions.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -* Copyright 2011 Lamarque Souza -* -* 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 KMAIL_MOBILE_OPTIONS_H -#define KMAIL_MOBILE_OPTIONS_H - -#include -#include - -static KCmdLineOptions kmailMobileOptions() -{ - KCmdLineOptions options; - options.add("t
", ki18n("Send message to 'address'")); - options.add("s ", ki18n("Set subject of message")); - options.add("c
", ki18n("Send CC: to 'address'")); - options.add("b
", ki18n("Send BCC: to 'address'")); - options.add("B ", ki18n("Set body of message")); - options.add("A ", ki18n("Add an attachment to the mail. This can be repeated")); - return options; -} - -#endif diff --git a/kdepim/mobile/mail/mailactionmanager.cpp b/kdepim/mobile/mail/mailactionmanager.cpp deleted file mode 100644 index 283fa0e4..00000000 --- a/kdepim/mobile/mail/mailactionmanager.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - Copyright (c) 2010 Andras Mantia - - 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 "mailactionmanager.h" - -#include - -#include -#include -#include - -#include -#include - -MailActionManager::MailActionManager( KActionCollection *actionCollection, QObject *parent ) - : QObject( parent ), - m_actionCollection( actionCollection ), - m_itemSelectionModel( 0 ), - m_itemActionSelectionModel( 0 ) -{ - KAction *action; - action = actionCollection->addAction( QLatin1String("mark_message_important") ); - action->setText( i18n( "Important" ) ); - action->setIcon( KIcon( QLatin1String("emblem-important") ) ); - action->setCheckable(true); - - action = actionCollection->addAction( QLatin1String("mark_message_action_item") ); - action->setText( i18n( "Action Item" ) ); - action->setIcon( KIcon( QLatin1String("mail-mark-task") ) ); - action->setCheckable( true ); - - action = actionCollection->addAction( QLatin1String("write_new_email") ); - action->setText( i18n( "Write New Email" ) ); - - action = actionCollection->addAction( QLatin1String("send_queued_emails") ); - action->setText( i18n( "Send All Unsent Emails" ) ); - - action = actionCollection->addAction( QLatin1String("send_queued_emails_via") ); - action->setText( i18n( "Send All Unsent Emails" ) ); - - action = actionCollection->addAction( QLatin1String("message_reply") ); - action->setText( i18n( "Reply" ) ); - - action = actionCollection->addAction( QLatin1String("message_reply_to_list") ); - action->setText( i18n( "Reply to Mailing List" ) ); - - action = actionCollection->addAction( QLatin1String("message_reply_without_quoting") ); - action->setText( i18n( "Reply Without Quoting" ) ); - - action = actionCollection->addAction( QLatin1String("message_reply_variants") ); - - action = actionCollection->addAction( QLatin1String("message_forward_as_attachment") ); - action->setText( i18n( "Forward as Attachment" ) ); - - action = actionCollection->addAction( QLatin1String("message_redirect") ); - action->setText( i18n( "Redirect" ) ); - - action = actionCollection->addAction( QLatin1String("save_favorite") ); - action->setText( i18n( "Save Favorite" ) ); - - action = actionCollection->addAction( QLatin1String("message_send_again") ); - action->setText( i18n( "Send Again" ) ); - - action = actionCollection->addAction( QLatin1String("message_save_as") ); - action->setText( i18n( "Save Email As" ) ); - - action = actionCollection->addAction( QLatin1String("message_edit") ); - action->setText( i18n( "Edit Email" ) ); - - action = actionCollection->addAction( QLatin1String("message_find_in") ); - action->setText( i18n( "Find in Email" ) ); - - action = actionCollection->addAction( QLatin1String("prefer_html_to_plain") ); - action->setText( i18n( "Prefer HTML To Plain Text" ) ); - action->setCheckable( true ); - action->setChecked( false ); - - action = actionCollection->addAction( QLatin1String("prefer_html_to_plain_viewer") ); - action->setText( i18n( "Prefer HTML To Plain Text" ) ); - action->setCheckable(true); - action->setChecked(false); - - action = actionCollection->addAction( QLatin1String("load_external_ref") ); - action->setText( i18n( "Load External References" ) ); - action->setCheckable( true ); - action->setChecked( false ); - - action = actionCollection->addAction( QLatin1String("message_fixed_font") ); - action->setText( i18n( "Use Fixed Font" ) ); - action->setCheckable( true ); - action->setChecked( false ); - - action = actionCollection->addAction( QLatin1String("move_all_to_trash") ); - action->setText( i18n( "Move Displayed Emails To Trash" ) ); - - action = actionCollection->addAction( QLatin1String("apply_filters") ); - action->setText( i18n( "Apply Filters" ) ); - - action = actionCollection->addAction( QLatin1String("apply_filters_bulk_action") ); - action->setText( i18n( "Apply Filters" ) ); - action->setEnabled( false ); - - action = actionCollection->addAction( QLatin1String("new_filter") ); - action->setText( i18n( "New Filter" ) ); -} - -void MailActionManager::setItemSelectionModel( QItemSelectionModel *selectionModel ) -{ - m_itemSelectionModel = selectionModel; - connect( m_itemSelectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(updateActions()) ); - updateActions(); -} - -void MailActionManager::setItemActionSelectionModel( QItemSelectionModel *selectionModel ) -{ - m_itemActionSelectionModel = selectionModel; - connect( m_itemActionSelectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(updateActions()) ); - updateActions(); -} - -void MailActionManager::updateActions() -{ - if ( m_itemActionSelectionModel ) - m_actionCollection->action( QLatin1String("apply_filters_bulk_action") )->setEnabled( m_itemActionSelectionModel->hasSelection() ); - - if ( !m_itemSelectionModel->hasSelection() ) { - m_actionCollection->action( QLatin1String("mark_message_important") )->setEnabled( false ); - m_actionCollection->action( QLatin1String("mark_message_action_item") )->setEnabled( false ); - return; - } - - const QModelIndexList list = m_itemSelectionModel->selectedRows(); - if ( list.size() != 1 ) - return; - - const QModelIndex index = list.first(); - const Akonadi::Item item = index.data( Akonadi::EntityTreeModel::ItemRole ).value(); - - if ( !item.isValid() ) - return; - - if ( !item.hasPayload() ) - return; - - Akonadi::MessageStatus status; - status.setStatusFromFlags( item.flags() ); - - m_actionCollection->action( QLatin1String("mark_message_important") )->setEnabled( true ); - m_actionCollection->action( QLatin1String("mark_message_action_item") )->setEnabled( true ); - m_actionCollection->action( QLatin1String("mark_message_important") )->setChecked( status.isImportant() ); - m_actionCollection->action( QLatin1String("mark_message_action_item") )->setChecked( status.isToAct() ); -} diff --git a/kdepim/mobile/mail/mailactionmanager.h b/kdepim/mobile/mail/mailactionmanager.h deleted file mode 100644 index 06e3ff5a..00000000 --- a/kdepim/mobile/mail/mailactionmanager.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - Copyright (c) 2010 Andras Mantia - - 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 MAILACTIONMANAGER_H -#define MAILACTIONMANAGER_H - -#include - -#include "kactioncollection.h" - -class MailActionManager : public QObject -{ - Q_OBJECT - - public: - explicit MailActionManager( KActionCollection *actionCollection, QObject *parent = 0 ); - - void setItemSelectionModel( QItemSelectionModel *selectionModel ); - void setItemActionSelectionModel( QItemSelectionModel *selectionModel ); - - private slots: - void updateActions(); - - private: - KActionCollection *m_actionCollection; - QItemSelectionModel *m_itemSelectionModel; - QItemSelectionModel *m_itemActionSelectionModel; -}; - -#endif // MAILACTIONMANAGER_H - diff --git a/kdepim/mobile/mail/mailthreadgroupercomparator.cpp b/kdepim/mobile/mail/mailthreadgroupercomparator.cpp deleted file mode 100644 index 5b214fe4..00000000 --- a/kdepim/mobile/mail/mailthreadgroupercomparator.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "mailthreadgroupercomparator.h" - -#include -#include - -#include -#include -#include - -MailThreadGrouperComparator::MailThreadGrouperComparator() - : mSortingOption( SortByDateTimeMostRecent ), - mIsOutboundCollection( false ) -{ -} - -MailThreadGrouperComparator::~MailThreadGrouperComparator() -{ -} - -QByteArray MailThreadGrouperComparator::identifierForItem( const Akonadi::Item &item ) const -{ - Q_ASSERT( item.hasPayload() ); - - return identifierForMessage( item.payload(), item.id() ); -} - -QByteArray MailThreadGrouperComparator::parentIdentifierForItem( const Akonadi::Item &item ) const -{ - Q_ASSERT( item.hasPayload() ); - - const KMime::Message::Ptr message = item.payload(); - - if ( !message->inReplyTo()->isEmpty() ) { - const QByteArray inReplyTo = message->inReplyTo()->as7BitString( false ); - return inReplyTo.mid( 1, inReplyTo.size() -2 ); // strip '<' and '>' - } - - return QByteArray(); -} - -bool MailThreadGrouperComparator::lessThan( const Akonadi::Item &leftItem, const Akonadi::Item &rightItem ) const -{ - Q_ASSERT( leftItem.isValid() ); - Q_ASSERT( rightItem.isValid() ); - - const Akonadi::Item leftThreadRootItem = threadItem( leftItem ); - const Akonadi::Item rightThreadRootItem = threadItem( rightItem ); - - Q_ASSERT( rightThreadRootItem.isValid() ); - Q_ASSERT( leftThreadRootItem.isValid() ); - - const bool leftItemIsThreadLeader = (leftThreadRootItem == leftItem); - const bool rightItemIsThreadLeader = (rightThreadRootItem == rightItem); - if ( leftItemIsThreadLeader && rightItemIsThreadLeader ) { - Q_ASSERT( leftThreadRootItem.hasPayload() ); - Q_ASSERT( rightThreadRootItem.hasPayload() ); - - const KMime::Message::Ptr leftThreadRootMessage = messageForItem( leftThreadRootItem ); - const KMime::Message::Ptr rightThreadRootMessage = messageForItem( rightThreadRootItem ); - - switch ( mSortingOption ) { - case SortByDateTime: - { - const KDateTime leftThreadRootDateTime = leftThreadRootMessage->date()->dateTime(); - const KDateTime rightThreadRootDateTime = rightThreadRootMessage->date()->dateTime(); - if ( leftThreadRootDateTime != rightThreadRootDateTime ) { - return leftThreadRootDateTime > rightThreadRootDateTime; - } - } - break; - case SortByDateTimeMostRecent: - { - const KDateTime leftNewest = mostRecentDateTimeInThread( leftThreadRootMessage, leftThreadRootItem.id() ); - const KDateTime rightNewest = mostRecentDateTimeInThread( rightThreadRootMessage, rightThreadRootItem.id() ); - - if ( leftNewest != rightNewest ) { - return leftNewest > rightNewest; - } - } - break; - case SortBySenderReceiver: - { - const QString leftSender = (mIsOutboundCollection ? leftThreadRootMessage->to()->asUnicodeString() - : leftThreadRootMessage->from()->asUnicodeString()); - const QString rightSender = (mIsOutboundCollection ? rightThreadRootMessage->to()->asUnicodeString() - : rightThreadRootMessage->sender()->asUnicodeString()); - - if ( leftSender != rightSender ) - return (leftSender.localeAwareCompare( rightSender ) < 0); - } - break; - case SortBySubject: - { - const QString leftSubject = MessageCore::StringUtil::stripOffPrefixes( leftThreadRootMessage->subject()->asUnicodeString() ); - const QString rightSubject = MessageCore::StringUtil::stripOffPrefixes( rightThreadRootMessage->subject()->asUnicodeString() ); - - if ( leftSubject != rightSubject ) - return (leftSubject.compare( rightSubject, Qt::CaseInsensitive ) < 0); - } - break; - case SortBySize: - { - const qint64 leftSize = leftThreadRootItem.size(); - const qint64 rightSize = rightThreadRootItem.size(); - - if ( leftSize != rightSize ) - return leftSize < rightSize; - } - break; - case SortByActionItem: - { - const bool leftIsActionItem = leftThreadRootItem.flags().contains( Akonadi::MessageFlags::ToAct ); - const bool rightIsActionItem = rightThreadRootItem.flags().contains( Akonadi::MessageFlags::ToAct ); - - if ( leftIsActionItem != rightIsActionItem ) - return leftIsActionItem; - } - break; - } - - return leftThreadRootItem.id() < rightThreadRootItem.id(); - - } else if ( leftItemIsThreadLeader && !rightItemIsThreadLeader ) { - if ( leftThreadRootItem == rightThreadRootItem ) - return true; // right item is in thread of left thread leader -> right item located below left item - else - return lessThan( leftThreadRootItem, rightThreadRootItem ); // based on thread leaders order - } else if ( !leftItemIsThreadLeader && rightItemIsThreadLeader ) { - if ( leftThreadRootItem == rightThreadRootItem ) - return false; // left item is in thread of right thread leader -> left item must be located below right item - else - return lessThan( leftThreadRootItem, rightThreadRootItem ); // based on thread leaders order - } else if ( !leftItemIsThreadLeader && !rightItemIsThreadLeader ) { - if ( leftThreadRootItem == rightThreadRootItem ) { // both in the same thread - Q_ASSERT( leftItem.hasPayload() ); - Q_ASSERT( rightItem.hasPayload() ); - - const KMime::Message::Ptr leftMessage = messageForItem( leftItem ); - const KMime::Message::Ptr rightMessage = messageForItem( rightItem ); - - const KDateTime leftDateTime = leftMessage->date()->dateTime(); - const KDateTime rightDateTime = rightMessage->date()->dateTime(); - - // Messages in the same thread are ordered most recent last. - if ( leftDateTime != rightDateTime ) { - return leftDateTime < rightDateTime; - } - - return leftItem.id() < rightItem.id(); // default - } else - return lessThan( leftThreadRootItem, rightThreadRootItem ); // based on thread leaders order - } - - return leftItem.id() < rightItem.id(); -} - -void MailThreadGrouperComparator::setSortingOption( SortingOption option ) -{ - mSortingOption = option; -} - -MailThreadGrouperComparator::SortingOption MailThreadGrouperComparator::sortingOption() const -{ - return mSortingOption; -} - -void MailThreadGrouperComparator::setGroupingOption( GroupingOption option ) -{ - mGroupingOption = option; -} - -MailThreadGrouperComparator::GroupingOption MailThreadGrouperComparator::groupingOption() const -{ - return mGroupingOption; -} - -void MailThreadGrouperComparator::setIsOutboundCollection( bool outbound ) -{ - mIsOutboundCollection = outbound; -} - -void MailThreadGrouperComparator::invalidateModel() -{ - invalidate(); -} - -QString MailThreadGrouperComparator::grouperString( const Akonadi::Item &item ) const -{ - KMime::Message::Ptr msg; - - if ( mSortingOption == SortByDateTimeMostRecent ) { - const Akonadi::Item rootItem = threadItem( item ); - const Akonadi::Item::Id newestItem = mostRecentIdInThread( messageForItem( rootItem ), rootItem.id() ); - msg = messageForItem( Akonadi::Item( newestItem ) ); - } else { - const Akonadi::Item rootItem = threadItem( item ); - msg = messageForItem( rootItem ); - } - - if ( mGroupingOption == GroupByDate ) { - // simplified version taken from libmessagelist - const KDateTime& dt = msg->date()->dateTime(); - const QDate dDate = dt.date(); - const KCalendarSystem *calendar = KGlobal::locale()->calendar(); - int daysAgo = -1; - if ( calendar->isValid( dDate ) && calendar->isValid( QDate::currentDate() ) ) { - daysAgo = dDate.daysTo( QDate::currentDate() ); - } - - if ( daysAgo < 0 || !dt.isValid() ) // In the future or invalid - return i18n( "Unknown" ); - else if( daysAgo == 0 ) // Today - return i18n( "Today" ); - else if ( daysAgo == 1 ) // Yesterday - return i18n( "Yesterday" ); - else if ( daysAgo > 1 && daysAgo < calendar->daysInWeek( QDate::currentDate() ) ) // Within last seven days - return KGlobal::locale()->calendar()->weekDayName( dDate ); - else if( calendar->month( dDate ) == calendar->month( QDate::currentDate() ) && calendar->year( dDate ) == calendar->year( QDate::currentDate() ) ) { // within this month - const int startOfWeekDaysAgo = ( calendar->daysInWeek( QDate::currentDate() ) + calendar->dayOfWeek( QDate::currentDate() ) - - KGlobal::locale()->weekStartDay() ) % calendar->daysInWeek( QDate::currentDate() ); - const int weeksAgo = ( ( daysAgo - startOfWeekDaysAgo ) / calendar->daysInWeek( QDate::currentDate() ) ) + 1; - if ( weeksAgo == 0 ) - return KGlobal::locale()->calendar()->weekDayName( dDate ); - else - return i18np( "One Week Ago", "%1 Weeks Ago", weeksAgo ); - } else if ( calendar->year( dDate ) == calendar->year( QDate::currentDate() ) ) { // within this year - return calendar->monthName( dDate ); - } else { // in previous years - static QHash yearNameHash; - - QString yearName; - if ( yearNameHash.contains( dDate.year() ) ) { - yearName = yearNameHash.value( dDate.year() ); - } else { - yearName = calendar->formatDate( dDate, KLocale::Year, KLocale::LongNumber ); - yearNameHash.insert( dDate.year(), yearName ); - } - return i18nc( "Message Aggregation Group Header: Month name and Year number", "%1 %2", calendar->monthName( dDate ), yearName ); - } - } else if ( mGroupingOption == GroupBySenderReceiver ) { - QStringList l; - foreach ( const KMime::Types::Mailbox &mbox, msg->from()->mailboxes() ) { - if ( mbox.hasName() ) - l.append( mbox.name() ); - else - l.append( mbox.addrSpec().asPrettyString() ); - } - return l.join( QLatin1String(", ") ); - } else { - return QLatin1String( "dummy" ); - } -} - -void MailThreadGrouperComparator::resetCaches() -{ - mMessageCache.clear(); - mMostRecentCache.clear(); -} - -QByteArray MailThreadGrouperComparator::identifierForMessage( const KMime::Message::Ptr &message, Akonadi::Item::Id id ) const -{ - QByteArray identifier = message->messageID()->identifier(); - if ( identifier.isEmpty() ) - identifier = QByteArray::number( id ); - - return identifier; -} - -KDateTime MailThreadGrouperComparator::mostRecentDateTimeInThread( const KMime::Message::Ptr &threadRoot, Akonadi::Item::Id itemId ) const -{ - const QHash::const_iterator it = mMostRecentCache.constFind( itemId ); - if ( it != mMostRecentCache.constEnd() ) - return (*it).dateTime; - - const QSet messageIds = threadDescendants( identifierForMessage( threadRoot, itemId ) ); - - KDateTime newest = threadRoot->date()->dateTime(); - Akonadi::Item::Id newestId = itemId; - - if ( messageIds.isEmpty() ) { - MostRecentEntry entry; - entry.id = newestId; - entry.dateTime = newest; - mMostRecentCache.insert( itemId, entry ); - return newest; - } - - foreach ( const QByteArray &messageId, messageIds ) { - const Akonadi::Item item = itemForIdentifier( messageId ); - Q_ASSERT( item.isValid() ); - Q_ASSERT( item.hasPayload() ); - - const KMime::Message::Ptr message = messageForItem( item ); - const KDateTime messageDateTime = message->date()->dateTime(); - if ( messageDateTime > newest ) { - newest = messageDateTime; - newestId = item.id(); - } - } - - MostRecentEntry entry; - entry.id = newestId; - entry.dateTime = newest; - - mMostRecentCache.insert( itemId, entry ); - return newest; -} - -Akonadi::Item::Id MailThreadGrouperComparator::mostRecentIdInThread( const KMime::Message::Ptr &threadRoot, Akonadi::Item::Id itemId ) const -{ - const QHash::const_iterator it = mMostRecentCache.constFind( itemId ); - if ( it != mMostRecentCache.constEnd() ) - return (*it).id; - - const QSet messageIds = threadDescendants( identifierForMessage( threadRoot, itemId ) ); - - KDateTime newest = threadRoot->date()->dateTime(); - Akonadi::Item::Id newestId = itemId; - - if ( messageIds.isEmpty() ) { - MostRecentEntry entry; - entry.id = newestId; - entry.dateTime = newest; - mMostRecentCache.insert( itemId, entry ); - return itemId; - } - - foreach ( const QByteArray &messageId, messageIds ) { - const Akonadi::Item item = itemForIdentifier( messageId ); - Q_ASSERT( item.isValid() ); - Q_ASSERT( item.hasPayload() ); - - const KMime::Message::Ptr message = messageForItem( item ); - const KDateTime messageDateTime = message->date()->dateTime(); - if ( messageDateTime > newest ) - newest = messageDateTime; - newestId = item.id(); - } - - MostRecentEntry entry; - entry.id = newestId; - entry.dateTime = newest; - - mMostRecentCache.insert( itemId, entry ); - return itemId; -} - -KMime::Message::Ptr MailThreadGrouperComparator::messageForItem( const Akonadi::Item &item ) const -{ - const QHash::const_iterator it = mMessageCache.constFind( item.id() ); - if ( it != mMessageCache.constEnd() ) - return *it; - - KMime::Message::Ptr message = item.payload(); - mMessageCache.insert( item.id(), message ); - - return message; -} - diff --git a/kdepim/mobile/mail/mailthreadgroupercomparator.h b/kdepim/mobile/mail/mailthreadgroupercomparator.h deleted file mode 100644 index 4a3cde8a..00000000 --- a/kdepim/mobile/mail/mailthreadgroupercomparator.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 MAILTHREADGROUPERCOMPARATOR_H -#define MAILTHREADGROUPERCOMPARATOR_H - -#include "threadgroupermodel.h" - -#include - -class MailThreadGrouperComparator : public ThreadGrouperComparator -{ - public: - enum SortingOption - { - SortByDateTime, - SortByDateTimeMostRecent, - SortBySenderReceiver, - SortBySubject, - SortBySize, - SortByActionItem - }; - - enum GroupingOption - { - GroupByNone, - GroupByDate, - GroupBySenderReceiver - }; - - /** - * Creates a new mail thread grouper comparator. - */ - MailThreadGrouperComparator(); - - /** - * Destroys the mail thread grouper comparator. - */ - ~MailThreadGrouperComparator(); - - /** - * Returns the unique identifier for the given message @p item. - */ - QByteArray identifierForItem( const Akonadi::Item &item ) const; - - /** - * Returns the parent identifier for the given message @p item. - */ - QByteArray parentIdentifierForItem( const Akonadi::Item &item ) const; - - /** - * Returns if the @p left message item is smaller than the @p right message item. - */ - bool lessThan( const Akonadi::Item &left, const Akonadi::Item &right ) const; - - /** - * Sets the sorting @p option. - * - * @note invalidateModel must be called afterwards to trigger an update - */ - void setSortingOption( SortingOption option ); - - /** - * Returns the sorting option. - */ - SortingOption sortingOption() const; - - /** - * Sets the grouping option. - * - * @note invalidateModel must be called afterwards to trigger an update - */ - void setGroupingOption( GroupingOption option ); - - /** - * Returns the grouping option. - */ - GroupingOption groupingOption() const; - - /** - * Sets whether the currently compared items come from an outbound mail collection - * (e.g. outbox, sent or drafts). - * - * @note invalidateModel must be called afterwards to trigger an update - */ - void setIsOutboundCollection( bool outbound ); - - /** - * Returns the string that shall be used as grouping key for the given @p item. - */ - virtual QString grouperString( const Akonadi::Item &item ) const; - - /** - * Triggers an invalidation of the ThreadGrouperModel this comparator belongs to. - * - * This method exists for performance reasons. Since a model invalidation always - * causes the modelReset() signal to be emitted, this method should be executed - * after all configuration changes (e.g. sorting/grouping option) have been done. - */ - void invalidateModel(); - - protected: - virtual void resetCaches(); - - private: - QByteArray identifierForMessage( const KMime::Message::Ptr&, Akonadi::Item::Id ) const; - KDateTime mostRecentDateTimeInThread( const KMime::Message::Ptr&, Akonadi::Item::Id ) const; - Akonadi::Item::Id mostRecentIdInThread( const KMime::Message::Ptr&, Akonadi::Item::Id ) const; - KMime::Message::Ptr messageForItem( const Akonadi::Item &item ) const; - - SortingOption mSortingOption; - GroupingOption mGroupingOption; - bool mIsOutboundCollection; - mutable QHash mMessageCache; - - struct MostRecentEntry - { - Akonadi::Item::Id id; - KDateTime dateTime; - }; - - mutable QHash mMostRecentCache; -}; - -#endif diff --git a/kdepim/mobile/mail/main.cpp b/kdepim/mobile/mail/main.cpp deleted file mode 100644 index 91ee1d5d..00000000 --- a/kdepim/mobile/mail/main.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* -* This file is part of Akonadi -* -* Copyright 2010 Stephen Kelly -* -* 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 "kmailmobileoptions.h" - -#include -#include - -#include - -#ifdef MAIL_SERIALIZER_PLUGIN_STATIC -#include - -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 - -#ifdef KDEPIM_STATIC_LIBS -extern bool ___MailTransport____INIT(); -#endif - -class KMailMobileApplication : public KDeclarativeApplication -{ -public: - KMailMobileApplication(); - explicit KMailMobileApplication( const KCmdLineOptions &applicationOptions ); - virtual int newInstance(); -}; - -KMailMobileApplication::KMailMobileApplication(): KDeclarativeApplication() -{ -} - -KMailMobileApplication::KMailMobileApplication( const KCmdLineOptions &applicationOptions ): KDeclarativeApplication( applicationOptions ) -{ -} - -int KMailMobileApplication::newInstance() -{ - KDeclarativeApplication::newInstance(); - if ( m_mainView ) { - m_mainView->handleCommandLine(); - } - return 0; -} - -int main( int argc, char **argv ) -{ - kWarning() << "Starting main function" << QDateTime::currentDateTime(); - -#ifdef KDEPIM_STATIC_LIBS - ___MailTransport____INIT(); -#endif - - const QByteArray& ba = QByteArray( "kmail-mobile" ); - const KLocalizedString name = ki18n( "Kontact Touch Mail" ); - KAboutData aboutData( ba, ba, name, ba, name ); - aboutData.setProductName( "KMail Mobile" ); //has to match the bugzilla product name - - KCmdLineArgs::init( argc, argv, &aboutData ); - KMailMobileApplication app( kmailMobileOptions() ); - - if ( !KMailMobileApplication::start() ) { - return 0; - } - - KGlobal::locale()->insertCatalog( QLatin1String("libakonadi-kmime") ); - KGlobal::locale()->insertCatalog( QLatin1String("libmessagecore") ); - KGlobal::locale()->insertCatalog( QLatin1String("libmessagecomposer") ); - KGlobal::locale()->insertCatalog( QLatin1String("libmessageviewer") ); - KGlobal::locale()->insertCatalog( QLatin1String("libtemplateparser" )); - KGlobal::locale()->insertCatalog( QLatin1String("libmailcommon") ); - KGlobal::locale()->insertCatalog( QLatin1String("kmail") ); // for identity dialog - KGlobal::locale()->insertCatalog( QLatin1String("libksieve") ); // for out of office reply dialog - KGlobal::locale()->insertCatalog( QLatin1String("akonadi_imap_resource") ); // for account status indicators - KGlobal::locale()->insertCatalog( QLatin1String("libkcalutils") ); // for invitation handling - KGlobal::locale()->insertCatalog( QLatin1String("libkleopatra") ); // for Krypto format settings in identity dialog - KGlobal::locale()->insertCatalog( QLatin1String("libkpimidentities") ); // for signature settings in identity dialog - KGlobal::locale()->insertCatalog( QLatin1String("calendarsupport") ); // for error messages while updating events and tasks - KGlobal::locale()->insertCatalog( QLatin1String("akonadicontact") ); //for identity + vcard - KGlobal::locale()->insertCatalog( QLatin1String("kabc") ); //need for addressbook - KGlobal::locale()->insertCatalog( QLatin1String("libpimcommon") ); //Need for acl - - return app.exec(); -} diff --git a/kdepim/mobile/mail/mainview.cpp b/kdepim/mobile/mail/mainview.cpp deleted file mode 100644 index 755ff639..00000000 --- a/kdepim/mobile/mail/mainview.cpp +++ /dev/null @@ -1,1924 +0,0 @@ -/* - Copyright (c) 2010 Stephen Kelly - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Andras Mantia - - 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 "mainview.h" - -#include "acleditor.h" -#include "actionhelper.h" -#include "breadcrumbnavigation.h" -#include "calendar/groupwareuidelegate.h" -#include "charsetselectiondialog.h" -#include "collectionfetchwatcher.h" -#include "composerview.h" -#include "configwidget.h" -#include "declarativewidgetbase.h" -#include "filtereditor.h" -#include "emailsexporthandler.h" -#include "emailsfilterproxymodel.h" -#include "emailsimporthandler.h" -#include "mailactionmanager.h" -#include "mailcommon/collectionpage/collectiongeneralpage.h" -#include "mailcommon/collectionpage/collectionexpirypage.h" -#include "mailcommon/filter/filtermanager.h" -#include "mailcommon/kernel/mailkernel.h" -#include "mailcommon/widgets/redirectdialog.h" -#include "mailcommon/mdn/sendmdnhandler.h" -#include "mailthreadgroupercomparator.h" -#include "messagecomposer/helper/messagehelper.h" -#include "messagecomposer/settings/messagecomposersettings.h" -#include "messagecore/helpers/messagehelpers.h" -#include "messagelistproxy.h" -#include "messagelistsettingscontroller.h" -#include "messageviewer/settings/globalsettings.h" -#include "messageviewer/header/headerstrategy.h" -#include "messageviewer/header/headerstyle.h" -#include "messageviewer/viewer/nodehelper.h" -#include "messageviewer/viewer/viewer.h" -#include "messageviewitem.h" -#include "mobilekernel.h" -#include "savemailcommand_p.h" -#include "searchwidget.h" -#include "settings.h" -#include "templateemailmodel.h" -#include "threadgroupermodel.h" -#include "threadmodel.h" -#include "threadselectionmodel.h" -#include "vacationmanager.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef KDEQMLPLUGIN_STATIC -#include "runtime/qml/kde/kdeintegration.h" -#endif - -Q_DECLARE_METATYPE( KMime::Content* ) -QML_DECLARE_TYPE( MessageViewer::MessageViewItem ) -QML_DECLARE_TYPE( DeclarativeConfigWidget ) -QML_DECLARE_TYPE( DeclarativeSearchWidget ) - -using namespace Akonadi; - -static bool workOffline() -{ - KConfig config( QLatin1String( "akonadikderc" ) ); - const KConfigGroup group( &config, QLatin1String( "Actions" ) ); - - return group.readEntry( "WorkOffline", false ); -} - -MainView::MainView(QWidget* parent) - : KDeclarativeMainView( QLatin1String( "kmail-mobile" ), new MessageListProxy, parent ), - mAskingToGoOnline( false ), - mTransportDialog( 0 ), - m_grouperComparator( 0 ), - mQuotaColorProxyModel( new QuotaColorProxyModel( this ) ) -{ - qRegisterMetaType(); - - updateConfig(); - - QDBusConnection::sessionBus().registerService( QLatin1String("org.kde.kmailmobile.composer") ); - QDBusConnection::sessionBus().registerObject( QLatin1String("/composer"), this, QDBusConnection::ExportScriptableSlots ); - - Akonadi::CollectionPropertiesDialog::registerPage( new MailCommon::CollectionGeneralPageFactory ); - Akonadi::CollectionPropertiesDialog::registerPage( new MailCommon::CollectionExpiryPageFactory ); -} - -MainView::~MainView() -{ - delete m_grouperComparator; - - const Akonadi::Collection trashCollection = CommonKernel->trashCollectionFolder(); - if ( trashCollection.isValid() ) { - if ( Settings::self()->miscEmptyTrashAtExit() ) { - if ( trashCollection.statistics().count() > 0 ) { - qDebug( "Emptying trash..." ); - Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( trashCollection, this ); - if ( job->exec() ) { - const Akonadi::Item::List items = job->items(); - if ( !items.isEmpty() ) { - Akonadi::ItemDeleteJob *deleteJob = new Akonadi::ItemDeleteJob( items, this ); - deleteJob->exec(); - qDebug( "done" ); - } - } - } - } - } -} - -void MainView::handleCommandLine() -{ - KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); - - if ( args->isSet("A") ) { - QMetaObject::invokeMethod( this, "openComposerAndAttach", Qt::QueuedConnection, - Q_ARG(QString, args->getOption("t")), - Q_ARG(QString, args->getOption("c")), - Q_ARG(QString, args->getOption("b")), - Q_ARG(QString, args->getOption("s")), - Q_ARG(QString, args->getOption("B")), - Q_ARG(QStringList, QStringList() << args->getOptionList("A")) ); - } else if ( args->isSet("t") ) { - QMetaObject::invokeMethod( this, "openComposer", Qt::QueuedConnection, - Q_ARG(QString, args->getOption("t")), - Q_ARG(QString, args->getOption("c")), - Q_ARG(QString, args->getOption("b")), - Q_ARG(QString, args->getOption("s")), - Q_ARG(QString, args->getOption("B")) ); - } -} - -void MainView::setConfigWidget( ConfigWidget *configWidget ) -{ - Q_ASSERT( configWidget ); - connect( configWidget, SIGNAL(configChanged()), this, SLOT(updateConfig()) ); - connect( configWidget, SIGNAL(showTemplatesHelp()), this, SLOT(showTemplatesHelp()) ); -} - -bool MainView::collectionIsSentMail() const -{ - return (SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::SentMail ) == mCurrentCollection); -} - -int MainView::openComposer( const QString &to, const QString &cc, const QString &bcc, - const QString &subject, const QString &body ) -{ - KMime::Message::Ptr message = KMime::Message::Ptr( new KMime::Message ); - message->to()->fromUnicodeString( to, "utf-8" ); - message->cc()->fromUnicodeString( cc, "utf-8" ); - message->bcc()->fromUnicodeString( bcc, "utf-8" ); - message->date()->setDateTime( KDateTime::currentLocalDateTime() ); - message->subject()->fromUnicodeString( subject, "utf-8" ); - - KMime::Content *bodyMessage = message->mainBodyPart(); - bodyMessage->setBody( body.toUtf8() ); - message->assemble(); - - ComposerView *composer = new ComposerView; - composer->setMessage( message ); - composer->show(); - - composer->setIdentity( currentFolderIdentity() ); - - return 0; -} - -int MainView::openComposerAndAttach( const QString &to, const QString &cc, const QString &bcc, - const QString &subject, const QString &body, - const QStringList &attachments ) -{ - if (attachments.isEmpty()) { - return openComposer( to, cc, bcc, subject, body ); - } - - // Set the multipart message. - KMime::Message::Ptr message = KMime::Message::Ptr( new KMime::Message ); - KMime::Headers::ContentType *ct = message->contentType(); - ct->setMimeType( "multipart/mixed" ); - ct->setBoundary( KMime::multiPartBoundary() ); - ct->setCategory( KMime::Headers::CCcontainer ); - message->contentTransferEncoding()->clear(); - - // Set the headers. - message->to()->fromUnicodeString( to, "utf-8" ); - message->cc()->fromUnicodeString( cc, "utf-8" ); - message->bcc()->fromUnicodeString( bcc, "utf-8" ); - message->date()->setDateTime( KDateTime::currentLocalDateTime() ); - message->subject()->fromUnicodeString( subject, "utf-8" ); - - // Set the first multipart, the body message. - KMime::Content *bodyMessage = new KMime::Content; - bodyMessage->contentType()->setMimeType( "text/plain" ); - bodyMessage->setBody( body.toUtf8() + "\n\n" ); - message->addContent( bodyMessage ); - - KUrl::List attachURLs = KUrl::List( attachments ); - for ( KUrl::List::ConstIterator it = attachURLs.constBegin(); it != attachURLs.constEnd(); ++it ) { - KMime::Content * a = createAttachment( (*it) ); - if ( a ) { - message->addContent( a ); - } - } - - message->assemble(); - - ComposerView *composer = new ComposerView; - composer->setMessage( message ); - composer->show(); - composer->setIdentity( currentFolderIdentity() ); - - return 0; -} - -KMime::Content *MainView::createAttachment( const KUrl &url ) const -{ - KMimeType::Ptr mimeType = KMimeType::findByUrl(url, 0, true); - QString fileName = url.toLocalFile(); - QFile file(fileName); - - if ( !file.open(QIODevice::ReadOnly) ) { - kWarning() << "Error opening file" << fileName << "for attaching: " << file.errorString(); - return 0; - } - - // TODO: abort in case of huge file. - qint64 size = file.size(); - QByteArray contents = file.readAll(); - file.close(); - - if ( contents.size() < size ) { - kDebug() << "Short read while attaching file" << fileName; - } - - QByteArray coded = KCodecs::base64Encode( contents, true ); - KMime::Headers::ContentDisposition *d = new KMime::Headers::ContentDisposition; - d->setDisposition( KMime::Headers::CDattachment ); - d->setFilename( fileName.section(QLatin1Char('/'), -1) ); - d->setDisposition( KMime::Headers::CDattachment ); - - KMime::Content *a = new KMime::Content(); - a->contentType()->fromUnicodeString( mimeType->name(), "utf-8" ); - a->setHeader( d ); - a->contentTransferEncoding()->setEncoding( KMime::Headers::CEbase64 ); - a->contentTransferEncoding()->setDecoded( false ); - a->setBody( coded + "\n\n" ); - - return a; -} - -#define VIEW(model) { \ - QTreeView *view = new QTreeView( this ); \ - view->setWindowFlags( Qt::Window ); \ - view->setAttribute(Qt::WA_DeleteOnClose); \ - view->setModel(model); \ - view->setWindowTitle(#model); \ - view->show(); \ -} \ - -QAbstractItemModel* MainView::createItemModelContext(QDeclarativeContext* context, QAbstractItemModel* model) -{ - m_grouperComparator = new MailThreadGrouperComparator; - m_threadGrouperModel = new ThreadGrouperModel( m_grouperComparator, this ); - m_threadGrouperModel->setSourceModel( model ); - - model = m_threadGrouperModel; - - QAbstractProxyModel *itemFilterModel = createItemFilterModel(); - if ( itemFilterModel ) { - setItemFilterModel( itemFilterModel ); - itemFilterModel->setSourceModel( model ); - model = itemFilterModel; - } - - QMLCheckableItemProxyModel *qmlCheckable = new QMLCheckableItemProxyModel( this ); - qmlCheckable->setSourceModel( model ); - - QItemSelectionModel *itemActionCheckModel = new QItemSelectionModel( model, this ); - qmlCheckable->setSelectionModel( itemActionCheckModel ); - - KSelectionProxyModel *checkedItems = new KSelectionProxyModel( itemActionCheckModel, this ); - checkedItems->setFilterBehavior( KSelectionProxyModel::ExactSelection ); - checkedItems->setSourceModel( model ); - - QItemSelectionModel *itemNavigationModel = new QItemSelectionModel( model, this ); - - QAbstractProxyModel *_listProxy = listProxy(); - - if ( _listProxy ) { - _listProxy->setParent( this ); // Make sure the proxy gets deleted when this gets deleted. - - _listProxy->setSourceModel( qmlCheckable ); - } - KLinkItemSelectionModel *itemNavigationSelectionModel = new KLinkItemSelectionModel( _listProxy, itemNavigationModel, this ); - - KLinkItemSelectionModel *itemActionSelectionModel = new KLinkItemSelectionModel( _listProxy, itemActionCheckModel, this ); - setItemNaigationAndActionSelectionModels(itemNavigationSelectionModel, itemActionSelectionModel); - - if ( _listProxy ) { - context->setContextProperty( QLatin1String("itemModel"), _listProxy ); - - QMLListSelectionModel *qmlItemNavigationSelectionModel = new QMLListSelectionModel( itemNavigationSelectionModel, this ); - QMLListSelectionModel *qmlItemActionSelectionModel = new QMLListSelectionModel( itemActionSelectionModel, this ); - - context->setContextProperty( QLatin1String("_itemNavigationModel"), QVariant::fromValue( static_cast( qmlItemNavigationSelectionModel ) ) ); - context->setContextProperty( QLatin1String("_itemActionModel"), QVariant::fromValue( static_cast( qmlItemActionSelectionModel ) ) ); - - Akonadi::BreadcrumbNavigationFactory *bulkActionBnf = new Akonadi::BreadcrumbNavigationFactory( this ); - bulkActionBnf->createCheckableBreadcrumbContext( entityTreeModel(), this ); - context->setContextProperty( QLatin1String("_bulkActionBnf"), QVariant::fromValue( static_cast( bulkActionBnf ) ) ); - } - - m_threadsModel = new ThreadModel(_listProxy, this); - - context->setContextProperty(QLatin1String( "_threads"), m_threadsModel ); - - QItemSelectionModel *itemThreadModel = new QItemSelectionModel( model, this ); - - m_threadContentsModel = new KSelectionProxyModel(itemThreadModel, this); - m_threadContentsModel->setSourceModel(_listProxy); - m_threadContentsModel->setObjectName(QLatin1String("threadContentsModel")); - - context->setContextProperty( QLatin1String("_threadContents"), m_threadContentsModel ); - - ThreadSelectionModel *threadSelector = new ThreadSelectionModel(m_threadsModel, itemThreadModel, itemNavigationModel, this); - - QMLListSelectionModel *qmlThreadSelector = new QMLListSelectionModel(threadSelector, this); - - context->setContextProperty(QLatin1String("_threadSelector"), qmlThreadSelector ); - - KLinkItemSelectionModel *threadMailSelector = new KLinkItemSelectionModel(m_threadContentsModel, itemNavigationModel, this); - - QMLListSelectionModel *qmlThreadMailSelector = new QMLListSelectionModel(threadMailSelector, this); - - context->setContextProperty(QLatin1String("_threadMailSelector"), qmlThreadMailSelector ); - - connect( this, SIGNAL(collectionSelectionChanged()), - this, SLOT(slotCollectionSelectionChanged()) ); - -#if 0 - { - QTreeView *view = new QTreeView; - view->setAttribute(Qt::WA_DeleteOnClose); - view->setModel(m_threadsModel); - view->setSelectionModel(threadSelector); - view->setWindowTitle("threads"); - view->show(); - } -#endif - - return model; -} - -bool MainView::doNotUseFilterLineEditInCurrentState() const -{ - // do not use filter line edit when in thread contents view - return (m_threadContentsModel->rowCount() > 0); -} - -void MainView::doDelayedInit() -{ - static const bool debugTiming = KCmdLineArgs::parsedArgs()->isSet( "timeit" ); - MobileKernel::self()->setFolderCollectionMonitor( monitor() ); - - mCollectionModel = new Akonadi::EntityMimeTypeFilterModel( this ); - mCollectionModel->setSourceModel( entityTreeModel() ); - mCollectionModel->addMimeTypeInclusionFilter( Akonadi::Collection::mimeType() ); - mCollectionModel->setHeaderGroup( Akonadi::EntityTreeModel::CollectionTreeHeaders ); - mCollectionModel->setDynamicSortFilter( true ); - mCollectionModel->setSortCaseSensitivity( Qt::CaseInsensitive ); - - MobileKernel::self()->setCollectionModel( mCollectionModel ); - - mTemplateSelectionModel = new QItemSelectionModel( entityTreeModel(), this ); - - mEmailTemplateModel = new TemplateEmailModel( mTemplateSelectionModel, this ); - mEmailTemplateModel->setSourceModel( entityTreeModel() ); - mEmailTemplateModel->setFilterBehavior( KSelectionProxyModel::ChildrenOfExactSelection ); - rootContext()->setContextProperty( QLatin1String("_emailTemplateModel"), mEmailTemplateModel ); - - FilterEditor *filterEditor = new FilterEditor( actionCollection(), this ); - rootContext()->setContextProperty( QLatin1String("filterEditor"), filterEditor ); - rootContext()->setContextProperty( QLatin1String("filterModel"), filterEditor->model() ); - - mAclEditor = new AclEditor( actionCollection(), this ); - rootContext()->setContextProperty( QLatin1String("aclEditor"), mAclEditor ); - rootContext()->setContextProperty( QLatin1String("aclModel"), mAclEditor->model() ); - - VacationManager *vacationManager = new VacationManager( actionCollection(), this, this ); - rootContext()->setContextProperty( QLatin1String("vacationManager"), vacationManager ); - - mMessageListSettingsController = new MessageListSettingsController( this ); - actionCollection()->addAction( QLatin1String("messagelist_change_settings"), mMessageListSettingsController->editAction() ); - actionCollection()->action( QLatin1String("messagelist_change_settings") )->setText( i18n( "Messagelist Display Format" ) ); - rootContext()->setContextProperty( QLatin1String("messageListSettings"), mMessageListSettingsController ); - connect( mMessageListSettingsController, SIGNAL(settingsChanged(MessageListSettings)), - this, SLOT(messageListSettingsChanged(MessageListSettings)) ); - - QTime time; - if ( debugTiming ) { - time.start(); - kWarning() << "Start MainView ctor" << &time << " - " << QDateTime::currentDateTime(); - } - - qmlRegisterType( "org.kde.messageviewer", 4, 5, "MessageView" ); - qmlRegisterType( "org.kde.akonadi.mail", 4, 5, "ConfigWidget" ); - qmlRegisterType( "org.kde.akonadi.mail", 4, 5, "SearchWidget" ); -#ifdef KDEQMLPLUGIN_STATIC - rootContext()->setContextProperty( QLatin1String( "KDE" ), new KDEIntegration( this ) ); -#endif - - addMimeType( KMime::Message::mimeType() ); - itemFetchScope().fetchPayloadPart( MessagePart::Envelope ); - setWindowTitle( i18n( "Mail" ) ); - - MailActionManager *mailActionManager = new MailActionManager( actionCollection(), this ); - mailActionManager->setItemSelectionModel( itemSelectionModel() ); - mailActionManager->setItemActionSelectionModel( itemActionModel() ); - - connect( actionCollection()->action( QLatin1String("mark_message_important") ), SIGNAL(triggered(bool)), SLOT(markImportant(bool)) ); - connect( actionCollection()->action( QLatin1String("mark_message_action_item") ), SIGNAL(triggered(bool)), SLOT(markMailTask(bool)) ); - connect( actionCollection()->action( QLatin1String("send_queued_emails") ), SIGNAL(triggered(bool)), SLOT(sendQueued()) ); - connect( actionCollection()->action( QLatin1String("send_queued_emails_via") ), SIGNAL(triggered(bool)), SLOT(sendQueuedVia()) ); - connect( actionCollection()->action( QLatin1String("message_reply") ), SIGNAL(triggered(bool)), SLOT(replyToMessage()) ); - connect( actionCollection()->action( QLatin1String("message_reply_to_list") ), SIGNAL(triggered(bool)), SLOT(replyToMailingList()) ); - connect( actionCollection()->action( QLatin1String("message_reply_without_quoting") ), SIGNAL(triggered(bool)), SLOT(replyWithoutQuoting()) ); - connect( actionCollection()->action( QLatin1String("message_forward_as_attachment") ), SIGNAL(triggered(bool)), SLOT(forwardAsAttachment()) ); - connect( actionCollection()->action( QLatin1String("message_redirect") ), SIGNAL(triggered(bool)), SLOT(redirect()) ); - connect( actionCollection()->action( QLatin1String("message_send_again" )), SIGNAL(triggered(bool)), SLOT(sendAgain()) ); - connect( actionCollection()->action( QLatin1String("message_edit") ), SIGNAL(triggered(bool)), SLOT(sendAgain()) ); //do the same under a different name - connect( actionCollection()->action( QLatin1String("message_find_in") ), SIGNAL(triggered(bool)), SLOT(findInMessage()) ); - connect( actionCollection()->action( QLatin1String("message_save_as") ), SIGNAL(triggered(bool)), SLOT(saveMessage()) ); - connect( actionCollection()->action( QLatin1String("message_fixed_font") ), SIGNAL(triggered(bool)), SLOT(useFixedFont()) ); - connect( actionCollection()->action( QLatin1String("save_favorite") ), SIGNAL(triggered(bool)), SLOT(saveFavorite()) ); - connect( actionCollection()->action( QLatin1String("prefer_html_to_plain") ), SIGNAL(triggered(bool)), SLOT(preferHTML(bool)) ); - connect( actionCollection()->action( QLatin1String("prefer_html_to_plain_viewer") ), SIGNAL(triggered(bool)), SLOT(preferHtmlViewer(bool)) ); - connect( actionCollection()->action( QLatin1String("load_external_ref") ), SIGNAL(triggered(bool)), SLOT(loadExternalReferences(bool)) ); - connect( actionCollection()->action( QLatin1String("move_all_to_trash") ), SIGNAL(triggered(bool)), SLOT(moveToOrEmptyTrash()) ); - connect( actionCollection()->action( QLatin1String("apply_filters") ), SIGNAL(triggered(bool)), SLOT(applyFilters()) ); - connect( actionCollection()->action( QLatin1String("apply_filters_bulk_action") ), SIGNAL(triggered(bool)), SLOT(applyFiltersBulkAction()) ); - - connect( itemSelectionModel()->model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), SLOT(dataChanged()) ); - - KAction *action = new KAction( i18n( "New Email" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(startComposer()) ); - actionCollection()->addAction( QLatin1String("add_new_mail"), action ); - - action = new KAction( i18n( "Import Emails" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(importItems()) ); - actionCollection()->addAction( QLatin1String( "import_emails" ), action ); - - action = new KAction( i18n( "Export Emails From This Account" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(exportItems()) ); - actionCollection()->addAction( QLatin1String( "export_account_emails" ), action ); - - action = new KAction( i18n( "Export Displayed Emails" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(exportItems()) ); - actionCollection()->addAction( QLatin1String( "export_selected_emails" ), action ); - - action = new KAction( i18n( "Show Source" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(showMessageSource()) ); - actionCollection()->addAction( QLatin1String( "show_message_source" ), action ); - - action = new KAction( i18n( "Email Encoding" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(selectOverrideEncoding()) ); - actionCollection()->addAction( QLatin1String( "change_message_encoding" ), action ); - - action = new KAction( i18n( "Show All Recipients" ), this ); - action->setCheckable( true ); - connect( action, SIGNAL(triggered(bool)), SLOT(toggleShowExtendedHeaders(bool)) ); - actionCollection()->addAction( QLatin1String( "show_extended_headers" ), action ); - - // lazy load of the default single folders - QTimer::singleShot( 3000, this, SLOT(initDefaultFolders()) ); - - // Is there messages to recover? Do it if needed. - recoverAutoSavedMessages(); - - if ( debugTiming ) { - kWarning() << "Finished MainView ctor: " << time.elapsed() << " - "<< &time; - } - - connect( this, SIGNAL(statusChanged(QDeclarativeView::Status)), - this, SLOT(qmlInitialized(QDeclarativeView::Status)) ); - - if ( !workOffline() ) { - const Akonadi::AgentInstance::List lst = MailCommon::Util::agentInstances(); - foreach ( Akonadi::AgentInstance type, lst ) { - const QString identifier = type.identifier(); - if ( PimCommon::Util::isImapResource(identifier) || - identifier.contains( POP3_RESOURCE_IDENTIFIER ) ) { - type.setIsOnline( true ); - } - } - } -} - -void MainView::qmlInitialized(QDeclarativeView::Status status) -{ - if ( status != Ready ) - return; - - MessageViewer::MessageViewItem* item = messageViewerItem(); - - if ( item ) { - // register the send MDN handler - item->viewer()->addMessageLoadedHandler( new MailCommon::SendMdnHandler( MobileKernel::self(), this ) ); - - const bool fixedFont = MessageViewer::GlobalSettings::self()->useFixedFont(); - item->viewer()->setUseFixedFont( fixedFont ); - actionCollection()->action( QLatin1String("message_fixed_font") )->setChecked( fixedFont ); - - actionCollection()->action( QLatin1String("show_extended_headers") )->setChecked( true ); - toggleShowExtendedHeaders( true ); - - connect( item->viewer(), SIGNAL(deleteMessage(Akonadi::Item)), - this, SLOT(slotDeleteMessage(Akonadi::Item)) ); - } -} - -void MainView::slotDeleteMessage( const Akonadi::Item &item ) -{ - if ( !item.isValid() ) - return; - - Akonadi::ItemDeleteJob *job = new Akonadi::ItemDeleteJob( item ); - job->start(); -} - -void MainView::recoverAutoSavedMessages() -{ - kDebug() << "Any message to recover?"; - QDir autoSaveDir( KStandardDirs::locateLocal( "data", QLatin1String( "kmail2/" ) ) + QLatin1String( "autosave" ) ); - //### move directory creation to here - - const QFileInfoList savedMessages = autoSaveDir.entryInfoList( QDir::Files ); - - if ( savedMessages.empty() ) { - kDebug() << "No messages to recover"; - return; - } - - foreach ( const QFileInfo& savedMessage, savedMessages ) { - QFile file( savedMessage.absoluteFilePath() ); - - if ( file.open( QIODevice::ReadOnly ) ) { - const KMime::Message::Ptr messagePtr ( new KMime::Message() ); - messagePtr->setContent( file.readAll() ); - messagePtr->parse(); - - // load the autosaved message in a new composer - ComposerView *composer = new ComposerView; - composer->setMessage( messagePtr, false ); - composer->setAutoSaveFileName( savedMessage.fileName() ); - composer->show(); - - file.close(); - } else { - kDebug() << "error!!"; - //###: review error string - KMessageBox::sorry( this, - i18n( "Could not recover a saved message." ), - i18n( "Recover Message Error" ) ); - } - } -} - -void MainView::startComposer() -{ - KMime::Message::Ptr msg( new KMime::Message() ); - - const uint identity = currentFolderIdentity(); - MessageHelper::initHeader( msg, MobileKernel::self()->identityManager(), identity ); - - ComposerView *composer = new ComposerView; - composer->setMessage( msg ); - composer->show(); - - composer->setIdentity( identity ); -} - -uint MainView::currentFolderIdentity() const -{ - // preset the folder/account identity of the current collection - const QModelIndexList indexes = regularSelectionModel()->selectedIndexes(); - if ( indexes.isEmpty() ) - return 0; - - const QModelIndex index = indexes.first(); - const Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( !collection.isValid() ) - return 0; - - QSharedPointer folderCollection = MailCommon::FolderCollection::forCollection( collection ); - if ( folderCollection.isNull() ) - return 0; - - return folderCollection->identity(); -} - -void MainView::restoreDraft( quint64 id ) -{ - ItemFetchJob *job = new ItemFetchJob( Item( id ), this ); - job->fetchScope().fetchFullPayload(); - job->fetchScope().setAncestorRetrieval( ItemFetchScope::Parent ); - connect( job, SIGNAL(result(KJob*)), SLOT(composeFetchResult(KJob*)) ); -} - -void MainView::composeFetchResult( KJob *job ) -{ - const ItemFetchJob *fetchJob = qobject_cast( job ); - if ( job->error() || fetchJob->items().isEmpty() ) { - kDebug() << "error:" << job->errorText(); - //###: review error string - KMessageBox::sorry( this, - i18n( "Could not restore a draft." ), - i18n( "Restore Draft Error" ) ); - return; - } - - const Item item = fetchJob->items().first(); - if ( !item.isValid() && !item.parentCollection().isValid() ) { - //###: review error string - KMessageBox::sorry( this, - i18n( "Invalid draft message." ), - i18n( "Restore Draft Error" ) ); - return; - } - - const KMime::Message::Ptr msg = MessageCore::Util::message( item ); - if ( !msg ) { - //###: review error string - KMessageBox::sorry( this, - i18n( "Message content error" ), - i18n( "Restore Draft Error" ) ); - return; - } - - // delete from the drafts folder - // ###: do we need an option for this?) - ItemDeleteJob *deleteJob = new ItemDeleteJob( item ); - connect( deleteJob, SIGNAL(result(KJob*)), this, SLOT(deleteItemResult(KJob*)) ); - - // create the composer and fill it with the retrieved message - ComposerView *composer = new ComposerView; - composer->setMessage( msg, false ); - composer->show(); -} - -void MainView::sendAgain() -{ - const Item item = currentItem(); - if ( !item.isValid() ) - return; - - ItemFetchJob *job = new ItemFetchJob( Item( item.id() ), this ); - job->fetchScope().fetchFullPayload(); - connect( job, SIGNAL(result(KJob*)), SLOT(sendAgainFetchResult(KJob*)) ); -} - -void MainView::sendAgainFetchResult( KJob *job ) -{ - const ItemFetchJob *fetchJob = qobject_cast( job ); - if ( job->error() || fetchJob->items().isEmpty() ) - return; - - const Item item = fetchJob->items().first(); - if ( !item.hasPayload() ) - return; - - const KMime::Message::Ptr msg = MessageCore::Util::message( item ); - MessageComposer::MessageFactory factory( msg, item.id() ); - factory.setIdentityManager( MobileKernel::self()->identityManager() ); - - KMime::Message::Ptr newMsg = factory.createResend(); - newMsg->contentType()->setCharset( MessageViewer::NodeHelper::charset( msg.get() ) ); - - ComposerView *composer = new ComposerView; - composer->setMessage( newMsg, false ); - composer->show(); -} - -bool MainView::askToGoOnline() -{ - // already asking means we are offline and need to wait anyhow - if ( mAskingToGoOnline ) { - return false; - } - - if ( workOffline() ) { - mAskingToGoOnline = true; - int rc = - KMessageBox::questionYesNo( this, - i18n( "KMail is currently in offline mode. " - "How do you want to proceed?" ), - i18n( "Online/Offline" ), - KGuiItem( i18n( "Work Online" ) ), - KGuiItem( i18n( "Work Offline" ) ) ); - - mAskingToGoOnline = false; - if ( rc == KMessageBox::No ) { - return false; - } else { - ///emulate turning off offline mode - QAction *workOffLineAction = mMailActionManager->action( StandardActionManager::ToggleWorkOffline ); - workOffLineAction->setChecked( true ); - workOffLineAction->trigger(); - } - } - - return true; -} - -void MainView::sendQueued() -{ - if ( !askToGoOnline() ) - return; - - KernelIf->msgSender()->sendQueued(); -} - -void MainView::sendQueuedVia() -{ - if ( !askToGoOnline() ) - return; - - const QStringList availTransports= MailTransport::TransportManager::self()->transportNames(); - - delete mTransportDialog; - mTransportDialog = new QWidget( this, Qt::Dialog ); //not a real dialog though, should be done in QML - mTransportDialog->setWindowTitle( i18n( "Send Queued Email Via" ) ); - - QPalette palette = mTransportDialog->palette(); - palette.setColor( QPalette::Window, Qt::darkGray ); //make sure the label is readable... - mTransportDialog->setPalette( palette ); - - QVBoxLayout *layout = new QVBoxLayout( mTransportDialog ); - QLabel *label = new QLabel( i18n( "Send Queued Email Via" ) ); - layout->addWidget( label ); - QSignalMapper *mapper = new QSignalMapper( mTransportDialog ); - - Q_FOREACH( const QString &transport, availTransports ) { - QPushButton *button = new QPushButton( transport ); - layout->addWidget( button ); - mapper->setMapping( button, transport ); - connect( button, SIGNAL(clicked()), mapper, SLOT(map()) ); - } - - connect( mapper, SIGNAL(mapped(QString)), this, SLOT(sendQueuedVia(QString))); - - QPushButton *button = new QPushButton( i18n( "Discard" ) ); - layout->addWidget( button ); - connect( button, SIGNAL(clicked(bool)), mTransportDialog, SLOT(close()) ); - - mTransportDialog->show(); -} - -void MainView::sendQueuedVia( const QString &transport ) -{ - KernelIf->msgSender()->sendQueued( transport ); - delete mTransportDialog; - mTransportDialog = 0; -} - -void MainView::replyToAuthor() -{ - const Item item = currentItem(); - if ( !item.isValid() ) - return; - - reply( item.id(), MessageComposer::ReplyAuthor ); -} - -void MainView::replyToMailingList() -{ - const Item item = currentItem(); - if ( !item.isValid() ) - return; - - reply( item.id(), MessageComposer::ReplyList ); -} - -void MainView::reply( quint64 id, MessageComposer::ReplyStrategy replyStrategy, bool quoteOriginal ) -{ - ItemFetchJob *job = new ItemFetchJob( Item( id ), this ); - job->fetchScope().fetchFullPayload(); - job->setProperty( "replyStrategy", QVariant::fromValue( replyStrategy ) ); - job->setProperty( "quoteOriginal", QVariant::fromValue( quoteOriginal ) ); - connect( job, SIGNAL(result(KJob*)), SLOT(replyFetchResult(KJob*)) ); -} - -void MainView::replyFetchResult( KJob *job ) -{ - const ItemFetchJob *fetchJob = qobject_cast( job ); - if ( job->error() || fetchJob->items().isEmpty() ) - return; - - const Item item = fetchJob->items().first(); - if ( !item.hasPayload() ) - return; - - MessageComposer::MessageFactory factory( item.payload(), item.id() ); - factory.setIdentityManager( MobileKernel::self()->identityManager() ); - factory.setReplyStrategy( fetchJob->property( "replyStrategy" ).value() ); - - factory.setQuote( fetchJob->property( "quoteOriginal" ).toBool() ); - - ComposerView *composer = new ComposerView; - composer->setMessage( factory.createReply().msg ); - composer->show(); - - composer->setIdentity( currentFolderIdentity() ); -} - -void MainView::forward( quint64 id, ForwardMode mode ) -{ - ItemFetchJob *job = new ItemFetchJob( Item( id ), this ); - job->fetchScope().fetchFullPayload(); - job->setProperty( "forwardMode", QVariant::fromValue( mode ) ); - connect( job, SIGNAL(result(KJob*)), SLOT(forwardFetchResult(KJob*)) ); -} - -void MainView::forwardFetchResult( KJob* job ) -{ - const ItemFetchJob *fetchJob = qobject_cast( job ); - if ( job->error() || fetchJob->items().isEmpty() ) - return; - - const Item item = fetchJob->items().first(); - if ( !item.hasPayload() ) - return; - - MessageComposer::MessageFactory factory( item.payload(), item.id() ); - factory.setIdentityManager( MobileKernel::self()->identityManager() ); - - const ForwardMode mode = fetchJob->property( "forwardMode" ).value(); - if ( mode == Redirect ) { - const MailCommon::RedirectDialog::SendMode sendMode = MessageComposer::MessageComposerSettings::self()->sendImmediate() - ? MailCommon::RedirectDialog::SendNow - : MailCommon::RedirectDialog::SendLater; - - MailCommon::RedirectDialog dlg( sendMode, this ); - if ( !dlg.exec() ) - return; - - if ( !MailTransport::TransportManager::self()->showTransportCreationDialog( this, MailTransport::TransportManager::IfNoTransportExists ) ) - return; - - factory.setFolderIdentity( MailCommon::Util::folderIdentity( item ) ); - const KMime::Message::Ptr redirectMessage = factory.createRedirect( dlg.to(), dlg.cc(), dlg.bcc() ); - if ( !redirectMessage ) - return; - - MessageStatus status; - status.setStatusFromFlags( item.flags() ); - if ( !status.isRead() ) - MailCommon::FilterAction::sendMDN( item, KMime::MDN::Dispatched ); - - const MessageComposer::MessageSender::SendMethod method = (dlg.sendMode() == MailCommon::RedirectDialog::SendNow) - ? MessageComposer::MessageSender::SendImmediate - : MessageComposer::MessageSender::SendLater; - - MobileKernel::self()->msgSender()->send( redirectMessage, method ); - - } else { - ComposerView *composer = new ComposerView; - switch ( mode ) { - case InLine: - composer->setMessage( factory.createForward() ); - break; - - case AsAttachment: { - QPair< KMime::Message::Ptr, QList< KMime::Content* > > forwardMessage = - factory.createAttachedForward( QList< Akonadi::Item >() << item); - - // the invokeMethods are there to be sure setMessage and addAttachment - // are called after composer->delayedInit - QMetaObject::invokeMethod( composer, "setMessage", Qt::QueuedConnection, - Q_ARG( KMime::Message::Ptr, forwardMessage.first ) ); - foreach ( KMime::Content* attach, forwardMessage.second ) { - QMetaObject::invokeMethod( composer, "addAttachment", Qt::QueuedConnection, - Q_ARG( KMime::Content*, attach ) ); - } - break; - } - - case Redirect: - break; // to make compilers happy. the Redirect case is handled above. - } - - composer->show(); - composer->setIdentity( currentFolderIdentity() ); - } - -} - -void MainView::markImportant( bool checked ) -{ - Item item = currentItem(); - if ( !item.isValid() ) - return; - - MessageStatus status; - status.setStatusFromFlags( item.flags() ); - if ( checked && status.isImportant() ) - return; - - if ( checked ) - status.setImportant(); - else - status.setImportant( false ); - - item.setFlags( status.statusFlags() ); - - ItemModifyJob *job = new ItemModifyJob( item ); - job->disableRevisionCheck(); - job->setIgnorePayload( true ); - connect( job, SIGNAL(result(KJob*)), SLOT(modifyDone(KJob*)) ); -} - -void MainView::markMailTask( bool checked ) -{ - Item item = currentItem(); - if ( !item.isValid() ) - return; - - MessageStatus status; - status.setStatusFromFlags( item.flags() ); - if ( checked && status.isToAct() ) - return; - - if ( checked ) - status.setToAct(); - else - status.setToAct( false ); - - item.setFlags( status.statusFlags() ); - - ItemModifyJob *job = new ItemModifyJob( item ); - job->disableRevisionCheck(); - job->setIgnorePayload( true ); - connect( job, SIGNAL(result(KJob*)), SLOT(modifyDone(KJob*)) ); -} - -void MainView::replyToMessage() -{ - const Item item = currentItem(); - if ( !item.isValid() ) - return; - - reply( item.id(), MessageComposer::ReplySmart ); -} - -void MainView::replyWithoutQuoting() -{ - const Item item = currentItem(); - if ( !item.isValid() ) - return; - - reply( item.id(), MessageComposer::ReplySmart, false); -} - -void MainView::replyToAll() -{ - const Item item = currentItem(); - if ( !item.isValid() ) - return; - - reply( item.id(), MessageComposer::ReplyAll ); -} - -void MainView::forwardMessage() -{ - const Item item = currentItem(); - if ( !item.isValid() ) - return; - - forward( item.id(), InLine ); -} - -void MainView::forwardAsAttachment() -{ - const Item item = currentItem(); - if ( !item.isValid() ) - return; - - forward( item.id(), AsAttachment ); -} - -void MainView::redirect() -{ - const Item item = currentItem(); - if ( !item.isValid() ) - return; - - forward( item.id(), Redirect ); -} - -Item MainView::currentItem() const -{ - const QModelIndexList list = itemSelectionModel()->selectedRows(); - - if ( list.size() != 1 ) - return Item(); - - const QModelIndex index = list.first(); - const Item item = index.data( EntityTreeModel::ItemRole ).value(); - if ( !item.hasPayload() ) - return Item(); - - return item; -} - -void MainView::modifyDone( KJob *job ) -{ - if ( job->error() ) { - kWarning() << "Modify error: " << job->errorString(); - //###: review error string - //## Use a notification instead? - KMessageBox::sorry( this, - i18n( "Error trying to set item status" ), - i18n( "Messages status error" ) ); - return; - } -} - -void MainView::dataChanged() -{ - const Item item = currentItem(); - if ( !item.isValid() ) - return; - - MessageStatus status; - status.setStatusFromFlags( item.flags() ); - - actionCollection()->action( QLatin1String("mark_message_important") )->setChecked( status.isImportant() ); - actionCollection()->action( QLatin1String("mark_message_action_item") )->setChecked( status.isToAct() ); -} - -void MainView::configureIdentity() -{ - KCMultiDialog dlg; - dlg.addModule( QLatin1String("kcm_kpimidentities") ); - dlg.currentPage()->setHeader( QLatin1String( "" ) ); // hide header to save space - dlg.setButtons( KDialog::Ok | KDialog::Cancel ); - dlg.exec(); -} - -bool MainView::isDraftThreadContent( int row ) -{ - static const int column = 0; - const QModelIndex index = m_threadContentsModel->index( row, column ); - - const Item item = index.data( EntityTreeModel::ItemRole ).value(); - - return folderIsDrafts( item.parentCollection() ); -} - -bool MainView::isDraftThreadRoot( int row ) -{ - static const int column = 0; - const QModelIndex index = m_threadsModel->index( row, column ); - - const int threadSize = index.data( ThreadModel::ThreadSizeRole ).toInt(); - if ( threadSize != 1 ) - return false; - - const Item item = index.data( EntityTreeModel::ItemRole ).value(); - - return folderIsDrafts( item.parentCollection() ); -} - -bool MainView::isSingleMessage(int row) -{ - static const int column = 0; - const QModelIndex index = m_threadsModel->index( row, column ); - - const int threadSize = index.data(ThreadModel::ThreadSizeRole).toInt(); - return threadSize == 1; -} - -bool MainView::isTemplateThreadContent( int row ) -{ - static const int column = 0; - const QModelIndex index = m_threadContentsModel->index( row, column ); - - const Item item = index.data( EntityTreeModel::ItemRole ).value(); - - return folderIsTemplates( item.parentCollection() ); -} - -bool MainView::isTemplateThreadRoot( int row ) -{ - static const int column = 0; - const QModelIndex index = m_threadsModel->index( row, column ); - - const int threadSize = index.data( ThreadModel::ThreadSizeRole ).toInt(); - if ( threadSize != 1 ) - return false; - - const Item item = index.data( EntityTreeModel::ItemRole ).value(); - - return folderIsTemplates( item.parentCollection() ); -} - -// ############################################################# -// ### Share the code between these marks with KMail Desktop? - -void MainView::initDefaultFolders() -{ - findCreateDefaultCollection( SpecialMailCollections::Inbox ); - findCreateDefaultCollection( SpecialMailCollections::Outbox ); - findCreateDefaultCollection( SpecialMailCollections::SentMail ); - findCreateDefaultCollection( SpecialMailCollections::Drafts ); - findCreateDefaultCollection( SpecialMailCollections::Trash ); - findCreateDefaultCollection( SpecialMailCollections::Templates ); - -} - -void MainView::findCreateDefaultCollection( SpecialMailCollections::Type type ) -{ - if ( SpecialMailCollections::self()->hasDefaultCollection( type ) ) { - const Collection collection = SpecialMailCollections::self()->defaultCollection( type ); - if ( !( collection.rights() & Collection::AllRights ) ) - kDebug() << "You do not have read/write permission to your inbox folder"; - } else { - SpecialMailCollectionsRequestJob *job = - new SpecialMailCollectionsRequestJob( this ); - - connect( job, SIGNAL(result(KJob*)), - this, SLOT(createDefaultCollectionDone(KJob*)) ); - job->requestDefaultCollection( type ); - job->setProperty("TYPE", (int) type ); - } -} - -void MainView::createDefaultCollectionDone( KJob *job ) -{ - if ( job->error() ) { - kDebug() << "Error creating default collection: " << job->errorText(); - //###: review error string - // disabled for now, triggers too often without good reason on the n900 (too short timeouts probably) -/* KMessageBox::sorry( this, - i18n("Error creating default collection."), - i18n("Internal Error"));*/ - return; - } - - if ( (SpecialMailCollections::Type)( job->property("TYPE").toInt() ) == SpecialMailCollections::Templates ) { - mTemplateSelectionModel->select( EntityTreeModel::modelIndexForCollection( entityTreeModel(), CommonKernel->templatesCollectionFolder() ), QItemSelectionModel::Select ); - } - - SpecialMailCollectionsRequestJob *requestJob = - qobject_cast( job ); - - const Collection collection = requestJob->collection(); - if ( !( collection.rights() & Collection::AllRights ) ) - kDebug() << "You do not have read/write permission to your inbox folder."; - - connect( SpecialMailCollections::self(), SIGNAL(defaultCollectionsChanged()), - this, SLOT(initDefaultFolders()), Qt::UniqueConnection ); - - folderChanged(); //call here, as e.g trash folders cannot be detected before the special collections are set up -} - -bool MainView::folderIsDrafts( const Collection &collection ) -{ - const Collection defaultDraftCollection = SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Drafts ); - - // check if this is the default draft folder - if ( collection == defaultDraftCollection ) - return true; - - // check for invalid collection - const QString idString = QString::number( collection.id() ); - if ( idString.isEmpty() ) - return false; - - // search the identities if the folder matches the drafts-folder - const KPIMIdentities::IdentityManager *im = MobileKernel::self()->identityManager(); - for ( KPIMIdentities::IdentityManager::ConstIterator it = im->begin(); it != im->end(); ++it ) { - if ( (*it).drafts() == idString ) - return true; - } - - return false; -} - -bool MainView::folderIsTemplates( const Collection &collection ) -{ - const Collection defaultTemplatesCollection = SpecialMailCollections::self()->defaultCollection( SpecialMailCollections::Templates ); - - // check if this is the default templates folder - if ( collection == defaultTemplatesCollection ) - return true; - - // check for invalid collection - const QString idString = QString::number( collection.id() ); - if ( idString.isEmpty() ) - return false; - - // search the identities if the folder matches the drafts-folder - const KPIMIdentities::IdentityManager *im = MobileKernel::self()->identityManager(); - for ( KPIMIdentities::IdentityManager::ConstIterator it = im->begin(); it != im->end(); ++it ) { - if ( (*it).templates() == idString ) - return true; - } - - return false; -} - -void MainView::deleteItemResult( KJob *job ) -{ - if ( job->error() ) { - kDebug() << "Error trying to delete item"; - //###: review error string - KMessageBox::sorry( this, - i18n( "Cannot delete draft." ), - i18n( "Delete Draft Error" ) ); - } -} - -void MainView::setupStandardActionManager( QItemSelectionModel *collectionSelectionModel, - QItemSelectionModel *itemSelectionModel ) -{ - mMailActionManager = new StandardMailActionManager( actionCollection(), this ); - mMailActionManager->setCollectionSelectionModel( collectionSelectionModel ); - mMailActionManager->setItemSelectionModel( itemSelectionModel ); - - //Don't use mMailActionManager->createAllActions() to save memory by not - //creating actions that doesn't make sense in mobile. - QList standardActions; - standardActions << StandardActionManager::CreateCollection << StandardActionManager::CopyCollections - << StandardActionManager::DeleteCollections << StandardActionManager::SynchronizeCollections - << StandardActionManager::CollectionProperties << StandardActionManager::CopyItems - << StandardActionManager::Paste << StandardActionManager::DeleteItems - << StandardActionManager::ManageLocalSubscriptions << StandardActionManager::AddToFavoriteCollections - << StandardActionManager::RemoveFromFavoriteCollections << StandardActionManager::RenameFavoriteCollection - << StandardActionManager::CutItems << StandardActionManager::CutCollections - << StandardActionManager::CreateResource << StandardActionManager::DeleteResources - << StandardActionManager::ResourceProperties << StandardActionManager::SynchronizeResources - << StandardActionManager::ToggleWorkOffline << StandardActionManager::CopyCollectionToDialog - << StandardActionManager::MoveCollectionToDialog << StandardActionManager::CopyItemToDialog - << StandardActionManager::MoveItemToDialog; - - Q_FOREACH( StandardActionManager::Type standardAction, standardActions ) { - mMailActionManager->createAction( standardAction ); - } - - QList mailActions; - mailActions << StandardMailActionManager::MarkMailAsRead << StandardMailActionManager::MarkMailAsUnread - << StandardMailActionManager::MarkMailAsImportant << StandardMailActionManager::MarkMailAsActionItem - << StandardMailActionManager::MarkAllMailAsRead << StandardMailActionManager::MarkAllMailAsUnread - << StandardMailActionManager::MarkAllMailAsImportant << StandardMailActionManager::MarkAllMailAsActionItem - << StandardMailActionManager::MoveToTrash << StandardMailActionManager::MoveAllToTrash - << StandardMailActionManager::RemoveDuplicates << StandardMailActionManager::EmptyAllTrash << StandardMailActionManager::EmptyTrash; - - Q_FOREACH( StandardMailActionManager::Type mailAction, mailActions ) { - mMailActionManager->createAction( mailAction ); - } - - mMailActionManager->interceptAction( StandardActionManager::CreateResource ); - - connect( mMailActionManager->action( StandardActionManager::CreateResource ), SIGNAL(triggered(bool)), - this, SLOT(launchAccountWizard()) ); - - const QStringList pages = QStringList() << QLatin1String( "MailCommon::CollectionGeneralPage" ) - << QLatin1String( "Akonadi::CachePolicyPage" ) - << QLatin1String( "MailCommon::CollectionExpiryPage" ); - - mMailActionManager->setCollectionPropertiesPageNames( pages ); - - ActionHelper::adaptStandardActionTexts( mMailActionManager ); - - mMailActionManager->action( StandardMailActionManager::MarkAllMailAsRead )->setText( i18n( "Mark Displayed Emails As Read" ) ); - mMailActionManager->action( StandardMailActionManager::MoveAllToTrash )->setText( i18n( "Move Displayed Emails To Trash" ) ); - mMailActionManager->action( StandardMailActionManager::MoveToTrash )->setText( i18n( "Move To Trash" ) ); - mMailActionManager->action( StandardMailActionManager::RemoveDuplicates )->setText( i18n( "Remove Duplicate Emails" ) ); - mMailActionManager->action( StandardMailActionManager::MarkMailAsRead )->setText( i18n( "Read" ) ); - mMailActionManager->action( StandardMailActionManager::MarkMailAsUnread )->setText( i18n( "Unread" ) ); - mMailActionManager->action( StandardMailActionManager::MarkMailAsImportant )->setText( i18n( "Important" ) ); - mMailActionManager->action( StandardMailActionManager::MarkMailAsActionItem )->setText( i18n( "Action Item" ) ); - - mMailActionManager->action( StandardActionManager::CopyItemToDialog )->setText( i18n( "Copy To" ) ); - mMailActionManager->action( StandardActionManager::MoveItemToDialog )->setText( i18n( "Move To" ) ); - - mMailActionManager->action( StandardActionManager::CreateCollection )->setText( i18n( "New Subfolder" ) ); - mMailActionManager->setActionText( StandardActionManager::SynchronizeCollections, ki18np( "Synchronize This Folder", "Synchronize These Folders" ) ); - mMailActionManager->action( StandardActionManager::CollectionProperties )->setText( i18n( "Folder Properties" ) ); - mMailActionManager->setActionText( StandardActionManager::DeleteCollections, ki18np( "Delete Folder", "Delete Folders" ) ); - mMailActionManager->action( StandardActionManager::MoveCollectionToDialog )->setText( i18n( "Move Folder To" ) ); - mMailActionManager->action( StandardActionManager::CopyCollectionToDialog )->setText( i18n( "Copy Folder To" ) ); - - connect(mMailActionManager, SIGNAL(actionStateUpdated()), this, SLOT(mailActionStateUpdated()) ); - - actionCollection()->action( QLatin1String("synchronize_all_items") )->setText( i18n( "Synchronize All Accounts" ) ); - - connect( collectionSelectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(folderChanged()) ); -} - -void MainView::mailActionStateUpdated() -{ - const Akonadi::Item::List selectedItems = mMailActionManager->selectedItems(); - bool itemIsSelected = !selectedItems.isEmpty(); - - if ( itemIsSelected ) { - bool allMarkedAsImportant = true; - bool allMarkedAsRead = true; - bool allMarkedAsActionItem = true; - - foreach ( const Akonadi::Item &item, selectedItems ) { - Akonadi::MessageStatus status; - status.setStatusFromFlags( item.flags() ); - if ( !status.isImportant() ) - allMarkedAsImportant = false; - if ( !status.isRead() ) - allMarkedAsRead = false; - if ( !status.isToAct() ) - allMarkedAsActionItem = false; - } - - QAction *action = mMailActionManager->action( Akonadi::StandardMailActionManager::MarkMailAsRead ); - if ( action ) { - if ( allMarkedAsRead ) - action->setText( i18n( "Unread" ) ); - else - action->setText( i18n( "Read" ) ); - } - - action = mMailActionManager->action( Akonadi::StandardMailActionManager::MarkMailAsImportant ); - if ( action ) { - if ( allMarkedAsImportant ) - action->setText( i18n( "Unimportant" ) ); - else - action->setText( i18n( "Important" ) ); - } - - action = mMailActionManager->action( Akonadi::StandardMailActionManager::MarkMailAsActionItem ); - if ( action ) { - if ( allMarkedAsActionItem ) - action->setText( i18n( "No Action Item" ) ); - else - action->setText( i18n( "Action Item" ) ); - } - } -} - -void MainView::setupAgentActionManager( QItemSelectionModel *selectionModel ) -{ - AgentActionManager *manager = createAgentActionManager( selectionModel ); - - manager->setContextText( AgentActionManager::CreateAgentInstance, AgentActionManager::DialogTitle, - i18nc( "@title:window", "New Account" ) ); - manager->setContextText( AgentActionManager::CreateAgentInstance, AgentActionManager::ErrorMessageText, - ki18n( "Could not create account: %1" ) ); - manager->setContextText( AgentActionManager::CreateAgentInstance, AgentActionManager::ErrorMessageTitle, - i18n( "Account creation failed" ) ); - - manager->setContextText( AgentActionManager::DeleteAgentInstance, AgentActionManager::MessageBoxTitle, - i18nc( "@title:window", "Delete Account?" ) ); - manager->setContextText( AgentActionManager::DeleteAgentInstance, AgentActionManager::MessageBoxText, - i18n( "Do you really want to delete the selected account?" ) ); -} - -QAbstractProxyModel* MainView::createMainProxyModel() const -{ - return mQuotaColorProxyModel; -} - -QAbstractProxyModel* MainView::createItemFilterModel() const -{ - return new EmailsFilterProxyModel(); -} - -ImportHandlerBase* MainView::importHandler() const -{ - return new EmailsImportHandler(); -} - -ExportHandlerBase* MainView::exportHandler() const -{ - return new EmailsExportHandler(); -} - -void MainView::saveMessage() -{ - const Item item = currentItem(); - if ( !item.isValid() ) - return; - -//See the header file for SaveMailCommand why is it here - SaveMailCommand *command = new SaveMailCommand( item, this ); - command->execute(); -} - -QString MainView::itemStorageCollectionAsPath( const Akonadi::Item &item ) const -{ - QModelIndex index = EntityTreeModel::modelIndexForCollection( entityTreeModel(), Akonadi::Collection( item.storageCollectionId() ) ); - Q_ASSERT( index.isValid() ); - - QString path; - while ( index.isValid() ) { - path.prepend( index.data().toString() ); - index = index.parent(); - if ( index.isValid() ) - path.prepend( QLatin1String(" / ") ); - } - - return path; -} - -void MainView::itemSelectionChanged() -{ - const QModelIndexList list = itemSelectionModel()->selectedRows(); - if ( list.size() != 1 ) { - // TODO Clear messageViewerItem - return; - } - - const QModelIndex itemIdx = list.first(); - const Akonadi::Item item = itemIdx.data(EntityTreeModel::ItemRole).value(); - - const QString path = itemStorageCollectionAsPath( item ); - - if ( messageViewerItem() ) { - messageViewerItem()->setItem( item ); - messageViewerItem()->setMessagePath( path ); - } -} - -void MainView::slotCollectionSelectionChanged() -{ - const QModelIndexList indexes = regularSelectionModel()->selectedIndexes(); - if ( indexes.isEmpty() ) - return; - - const QModelIndex index = indexes.first(); - const Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( collection.isValid() ) { - mAclEditor->setCollection( collection ); - m_grouperComparator->setIsOutboundCollection( collection.hasAttribute() && - collection.attribute()->isOutboundFolder() ); - mMessageListSettingsController->setCollection( collection ); - } - - mCurrentCollection = collection; - emit currentCollectionChanged(); -} - -MessageViewer::MessageViewItem* MainView::messageViewerItem() -{ - MessageViewer::MessageViewItem* item = 0; - - QList items = rootObject()->findChildren(); - if ( !items.isEmpty() ) - item = items.first(); - - return item; -} - - -void MainView::findInMessage() -{ - MessageViewer::MessageViewItem* item = messageViewerItem(); - if ( item ) { - item->viewer()->slotFind(); - } -} - -void MainView::preferHTML(bool useHtml) -{ - MessageViewer::MessageViewItem* item = messageViewerItem(); - - if ( item ) { - const QItemSelectionModel *collectionSelectionModel = regularSelectionModel(); - if ( collectionSelectionModel->selection().indexes().isEmpty() ) - return; - - const QModelIndexList selectedIndexes = collectionSelectionModel->selection().indexes(); - Q_FOREACH( const QModelIndex &index, selectedIndexes ) { - Q_ASSERT( index.isValid() ); - - const Collection collection = index.data( CollectionModel::CollectionRole ).value(); - Q_ASSERT( collection.isValid() ); - - KSharedConfigPtr config = KSharedConfig::openConfig( QLatin1String("kmail-mobilerc") ); - KConfigGroup group( config, QString::fromLatin1( "c%1" ).arg( collection.id() ) ); - group.writeEntry( "htmlMailOverride", useHtml ); - } - - item->viewer()->setDisplayFormatMessageOverwrite( useHtml ? MessageViewer::Viewer::Html : MessageViewer::Viewer::Text ); - item->viewer()->update( MessageViewer::Viewer::Force ); - } - - // update the viewer specific state according to the folder wide state - QAction *action = actionCollection()->action( QLatin1String("prefer_html_to_plain_viewer") ); - disconnect( action, SIGNAL(triggered(bool)), this, SLOT(preferHtmlViewer(bool)) ); - action->setChecked( useHtml ); - connect( action, SIGNAL(triggered(bool)), this, SLOT(preferHtmlViewer(bool)) ); -} - -void MainView::preferHtmlViewer( bool useHtml ) -{ - MessageViewer::MessageViewItem* item = messageViewerItem(); - - if ( item ) { - item->viewer()->setDisplayFormatMessageOverwrite( useHtml ? MessageViewer::Viewer::Html : MessageViewer::Viewer::Text ); - item->viewer()->update( MessageViewer::Viewer::Force ); - } -} - -void MainView::loadExternalReferences(bool load) -{ - MessageViewer::MessageViewItem* item = messageViewerItem(); - - if ( item ) { - const QItemSelectionModel *collectionSelectionModel = regularSelectionModel(); - if ( collectionSelectionModel->selection().indexes().isEmpty() ) - return; - - const QModelIndexList selectedIndexes = collectionSelectionModel->selection().indexes(); - Q_FOREACH( const QModelIndex &index, selectedIndexes ) { - Q_ASSERT( index.isValid() ); - - const Collection collection = index.data( CollectionModel::CollectionRole ).value(); - Q_ASSERT( collection.isValid() ); - - KSharedConfigPtr config = KSharedConfig::openConfig( QLatin1String("kmail-mobilerc") ); - KConfigGroup group( config, QString::fromLatin1("c%1" ).arg( collection.id() ) ); - group.writeEntry( "htmlLoadExternalOverride", load ); - } - - item->viewer()->setHtmlLoadExtOverride( load ); - item->viewer()->update( MessageViewer::Viewer::Force ); - } -} - -void MainView::folderChanged() -{ - const QItemSelectionModel* collectionSelectionModel = regularSelectionModel(); - const QModelIndexList indexes = collectionSelectionModel->selection().indexes(); - if ( indexes.isEmpty() ) - return; - - //NOTE: not exactly correct if multiple folders are selected, although I don't know what to do then, as the action is not - //a tri-state one (checked, unchecked, for some folders checked) - bool htmlMailOverrideInAll = true; - bool htmlLoadExternalOverrideInAll = true; - - KSharedConfigPtr config = KSharedConfig::openConfig( QLatin1String("kmail-mobilerc") ); - Q_FOREACH( const QModelIndex &index, collectionSelectionModel->selectedRows() ) { - Q_ASSERT( index.isValid() ); - - const Collection collection = index.data( CollectionModel::CollectionRole ).value(); - Q_ASSERT( collection.isValid() ); - - KConfigGroup group( config, QString::fromLatin1( "c%1" ).arg( collection.id() ) ); - if ( group.readEntry( "htmlMailOverride", false ) == false ) - htmlMailOverrideInAll = false; - - if ( group.readEntry( "htmlLoadExternalOverride", false ) == false ) - htmlLoadExternalOverrideInAll = false; - } - actionCollection()->action( QLatin1String("prefer_html_to_plain") )->setChecked( htmlMailOverrideInAll ); - actionCollection()->action( QLatin1String("prefer_html_to_plain_viewer") )->setChecked( htmlMailOverrideInAll ); - preferHTML( htmlMailOverrideInAll ); - actionCollection()->action( QLatin1String("load_external_ref") )->setChecked( htmlLoadExternalOverrideInAll ); - loadExternalReferences( htmlLoadExternalOverrideInAll ); - - actionCollection()->action( QLatin1String("move_all_to_trash") )->setText( i18n( "Move Displayed Emails To Trash" ) ); - if ( indexes.count() == 1 ) { - const QModelIndex index = collectionSelectionModel->selection().indexes().first(); - const Collection collection = index.data( CollectionModel::CollectionRole ).value(); - Q_ASSERT( collection.isValid() ); - - if ( CommonKernel->folderIsTrash( collection ) ) - actionCollection()->action( QLatin1String("move_all_to_trash") )->setText( i18n( "Empty Trash" ) ); - } -} - -void MainView::moveToOrEmptyTrash() -{ - const QItemSelectionModel *collectionSelectionModel = regularSelectionModel(); - const QModelIndexList indexes = collectionSelectionModel->selection().indexes(); - if ( indexes.isEmpty() ) - return; - - const QModelIndex index = indexes.first(); - const Collection collection = index.data( CollectionModel::CollectionRole ).value(); - Q_ASSERT( collection.isValid() ); - - if ( indexes.count() == 1 && CommonKernel->folderIsTrash( collection ) ) { - //empty trash - kDebug() << "EMPTY TRASH"; - mMailActionManager->action( Akonadi::StandardMailActionManager::EmptyTrash )->trigger(); - } else { - mMailActionManager->action( Akonadi::StandardMailActionManager::MoveAllToTrash )->trigger(); - } -} - -void MainView::useFixedFont() -{ - MessageViewer::MessageViewItem* item = messageViewerItem(); - - if ( item ) { - bool fixedFont = MessageViewer::GlobalSettings::self()->useFixedFont(); - item->viewer()->setUseFixedFont( !fixedFont ); - item->viewer()->update( MessageViewer::Viewer::Force ); - MessageViewer::GlobalSettings::self()->setUseFixedFont( !fixedFont ); - MessageViewer::GlobalSettings::self()->writeConfig(); - } -} - -int MainView::emailTemplateCount() -{ - return mEmailTemplateModel ? mEmailTemplateModel->rowCount() : 0; -} - -void MainView::restoreTemplate( quint64 id ) -{ - ItemFetchJob *job = new ItemFetchJob( Item( id ), this ); - job->fetchScope().fetchFullPayload(); - job->fetchScope().setAncestorRetrieval( ItemFetchScope::Parent ); - connect( job, SIGNAL(result(KJob*)), SLOT(templateFetchResult(KJob*)) ); -} - -void MainView::newMessageFromTemplate( int index ) -{ - Akonadi::Item item = mEmailTemplateModel->index( index, 0 ).data( Akonadi::EntityTreeModel::ItemRole ).value(); - Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( item ); - job->fetchScope().fetchFullPayload( true ); - connect( job, SIGNAL(result(KJob*)), SLOT(templateFetchResult(KJob*)) ); -} - -void MainView::templateFetchResult( KJob* job) -{ - const ItemFetchJob *fetchJob = qobject_cast( job ); - if ( job->error() || fetchJob->items().isEmpty() ) { - kDebug() << "error!!"; - //###: review error string - KMessageBox::sorry( this, - i18n( "Could not fetch template." ), - i18n( "Template Fetching Error" ) ); - return; - } - - const Item item = fetchJob->items().first(); - - KMime::Message::Ptr message = MessageCore::Util::message( item ); - KMime::Message::Ptr newMsg(new KMime::Message); - newMsg->setContent( message->encodedContent() ); - newMsg->parse(); - // these fields need to be regenerated for the new message - newMsg->removeHeader("Date"); - newMsg->removeHeader("Message-ID"); - ComposerView *composer = new ComposerView; - composer->setMessage( newMsg, false ); - composer->show(); -} - -void MainView::updateConfig() -{ - mQuotaColorProxyModel->setWarningThreshold( Settings::self()->miscQuotaWarningThreshold() ); - mQuotaColorProxyModel->setWarningColor( Settings::self()->miscQuotaWarningColor() ); - - MessageViewer::MessageViewItem *item = messageViewerItem(); - if ( item ) { - item->viewer()->writeConfig(); - item->viewer()->readConfig(); // let CSS parser reread its config - } - - if ( !regularSelectionModel() ) - return; - - const QModelIndexList indexes = regularSelectionModel()->selectedIndexes(); - if ( indexes.isEmpty() ) - return; - - const QModelIndex index = indexes.first(); - const Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( collection.isValid() && mMessageListSettingsController ) - mMessageListSettingsController->setCollection( collection ); -} - -void MainView::applyFilters() -{ - Item::List items; - - const QModelIndexList itemIndexes = itemSelectionModel()->selectedRows(); - foreach ( const QModelIndex &index, itemIndexes ) { - const Item item = index.data( EntityTreeModel::ItemRole ).value(); - if ( item.isValid() ) - items << item; - } - - if ( itemIndexes.isEmpty() ) { - // if no items have been selected, use all items of the currently selected collections - foreach ( const QModelIndex &index, regularSelectionModel()->selectedRows() ) { - const Collection collection = index.data( EntityTreeModel::CollectionRole ).value(); - if ( collection.isValid() ) { - ItemFetchJob *fetchJob = new ItemFetchJob( collection ); - fetchJob->fetchScope().fetchFullPayload(); - if ( fetchJob->exec() ) { - items << fetchJob->items(); - } - } - } - } - - MailCommon::FilterManager::instance()->filter( items ); -} - -void MainView::applyFiltersBulkAction() -{ - Item::List items; - - foreach ( const QModelIndex &index, itemActionModel()->selectedRows() ) { - const Item item = index.data( EntityTreeModel::ItemRole ).value(); - if ( item.isValid() ) - items << item; - } - - MailCommon::FilterManager::instance()->filter( items ); -} - -bool MainView::selectNextUnreadMessageInCurrentFolder() -{ - const QAbstractItemModel *model = itemModel(); - const QModelIndexList list = itemSelectionModel()->selectedRows(); - - const QModelIndex currentIndex = (list.isEmpty() ? model->index( 0, 0 ) : list.first()); - - const int rowCount = model->rowCount( QModelIndex() ); - - // start from current message - for ( int row = currentIndex.row() + 1; row < rowCount; ++row ) { - const QModelIndex itemIndex = model->index( row, 0 ); - const Akonadi::Item item = itemIndex.data( Akonadi::EntityTreeModel::ItemRole ).value(); - if ( !item.hasFlag( Akonadi::MessageFlags::Seen ) ) { - const QString path = itemStorageCollectionAsPath( item ); - messageViewerItem()->setMessagePath( path ); - messageViewerItem()->setItem( item ); - return true; - } - } - - // no unread message found, try from begin of folder - for ( int row = 0; row < currentIndex.row(); ++row ) { - const QModelIndex itemIndex = model->index( row, 0 ); - const Akonadi::Item item = itemIndex.data( Akonadi::EntityTreeModel::ItemRole ).value(); - if ( !item.hasFlag( Akonadi::MessageFlags::Seen ) ) { - const QString path = itemStorageCollectionAsPath( item ); - messageViewerItem()->setMessagePath( path ); - messageViewerItem()->setItem( item ); - return true; - } - } - - return false; // no unread message in folder -} - -void MainView::selectNextUnreadMessage() -{ - if ( selectNextUnreadMessageInCurrentFolder() ) - return; - - // since we passed a custom model in createMainProxyModel(), we have to use it here as well - QAbstractItemModel *model = mQuotaColorProxyModel; - - // since there is no unread message left in current folder, try the next one - QModelIndex next = MailCommon::Util::nextUnreadCollection( model, model->index( 0, 0 ), MailCommon::Util::ForwardSearch ); - if ( next.isValid() ) { - regularSelectionModel()->setCurrentIndex( next, QItemSelectionModel::ClearAndSelect ); - AkonadiFuture::CollectionFetchWatcher *watcher = new AkonadiFuture::CollectionFetchWatcher( next, model, this ); - connect( watcher, SIGNAL(collectionFetched(QModelIndex)), SLOT(selectNextUnreadMessageInCurrentFolder()) ); - watcher->start(); - } -} - -void MainView::showTemplatesHelp() -{ - openDocumentation( QLatin1String( "mail/templateshelp.html" ) ); -} - -void MainView::showMessageSource() -{ - MessageViewer::MessageViewItem *item = messageViewerItem(); - if ( item ) { - item->viewer()->slotShowMessageSource(); - } -} - -void MainView::selectOverrideEncoding() -{ - MessageViewer::MessageViewItem *item = messageViewerItem(); - if ( item ) { - CharsetSelectionDialog dlg( this ); - dlg.setCharset( item->viewer()->overrideEncoding() ); - - if ( dlg.exec() ) - item->viewer()->setOverrideEncoding( dlg.charset() ); - } -} - -void MainView::toggleShowExtendedHeaders( bool value ) -{ - MessageViewer::MessageViewItem *item = messageViewerItem(); - if ( item ) { - if ( value ) - item->viewer()->setHeaderStyleAndStrategy( MessageViewer::HeaderStyle::mobileExtended(), MessageViewer::HeaderStrategy::all() ); - else - item->viewer()->setHeaderStyleAndStrategy( MessageViewer::HeaderStyle::mobile(), MessageViewer::HeaderStrategy::all() ); - } -} - -void MainView::messageListSettingsChanged( const MessageListSettings &settings ) -{ - switch ( settings.sortingOption() ) { - case MessageListSettings::SortByDateTime: - m_grouperComparator->setSortingOption( MailThreadGrouperComparator::SortByDateTime ); - break; - case MessageListSettings::SortByDateTimeMostRecent: - m_grouperComparator->setSortingOption( MailThreadGrouperComparator::SortByDateTimeMostRecent ); - break; - case MessageListSettings::SortBySenderReceiver: - m_grouperComparator->setSortingOption( MailThreadGrouperComparator::SortBySenderReceiver ); - break; - case MessageListSettings::SortBySubject: - m_grouperComparator->setSortingOption( MailThreadGrouperComparator::SortBySubject ); - break; - case MessageListSettings::SortBySize: - m_grouperComparator->setSortingOption( MailThreadGrouperComparator::SortBySize ); - break; - case MessageListSettings::SortByActionItem: - m_grouperComparator->setSortingOption( MailThreadGrouperComparator::SortByActionItem ); - break; - } - - switch ( settings.groupingOption() ) { - case MessageListSettings::GroupByDate: - m_grouperComparator->setGroupingOption( MailThreadGrouperComparator::GroupByDate ); - break; - case MessageListSettings::GroupBySenderReceiver: - m_grouperComparator->setGroupingOption( MailThreadGrouperComparator::GroupBySenderReceiver ); - break; - case MessageListSettings::GroupByNone: - m_grouperComparator->setGroupingOption( MailThreadGrouperComparator::GroupByNone ); - break; - } - - m_threadGrouperModel->setThreadingEnabled( settings.useThreading() ); - - m_threadGrouperModel->sort( 0, settings.sortingOrder() ); -} - -// ############################################################# - diff --git a/kdepim/mobile/mail/mainview.h b/kdepim/mobile/mail/mainview.h deleted file mode 100644 index 5d16742e..00000000 --- a/kdepim/mobile/mail/mainview.h +++ /dev/null @@ -1,239 +0,0 @@ -/* - Copyright (c) 2010 Stephen Kelly - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Andras Mantia - - 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 MAINVIEW_H -#define MAINVIEW_H - -#include "kdeclarativemainview.h" - -#include -#include -#include -#include - -namespace Akonadi { - class EntityMimeTypeFilterModel; - class QuotaColorProxyModel; - class StandardMailActionManager; -} - -namespace MessageViewer { - class MessageViewItem; -} - -class AclEditor; -class AkonadiSender; -class ComposerView; -class ConfigWidget; -class FilterModel; -class KJob; -class KSelectionProxyModel; -class MailThreadGrouperComparator; -class MessageListSettings; -class MessageListSettingsController; -class QStandardItemModel; -class TemplateEmailModel; -class ThreadGrouperModel; -class ThreadModel; - -class MainView : public KDeclarativeMainView -{ - Q_OBJECT - Q_CLASSINFO( "D-Bus Interface", "org.kde.kmailmobile.Composer" ) - Q_CLASSINFO( "D-Bus Introspection", "" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "") - - Q_PROPERTY( bool collectionIsSentMail READ collectionIsSentMail NOTIFY currentCollectionChanged ) - - public: - explicit MainView(QWidget* parent = 0); - - ~MainView(); - - void handleCommandLine(); - - enum ForwardMode { - InLine = 0, - AsAttachment, - Redirect - }; - - void setConfigWidget( ConfigWidget *configWidget ); - - bool collectionIsSentMail() const; - - public Q_SLOTS: - void startComposer(); - void restoreDraft( quint64 id ); - void restoreTemplate( quint64 id ); - - void markImportant( bool checked ); - void markMailTask( bool checked ); - void modifyDone( KJob *job ); - void dataChanged(); - - bool isDraftThreadContent( int row ); - bool isDraftThreadRoot( int row ); - bool isSingleMessage( int row ); - bool folderIsDrafts( const Akonadi::Collection &collection ); - bool isTemplateThreadContent( int row ); - bool isTemplateThreadRoot( int row ); - bool folderIsTemplates( const Akonadi::Collection &collection ); - - void configureIdentity(); - - int emailTemplateCount(); - void newMessageFromTemplate( int index ); - - void selectNextUnreadMessage(); - - Q_SCRIPTABLE int openComposer( const QString & to, - const QString & cc, - const QString & bcc, - const QString & subject, - const QString & body ); - - Q_SCRIPTABLE int openComposerAndAttach( const QString & to, - const QString & cc, - const QString & bcc, - const QString & subject, - const QString & body, - const QStringList & attachments ); - void mailActionStateUpdated(); - - Q_SIGNALS: - void currentCollectionChanged(); - - protected slots: - void forwardMessage(); - void forwardAsAttachment(); - void redirect(); - void replyToAll(); - void replyToAuthor(); - void replyToMailingList(); - void replyToMessage(); - void replyWithoutQuoting(); - void sendAgain(); - void sendQueued(); - void sendQueuedVia(); - void sendQueuedVia( const QString &transport ); - void saveMessage(); - void findInMessage(); - void preferHTML( bool useHtml ); - void preferHtmlViewer( bool useHtml ); - void loadExternalReferences( bool load ); - void folderChanged(); - void moveToOrEmptyTrash(); - void useFixedFont(); - void applyFilters(); - void applyFiltersBulkAction(); - - void itemSelectionChanged(); - void slotCollectionSelectionChanged(); - - protected: - void doDelayedInit(); - virtual void setupStandardActionManager( QItemSelectionModel *collectionSelectionModel, - QItemSelectionModel *itemSelectionModel ); - - virtual void setupAgentActionManager( QItemSelectionModel *selectionModel ); - - virtual QAbstractProxyModel* createMainProxyModel() const; - virtual QAbstractProxyModel* createItemFilterModel() const; - - virtual ImportHandlerBase* importHandler() const; - virtual ExportHandlerBase* exportHandler() const; - - virtual QAbstractItemModel* createItemModelContext(QDeclarativeContext* context, QAbstractItemModel* model); - - virtual bool doNotUseFilterLineEditInCurrentState() const; - - private slots: - void qmlInitialized( QDeclarativeView::Status status ); - void sendAgainFetchResult( KJob *job ); - void replyFetchResult( KJob *job ); - void forwardFetchResult( KJob *job ); - void composeFetchResult( KJob *job ); - void initDefaultFolders(); - void createDefaultCollectionDone( KJob *job); - void deleteItemResult( KJob *job ); - void templateFetchResult( KJob *job ); - void updateConfig(); - bool askToGoOnline(); - void showMessageSource(); - void selectOverrideEncoding(); - void toggleShowExtendedHeaders( bool ); - void messageListSettingsChanged( const MessageListSettings& ); - bool selectNextUnreadMessageInCurrentFolder(); - void showTemplatesHelp(); - void slotDeleteMessage( const Akonadi::Item &item ); - - private: - void reply( quint64 id, MessageComposer::ReplyStrategy replyStrategy, bool quoteOriginal = true ); - void forward( quint64 id, ForwardMode mode ); - void findCreateDefaultCollection( Akonadi::SpecialMailCollections::Type type ); - void recoverAutoSavedMessages(); - Akonadi::Item currentItem() const; - MessageViewer::MessageViewItem *messageViewerItem(); - uint currentFolderIdentity() const; - QString itemStorageCollectionAsPath( const Akonadi::Item& ) const; - KMime::Content *createAttachment( const KUrl &url ) const; - - bool mAskingToGoOnline; - QWidget *mTransportDialog; - Akonadi::StandardMailActionManager *mMailActionManager; - Akonadi::EntityMimeTypeFilterModel *mCollectionModel; - TemplateEmailModel *mEmailTemplateModel; - QItemSelectionModel *mTemplateSelectionModel; - KSelectionProxyModel *m_threadContentsModel; - MailThreadGrouperComparator *m_grouperComparator; - ThreadGrouperModel *m_threadGrouperModel; - ThreadModel *m_threadsModel; - FilterModel *mFilterModel; - Akonadi::QuotaColorProxyModel *mQuotaColorProxyModel; - AclEditor *mAclEditor; - MessageListSettingsController *mMessageListSettingsController; - Akonadi::Collection mCurrentCollection; -}; - -Q_DECLARE_METATYPE( MainView::ForwardMode ) - -#endif diff --git a/kdepim/mobile/mail/messagelistproxy.cpp b/kdepim/mobile/mail/messagelistproxy.cpp deleted file mode 100644 index 5387cabc..00000000 --- a/kdepim/mobile/mail/messagelistproxy.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "messagelistproxy.h" - -#include -#include - -#include - -#include -#include -#include - -inline uint qHash( const QDate &date ) -{ - return date.toJulianDay(); -} - -MessageListProxy::MessageListProxy(QObject* parent) : ListProxy(parent) -{ -} - -QVariant MessageListProxy::data(const QModelIndex& index, int role) const -{ - const Akonadi::Item item = QSortFilterProxyModel::data( index, Akonadi::EntityTreeModel::ItemRole ).value(); - if ( item.isValid() && item.hasPayload() ) { - const KMime::Message::Ptr msg = item.payload(); - Akonadi::MessageStatus messageStatus; - messageStatus.setStatusFromFlags(item.flags()); - - switch ( role ) { - case SubjectRole: - return msg->subject()->asUnicodeString().trimmed(); - case FromRole: - { - QStringList l; - foreach ( const KMime::Types::Mailbox &mbox, msg->from()->mailboxes() ) { - if ( mbox.hasName() ) - l.append( mbox.name() ); - else - l.append( mbox.addrSpec().asPrettyString() ); - } - return l.join( QLatin1String(", ") ); - } - case DateRole: - { - static QHash dateNameHash; - - const KDateTime &dateTime = msg->date()->dateTime().toLocalZone(); - const QDate date = dateTime.date(); - if ( date == QDate::currentDate() ) { - return KGlobal::locale()->formatTime( dateTime.time() ); - } - - const QHash::const_iterator key = dateNameHash.constFind( date ); - if ( key != dateNameHash.constEnd() ) - return *key; - - const QString dateName = KGlobal::locale()->formatDate( date, KLocale::FancyShortDate ); - dateNameHash.insert( date, dateName ); - - return dateName; - } - case SizeRole: - { - return KGlobal::locale()->formatByteSize( qMax( 0LL, item.size() ) ); - } - case IsUnreadRole: - return !messageStatus.isRead(); - case IsImportantRole: - return messageStatus.isImportant(); - case IsActionItemRole: - return messageStatus.isToAct(); - case HasAttachmentRole: - return messageStatus.hasAttachment(); - case IsRepliedRole: - return messageStatus.isReplied(); - case IsForwardedRole: - return messageStatus.isForwarded(); - case IsSignedRole: - return messageStatus.isSigned(); - case IsEncryptedRole: - return messageStatus.isEncrypted(); - case DateGroupRole: - { - // simplified version taken from libmessagelist - const KDateTime& dt = msg->date()->dateTime(); - const QDate dDate = dt.date(); - const KCalendarSystem *calendar = KGlobal::locale()->calendar(); - int daysAgo = -1; - if ( calendar->isValid( dDate ) && calendar->isValid( QDate::currentDate() ) ) { - daysAgo = dDate.daysTo( QDate::currentDate() ); - } - - if ( daysAgo < 0 || !dt.isValid() ) // In the future or invalid - return i18n( "Unknown" ); - else if( daysAgo == 0 ) // Today - return i18n( "Today" ); - else if ( daysAgo == 1 ) // Yesterday - return i18n( "Yesterday" ); - else if ( daysAgo > 1 && daysAgo < calendar->daysInWeek( QDate::currentDate() ) ) // Within last seven days - return KGlobal::locale()->calendar()->weekDayName( dDate ); - else if( calendar->month( dDate ) == calendar->month( QDate::currentDate() ) && calendar->year( dDate ) == calendar->year( QDate::currentDate() ) ) { // within this month - const int startOfWeekDaysAgo = ( calendar->daysInWeek( QDate::currentDate() ) + calendar->dayOfWeek( QDate::currentDate() ) - - KGlobal::locale()->weekStartDay() ) % calendar->daysInWeek( QDate::currentDate() ); - const int weeksAgo = ( ( daysAgo - startOfWeekDaysAgo ) / calendar->daysInWeek( QDate::currentDate() ) ) + 1; - if ( weeksAgo == 0 ) - return KGlobal::locale()->calendar()->weekDayName( dDate ); - else - return i18np( "One Week Ago", "%1 Weeks Ago", weeksAgo ); - } else if ( calendar->year( dDate ) == calendar->year( QDate::currentDate() ) ) { // within this year - return calendar->monthName( dDate ); - } else { // in previous years - static QHash yearNameHash; - - QString yearName; - if ( yearNameHash.contains( dDate.year() ) ) { - yearName = yearNameHash.value( dDate.year() ); - } else { - yearName = calendar->formatDate( dDate, KLocale::Year, KLocale::LongNumber ); - yearNameHash.insert( dDate.year(), yearName ); - } - return i18nc( "Message Aggregation Group Header: Month name and Year number", "%1 %2", calendar->monthName( dDate ), yearName ); - } - } - case SenderGroupRole: - { - QStringList l; - foreach ( const KMime::Types::Mailbox &mbox, msg->from()->mailboxes() ) { - if ( mbox.hasName() ) - l.append( mbox.name() ); - else - l.append( mbox.addrSpec().asPrettyString() ); - } - return l.join( QLatin1String(", ") ); - } - } - } - return QSortFilterProxyModel::data(index, role); -} - -void MessageListProxy::setSourceModel(QAbstractItemModel* sourceModel) -{ - ListProxy::setSourceModel(sourceModel); - QHash names = roleNames(); - names.insert( Akonadi::EntityTreeModel::ItemIdRole, "itemId" ); - names.insert( SubjectRole, "subject" ); - names.insert( FromRole, "from" ); - names.insert( DateRole, "date" ); - names.insert( SizeRole, "size" ); - names.insert( IsUnreadRole, "is_unread" ); - names.insert( IsImportantRole, "is_important" ); - names.insert( IsActionItemRole, "is_action_item" ); - names.insert( HasAttachmentRole, "has_attachment" ); - names.insert( IsRepliedRole, "is_replied" ); - names.insert( IsForwardedRole, "is_forwarded" ); - names.insert( IsSignedRole, "is_signed" ); - names.insert( IsEncryptedRole, "is_encrypted" ); - names.insert( DateGroupRole, "dateGroup" ); - names.insert( SenderGroupRole, "senderGroup" ); - setRoleNames( names ); -} - diff --git a/kdepim/mobile/mail/messagelistproxy.h b/kdepim/mobile/mail/messagelistproxy.h deleted file mode 100644 index 320b3908..00000000 --- a/kdepim/mobile/mail/messagelistproxy.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 MESSAGELISTPROXY_H -#define MESSAGELISTPROXY_H - -#include "listproxy.h" -#include - -/** Proxy model to provide roles for accessing KMime::Message properties from QML. */ -class MessageListProxy : public ListProxy -{ - Q_OBJECT - - public: - explicit MessageListProxy(QObject* parent = 0); - enum Role { - SubjectRole = Akonadi::EntityTreeModel::UserRole, - FromRole, - DateRole, - SizeRole, - IsUnreadRole, - IsImportantRole, - IsActionItemRole, - HasAttachmentRole, - IsRepliedRole, - IsForwardedRole, - IsSignedRole, - IsEncryptedRole, - DateGroupRole, - SenderGroupRole - }; - - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const; - void setSourceModel(QAbstractItemModel* sourceModel); -}; - -#endif diff --git a/kdepim/mobile/mail/messagelistsettings.cpp b/kdepim/mobile/mail/messagelistsettings.cpp deleted file mode 100644 index 5611257a..00000000 --- a/kdepim/mobile/mail/messagelistsettings.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "messagelistsettings.h" - -#include -#include -#include - -MessageListSettings::MessageListSettings() - : mSortingOption( SortByDateTimeMostRecent ), - mSortDescending( false ), - mGroupingOption( GroupByDate ), - mUseThreading( true ), - mUseGlobalSettings( true ) -{ -} - -MessageListSettings::~MessageListSettings() -{ -} - -void MessageListSettings::setSortingOption( SortingOption option ) -{ - mSortingOption = option; -} - -MessageListSettings::SortingOption MessageListSettings::sortingOption() const -{ - return mSortingOption; -} - -void MessageListSettings::setSortingOrder( Qt::SortOrder order ) -{ - mSortDescending = (order == Qt::DescendingOrder); -} - -Qt::SortOrder MessageListSettings::sortingOrder() const -{ - return (mSortDescending ? Qt::DescendingOrder : Qt::AscendingOrder); -} - -void MessageListSettings::setGroupingOption( GroupingOption option ) -{ - mGroupingOption = option; -} - -MessageListSettings::GroupingOption MessageListSettings::groupingOption() const -{ - return mGroupingOption; -} - -void MessageListSettings::setUseThreading( bool threading ) -{ - mUseThreading = threading; -} - -bool MessageListSettings::useThreading() const -{ - return mUseThreading; -} - -void MessageListSettings::setUseGlobalSettings( bool value ) -{ - mUseGlobalSettings = value; -} - -bool MessageListSettings::useGlobalSettings() const -{ - return mUseGlobalSettings; -} - -MessageListSettings MessageListSettings::fromConfig( qint64 collectionId ) -{ - const QString groupName = QString::fromLatin1( "MessageListSettings-%1" ).arg( collectionId ); - - MessageListSettings settings; - - if ( KGlobal::config()->hasGroup( groupName ) ) { // use collection specific settings - const KConfigGroup group( KGlobal::config(), groupName ); - - settings.mSortingOption = static_cast( group.readEntry( "SortingOption", SortByDateTimeMostRecent ) ); - settings.mSortDescending = group.readEntry( "SortDescending", false ); - settings.mGroupingOption = static_cast( group.readEntry( "GroupingOption", GroupByDate ) ); - settings.mUseThreading = group.readEntry( "UseThreading", true ); - settings.mUseGlobalSettings = false; - } else { // use default settings - const KConfigGroup group( KGlobal::config(), QLatin1String( "MessageListSettings-default" ) ); - - settings.mSortingOption = static_cast( group.readEntry( "SortingOption", SortByDateTimeMostRecent ) ); - settings.mSortDescending = group.readEntry( "SortDescending", false ); - settings.mGroupingOption = static_cast( group.readEntry( "GroupingOption", GroupByDate ) ); - settings.mUseThreading = group.readEntry( "UseThreading", true ); - settings.mUseGlobalSettings = true; - } - - return settings; -} - -void MessageListSettings::toConfig( qint64 collectionId, const MessageListSettings &settings ) -{ - const QString groupName = QString::fromLatin1( "MessageListSettings-%1" ).arg( collectionId ); - - if ( settings.useGlobalSettings() ) { - KGlobal::config()->deleteGroup( groupName ); - } else { - KConfigGroup group( KGlobal::config(), groupName ); - - group.writeEntry( "SortingOption", static_cast( settings.mSortingOption ) ); - group.writeEntry( "SortDescending", settings.mSortDescending ); - group.writeEntry( "GroupingOption", static_cast( settings.mGroupingOption ) ); - group.writeEntry( "UseThreading", settings.mUseThreading ); - } - - KGlobal::config()->sync(); -} - -MessageListSettings MessageListSettings::fromDefaultConfig() -{ - const KConfigGroup group( KGlobal::config(), QLatin1String( "MessageListSettings-default" ) ); - - MessageListSettings settings; - settings.mSortingOption = static_cast( group.readEntry( "SortingOption", SortByDateTimeMostRecent ) ); - settings.mSortDescending = group.readEntry( "SortDescending", false ); - settings.mGroupingOption = static_cast( group.readEntry( "GroupingOption", GroupByDate ) ); - settings.mUseThreading = group.readEntry( "UseThreading", true ); - settings.mUseGlobalSettings = true; - - return settings; -} - -void MessageListSettings::toDefaultConfig( const MessageListSettings &settings ) -{ - const QLatin1String groupName( "MessageListSettings-default" ); - - KConfigGroup group( KGlobal::config(), groupName ); - - group.writeEntry( "SortingOption", static_cast( settings.mSortingOption ) ); - group.writeEntry( "SortDescending", settings.mSortDescending ); - group.writeEntry( "GroupingOption", static_cast( settings.mGroupingOption ) ); - group.writeEntry( "UseThreading", settings.mUseThreading ); - - KGlobal::config()->sync(); -} diff --git a/kdepim/mobile/mail/messagelistsettings.h b/kdepim/mobile/mail/messagelistsettings.h deleted file mode 100644 index 5955fb74..00000000 --- a/kdepim/mobile/mail/messagelistsettings.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 MESSAGELISTSETTINGS_H -#define MESSAGELISTSETTINGS_H - -#include - -class MessageListSettings -{ - public: - MessageListSettings(); - ~MessageListSettings(); - - enum SortingOption - { - SortByDateTime, - SortByDateTimeMostRecent, - SortBySenderReceiver, - SortBySubject, - SortBySize, - SortByActionItem - }; - - enum GroupingOption - { - GroupByNone, - GroupByDate, - GroupBySenderReceiver - }; - - void setSortingOption( SortingOption option ); - SortingOption sortingOption() const; - - void setSortingOrder( Qt::SortOrder order ); - Qt::SortOrder sortingOrder() const; - - void setGroupingOption( GroupingOption option ); - GroupingOption groupingOption() const; - - void setUseThreading( bool threading ); - bool useThreading() const; - - void setUseGlobalSettings( bool value ); - bool useGlobalSettings() const; - - static MessageListSettings fromConfig( qint64 collectionId ); - static void toConfig( qint64 collectionId, const MessageListSettings &settings ); - - static MessageListSettings fromDefaultConfig(); - static void toDefaultConfig( const MessageListSettings &settings ); - - private: - SortingOption mSortingOption; - bool mSortDescending; - GroupingOption mGroupingOption; - bool mUseThreading; - bool mUseGlobalSettings; -}; - -#endif diff --git a/kdepim/mobile/mail/messagelistsettingscontroller.cpp b/kdepim/mobile/mail/messagelistsettingscontroller.cpp deleted file mode 100644 index e5a5bb5f..00000000 --- a/kdepim/mobile/mail/messagelistsettingscontroller.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "messagelistsettingscontroller.h" - -#include "ui_messagelistsettingseditor.h" - -#include -#include - -#include - -MessageListSettingsController::MessageListSettingsController( QObject *parent ) - : QObject( parent ) -{ - mEditAction = new QAction( this ); - mEditAction->setText( i18n( "Change Sorting/Grouping..." ) ); - mEditAction->setEnabled( false ); - - connect( mEditAction, SIGNAL(triggered(bool)), SLOT(editSettings()) ); -} - -QString MessageListSettingsController::groupingRole() const -{ - switch ( mSettings.groupingOption() ) { - case MessageListSettings::GroupByNone: - return QLatin1String( "" ); - break; - case MessageListSettings::GroupByDate: - return QLatin1String( "dateGroup" ); - break; - case MessageListSettings::GroupBySenderReceiver: - return QLatin1String( "senderGroup" ); - break; - } - - return QString(); -} - -QAction* MessageListSettingsController::editAction() const -{ - return mEditAction; -} - -void MessageListSettingsController::setCollection( const Akonadi::Collection &collection ) -{ - mEditAction->setEnabled( collection.isValid() ); - - if ( !collection.isValid() ) - return; - - mCollectionId = collection.id(); - - mSettings = MessageListSettings::fromConfig( mCollectionId ); - - emit settingsChanged( mSettings ); -} - -void MessageListSettingsController::editSettings() -{ - Ui_MessageListSettingsEditor ui; - - KDialog dialog; - ui.setupUi( dialog.mainWidget() ); - - ui.mSortingOption->setCurrentIndex( static_cast( mSettings.sortingOption() ) ); - ui.mSortingOrder->setCurrentIndex( mSettings.sortingOrder() == Qt::AscendingOrder ? 0 : 1 ); - ui.mGroupingOption->setCurrentIndex( static_cast( mSettings.groupingOption() ) ); - ui.mUseThreading->setChecked( mSettings.useThreading() ); - ui.mUseGlobalSettings->setChecked( mSettings.useGlobalSettings() ); - - if ( !dialog.exec() ) - return; - - mSettings.setSortingOption( static_cast( ui.mSortingOption->currentIndex() ) ); - mSettings.setSortingOrder( ui.mSortingOrder->currentIndex() == 0 ? Qt::AscendingOrder : Qt::DescendingOrder ); - mSettings.setGroupingOption( static_cast( ui.mGroupingOption->currentIndex() ) ); - mSettings.setUseThreading( ui.mUseThreading->isChecked() ); - mSettings.setUseGlobalSettings( ui.mUseGlobalSettings->isChecked() ); - - MessageListSettings::toConfig( mCollectionId, mSettings ); - - emit settingsChanged( mSettings ); -} diff --git a/kdepim/mobile/mail/messagelistsettingscontroller.h b/kdepim/mobile/mail/messagelistsettingscontroller.h deleted file mode 100644 index b32a4f6a..00000000 --- a/kdepim/mobile/mail/messagelistsettingscontroller.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 MESSAGELISTSETTINGSCONTROLLER_H -#define MESSAGELISTSETTINGSCONTROLLER_H - -#include "messagelistsettings.h" - -#include - -#include - -class QAction; - -class MessageListSettingsController : public QObject -{ - Q_OBJECT - - Q_PROPERTY( QString groupingRole READ groupingRole NOTIFY settingsChanged ) - Q_PROPERTY( QAction* editAction READ editAction ) - - public: - explicit MessageListSettingsController( QObject *parent = 0 ); - - QString groupingRole() const; - - QAction* editAction() const; - - public Q_SLOTS: - void setCollection( const Akonadi::Collection &collection ); - - Q_SIGNALS: - void settingsChanged( const MessageListSettings &settings ); - - private Q_SLOTS: - void editSettings(); - - private: - Akonadi::Collection::Id mCollectionId; - MessageListSettings mSettings; - QAction *mEditAction; -}; - -#endif diff --git a/kdepim/mobile/mail/messagelistsettingseditor.ui b/kdepim/mobile/mail/messagelistsettingseditor.ui deleted file mode 100644 index 66fb4983..00000000 --- a/kdepim/mobile/mail/messagelistsettingseditor.ui +++ /dev/null @@ -1,188 +0,0 @@ - - - MessageListSettingsEditor - - - - 0 - 0 - 450 - 159 - - - - - - - Folder uses default settings - - - true - - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - false - - - - 0 - - - 0 - - - - - 0 - - - - - Sorting: - - - - - - - - By Date/Time - - - - - By Most Recent in Discussion - - - - - By Smart Sender/Receiver - - - - - By Subject - - - - - By Size - - - - - By Action Item Status - - - - - - - - - Ascending - - - - - Descending - - - - - - - - Grouping: - - - - - - - - None - - - - - By Starting Date of Discussion - - - - - By Smart Sender/Receiver - - - - - - - - Show threads - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 24 - - - - - - - - - - mUseGlobalSettings - toggled(bool) - widget - setDisabled(bool) - - - 48 - 10 - - - 98 - 69 - - - - - diff --git a/kdepim/mobile/mail/messageviewitem.cpp b/kdepim/mobile/mail/messageviewitem.cpp deleted file mode 100644 index 093dcace..00000000 --- a/kdepim/mobile/mail/messageviewitem.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 "messageviewitem.h" - -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include "attachmentproxymodel.h" -#include - -using namespace MessageViewer; - -MessageViewItem::MessageViewItem( QDeclarativeItem* parent ) - : DeclarativeAkonadiItem( parent ) -{ - m_viewer = new Viewer( 0 ); - m_viewer->setHeaderStyleAndStrategy( HeaderStyle::mobile(), HeaderStrategy::all() ); - m_viewer->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff ); - m_viewer->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff ); - m_viewer->addMessageLoadedHandler( new MessageViewer::MarkMessageReadHandler( this ) ); - setWidget( m_viewer ); - - KDescendantsProxyModel *flatProxy = new KDescendantsProxyModel( this ); - flatProxy->setSourceModel( m_viewer->messageTreeModel() ); - - m_attachmentProxy = new AttachmentProxyModel( this ); - m_attachmentProxy->setSourceModel( flatProxy ); - - connect( m_viewer, SIGNAL(urlClicked(Akonadi::Item,KUrl)), SIGNAL(urlClicked(Akonadi::Item,KUrl)) ); - connect( m_viewer, SIGNAL(itemRemoved()), SIGNAL(mailRemoved()) ); -} - -MessageViewItem::~MessageViewItem() -{ - delete m_viewer; -} - -qint64 MessageViewItem::itemId() const -{ - return m_viewer->messageItem().id(); -} - -void MessageViewItem::setItemId( qint64 id ) -{ - m_viewer->setMessageItem( Akonadi::Item( id ) ); -} - -void MessageViewItem::setItem( const Akonadi::Item &item ) -{ - m_viewer->setMessageItem( item ); -} - -QString MessageViewItem::splashMessage() const -{ - return QString(); // TODO -} - -void MessageViewItem::setSplashMessage(const QString& message) -{ - if ( message.isEmpty() ) - m_viewer->enableMessageDisplay(); - else - m_viewer->displaySplashPage( message ); -} - -QString MessageViewItem::messagePath() const -{ - return m_viewer->messagePath(); -} - -void MessageViewItem::setMessagePath( const QString& messagePath ) -{ - m_viewer->setMessagePath( messagePath ); -} - -QObject* MessageViewItem::attachmentModel() const -{ - return m_attachmentProxy; -} - -void MessageViewItem::scrollDown( int dist ) -{ - m_viewer->slotScrollDown( dist ); -} - - -void MessageViewItem::scrollUp( int dist ) -{ - m_viewer->slotScrollUp( dist ); -} - -Viewer* MessageViewItem::viewer() -{ - return m_viewer; -} - -void MessageViewItem::saveAllAttachments() -{ - m_viewer->slotAttachmentSaveAll(); -} - -void MessageViewItem::copyAllToClipboard() -{ - m_viewer->selectAll(); - m_viewer->copySelectionToClipboard(); - m_viewer->clearSelection(); -} - - diff --git a/kdepim/mobile/mail/messageviewitem.h b/kdepim/mobile/mail/messageviewitem.h deleted file mode 100644 index 92493155..00000000 --- a/kdepim/mobile/mail/messageviewitem.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 MESSAGEVIEWER_MESSAGEVIEWITEM_H -#define MESSAGEVIEWER_MESSAGEVIEWITEM_H - -#include "declarativeakonadiitem.h" - -class QSortFilterProxyModel; -class KUrl; - -namespace Akonadi { -class Item; -} - -namespace MessageViewer { - -class Viewer; - -class MessageViewItem : public DeclarativeAkonadiItem -{ - Q_OBJECT - Q_PROPERTY( QString splashMessage READ splashMessage WRITE setSplashMessage ) - Q_PROPERTY( QObject* attachmentModel READ attachmentModel CONSTANT ) - Q_PROPERTY( QString messagePath READ messagePath WRITE setMessagePath ) - - public: - explicit MessageViewItem( QDeclarativeItem *parent = 0 ); - ~MessageViewItem(); - - QString splashMessage() const; - void setSplashMessage( const QString &message ); - - QString messagePath() const; - void setMessagePath( const QString &messagePath ); - - QObject* attachmentModel() const; - - Viewer *viewer(); - - virtual qint64 itemId() const; - virtual void setItemId( qint64 id ); - virtual void setItem( const Akonadi::Item &item ); - - virtual void scrollDown( int dist ); - virtual void scrollUp( int dist ); - - public slots: - void saveAllAttachments(); - void copyAllToClipboard(); - - signals: - /** Emitted for urls not handled by MessageViewer::Viewer. */ - void urlClicked( const Akonadi::Item &item, const KUrl &url ); - void mailRemoved(); - - private: - Viewer *m_viewer; - QSortFilterProxyModel *m_attachmentProxy; -}; - -} - -#endif /* MESSAGEVIEWER_MESSAGEVIEWITEM_H */ diff --git a/kdepim/mobile/mail/mobilekernel.cpp b/kdepim/mobile/mail/mobilekernel.cpp deleted file mode 100644 index 1695b1f7..00000000 --- a/kdepim/mobile/mail/mobilekernel.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Andras Mantia - - 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 "mobilekernel.h" -#include -#include -#include -#include -#include -#include - -using namespace MailCommon; - -static MobileKernel * mySelf = 0; - -MobileKernel::MobileKernel() : mMonitor( 0 ), mCollectionModel( 0 ), mMessageSender( 0 ), mConfig( 0 ) -{ - CommonKernel; //init - - mJobScheduler = new JobScheduler(0); - mIdentityManager = new KPIMIdentities::IdentityManager( false, 0, "mIdentityManager" ); - mAutoCorrection = new PimCommon::AutoCorrection(); - mMessageSender = new MessageComposer::AkonadiSender; - CommonKernel->registerKernelIf( this ); //register KernelIf early, it is used by the Filter classes - - CommonKernel->registerFilterIf( this ); - - CommonKernel->registerSettingsIf( this ); -} - -MobileKernel::~MobileKernel() -{ - delete mJobScheduler; - delete mIdentityManager; - delete mMessageSender; - delete mAutoCorrection; -} - -MobileKernel* MobileKernel::self() -{ - if ( !mySelf ) { - mySelf = new MobileKernel(); - } - return mySelf; -} - -PimCommon::AutoCorrection *MobileKernel::composerAutoCorrection() const -{ - return mAutoCorrection; -} - -void MobileKernel::updateSystemTray() -{ -//TODO: if it is needed at all -} - -void MobileKernel::syncConfig() -{ - mConfig->sync(); -} - -KSharedConfig::Ptr MobileKernel::config() -{ - if ( !mConfig ) - { - mConfig = KSharedConfig::openConfig( QLatin1String("kmail-mobilerc") ); - } - - return mConfig; -} - -KPIMIdentities::IdentityManager* MobileKernel::identityManager() -{ - return mIdentityManager; -} - -MessageComposer::MessageSender* MobileKernel::msgSender() -{ - return mMessageSender; -} - - -void MobileKernel::setLastSelectedFolder(const Akonadi::Entity::Id& col) -{ - //TODO: implement - Q_UNUSED( col ); -} - -Akonadi::Entity::Id MobileKernel::lastSelectedFolder() -{ - return -1; //this was the default on Kmail desktop -} - -qreal MobileKernel::closeToQuotaThreshold() -{ - return 80; //this was the default on Kmail desktop -} - -bool MobileKernel::excludeImportantMailFromExpiry() -{ - return true;//this was the default on Kmail desktop -} - -bool MobileKernel::showPopupAfterDnD() -{ - return false; -} - -QStringList MobileKernel::customTemplates() -{ - return QStringList(); //TODO: implement -} - -void MobileKernel::openFilterDialog( bool createDummyFilter ) -{ - //TODO: Implement filter dialog for mobile - Q_UNUSED( createDummyFilter ); -} - -void MobileKernel::createFilter(const QByteArray& field, const QString& value) -{ - //TODO: Implement for mobile (call the dialog with predefined values) - Q_UNUSED( field ); - Q_UNUSED( value ); -} - diff --git a/kdepim/mobile/mail/mobilekernel.h b/kdepim/mobile/mail/mobilekernel.h deleted file mode 100644 index e163fc43..00000000 --- a/kdepim/mobile/mail/mobilekernel.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Andras Mantia - - 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 MOBILEKERNEL_H -#define MOBILEKERNEL_H - -#include "mailcommon/interfaces/mailinterfaces.h" - -#include - -namespace MessageComposer { -class AkonadiSender; -} -namespace KPIMIdentities { -class IdentityManager; -} - -namespace Akonadi { -class ChangeRecorder; -} - -namespace MailCommon { - class JobScheduler; -} - -namespace PimCommon { - class AutoCorrection; -} - -class MobileKernel : public MailCommon::IKernel, public MailCommon::ISettings, public MailCommon::IFilter -{ - -public: - static MobileKernel *self(); - - void setFolderCollectionMonitor( Akonadi::ChangeRecorder* monitor ) { mMonitor = monitor; } - void setCollectionModel( Akonadi::EntityMimeTypeFilterModel *collectionModel ) { mCollectionModel = collectionModel; } - PimCommon::AutoCorrection* composerAutoCorrection() const; - -//IKernel methods: - /*reimp*/ Akonadi::ChangeRecorder* folderCollectionMonitor() const { return mMonitor; } - /*reimp*/ MailCommon::JobScheduler* jobScheduler() const { return mJobScheduler; } - /*reimp*/ KSharedConfig::Ptr config(); - /*reimp*/ void syncConfig(); - /*reimp*/ KPIMIdentities::IdentityManager* identityManager(); - /*reimp*/ Akonadi::EntityMimeTypeFilterModel* collectionModel() const { return mCollectionModel; } - /*reimp*/ MessageComposer::MessageSender* msgSender(); - -//ISettings methods: - /*reimp*/ void updateSystemTray(); - /*reimp*/ void setLastSelectedFolder(const Akonadi::Entity::Id& col); - /*reimp*/ Akonadi::Entity::Id lastSelectedFolder(); - /*reimp*/ qreal closeToQuotaThreshold(); - /*reimp*/ bool excludeImportantMailFromExpiry(); - /*reimp*/ bool showPopupAfterDnD(); - /*reimp*/ QStringList customTemplates(); - -//IFilter methods: - virtual void createFilter(const QByteArray& field, const QString& value); - virtual void openFilterDialog( bool createDummyFilter = true ); - - /*reimp*/ ~MobileKernel(); - -private: - MobileKernel(); - - MailCommon::JobScheduler *mJobScheduler; - Akonadi::ChangeRecorder *mMonitor; - KPIMIdentities::IdentityManager *mIdentityManager; - Akonadi::EntityMimeTypeFilterModel *mCollectionModel; - MessageComposer::AkonadiSender *mMessageSender; - KSharedConfig::Ptr mConfig; - PimCommon::AutoCorrection *mAutoCorrection; -}; - -#endif // MOBILEKERNEL_H diff --git a/kdepim/mobile/mail/remove-attachment-button.png b/kdepim/mobile/mail/remove-attachment-button.png deleted file mode 100644 index b375375c..00000000 Binary files a/kdepim/mobile/mail/remove-attachment-button.png and /dev/null differ diff --git a/kdepim/mobile/mail/savemailcommand.cpp b/kdepim/mobile/mail/savemailcommand.cpp deleted file mode 100644 index 74a897ff..00000000 --- a/kdepim/mobile/mail/savemailcommand.cpp +++ /dev/null @@ -1,298 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Andras Mantia - - 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 "savemailcommand_p.h" -#include "messagecore/utils/stringutil.h" -#include "messageviewer/viewer/nodehelper.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -//TODO: Review if it is needed in other place as well -KUrl subjectToUrl( const QString &subject ) -{ - QString fileName = MessageCore::StringUtil::cleanFileName( subject.trimmed() ); - - // avoid stripping off the last part of the subject after a "." - // by KFileDialog, which thinks it's an extension - if ( !fileName.endsWith( QLatin1String( ".mbox" ) ) ) - fileName += QLatin1String(".mbox"); - - const QString filter = i18n( "*.mbox|email messages (*.mbox)\n*|all files (*)" ); - return KFileDialog::getSaveUrl( KUrl::fromPath( fileName ), filter ); -} - -#define STRDIM(x) (sizeof(x)/sizeof(*x)-1) -//TODO: copied from runtime/resources/mbox/libmbox/mbox_p.cpp . Check if we can share it. -QByteArray escapeFrom( const QByteArray &str ) -{ - const unsigned int strLen = str.length(); - if ( strLen <= STRDIM( "From " ) ) - return str; - - // worst case: \nFrom_\nFrom_\nFrom_... => grows to 7/6 - QByteArray result( int( strLen + 5 ) / 6 * 7 + 1, '\0'); - - const char * s = str.data(); - const char * const e = s + strLen - STRDIM( "From "); - char * d = result.data(); - - bool onlyAnglesAfterLF = false; // dont' match ^From_ - while ( s < e ) { - switch ( *s ) { - case '\n': - onlyAnglesAfterLF = true; - break; - case '>': - break; - case 'F': - if ( onlyAnglesAfterLF && qstrncmp( s+1, "rom ", STRDIM("rom ") ) == 0 ) - *d++ = '>'; - // fall through - default: - onlyAnglesAfterLF = false; - break; - } - *d++ = *s++; - } - while ( s < str.data() + strLen ) - *d++ = *s++; - - result.truncate( d - result.data() ); - return result; -} -#undef STRDIM - -QByteArray mboxMessageSeparator( const QByteArray &msg ) -{ - KMime::Message mail; - mail.setHead( KMime::CRLFtoLF( msg ) ); - mail.parse(); - - QByteArray separator = "From "; - - KMime::Headers::From *from = mail.from( false ); - if ( !from || from->addresses().isEmpty() ) - separator += "unknown@unknown.invalid"; - else - separator += from->addresses().first() + ' '; - - KMime::Headers::Date *date = mail.date(false); - if (!date || date->isEmpty()) - separator += QDateTime::currentDateTime().toString( Qt::TextDate ).toUtf8() + '\n'; - else - separator += date->as7BitString(false) + '\n'; - - return separator; -} - - -//TODO: remove when it is moved to kdepimlibs, use Util::showJobError instead -void showJobError( KJob* job ) -{ - assert(job); - // we can be called from the KJob::kill, where we are no longer a KIO::Job - // so better safe than sorry - KIO::Job* kiojob = dynamic_cast(job); - if( kiojob && kiojob->ui() ) - kiojob->ui()->showErrorMessage(); - else - kWarning() << "There is no GUI delegate set for a kjob, and it failed with error:" << job->errorString(); -} - - -SaveMailCommand::SaveMailCommand(const Akonadi::Item& message, QObject *parent) : - QObject(parent), mOffset(0), mJob(0), mTotalSize(0) -{ - mMessages.append(message); - mMsgListIndex = 0; -} - -SaveMailCommand::SaveMailCommand(const Akonadi::Item::List& messages, QObject *parent) : - QObject(parent), mMessages(messages), mOffset(0), mJob(0), mTotalSize(0) -{ - mMsgListIndex = 0; -} - -void SaveMailCommand::execute() -{ - Akonadi::Collection sourceFolder = mMessages.first().parentCollection(); - Akonadi::ItemFetchJob *job = new Akonadi::ItemFetchJob( mMessages, this ); - job->fetchScope().fetchFullPayload(true); - connect( job, SIGNAL(result(KJob*)), this, SLOT(slotFetchDone(KJob*))); -} - -void SaveMailCommand::slotFetchDone(KJob *job) -{ - if ( job->error() ) { - // handle errors - showJobError(job); - emitResult( Failed ); - return; - } - - Akonadi::ItemFetchJob *fjob = dynamic_cast( job ); - Q_ASSERT( fjob ); - mMessages = fjob->items(); - - mUrl = subjectToUrl( MessageViewer::NodeHelper::cleanSubject( mMessages.first().payload().get() ) ); - if ( mUrl.isEmpty() ) { - emitResult( Failed ); - return; - } - - if (mMessages.count() == 1) - mTotalSize = mMessages.first().size(); - - kDebug() << mUrl << mTotalSize; - -#ifndef KDEPIM_MOBILE_UI - mJob = KIO::put( mUrl, -1 /*TODO: See MessageViewer::Util::getWritePermissions() */ ); - mJob->setTotalSize( mTotalSize ); - mJob->setAsyncDataEnabled( true ); - connect(mJob, SIGNAL(dataReq(KIO::Job*,QByteArray&)), - SLOT(slotSaveDataReq())); - connect(mJob, SIGNAL(result(KJob*)), - SLOT(slotSaveResult(KJob*))); -#else - if ( QFile::exists( mUrl.toLocalFile() ) && KMessageBox::warningContinueCancel( 0 /*parentWidget()*/, - i18n("File %1 exists.\nDo you want to replace it?", - mUrl.prettyUrl()), i18n("Save to File"), KGuiItem(i18n("&Replace")) ) != KMessageBox::Continue) - { - emitResult( Failed ); - return; - } - QFile file( mUrl.toLocalFile() ); - if ( file.open( QFile::WriteOnly ) ) { - foreach ( const Akonadi::Item &item, mMessages ) { - slotMessageRetrievedForSaving( item ); - file.write( mData ); - } - emitResult( OK ); - } else { - emitResult( Failed ); - } -#endif -} - -//remove after the move to kdepimlibs -void SaveMailCommand::emitResult( Result value ) -{ - emit result( value ); - deleteLater(); -} - - -void SaveMailCommand::slotSaveDataReq() -{ - int remainingBytes = mData.size() - mOffset; - if ( remainingBytes > 0 ) { - // eat leftovers first - if ( remainingBytes > MAX_CHUNK_SIZE ) - remainingBytes = MAX_CHUNK_SIZE; - - QByteArray data; - data = QByteArray( mData.data() + mOffset, remainingBytes ); - mJob->sendAsyncData( data ); - mOffset += remainingBytes; - return; - } - // No leftovers, process next message. - if ( mMsgListIndex < static_cast( mMessages.size() ) ) { - slotMessageRetrievedForSaving( mMessages[mMsgListIndex] ); - } else { - // No more messages. Tell the putjob we are done. - QByteArray data = QByteArray(); - mJob->sendAsyncData( data ); - } -} - -void SaveMailCommand::slotMessageRetrievedForSaving(const Akonadi::Item &msg) -{ - //if ( msg ) - { - QByteArray msgData = msg.payloadData(); - QByteArray str( mboxMessageSeparator( msgData ) ); - str += escapeFrom( msgData ); - str += '\n'; - mData = str; - mData.resize( mData.size() - 1 ); - mOffset = 0; -#ifndef KDEPIM_MOBILE_UI - QByteArray data; - int size; - // Unless it is great than 64 k send the whole message. kio buffers for us. - if( mData.size() > MAX_CHUNK_SIZE ) - size = MAX_CHUNK_SIZE; - else - size = mData.size(); - - data = QByteArray( mData, size ); - mJob->sendAsyncData( data ); - mOffset += size; -#endif - } - ++mMsgListIndex; -} - - -void SaveMailCommand::slotSaveResult(KJob *job) -{ - if (job->error()) - { - if (job->error() == KIO::ERR_FILE_ALREADY_EXIST) - { - if (KMessageBox::warningContinueCancel(0 /*parentWidget()*/, - i18n("File %1 exists.\nDo you want to replace it?", - mUrl.prettyUrl()), i18n("Save to File"), KGuiItem(i18n("&Replace"))) - == KMessageBox::Continue) { - mOffset = 0; - - mJob = KIO::put( mUrl, -1 /*See MessageViewer::Util::getWritePermissions()*/, KIO::Overwrite ); - mJob->setTotalSize( mTotalSize ); - mJob->setAsyncDataEnabled( true ); - connect(mJob, SIGNAL(dataReq(KIO::Job*,QByteArray&)), - SLOT(slotSaveDataReq())); - connect(mJob, SIGNAL(result(KJob*)), - SLOT(slotSaveResult(KJob*))); - } - } - else - { - showJobError(job); - emitResult( Failed ); - deleteLater(); - } - } else { - emitResult( OK ); - deleteLater(); - } -} - -#include "moc_savemailcommand_p.cpp" diff --git a/kdepim/mobile/mail/savemailcommand_p.h b/kdepim/mobile/mail/savemailcommand_p.h deleted file mode 100644 index bb1257a8..00000000 --- a/kdepim/mobile/mail/savemailcommand_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Andras Mantia - - 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 -*/ - -/*TODO: This class belongs to kdepimlibs/akonadi/kmime (an SMAM command), just that as - of now, MessageViewer::NodeHelper and MessageCore::StringUtil is in kdepim, not in kdepimlibs - There it should inherit from CommandBase, like the other commands. - Based on KMSaveMsgCommand. -*/ - - -#ifndef SAVEMAILCOMMAND_P_H -#define SAVEMAILCOMMAND_P_H - -#include - -#include - -#include - -namespace KIO { - class TransferJob; -} - -class KJob; - -class SaveMailCommand : public QObject -{ - Q_OBJECT -public: - explicit SaveMailCommand(const Akonadi::Item& message, QObject *parent = 0); - explicit SaveMailCommand(const Akonadi::Item::List& messages, QObject *parent = 0); - - /*reimp*/ void execute(); - - enum Result { Undefined, OK, Canceled, Failed }; //Remove after moving to kdepimlibs - -Q_SIGNALS: - void result( Result ); //Remove after moving to kdepimlibs - - -protected Q_SLOTS: - virtual void emitResult( Result result ); //Remove after moving to kdepimlibs - -private Q_SLOTS: - void slotFetchDone( KJob* job ); - void slotSaveResult(KJob *job); - /** the message has been transferred for saving */ - void slotMessageRetrievedForSaving(const Akonadi::Item &msg); - void slotSaveDataReq(); - -private: - Akonadi::Item::List mMessages; - KUrl mUrl; - uint mMsgListIndex; - QByteArray mData; - int mOffset; - KIO::TransferJob *mJob; - size_t mTotalSize; - static const int MAX_CHUNK_SIZE = 64*1024; -}; - -#endif // SAVEMAILCOMMAND_P_H diff --git a/kdepim/mobile/mail/searchwidget.cpp b/kdepim/mobile/mail/searchwidget.cpp deleted file mode 100644 index 8e0df110..00000000 --- a/kdepim/mobile/mail/searchwidget.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 - -#include - -#include - -SearchWidget::SearchWidget( QWidget *parent ) - : QWidget( parent ) -{ - mUi.setupUi( this ); - - // set defaults - mUi.inSubjects->setChecked( true ); - mUi.inSenders->setChecked( true ); - mUi.inBodyContents->setChecked( true ); - mUi.startDate->setDate( QDate::currentDate() ); - mUi.endDate->setDate( QDate::currentDate().addYears( 1 ) ); - mUi.collectionCombo->setMimeTypeFilter( QStringList() << KMime::Message::mimeType() ); -} - -QString SearchWidget::query() const -{ - //TODO create search query form 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(); -} - diff --git a/kdepim/mobile/mail/searchwidget.h b/kdepim/mobile/mail/searchwidget.h deleted file mode 100644 index 52321477..00000000 --- a/kdepim/mobile/mail/searchwidget.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 -#include - -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 diff --git a/kdepim/mobile/mail/searchwidget.ui b/kdepim/mobile/mail/searchwidget.ui deleted file mode 100644 index 86bf04f0..00000000 --- a/kdepim/mobile/mail/searchwidget.ui +++ /dev/null @@ -1,219 +0,0 @@ - - - SearchWidget - - - - 0 - 0 - 451 - 227 - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Search for: - - - - - - - true - - - - - - - In: - - - - - - - - 0 - - - 3 - - - 0 - - - 3 - - - - - Subjects - - - - - - - Senders - - - - - - - Recipients - - - - - - - Body Contents - - - - - - - - - - Sent between: - - - - - - - - - true - - - - - - - - 0 - 0 - - - - and - - - Qt::AlignCenter - - - - - - - true - - - - - - - - - Include messages within the specified date range - - - - - - - Located in: - - - - - - - - 0 - - - 3 - - - 0 - - - 3 - - - - - any folder - - - true - - - - - - - only in folder - - - - - - - false - - - - - - - - - - - KDateComboBox - QComboBox -
kdatecombobox.h
-
- - KLineEdit - QLineEdit -
klineedit.h
-
- - Akonadi::CollectionComboBox - QComboBox -
akonadi/collectioncombobox.h
-
-
- - - - locatedInSpecificCollection - toggled(bool) - collectionCombo - setEnabled(bool) - - - 138 - 235 - - - 217 - 239 - - - - -
diff --git a/kdepim/mobile/mail/settings.kcfg.cmake b/kdepim/mobile/mail/settings.kcfg.cmake deleted file mode 100644 index 386c40c5..00000000 --- a/kdepim/mobile/mail/settings.kcfg.cmake +++ /dev/null @@ -1,136 +0,0 @@ - - - - kglobalsettings.h - - - - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - ${WARN_TOOMANY_RECIPIENTS_DEFAULT} - If the number of recipients is larger than this value, KMail Mobile will warn and ask for a confirmation before sending the mail. The warning can be turned off. - - - - 5 - 1 - 100 - If the number of recipients is larger than this value, KMail Mobile will warn and ask for a confirmation before sending the mail. The warning can be turned off. - - - - - - - - - - - - - 80 - - - red - - - - - - - - - - - - - - SortByDateTimeMostRecent - - - - - - - Ascending - - - - - - - - GroupByDate - - - true - - - - - - true - - - - - - - - - - - - - - - - - - Ignore - - - - - - - - - - - - - - - Nothing - - - diff --git a/kdepim/mobile/mail/settings.kcfgc b/kdepim/mobile/mail/settings.kcfgc deleted file mode 100644 index 734c1668..00000000 --- a/kdepim/mobile/mail/settings.kcfgc +++ /dev/null @@ -1,6 +0,0 @@ -File=settings.kcfg -ClassName=Settings -Mutators=true -Singleton=true -ItemAccessors=true -SetUserTexts=true diff --git a/kdepim/mobile/mail/snippetseditor.cpp b/kdepim/mobile/mail/snippetseditor.cpp deleted file mode 100644 index 17f8f265..00000000 --- a/kdepim/mobile/mail/snippetseditor.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "snippetseditor.h" - -#include -#include -#include - -#include -#include - -SnippetsEditor::SnippetsEditor( KActionCollection *actionCollection, QObject *parent ) - : QObject( parent ), mSnippetsManager( new MailCommon::SnippetsManager( actionCollection, this ) ) -{ - actionCollection->addAction(QLatin1String( "snippetseditor_add_snippet"), mSnippetsManager->addSnippetAction() ); - actionCollection->addAction( QLatin1String("snippetseditor_edit_snippet"), mSnippetsManager->editSnippetAction() ); - actionCollection->addAction( QLatin1String("snippetseditor_delete_snippet"), mSnippetsManager->deleteSnippetAction() ); - - actionCollection->addAction( QLatin1String("snippetseditor_add_snippetgroup"), mSnippetsManager->addSnippetGroupAction() ); - actionCollection->addAction( QLatin1String("snippetseditor_edit_snippetgroup"), mSnippetsManager->editSnippetGroupAction() ); - actionCollection->addAction( QLatin1String("snippetseditor_delete_snippetgroup"), mSnippetsManager->deleteSnippetGroupAction() ); - - actionCollection->addAction( QLatin1String("snippetseditor_insert_snippet"), mSnippetsManager->insertSnippetAction() ); - - mProxyModel = new KDescendantsProxyModel( this ); - mProxyModel->setSourceModel( mSnippetsManager->model() ); -} - -void SnippetsEditor::setEditor( QObject *editor, const char *insertSnippetMethod, const char *dropSignal ) -{ - mSnippetsManager->setEditor( editor, insertSnippetMethod, dropSignal ); -} - -void SnippetsEditor::save() -{ - //TODO:mSnippetsManager->save(); -} - -QAbstractItemModel* SnippetsEditor::model() const -{ - return mProxyModel; -} - -void SnippetsEditor::setRowSelected( int row ) -{ - QItemSelectionModel *selectionModel = mSnippetsManager->selectionModel(); - - Q_ASSERT( row >= 0 && row < mProxyModel->rowCount() ); - - const QModelIndex proxyIndex = mProxyModel->index( row, 0, QModelIndex() ); - - selectionModel->select( mProxyModel->mapToSource( proxyIndex ), QItemSelectionModel::ClearAndSelect ); -} - diff --git a/kdepim/mobile/mail/snippetseditor.h b/kdepim/mobile/mail/snippetseditor.h deleted file mode 100644 index 08b5afe9..00000000 --- a/kdepim/mobile/mail/snippetseditor.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 SNIPPETSEDITOR_H -#define SNIPPETSEDITOR_H - -#include - -namespace MailCommon { -class SnippetsManager; -} - -class KActionCollection; -class KDescendantsProxyModel; -class QAbstractItemModel; - -/** - * @short The C++ part of the snippets editor for mobile apps. - * - * This class encapsulates the logic of the snippet viewing/editing - * and the UI is provided by SnippetsEditor.qml. - */ -class SnippetsEditor : public QObject -{ - Q_OBJECT - - public: - /** - * Creates a new snippets editor. - * - * @param actionCollection The action collection to register the manipulation - * actions (e.g. add, edit, delete) at - * @param parent The parent object. - */ - explicit SnippetsEditor( KActionCollection *actionCollection, QObject *parent = 0 ); - - void setEditor( QObject *editor, const char *insertSnippetMethod, const char *dropSignal ); - - public Q_SLOTS: - /** - * Saves changes to the snippets back to disk. - */ - void save(); - - /** - * Returns the snippets list model of the current collection. - */ - QAbstractItemModel* model() const; - - /** - * Sets the row of the snippets the user has selected in the UI. - */ - void setRowSelected( int row ); - - private: - MailCommon::SnippetsManager *mSnippetsManager; - KDescendantsProxyModel *mProxyModel; -}; - -#endif diff --git a/kdepim/mobile/mail/templateemailmodel.cpp b/kdepim/mobile/mail/templateemailmodel.cpp deleted file mode 100644 index 2ba07f87..00000000 --- a/kdepim/mobile/mail/templateemailmodel.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Andras Mantia - - 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 "templateemailmodel.h" -#include -#include - -QVariant TemplateEmailModel::data(const QModelIndex& index, int role) const -{ - if ( role == Qt::DisplayRole ) { - KMime::Message::Ptr message = Akonadi::SelectionProxyModel::data(index, Akonadi::EntityTreeModel::ItemRole).value().payload(); - return message->subject()->asUnicodeString(); - } else { - return Akonadi::SelectionProxyModel::data(index, role); - } -} diff --git a/kdepim/mobile/mail/templateemailmodel.h b/kdepim/mobile/mail/templateemailmodel.h deleted file mode 100644 index 47c786ae..00000000 --- a/kdepim/mobile/mail/templateemailmodel.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Andras Mantia - - 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 TEMPLATEEMAILMODEL_H -#define TEMPLATEEMAILMODEL_H - -#include - -/** A simple model that overrides the data() method, so the display role is the subject of the mails. - * Then in QML one can use "display" to get it. - */ -class TemplateEmailModel : public Akonadi::SelectionProxyModel { - Q_OBJECT -public: - explicit TemplateEmailModel( QItemSelectionModel *selectionModel, QObject *parent = 0 ) : Akonadi::SelectionProxyModel( selectionModel, parent) { - } - - QVariant data( const QModelIndex & index, int role = Qt::DisplayRole ) const; -}; - - -#endif // TEMPLATEEMAILMODEL_H diff --git a/kdepim/mobile/mail/tests/CMakeLists.txt b/kdepim/mobile/mail/tests/CMakeLists.txt deleted file mode 100644 index 8b137891..00000000 --- a/kdepim/mobile/mail/tests/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/kdepim/mobile/mail/tests/StaticCollectionModel.qml b/kdepim/mobile/mail/tests/StaticCollectionModel.qml deleted file mode 100644 index 664a0176..00000000 --- a/kdepim/mobile/mail/tests/StaticCollectionModel.qml +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 Qt 4.6 -import org.kde 4.5 - -/** - * Static set of collections, for testing QML files without available Akonadi. - */ -ListModel { - ListElement { - display: "Inbox" - decoration: "mail-inbox" - } -} \ No newline at end of file diff --git a/kdepim/mobile/mail/tests/StaticMessageModel.qml b/kdepim/mobile/mail/tests/StaticMessageModel.qml deleted file mode 100644 index 2b2a55da..00000000 --- a/kdepim/mobile/mail/tests/StaticMessageModel.qml +++ /dev/null @@ -1,260 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 Qt 4.6 - -/** - * Static set of nessages, for testing QML files without available Akonadi. - */ -ListModel { - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } - ListElement { - subject: "Hello World!" - from: "Volker Krause " - to: "Steve Kelly " - date: "Monday, 22nd March 2010, 14:28 CET" - } -} \ No newline at end of file diff --git a/kdepim/mobile/mail/tests/folderviewtest.qml b/kdepim/mobile/mail/tests/folderviewtest.qml deleted file mode 100644 index 5c4685b7..00000000 --- a/kdepim/mobile/mail/tests/folderviewtest.qml +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 Qt 4.6 -import org.kde 4.5 -import org.kde.akonadi 4.5 -import "StaticCollectionModel.qml" - -Rectangle { - width: 800 - height: 480 - - StaticCollectionModel { - id: collectionModel - } - - CollectionView { - model: collectionModel - anchors.fill: parent - } -} \ No newline at end of file diff --git a/kdepim/mobile/mail/tests/headerlisttest.qml b/kdepim/mobile/mail/tests/headerlisttest.qml deleted file mode 100644 index 4a62b47e..00000000 --- a/kdepim/mobile/mail/tests/headerlisttest.qml +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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 Qt 4.6 -import org.kde 4.5 -import "StaticMessageModel.qml" -import ".." - -Rectangle { - id: topLevel - height: 480 - width: 800 - - StaticMessageModel { id: itemModel } - - HeaderView { - id: headerList - anchors.fill: parent - model: itemModel - } -} diff --git a/kdepim/mobile/mail/toggle-encryption-button.png b/kdepim/mobile/mail/toggle-encryption-button.png deleted file mode 100644 index 12c3e655..00000000 Binary files a/kdepim/mobile/mail/toggle-encryption-button.png and /dev/null differ diff --git a/kdepim/mobile/mail/toggle-signature-button.png b/kdepim/mobile/mail/toggle-signature-button.png deleted file mode 100644 index 22a71fd1..00000000 Binary files a/kdepim/mobile/mail/toggle-signature-button.png and /dev/null differ diff --git a/kdepim/mobile/mail/vacationmanager.cpp b/kdepim/mobile/mail/vacationmanager.cpp deleted file mode 100644 index 8f71928c..00000000 --- a/kdepim/mobile/mail/vacationmanager.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "vacationmanager.h" - -#include -#include -#include -#include -#include -#include - -#include - -VacationManager::VacationManager( KActionCollection *actionCollection, QObject *kernel, QObject *parent ) - : QObject( parent ), - mKernel( kernel ), - mVacationScriptIsActive( false ), - mEditAction( 0 ) -{ - if ( KSieveUi::Util::checkOutOfOfficeOnStartup() ) - QTimer::singleShot( 0, this, SLOT(checkVacation()) ); - - if ( KSieveUi::Util::allowOutOfOfficeSettings() ) { - mEditAction = new KAction( i18n( "Edit \"Out of Office\" Replies" ), this ); - actionCollection->addAction( QLatin1String("tools_edit_vacation"), mEditAction ); - connect( mEditAction, SIGNAL(triggered(bool)), SLOT(editVacation()) ); - } -} - -VacationManager::~VacationManager() -{ -} - -bool VacationManager::activeVacationScriptAvailable() const -{ - return mVacationScriptIsActive; -} - -void VacationManager::updateVacationScriptActivity( bool active, const QString &serverName ) -{ - Q_UNUSED(serverName); - mVacationScriptIsActive = active; - emit vacationScriptActivityChanged(); -} - -void VacationManager::checkVacation() -{ - updateVacationScriptActivity( false ); - - if ( !askToGoOnline() ) - return; - - KSieveUi::Vacation *vacation = new KSieveUi::Vacation( this, true /* check only */ ); - connect( vacation, SIGNAL(scriptActive(bool,QString)), SLOT(updateVacationScriptActivity(bool,QString)) ); - connect( vacation, SIGNAL(requestEditVacation()), SLOT(editVacation()) ); -} - -void VacationManager::editVacation() -{ - if ( !askToGoOnline() ) - return; - - if ( mVacation ) - return; - - mVacation = new KSieveUi::Vacation( this ); - connect( mVacation, SIGNAL(scriptActive(bool,QString)), SLOT(updateVacationScriptActivity(bool,QString)) ); - connect( mVacation, SIGNAL(requestEditVacation()), SLOT(editVacation()) ); - if ( mVacation->isUsable() ) { - connect( mVacation, SIGNAL(result(bool)), mVacation, SLOT(deleteLater()) ); - } else { - QString msg = i18n( "KMail Mobile's Out of Office Reply functionality relies on " - "server-side filtering. You have not yet configured an " - "IMAP server for this.\n" - "You can do this on the \"Filtering\" tab of the IMAP " - "account configuration."); - KMessageBox::sorry( 0, msg, i18n( "No Server-Side Filtering Configured" ) ); - - delete mVacation; - } -} - -bool VacationManager::askToGoOnline() const -{ - bool result = false; - - QMetaObject::invokeMethod( mKernel, "askToGoOnline", Qt::DirectConnection, - Q_RETURN_ARG( bool, result ) ); - - return result; -} - diff --git a/kdepim/mobile/mail/vacationmanager.h b/kdepim/mobile/mail/vacationmanager.h deleted file mode 100644 index df6b7cd9..00000000 --- a/kdepim/mobile/mail/vacationmanager.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 VACATIONMANAGER_H -#define VACATIONMANAGER_H - -#include -#include - -namespace KSieveUi { -class Vacation; -} - -class KAction; -class KActionCollection; - -/** - * @short A class that encapsulates the handling of vacation sieve scripts. - */ -class VacationManager : public QObject -{ - Q_OBJECT - - Q_PROPERTY( bool activeVacationScriptAvailable READ activeVacationScriptAvailable NOTIFY vacationScriptActivityChanged ) - - public: - /** - * Creates a new vacation manager. - * - * @param actionCollection The action collection to register the edit action at. - * @param kernel The object that provide a bool askToGoOnline() slot. - * @param parent The parent object. - */ - explicit VacationManager( KActionCollection *actionCollection, QObject *kernel, QObject *parent = 0 ); - - /** - * Destroys the vacation manager. - */ - ~VacationManager(); - - /** - * Returns whether an active vacation script is available on the server. - */ - bool activeVacationScriptAvailable() const; - - public Q_SLOTS: - /** - * Opens the vacation script edit dialog. - */ - void editVacation(); - - Q_SIGNALS: - /** - * This signal is emitted whenever the activity of the vacation script has changed. - */ - void vacationScriptActivityChanged(); - - private Q_SLOTS: - void updateVacationScriptActivity(bool , const QString &serverName=QString()); - - void checkVacation(); - - private: - bool askToGoOnline() const; - - QPointer mVacation; - QObject *mKernel; - bool mVacationScriptIsActive; - KAction *mEditAction; -}; - -#endif diff --git a/kdepim/mobile/notes/BulkActionComponent.qml b/kdepim/mobile/notes/BulkActionComponent.qml deleted file mode 100644 index 46799420..00000000 --- a/kdepim/mobile/notes/BulkActionComponent.qml +++ /dev/null @@ -1,45 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - Copyright (c) 2010 Stephen Kelly - - 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.0 -import org.kde 4.5 -import org.kde.pim.mobileui 4.5 as KPIM - -KPIM.BulkActionScreen { - id : bulkActionScreen - visible : guiStateManager.inBulkActionScreenState - anchors.top: parent.top - anchors.fill: parent - backgroundImage : backgroundImage.source - - actionListWidth : 1/3 * parent.width - multipleText : KDE.i18np("1 note book", "%1 note books", collectionView.numSelected) - selectedItemModel : _breadcrumbNavigationFactory.qmlSelectedItemModel(); - headerList : NotesListView { - showCheckBox : true - id: bulkActionHeaderList - model: itemModel - checkModel : _itemActionModel - anchors.fill : parent - showDeleteButton: false - itemHeight: bulkActionScreen.itemHeight - } -} diff --git a/kdepim/mobile/notes/CMakeLists.txt b/kdepim/mobile/notes/CMakeLists.txt deleted file mode 100644 index e1dbf276..00000000 --- a/kdepim/mobile/notes/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -project(notes-mobile) - -include_directories( - ${KDEPIMLIBS_INCLUDE_DIR} - ${AKONADI_INCLUDE_DIR} - ${Boost_INCLUDE_DIR} -) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}") - -set(notes_mobile_SRCS - notelistproxy.cpp - notesexporthandler.cpp - notesfilterproxymodel.cpp - notesimporthandler.cpp - mainview.cpp - main.cpp - searchwidget.cpp -) - -qt4_wrap_ui(notes_mobile_SRCS searchwidget.ui) - -if(RUNTIME_PLUGINS_STATIC) - add_definitions(-DMAIL_SERIALIZER_PLUGIN_STATIC) -endif() - -kde4_add_app_icon(notes_mobile_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/hi*-apps-notes-mobile.png") - -kde4_add_executable(notes-mobile ${notes_mobile_SRCS}) - -target_link_libraries(notes-mobile - ${QT_QTDECLARATIVE_LIBRARY} - ${KDEPIMLIBS_AKONADI_KMIME_LIBS} - ${KDEPIMLIBS_KMIME_LIBS} - ${KDEPIMLIBS_KMBOX_LIBS} - kdepimmobileui - kdepim - akonadi_next -) - -if(RUNTIME_PLUGINS_STATIC) - target_link_libraries(notes-mobile akonadi_serializer_mail) -endif() - -install(TARGETS notes-mobile ${INSTALL_TARGETS_DEFAULT_ARGS}) -install(PROGRAMS notes-mobile.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) -install(FILES - BulkActionComponent.qml - notes.qml - NoteActions.qml - NoteView.qml - NotesListView.qml - notes-mobile-background.png - DESTINATION ${DATA_INSTALL_DIR}/notes-mobile -) - -kde4_install_icons(${ICON_INSTALL_DIR}) diff --git a/kdepim/mobile/notes/Messages.sh b/kdepim/mobile/notes/Messages.sh deleted file mode 100644 index 28c8dab2..00000000 --- a/kdepim/mobile/notes/Messages.sh +++ /dev/null @@ -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/notes-mobile.pot -$XGETTEXT -ktranslate `find . -name '*.qml'` -j -L Java -o $podir/notes-mobile.pot -rm -f rc.cpp diff --git a/kdepim/mobile/notes/NoteActions.qml b/kdepim/mobile/notes/NoteActions.qml deleted file mode 100644 index 03d93fef..00000000 --- a/kdepim/mobile/notes/NoteActions.qml +++ /dev/null @@ -1,128 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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.0 -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 Notebooks" ) } - ActionListItem { name : "import_notes" } - } - - FavoriteManager{ model : favoritesList } - - AgentInstanceList { - name : "accounts_list" - category : "home" - 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_notes" } - } - - ActionList { - category : "single_folder" - name : "single_folder_folder_menu" - text : KDE.i18n( "Folder" ) - ActionListItem { name : "akonadi_collection_sync" } - ActionListItem { name : "export_selected_notes" } - } - - 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_notes" } - } - - ActionList { - name : "multi_folder_view_menu" - category : "multiple_folder" - 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 Notebooks" ) } - ScriptActionItem { name : "start_maintenance"; title : KDE.i18n( "Switch To Editing Mode" ) } - } - - ActionList { - name : "note_viewer_edit_menu" - category : "note_viewer" - text : KDE.i18n( "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( "Notes" ) - type : "note" - configureActionVisible: false - - addNewActionName: "add_new_note" - //TODO enable when SearchWidget::query() is implemented - //searchActionTitle: KDE.i18n( "Search For Notes" ) - } -} diff --git a/kdepim/mobile/notes/NoteView.qml b/kdepim/mobile/notes/NoteView.qml deleted file mode 100644 index 6181f1dd..00000000 --- a/kdepim/mobile/notes/NoteView.qml +++ /dev/null @@ -1,108 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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.0 - -Rectangle { - id : _topContext - color: "#00000000" // Set a transparent color. - property int currentNoteRow : -1 - anchors.fill : parent - - onCurrentNoteRowChanged : { - titleInput.text = application.noteTitle( currentNoteRow ); - contentEdit.text = application.noteContent( currentNoteRow ); - } - - function saveNote() - { - application.saveNote(titleInput.text, contentEdit.text); - } - - Rectangle { - border { color: "grey"; width: 2; } - color: "#00000000" - id : titleWrapper - anchors.top : parent.top - anchors.left : parent.left - anchors.right : parent.right - height : 30 - radius : 8 - TextInput { - id : titleInput - color : "#000001" // yes, not exactly black, since QML maps black to white on the N900... - anchors.left : parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.leftMargin : 10 - anchors.rightMargin : 10 - - /* - onClicked : { - application.saveCurrentNoteContent(contentEdit.text); - } */ - } - - } - - Rectangle { - border { color: "grey"; width: 2; } - color: "#00000000" - anchors.top : titleWrapper.bottom - anchors.left : parent.left - anchors.right : parent.right - anchors.bottom : parent.bottom - anchors.topMargin: 8 - radius : 8 - Flickable { - id: flick - - anchors.fill : parent - anchors.topMargin : 8 - anchors.bottomMargin : 8 - anchors.leftMargin : 10 - anchors.rightMargin : 10 - - clip: true - - function ensureVisible(r) - { - if (contentX >= r.x) - contentX = r.x; - else if (contentX+width <= r.x+r.width) - contentX = r.x+r.width-width; - if (contentY >= r.y) - contentY = r.y; - else if (contentY+height <= r.y+r.height) - contentY = r.y+r.height-height; - } - - TextEdit { - id : contentEdit - color : "#000001" // yes, not exactly black, since QML maps black to white on the N900... - anchors.fill : parent - - wrapMode: TextEdit.Wrap - onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) - } - } - } -} diff --git a/kdepim/mobile/notes/NotesListView.qml b/kdepim/mobile/notes/NotesListView.qml deleted file mode 100644 index 98690f31..00000000 --- a/kdepim/mobile/notes/NotesListView.qml +++ /dev/null @@ -1,146 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - 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.0 -import org.kde.pim.mobileui 4.5 as KPIM - -/** Akonadi Note List View - */ -KPIM.ItemListView { - id: _top - property bool showDeleteButton : true - property bool showCheckBox - property variant checkModel - - delegate: [ - KPIM.ItemListViewDelegate { - showCheckBox : _top.showCheckBox - checkModel : _top.checkModel - navigationModel : _top.navigationModel - height : _top.itemHeight - summaryContent : [ - Text { - id: titleLabel - anchors.top : parent.top - anchors.topMargin : 1 - anchors.left : parent.left - anchors.leftMargin : 10 - anchors.right: parent.right - anchors.rightMargin: deleteAction.width - text : model.title - color : "#0C55BB" - font.pixelSize: 16 - elide: "ElideRight" - }, - Text { - id: subjectLabel - anchors.top : titleLabel.bottom - anchors.topMargin : 1 - anchors.left : parent.left - anchors.leftMargin : 10 - anchors.right: parent.right - anchors.rightMargin: deleteAction.width - height : 30; - text : model.shortContent - font.pixelSize: 18 - elide: "ElideRight" - clip: true - }, /* - Image { - id : importantFlagImage - anchors.verticalCenter : parent.verticalCenter; - anchors.left : parent.left - anchors.leftMargin : 15 - source : "important-email.png" - opacity : model.is_important ? 0.25 : 0 - }, - Image { - id : actionFlagImage - anchors.verticalCenter : parent.verticalCenter; - anchors.left : importantFlagImage.right - source : "action-item-email.png" - opacity : model.is_action_item ? 0.25 : 0 - }, */ - KPIM.Action{ - id : deleteAction - anchors.verticalCenter: parent.verticalCenter; - anchors.right : parent.right; - width: imageWidth - height : imageHeight - action : application.getAction("akonadi_item_delete", "") - hidable : false - showText : false - disableable : false - opacity : 0.6 - visible : showDeleteButton - onTriggered : { - _itemActionModel.select(model.index, 3); - } - image : KDE.locate( "data", "mobileui/delete-button.png" ); - } - ] - - states : [ - State { - name : "deleteFaded" - when : itemListView.flicking - PropertyChanges { - target : deleteAction; - opacity : 0 - } - PropertyChanges { - target : deleteAction.anchors; - rightMargin : -deleteAction.width - } - } - ] - transitions : [ - Transition { - from : "" - to : "deleteFaded" - PropertyAnimation { - target : deleteAction - properties : "opacity" - duration: 500 - easing.type: "OutQuad" - } - }, - Transition { - from : "deleteFaded" - to : "" - SequentialAnimation { - PauseAnimation { - // delay a bit - duration: { - // TODO: figure out how to do this. - 0 - } - } - PropertyAnimation { - target : deleteAction.anchors - properties : "rightMargin" - duration: 500 - easing.type: "InQuad" - } - } - } - ] - } - ] -} diff --git a/kdepim/mobile/notes/hi48-apps-notes-mobile.png b/kdepim/mobile/notes/hi48-apps-notes-mobile.png deleted file mode 100644 index ed1e1075..00000000 Binary files a/kdepim/mobile/notes/hi48-apps-notes-mobile.png and /dev/null differ diff --git a/kdepim/mobile/notes/hi64-apps-notes-mobile.png b/kdepim/mobile/notes/hi64-apps-notes-mobile.png deleted file mode 100644 index 1630d4f0..00000000 Binary files a/kdepim/mobile/notes/hi64-apps-notes-mobile.png and /dev/null differ diff --git a/kdepim/mobile/notes/hi80-apps-notes-mobile-harmattan.png b/kdepim/mobile/notes/hi80-apps-notes-mobile-harmattan.png deleted file mode 100644 index 89c2c97b..00000000 Binary files a/kdepim/mobile/notes/hi80-apps-notes-mobile-harmattan.png and /dev/null differ diff --git a/kdepim/mobile/notes/main.cpp b/kdepim/mobile/notes/main.cpp deleted file mode 100644 index 6867a255..00000000 --- a/kdepim/mobile/notes/main.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 -#include -#include - -#include "mainview.h" - -#ifdef MAIL_SERIALIZER_PLUGIN_STATIC -#include - -Q_IMPORT_PLUGIN(akonadi_serializer_mail) -#endif - -int main( int argc, char **argv ) -{ - const QByteArray& ba = QByteArray( "notes-mobile" ); - const KLocalizedString name = ki18n( "Kontact Touch Notes" ); - - KAboutData aboutData( ba, ba, name, ba, name ); - aboutData.setProductName( "KJots Mobile" ); //has to match the bugzilla product name - - KCmdLineArgs::init( argc, argv, &aboutData ); - KDeclarativeApplication app; - - return app.exec(); -} - diff --git a/kdepim/mobile/notes/mainview.cpp b/kdepim/mobile/notes/mainview.cpp deleted file mode 100644 index dbedaa42..00000000 --- a/kdepim/mobile/notes/mainview.cpp +++ /dev/null @@ -1,377 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "mainview.h" - -#include "actionhelper.h" -#include "notelistproxy.h" -#include "notesexporthandler.h" -#include "notesfilterproxymodel.h" -#include "notesimporthandler.h" -#include "searchwidget.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#ifdef KDEQMLPLUGIN_STATIC -#include "runtime/qml/kde/kdeintegration.h" -#endif - -using namespace Akonadi; - -QML_DECLARE_TYPE( DeclarativeSearchWidget ) - -MainView::MainView( QWidget *parent ) - : KDeclarativeMainView( QLatin1String("notes"), new NoteListProxy( Akonadi::EntityTreeModel::UserRole ), parent ) -{ -} - -void MainView::doDelayedInit() -{ - setWindowTitle( i18n( "Notes" ) ); - - qmlRegisterType( "org.kde.akonadi.notes", 4, 5, "SearchWidget" ); - -#ifdef KDEQMLPLUGIN_STATIC - rootContext()->setContextProperty( QLatin1String( "KDE" ), new KDEIntegration( this ) ); -#endif - - addMimeType( QLatin1String("text/x-vnd.akonadi.note") ); - itemFetchScope().fetchFullPayload(); - - KAction *action = new KAction( i18n( "New Note" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(startComposer()) ); - actionCollection()->addAction( QLatin1String( "add_new_note" ), action ); - - action = new KAction( i18n( "Import Notes" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(importItems()) ); - actionCollection()->addAction( QLatin1String( "import_notes" ), action ); - - action = new KAction( i18n( "Export Notes From This Account" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(exportItems()) ); - actionCollection()->addAction( QLatin1String( "export_account_notes" ), action ); - - action = new KAction( i18n( "Export Displayed Notes" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(exportItems()) ); - actionCollection()->addAction( QLatin1String( "export_selected_notes" ), action ); -} - -QString MainView::noteTitle( int row ) const -{ - if ( row < 0 ) - return QString(); - - QObject *itemModelObject = engine()->rootContext()->contextProperty( QLatin1String("itemModel") ).value(); - QAbstractItemModel *itemModel = qobject_cast( itemModelObject ); - - if ( !itemModel ) - return QString(); - - static const int column = 0; - const QModelIndex index = itemModel->index( row, column ); - - if ( !index.isValid() ) - return QString(); - - const Item item = index.data( EntityTreeModel::ItemRole ).value(); - - if ( !item.isValid() ) - return QString(); - - if ( !item.hasPayload() ) - return QString(); - - const KMime::Message::Ptr note = item.payload(); - - return note->subject()->asUnicodeString(); -} - -QString MainView::noteContent( int row ) const -{ - if ( row < 0 ) - return QString(); - - QObject *itemModelObject = engine()->rootContext()->contextProperty( QLatin1String("itemModel") ).value(); - QAbstractItemModel *itemModel = qobject_cast( itemModelObject ); - - if ( !itemModel ) - return QString(); - - static const int column = 0; - const QModelIndex index = itemModel->index( row, column ); - - if ( !index.isValid() ) - return QString(); - - const Item item = index.data( EntityTreeModel::ItemRole ).value(); - - if ( !item.isValid() ) - return QString(); - - if ( !item.hasPayload() ) - return QString(); - - const KMime::Message::Ptr note = item.payload(); - - // TODO: Rich mimetype. - return note->mainBodyPart()->decodedText(); -} - -void MainView::saveNote( const QString& title, const QString& content ) -{ - QAbstractItemModel *model = const_cast( itemSelectionModel()->model() ); - - if ( !model->hasChildren() ) - return; - - const QModelIndexList list = itemSelectionModel()->selectedRows(); - - if ( list.size() != 1 ) - return; - - const QModelIndex index = list.first(); - - Q_ASSERT( index.isValid() ); - - Item item = index.data( EntityTreeModel::ItemRole ).value(); - - if ( !item.isValid() ) - return; - - if ( !item.hasPayload() ) - return; - - KMime::Message::Ptr note = item.payload(); - note->subject()->fromUnicodeString( title, "utf-8" ); - KMime::Content *c = note->mainBodyPart(); - c->fromUnicodeString( content ); - - note->assemble(); - - model->setData( index, QVariant::fromValue( item ), EntityTreeModel::ItemRole ); -} - -void MainView::saveCurrentNoteTitle( const QString& title ) -{ - QAbstractItemModel *model = const_cast( itemSelectionModel()->model() ); - - if ( !model->hasChildren() ) - return; - - const QModelIndexList list = itemSelectionModel()->selectedRows(); - - if ( list.size() != 1 ) - return; - - const QModelIndex index = list.first(); - - Q_ASSERT( index.isValid() ); - - Item item = index.data( EntityTreeModel::ItemRole ).value(); - - if ( !item.isValid() ) - return; - - if ( !item.hasPayload() ) - return; - - KMime::Message::Ptr note = item.payload(); - note->subject()->fromUnicodeString( title, "utf-8" ); - - note->assemble(); - - model->setData( index, QVariant::fromValue( item ), EntityTreeModel::ItemRole ); -} - -void MainView::saveCurrentNoteContent( const QString& content ) -{ - QAbstractItemModel *model = const_cast( itemSelectionModel()->model() ); - - if ( !model->hasChildren() ) - return; - - const QModelIndexList list = itemSelectionModel()->selectedRows(); - - if ( list.size() != 1 ) - return; - - const QModelIndex index = list.first(); - - Q_ASSERT( index.isValid() ); - - Item item = index.data( EntityTreeModel::ItemRole ).value(); - - if ( !item.isValid() ) - return; - - if ( !item.hasPayload() ) - return; - - KMime::Message::Ptr note = item.payload(); - KMime::Content *c = note->mainBodyPart(); - c->fromUnicodeString( content ); - - note->assemble(); - - model->setData( index, QVariant::fromValue( item ), EntityTreeModel::ItemRole ); -} - -Collection MainView::suitableContainerCollection( const QModelIndex &parent ) const -{ - const int rowCount = entityTreeModel()->rowCount( parent ); - for ( int row = 0; row < rowCount; ++row ) { - static const int column = 0; - const QModelIndex index = entityTreeModel()->index( row, column, parent ); - Q_ASSERT( index.isValid() ); - - const Collection collection = index.data( EntityTreeModel::CollectionRole ).value(); - Q_ASSERT( collection.isValid() ); - - if ( collection.contentMimeTypes().contains( Akonotes::Note::mimeType() ) ) - return collection; - - const Collection descendantCollection = suitableContainerCollection( index ); - if ( descendantCollection.isValid() ) - return descendantCollection; - } - - return Collection(); -} - -void MainView::startComposer() -{ - // If a collection is currently selected, put the new note there. - - const int rowCount = selectedItemsModel()->rowCount(); - - if ( rowCount > 1 ) - // Multiple items are selected. Find out how this should be handled. - return; - - if ( rowCount == 1 ) { - const QModelIndex index = selectedItemsModel()->index( 0, 0 ); - Q_ASSERT( index.isValid() ); - - const Collection collection = index.data( EntityTreeModel::CollectionRole ).value(); - Q_ASSERT( collection.isValid() ); - - Akonotes::NoteCreatorAndSelector *noteCreator = new Akonotes::NoteCreatorAndSelector( itemSelectionModel(), itemSelectionModel(), this ); - noteCreator->createNote( collection ); - - return; - } - - // otherwise nothing is selected, find a collection which can contain notes and put it there. - - const Collection collection = suitableContainerCollection(); - - if ( !collection.isValid() ) { - KMessageBox::information( this, i18n( "You do not appear to have any resources for notes. Please create one first." ), - i18n( "No resources available" ) ); - // No suitable collection found. - // Create a resource with LocalResourceCreator, - // then add a collection, then use the NoteCreatorAndSelector. - return; - } - - Akonotes::NoteCreatorAndSelector *noteCreator = new Akonotes::NoteCreatorAndSelector( regularSelectionModel(), itemSelectionModel(), this ); - noteCreator->createNote( collection ); -} - -void MainView::setupStandardActionManager( QItemSelectionModel *collectionSelectionModel, - QItemSelectionModel *itemSelectionModel ) -{ - Akonadi::StandardActionManager *manager = new Akonadi::StandardActionManager( actionCollection(), this ); - manager->setCollectionSelectionModel( collectionSelectionModel ); - manager->setItemSelectionModel( itemSelectionModel ); - - manager->createAllActions(); - manager->interceptAction( Akonadi::StandardActionManager::CreateResource ); - - connect( manager->action( Akonadi::StandardActionManager::CreateResource ), SIGNAL(triggered(bool)), - this, SLOT(launchAccountWizard()) ); - - ActionHelper::adaptStandardActionTexts( manager ); - - manager->action( StandardActionManager::CollectionProperties )->setText( i18n( "Notebook Properties" ) ); - manager->action( StandardActionManager::CreateCollection )->setText( i18n( "New Sub Notebook" ) ); - manager->action( StandardActionManager::CreateCollection )->setProperty( "ContentMimeTypes", QStringList() << Akonadi::Collection::mimeType() << Akonotes::Note::mimeType() ); - manager->setActionText( StandardActionManager::SynchronizeCollections, ki18np( "Synchronize This Notebook", "Synchronize These Notebooks" ) ); - manager->setActionText( StandardActionManager::DeleteCollections, ki18np( "Delete Notebook", "Delete Notebooks" ) ); - manager->action( StandardActionManager::MoveCollectionToDialog )->setText( i18n( "Move Notebook To" ) ); - manager->action( StandardActionManager::CopyCollectionToDialog )->setText( i18n( "Copy Notebook To" ) ); - manager->action( StandardActionManager::CopyItemToDialog )->setText( i18n( "Copy Note To" ) ); - manager->action( StandardActionManager::MoveItemToDialog )->setText( i18n( "Move Note To" ) ); - manager->setActionText( StandardActionManager::DeleteItems, ki18np( "Delete Note", "Delete Notes" ) ); - - actionCollection()->action( QLatin1String("synchronize_all_items") )->setText( i18n( "Synchronize All Accounts" ) ); -} - -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?" ) ); -} - -QAbstractProxyModel* MainView::createItemFilterModel() const -{ - return new NotesFilterProxyModel(); -} - -ImportHandlerBase* MainView::importHandler() const -{ - return new NotesImportHandler(); -} - -ExportHandlerBase* MainView::exportHandler() const -{ - return new NotesExportHandler(); -} diff --git a/kdepim/mobile/notes/mainview.h b/kdepim/mobile/notes/mainview.h deleted file mode 100644 index 1a47fcfd..00000000 --- a/kdepim/mobile/notes/mainview.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 MAINVIEW_H -#define MAINVIEW_H - -#include "kdeclarativemainview.h" - -#include - -class MainView : public KDeclarativeMainView -{ - Q_OBJECT - - public: - explicit MainView( QWidget *parent = 0 ); - - public slots: - QString noteTitle( int row ) const; - QString noteContent( int row ) const; - - void saveNote( const QString &title, const QString &content ); - void saveCurrentNoteTitle( const QString &title ); - void saveCurrentNoteContent( const QString &content ); - - void startComposer(); - - protected: - virtual 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; - - private: - Akonadi::Collection suitableContainerCollection( const QModelIndex &parent = QModelIndex() ) const; -}; - -#endif // MAINVIEW_H diff --git a/kdepim/mobile/notes/notelistproxy.cpp b/kdepim/mobile/notes/notelistproxy.cpp deleted file mode 100644 index a9cbc10f..00000000 --- a/kdepim/mobile/notes/notelistproxy.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 "notelistproxy.h" - -#include - -#include -#include - -using namespace Akonadi; - -NoteListProxy::NoteListProxy( int customRoleBaseline, QObject* parent ) - : ListProxy( parent ), - mCustomRoleBaseline( customRoleBaseline ) -{ } - -QVariant NoteListProxy::data( const QModelIndex& index, int role ) const -{ - const Akonadi::Item item = QSortFilterProxyModel::data( index, Akonadi::EntityTreeModel::ItemRole ).value(); - - if ( item.isValid() && item.hasPayload() ) { - const KMime::Message::Ptr note = item.payload(); - switch ( relativeCustomRole( role ) ) { - case Title: - return note->subject()->asUnicodeString(); - case Content: - return note->mainBodyPart()->decodedText(); - case PlainContent: - { - QTextDocument doc; - if ( note->contentType()->asUnicodeString() == QLatin1String( "text/plain" ) ) - doc.setPlainText( note->mainBodyPart()->decodedText() ); - else - doc.setHtml( note->mainBodyPart()->decodedText() ); - return doc.toPlainText(); - } - case ShortContent: - { - QTextDocument doc; - if ( note->contentType()->asUnicodeString() == QLatin1String( "text/plain" ) ) - doc.setPlainText( note->mainBodyPart()->decodedText() ); - else - doc.setHtml( note->mainBodyPart()->decodedText() ); - const QString plain = doc.toPlainText(); - const QStringList list = plain.split( QLatin1Char( '\n' ) ); - if ( list.isEmpty() ) - return QString(); - return list.first(); - } - } - } - - return QSortFilterProxyModel::data(index, role); -} - -void NoteListProxy::setSourceModel( QAbstractItemModel* sourceModel ) -{ - ListProxy::setSourceModel(sourceModel); - - QHash names = roleNames(); - names.insert( EntityTreeModel::ItemIdRole, "itemId" ); - names.insert( absoluteCustomRole( Title ), "title" ); - names.insert( absoluteCustomRole( Content ), "content" ); - names.insert( absoluteCustomRole( PlainContent ), "plainContent" ); - names.insert( absoluteCustomRole( ShortContent ), "shortContent" ); - setRoleNames( names ); -} - diff --git a/kdepim/mobile/notes/notelistproxy.h b/kdepim/mobile/notes/notelistproxy.h deleted file mode 100644 index d3c3b422..00000000 --- a/kdepim/mobile/notes/notelistproxy.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Stephen Kelly - - 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 NOTELISTPROXY_H -#define NOTELISTPROXY_H - -#include "listproxy.h" - -class NoteListProxy : public ListProxy -{ -public: - enum Role { - Title, - Content, - PlainContent, - ShortContent - }; - -public: - explicit NoteListProxy( int customRoleBaseline, QObject* parent = 0 ); - - virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const; - - virtual void setSourceModel( QAbstractItemModel* sourceModel ); - -private: - int absoluteCustomRole( int role ) const { return role + mCustomRoleBaseline; } - int relativeCustomRole( int role ) const { return role - mCustomRoleBaseline; } - -private: - int mCustomRoleBaseline; -}; - -#endif // NOTELISTPROXY_H diff --git a/kdepim/mobile/notes/notes-mobile-background.png b/kdepim/mobile/notes/notes-mobile-background.png deleted file mode 100644 index 7232e2fd..00000000 Binary files a/kdepim/mobile/notes/notes-mobile-background.png and /dev/null differ diff --git a/kdepim/mobile/notes/notes-mobile.desktop b/kdepim/mobile/notes/notes-mobile.desktop deleted file mode 100644 index 3172238b..00000000 --- a/kdepim/mobile/notes/notes-mobile.desktop +++ /dev/null @@ -1,80 +0,0 @@ -[Desktop Entry] -Version=1.0 -Name=Notes -Name[af]=Notas -Name[ar]=ملاحظات -Name[be]=Заметкі -Name[bg]=Notes -Name[br]=Notennoù -Name[bs]=Bilješke -Name[ca]=Notes -Name[ca@valencia]=Notes -Name[cs]=Poznámky -Name[cy]=Nodiadau -Name[da]=Noter -Name[de]=Notizen -Name[el]=Σημειώσεις -Name[en_GB]=Notes -Name[eo]=Notoj -Name[es]=Notas -Name[et]=Sedelid -Name[eu]=Oharrak -Name[fa]=یادداشتها -Name[fi]=Muistiinpanot -Name[fr]=Notes -Name[fy]=Notysjes -Name[ga]=Nótaí -Name[gl]=Notas -Name[he]=פתקים -Name[hu]=Feljegyzések -Name[ia]=Notas -Name[is]=Minnismiðar -Name[it]=Note -Name[ja]=メモ -Name[ka]=ჩანიშვნები -Name[kk]=Жазбалар -Name[km]=ចំណាំ -Name[ko]=노트 -Name[lt]=Užrašai -Name[lv]=Piezīmes -Name[mai]=टिप्पणी -Name[mk]=Белешки -Name[mr]=नोंदी -Name[ms]=Nota -Name[nb]=Notater -Name[nds]=Notizen -Name[ne]=टिपोट -Name[nl]=Notities -Name[nn]=Notat -Name[oc]=Nòtas -Name[pa]=ਨੋਟਿਸ -Name[pl]=Notatki -Name[pt]=Notas -Name[pt_BR]=Notas -Name[ro]=Notițe -Name[ru]=Заметки -Name[se]=Nohtat -Name[sk]=Poznámky -Name[sl]=Notice -Name[sr]=Белешке -Name[sr@ijekavian]=Белешке -Name[sr@ijekavianlatin]=Beleške -Name[sr@latin]=Beleške -Name[sv]=Anteckningar -Name[ta]=குறிப்புகள் -Name[tg]=Ахборот -Name[th]=บันทึกย่อ -Name[tr]=Notlar -Name[ug]=ئىزاھ -Name[uk]=Примітки -Name[uz]=Yozma xotira -Name[uz@cyrillic]=Ёзма хотира -Name[wa]=Notes -Name[x-test]=xxNotesxx -Name[zh_CN]=便笺 -Name[zh_TW]=便條 -Exec=notes-mobile - -Icon=notes-mobile -Type=Application -Categories=Qt;KDE;Utility;TextTools; diff --git a/kdepim/mobile/notes/notes-mobile.ico b/kdepim/mobile/notes/notes-mobile.ico deleted file mode 100644 index 3485cf00..00000000 Binary files a/kdepim/mobile/notes/notes-mobile.ico and /dev/null differ diff --git a/kdepim/mobile/notes/notes-mobile.rc b/kdepim/mobile/notes/notes-mobile.rc deleted file mode 100644 index da37ebdb..00000000 --- a/kdepim/mobile/notes/notes-mobile.rc +++ /dev/null @@ -1 +0,0 @@ -NOTES_MOBILE_ICON ICON "notes-mobile.ico" diff --git a/kdepim/mobile/notes/notes.qml b/kdepim/mobile/notes/notes.qml deleted file mode 100644 index 118c9d17..00000000 --- a/kdepim/mobile/notes/notes.qml +++ /dev/null @@ -1,371 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - Copyright (c) 2010 Stephen Kelly - - 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.0 -import org.kde 4.5 -import org.kde.akonadi 4.5 as Akonadi -import org.kde.pim.mobileui 4.5 as KPIM -import org.kde.akonadi.notes 4.5 as Notes -import "../mobileui/ScreenFunctions.js" as Screen - -KPIM.MainView { - id: notesMobile - - Connections { - target: guiStateManager - onGuiStateChanged: { updateContextActionStates() } - } - - Component.onCompleted : updateContextActionStates(); - - function updateContextActionStates() - { - if ( guiStateManager.inHomeScreenState ) { - noteActions.showOnlyCategory( "home" ) - } else if ( guiStateManager.inAccountScreenState ) { - noteActions.showOnlyCategory( "account" ) - } else if ( guiStateManager.inSingleFolderScreenState ) { - noteActions.showOnlyCategory( "single_folder" ) - } else if ( guiStateManager.inMultipleFolderScreenState || guiStateManager.inSearchResultScreenState ) { - noteActions.showOnlyCategory( "multiple_folder" ) - } else if ( guiStateManager.inViewSingleItemState ) { - noteActions.showOnlyCategory( "note_viewer" ) - } - } - - NoteView { - id: noteView - objectName : "noteView" - visible: guiStateManager.inViewSingleItemState - anchors.left: parent.left - anchors.topMargin : 40 - anchors.bottomMargin : 10 - anchors.leftMargin : 50 - anchors.rightMargin : 10 - width: parent.width - height: parent.height - - Rectangle { - anchors.top : noteView.top - anchors.bottom : noteView.bottom - anchors.right : noteView.left - width : noteView.anchors.leftMargin - color : "#FAFAFA" - } - } - - Rectangle { - id : backToMessageListButton - visible: guiStateManager.inViewSingleItemState - anchors.right : notesMobile.right - anchors.rightMargin : 70 - anchors.bottom : notesMobile.bottom - anchors.bottomMargin : 100 - Image { - source : KDE.locate( "data", "mobileui/back-to-list-button.png" ); - MouseArea { - anchors.fill : parent; - onClicked : { - noteView.saveNote(); - _itemNavigationModel.select(-1, 1) - guiStateManager.popState(); - } - } - } - } - - - 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 - anchors.right : parent.right - - Image { - id: backgroundImage - x: 0 - y: 0 -// FIXME: too big, costs about 1.5Mb RAM -// source: "notes-mobile-background.png" - visible: collectionView.visible - } - - Akonadi.AkonadiBreadcrumbNavigationView { - id : collectionView - anchors.top: parent.top - width: 1/3 * parent.width - anchors.bottom : selectButton.top - anchors.left: parent.left - 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 emails", - "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 note","%1 notes",headerList.count)) - - 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.numSelected == 1) ? -selectButton.height : 0 } - buttonText : (collectionView.numSelected <= 1) ? KDE.i18n("Select") : KDE.i18n("Change Selection") - opacity : { (collectionView.numSelected == 1) ? 0 : 1 } - onClicked : { - application.persistCurrentSelection("preFavSelection"); - guiStateManager.pushState( KPIM.GuiStateManager.MultipleFolderSelectionScreenState ) - } - } - - KPIM.StartCanvas { - id : startPage - visible: !collectionView.hasSelection - anchors.left : collectionView.right - anchors.top : parent.top - anchors.bottom : parent.bottom - anchors.right : parent.right - anchors.leftMargin : 10 - anchors.rightMargin : 10 - showAccountsList : false - favoritesModel : favoritesList - - contextActions : [ - Column { - anchors.fill: parent - height : 70 - KPIM.Button2 { - width: parent.width - buttonText : KDE.i18n( "New Note" ) - onClicked : { - application.startComposer(); - } - } - } - ] - } - - Rectangle { - id : emptyFolderPage - visible: (!guiStateManager.inHomeScreenState && collectionView.hasBreadcrumbs && headerList.count == 0) - anchors.left : collectionView.right - anchors.top : parent.top - anchors.bottom : parent.bottom - anchors.right : parent.right - color : "#00000000" - Text { - text : KDE.i18n("No notes in this notebook"); - height : 20; - font.italic : true - horizontalAlignment : Text.AlignHCenter - anchors.verticalCenter : parent.verticalCenter; - anchors.horizontalCenter : parent.horizontalCenter - } - } - - Rectangle { - id : notesListPage - visible: { guiStateManager.inAccountScreenState || - guiStateManager.inSingleFolderScreenState || - guiStateManager.inMultipleFolderScreenState - } - anchors.left : collectionView.right - anchors.top : parent.top - anchors.bottom : parent.bottom - anchors.right : parent.right - color : "#00000000" - - NotesListView { - id: headerList - model: itemModel - checkModel : _itemActionModel - anchors.left : parent.left - anchors.top : parent.top - anchors.bottom : filterLineEdit.top - anchors.right : parent.right - navigationModel : _itemNavigationModel - itemHeight: Screen.partition( height, 7 ) - } - - Akonadi.FilterLineEdit { - id: filterLineEdit - anchors.left : parent.left - anchors.bottom : parent.bottom - anchors.right : parent.right - visible : false - height : 0 - y: height == 0 ? parent.height : parent.height - height - } - - Connections { - target : _itemNavigationModel - onCurrentRowChanged : { - headerList.currentRow = _itemNavigationModel.currentRow - noteView.currentNoteRow = _itemNavigationModel.currentRow - guiStateManager.pushUniqueState( KPIM.GuiStateManager.ViewSingleItemState ); - _itemActionModel.select( _itemNavigationModel.currentRow, 3 ); - } - } - } - } - - 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( noteActions, noteActions.refresh ); - } - - content : [ - NoteActions { - id : noteActions - anchors.fill : parent - - scriptActions : [ - KPIM.ScriptAction { - name : "show_about_dialog" - script : { - actionPanel.collapse(); - aboutDialog.visible = true - } - }, -//TODO enable when SearchWidget::query() is implemented -// KPIM.ScriptAction { -// name : "search_note" -// 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 : "start_maintenance" - script : { - actionPanel.collapse(); - guiStateManager.pushState( KPIM.GuiStateManager.BulkActionScreenState ); - } - } - ] - - onDoCollapse : actionPanel.collapse(); - } - ] - } - } - - 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.fill: parent - - itemView: NotesListView { - id: searchNotesListView - model: itemModel - checkModel : _itemActionModel - navigationModel : _itemNavigationModel - anchors.fill : parent - itemHeight: Screen.partition( height, 7 ) - } - - resultText: KDE.i18np( "One note found", "%1 notes found", searchNotesListView.count ) - } - - Connections { - target: startPage - onFavoriteSelected : { - application.loadFavorite(favName); - } - } - - 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; } - } - - - KPIM.SearchDialog { - id : searchDialog - searchWidget: Notes.SearchWidget { - anchors.fill: parent - } - } -} diff --git a/kdepim/mobile/notes/notesexporthandler.cpp b/kdepim/mobile/notes/notesexporthandler.cpp deleted file mode 100644 index 7765fec9..00000000 --- a/kdepim/mobile/notes/notesexporthandler.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "notesexporthandler.h" - -#include -#include -#include -#include -#include - -QString NotesExportHandler::dialogText() const -{ - return i18n( "Which notes shall be exported?" ); -} - -QString NotesExportHandler::dialogAllText() const -{ - return i18n( "All Notes" ); -} - -QString NotesExportHandler::dialogLocalOnlyText() const -{ - return i18n( "Notes in current folder" ); -} - -QStringList NotesExportHandler::mimeTypes() const -{ - return QStringList( QLatin1String( "text/x-vnd.akonadi.note" ) ); -} - -bool NotesExportHandler::exportItems( const Akonadi::Item::List &items ) -{ - QList notes; - - foreach ( const Akonadi::Item &item, items ) { - if ( item.hasPayload() ) - notes << item.payload(); - } - - const QString fileName = KFileDialog::getSaveFileName( KUrl( QLatin1String( "notes.mbox" ) ), QLatin1String( "*.mbox" ) ); - if ( fileName.isEmpty() ) // user canceled export - return true; - - KMBox::MBox mbox; - if ( !mbox.load( fileName ) ) { - KMessageBox::error( 0, i18n( "Unable to open MBox file %1", fileName ) ); - return false; - } - - foreach ( const KMime::Message::Ptr ¬e, notes ) { - mbox.appendMessage( note ); - } - - if ( !mbox.save() ) { - KMessageBox::error( 0, i18n( "Unable to save notes to MBox file %1", fileName ) ); - return false; - } - - return true; -} diff --git a/kdepim/mobile/notes/notesexporthandler.h b/kdepim/mobile/notes/notesexporthandler.h deleted file mode 100644 index 136f8b9d..00000000 --- a/kdepim/mobile/notes/notesexporthandler.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 NOTESEXPORTHANDLER_H -#define NOTESEXPORTHANDLER_H - -#include "../lib/exporthandlerbase.h" - -class NotesExportHandler : 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 diff --git a/kdepim/mobile/notes/notesfilterproxymodel.cpp b/kdepim/mobile/notes/notesfilterproxymodel.cpp deleted file mode 100644 index dd02e701..00000000 --- a/kdepim/mobile/notes/notesfilterproxymodel.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "notesfilterproxymodel.h" - -#include -#include - -static bool noteMatchesFilter( const KMime::Message::Ptr ¬e, const QString &filterString ); - -using namespace Akonadi; - -class NotesFilterProxyModel::Private -{ - public: - QString mFilter; -}; - -NotesFilterProxyModel::NotesFilterProxyModel( QObject *parent ) - : QSortFilterProxyModel( parent ), d( new Private ) -{ - setSortLocaleAware( true ); - setDynamicSortFilter( true ); -} - -NotesFilterProxyModel::~NotesFilterProxyModel() -{ - delete d; -} - -void NotesFilterProxyModel::setFilterString( const QString &filter ) -{ - d->mFilter = filter; - invalidateFilter(); -} - -bool NotesFilterProxyModel::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(); - - if ( item.hasPayload() ) { - const KMime::Message::Ptr note = item.payload(); - return noteMatchesFilter( note, d->mFilter ); - } - - return true; -} - -static bool noteMatchesFilter( const KMime::Message::Ptr ¬e, const QString &filterString ) -{ - if ( note->subject()->asUnicodeString().contains( filterString, Qt::CaseInsensitive ) ) - return true; - - if ( note->mainBodyPart()->decodedText().contains( filterString, Qt::CaseInsensitive ) ) - return true; - - return false; -} - diff --git a/kdepim/mobile/notes/notesfilterproxymodel.h b/kdepim/mobile/notes/notesfilterproxymodel.h deleted file mode 100644 index 5f38ee37..00000000 --- a/kdepim/mobile/notes/notesfilterproxymodel.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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_NOTESFILTERPROXYMODEL_H -#define AKONADI_NOTESFILTERPROXYMODEL_H - -#include - -namespace Akonadi { - -/** - * @short A proxy model for \a EntityTreeModel based note models. - * - * This class provides a filter proxy model for a EntityTreeModel. - * The list of shown notes can be limited by settings a filter pattern. - * Only notes that contain this pattern as part of their data will be listed. - * - * Example: - * - * @code - * - * Akonadi::NotesFilterProxyModel *filter = new Akonadi::NotesFilterProxyModel; - * 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 - */ -class NotesFilterProxyModel : public QSortFilterProxyModel -{ - Q_OBJECT - - public: - /** - * Creates a new notes filter proxy model. - * - * @param parent The parent object. - */ - explicit NotesFilterProxyModel( QObject *parent = 0 ); - - /** - * Destroys the notes filter proxy model. - */ - ~NotesFilterProxyModel(); - - public Q_SLOTS: - /** - * Sets the @p filter that is used to filter for matching notes. - */ - 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 diff --git a/kdepim/mobile/notes/notesimporthandler.cpp b/kdepim/mobile/notes/notesimporthandler.cpp deleted file mode 100644 index 3fe1f414..00000000 --- a/kdepim/mobile/notes/notesimporthandler.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "notesimporthandler.h" - -#include -#include -#include -#include - -QString NotesImportHandler::fileDialogNameFilter() const -{ - return QLatin1String( "*.mbox|MBox" ); -} - -QString NotesImportHandler::fileDialogTitle() const -{ - return i18n( "Select MBox to Import" ); -} - -QString NotesImportHandler::collectionDialogText() const -{ - return i18n( "Select the folder the imported note(s) shall be saved in:" ); -} - -QString NotesImportHandler::collectionDialogTitle() const -{ - return i18n( "Select Folder" ); -} - -QString NotesImportHandler::importDialogText( int count, const QString &collectionName ) const -{ - return i18np( "Importing one note to %2", "Importing %1 notes to %2", count, collectionName ); -} - -QString NotesImportHandler::importDialogTitle() const -{ - return i18n( "Import Notes" ); -} - -QStringList NotesImportHandler::mimeTypes() const -{ - return QStringList( QLatin1String( "text/x-vnd.akonadi.note" ) ); -} - -Akonadi::Item::List NotesImportHandler::createItems( const QStringList &fileNames, bool *ok ) -{ - *ok = true; - - Akonadi::Item::List items; - - QList notes; - - foreach ( const QString &fileName, fileNames ) { - KMBox::MBox mbox; - - if ( mbox.load( fileName ) ) { - - const KMBox::MBoxEntry::List entries = mbox.entries(); - mbox.lock(); - foreach ( const KMBox::MBoxEntry &entry, entries ) { - KMime::Message *note = mbox.readMessage( entry ); - if ( note ) - notes << KMime::Message::Ptr( note ); - } - mbox.unlock(); - } else { - const QString caption( i18n( "MBox Import Failed" ) ); - const QString msg = i18nc( "@info", - "When trying to read the MBox, there was an error opening the file %1:", - fileName ); - KMessageBox::error( 0, msg, caption ); - *ok = false; - } - } - - if ( notes.isEmpty() ) { - if ( !(*ok) && fileNames.count() > 1 ) - KMessageBox::information( 0, i18n( "No notes were imported, due to errors with the MBox." ) ); - else if ( *ok ) - KMessageBox::information( 0, i18n( "The MBox does not contain any notes." ) ); - - return items; // nothing to import - } - - foreach ( const KMime::Message::Ptr ¬e, notes ) { - Akonadi::Item item; - item.setPayload( note ); - item.setMimeType( QLatin1String( "text/x-vnd.akonadi.note" ) ); - - items << item; - } - - return items; -} diff --git a/kdepim/mobile/notes/notesimporthandler.h b/kdepim/mobile/notes/notesimporthandler.h deleted file mode 100644 index ca14c193..00000000 --- a/kdepim/mobile/notes/notesimporthandler.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 NOTESIMPORTHANDLER_H -#define NOTESIMPORTHANDLER_H - -#include "../lib/importhandlerbase.h" - -class NotesImportHandler : 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 diff --git a/kdepim/mobile/notes/searchwidget.cpp b/kdepim/mobile/notes/searchwidget.cpp deleted file mode 100644 index 572ab3dc..00000000 --- a/kdepim/mobile/notes/searchwidget.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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" - -SearchWidget::SearchWidget( QWidget *parent ) - : QWidget( parent ) -{ - mUi.setupUi( this ); - - // set defaults - mUi.inTitles->setChecked( true ); - mUi.inContents->setChecked( true ); - mUi.collectionCombo->setMimeTypeFilter( QStringList() << QLatin1String( "text/x-vnd.akonadi.note" ) ); -} - -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(); -} - diff --git a/kdepim/mobile/notes/searchwidget.h b/kdepim/mobile/notes/searchwidget.h deleted file mode 100644 index 52321477..00000000 --- a/kdepim/mobile/notes/searchwidget.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 -#include - -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 diff --git a/kdepim/mobile/notes/searchwidget.ui b/kdepim/mobile/notes/searchwidget.ui deleted file mode 100644 index c1b7b2f4..00000000 --- a/kdepim/mobile/notes/searchwidget.ui +++ /dev/null @@ -1,152 +0,0 @@ - - - SearchWidget - - - - 0 - 0 - 430 - 278 - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Search for: - - - - - - - true - - - - - - - In: - - - - - - - - 0 - - - 3 - - - 0 - - - 3 - - - - - Titles - - - - - - - Contents - - - - - - - - - - Located in: - - - - - - - - 0 - - - 3 - - - 0 - - - 3 - - - - - any folder - - - true - - - - - - - only in folder - - - - - - - false - - - - - - - - - - - KLineEdit - QLineEdit -
klineedit.h
-
- - Akonadi::CollectionComboBox - QComboBox -
akonadi/collectioncombobox.h
-
-
- - - - locatedInSpecificCollection - toggled(bool) - collectionCombo - setEnabled(bool) - - - 138 - 235 - - - 217 - 239 - - - - -
diff --git a/kdepim/mobile/pics/CMakeLists.txt b/kdepim/mobile/pics/CMakeLists.txt deleted file mode 100644 index b72b752c..00000000 --- a/kdepim/mobile/pics/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -install(FILES - add-button.png - back-to-list-button.png - delete-button.png - edit-button.png - long-press-indicator.png - movedown-button.png - moveup-button.png - splashscreenstatic.png - built-on-the-kde-platform.png - DESTINATION ${DATA_INSTALL_DIR}/mobileui) - diff --git a/kdepim/mobile/pics/add-button.png b/kdepim/mobile/pics/add-button.png deleted file mode 100644 index 93070d97..00000000 Binary files a/kdepim/mobile/pics/add-button.png and /dev/null differ diff --git a/kdepim/mobile/pics/back-to-list-button.png b/kdepim/mobile/pics/back-to-list-button.png deleted file mode 100644 index 429d427c..00000000 Binary files a/kdepim/mobile/pics/back-to-list-button.png and /dev/null differ diff --git a/kdepim/mobile/pics/built-on-the-kde-platform.png b/kdepim/mobile/pics/built-on-the-kde-platform.png deleted file mode 100644 index be905574..00000000 Binary files a/kdepim/mobile/pics/built-on-the-kde-platform.png and /dev/null differ diff --git a/kdepim/mobile/pics/delete-button.png b/kdepim/mobile/pics/delete-button.png deleted file mode 100644 index 705a9d85..00000000 Binary files a/kdepim/mobile/pics/delete-button.png and /dev/null differ diff --git a/kdepim/mobile/pics/edit-button.png b/kdepim/mobile/pics/edit-button.png deleted file mode 100644 index 79c773ee..00000000 Binary files a/kdepim/mobile/pics/edit-button.png and /dev/null differ diff --git a/kdepim/mobile/pics/long-press-indicator.png b/kdepim/mobile/pics/long-press-indicator.png deleted file mode 100644 index eb67fb15..00000000 Binary files a/kdepim/mobile/pics/long-press-indicator.png and /dev/null differ diff --git a/kdepim/mobile/pics/movedown-button.png b/kdepim/mobile/pics/movedown-button.png deleted file mode 100644 index c9775fb3..00000000 Binary files a/kdepim/mobile/pics/movedown-button.png and /dev/null differ diff --git a/kdepim/mobile/pics/moveup-button.png b/kdepim/mobile/pics/moveup-button.png deleted file mode 100644 index e33d4b68..00000000 Binary files a/kdepim/mobile/pics/moveup-button.png and /dev/null differ diff --git a/kdepim/mobile/pics/splashscreenstatic.png b/kdepim/mobile/pics/splashscreenstatic.png deleted file mode 100644 index ba35b302..00000000 Binary files a/kdepim/mobile/pics/splashscreenstatic.png and /dev/null differ diff --git a/kdepim/mobile/tasks/BulkActionComponent.qml b/kdepim/mobile/tasks/BulkActionComponent.qml deleted file mode 100644 index 97b6673a..00000000 --- a/kdepim/mobile/tasks/BulkActionComponent.qml +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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.topMargin : 12 - anchors.fill: parent - - actionListWidth : 1/3 * parent.width - multipleText : KDE.i18np("1 folder", "%1 folders", collectionView.numSelected) - selectedItemModel : _breadcrumbNavigationFactory.qmlSelectedItemModel(); - headerList : TaskListView { - showCheckBox : true - id: bulkActionHeaderList - model: itemModel - checkModel : _itemActionModel - anchors.fill : parent - showCompletionSlider: false - itemHeight: bulkActionScreen.itemHeight - } -} - diff --git a/kdepim/mobile/tasks/CMakeLists.txt b/kdepim/mobile/tasks/CMakeLists.txt deleted file mode 100644 index 470f6c8a..00000000 --- a/kdepim/mobile/tasks/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -project(task-mobile) - -include_directories( - ${KDEPIMLIBS_INCLUDE_DIR} - ${AKONADI_INCLUDE_DIR} - ${Boost_INCLUDE_DIR} - ${CMAKE_SOURCE_DIR}/calendarsupport/ - ${CMAKE_BINARY_DIR}/calendarsupport/ - ${CMAKE_SOURCE_DIR}/calendarviews -) - -set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}" ) - -set(mobile_tasks_SRCS - configwidget.cpp - searchwidget.cpp - tasklistproxy.cpp - tasksfilterproxymodel.cpp - tasksexporthandler.cpp - tasksimporthandler.cpp - tasksactionmanager.cpp - taskthreadgroupercomparator.cpp - mainview.cpp - main.cpp -) - -qt4_wrap_ui(mobile_tasks_SRCS configwidget.ui searchwidget.ui) -kde4_add_kcfg_files(mobile_tasks_SRCS settings.kcfgc) - -if (RUNTIME_PLUGINS_STATIC) - add_definitions(-DKCALCORE_SERIALIZER_PLUGIN_STATIC) -endif () - -kde4_add_app_icon(mobile_tasks_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/hi*-apps-tasks-mobile.png") - -kde4_add_executable(tasks-mobile ${mobile_tasks_SRCS} ) - -target_link_libraries(tasks-mobile - ${QT_QTDECLARATIVE_LIBRARY} - ${KDEPIMLIBS_KCALCORE_LIBS} - ${KDEPIMLIBS_AKONADI_CALENDAR_LIBS} - kdepimdbusinterfaces - kdepimmobileui - kdepimmobileuicalendar - kdepim - eventviews -) - -if (RUNTIME_PLUGINS_STATIC) - target_link_libraries(tasks-mobile akonadi_serializer_addressee akonadi_serializer_contactgroup akonadi_serializer_kcalcore akonadi_serializer_mail) -endif () - -install(TARGETS tasks-mobile ${INSTALL_TARGETS_DEFAULT_ARGS}) -install(PROGRAMS tasks-mobile.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) -install(FILES - BulkActionComponent.qml - ConfigDialog.qml - tasks.qml - tasks-mobile-background.png - TaskActions.qml - TaskListView.qml - DESTINATION ${DATA_INSTALL_DIR}/tasks-mobile -) -kde4_install_icons( ${ICON_INSTALL_DIR} ) diff --git a/kdepim/mobile/tasks/ConfigDialog.qml b/kdepim/mobile/tasks/ConfigDialog.qml deleted file mode 100644 index 01175ac1..00000000 --- a/kdepim/mobile/tasks/ConfigDialog.qml +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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.tasks 4.5 as Tasks -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; - - Tasks.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() - } - } -} diff --git a/kdepim/mobile/tasks/Messages.sh b/kdepim/mobile/tasks/Messages.sh deleted file mode 100644 index d47ff003..00000000 --- a/kdepim/mobile/tasks/Messages.sh +++ /dev/null @@ -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/tasks-mobile.pot -$XGETTEXT -ktranslate `find . -name '*.qml'` -j -L Java -o $podir/tasks-mobile.pot -rm -f rc.cpp diff --git a/kdepim/mobile/tasks/TaskActions.qml b/kdepim/mobile/tasks/TaskActions.qml deleted file mode 100644 index 4816e660..00000000 --- a/kdepim/mobile/tasks/TaskActions.qml +++ /dev/null @@ -1,152 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 Task Lists" ) } - ActionListItem { name : "import_tasks" } - ActionListItem { name : "export_account_tasks" } - 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 : "archive_old_entries" } - ActionListItem { name : "purge_completed_tasks" } - } - - ActionList { - name : "single_folder_folder_menu" - category : "single_folder" - text : KDE.i18n( "Folder" ) - ActionListItem { name : "akonadi_collection_sync" } - ActionListItem { name : "export_selected_tasks" } - ActionListItem { name : "archive_old_entries" } - ActionListItem { name : "purge_completed_tasks" } - } - - 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_tasks" } - ActionListItem { name : "archive_old_entries" } - ActionListItem { name : "purge_completed_todos" } - } - - 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 Task Lists" ) } - ScriptActionItem { name : "start_maintenance"; title : KDE.i18n( "Switch To Editing Mode" ) } - } - - ActionList { - category : "todo_viewer" - name : "todo_viewer_todo_menu" - text : KDE.i18n( "Task" ) - ActionListItem { name : "akonadi_subtodo_create" } - ActionListItem { name : "make_subtask_independent" } - ActionListItem { name : "make_all_subtasks_independent" } - } - - ActionList { - category : "todo_viewer" - name : "todo_viewer_attachment_menu" - text : KDE.i18n( "Attachments" ) - ActionListItem { name : "save_all_attachments" } - } - - ActionList { - category : "todo_viewer" - name : "todo_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 { - name : "application_menu" - category : "standard" - text : KDE.i18n( "Tasks" ) - type : "task" - - addNewActionName: "akonadi_todo_create" - //TODO enable when SearchWidget::query() is implemented - //searchActionTitle: KDE.i18n( "Search For Tasks" ) - configureActionTitle: KDE.i18n( "Configure Tasks" ) - } -} diff --git a/kdepim/mobile/tasks/TaskListView.qml b/kdepim/mobile/tasks/TaskListView.qml deleted file mode 100644 index dc263ca0..00000000 --- a/kdepim/mobile/tasks/TaskListView.qml +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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: itemList - property bool showCheckBox - property variant checkModel - property bool showCompletionSlider: true - - delegate: [ - KPIM.ItemListViewDelegate { - id : listDelegate - showCheckBox : itemList.showCheckBox - checkModel : itemList.checkModel - navigationModel : itemList.navigationModel - height : itemList.itemHeight - color: model.backgroundColor - clip: true - summaryContent: [ - QML.Text { - id : summaryLabel - anchors.top : parent.top - anchors.topMargin : 1 - anchors.left : parent.left - anchors.leftMargin : model.isSubTask ? 30 : 10 - anchors.right: parent.right - anchors.rightMargin: completionSlider.width - text: KDE.i18n( "Task: %1", model.summary ) - color : "#0C55BB" - font.pixelSize: 16 - elide: "ElideRight" - }, - QML.Text { - anchors.top : summaryLabel.bottom - anchors.topMargin : 1 - anchors.left : parent.left - anchors.leftMargin : model.isSubTask ? 30 : 10 - anchors.right: parent.right - anchors.rightMargin: completionSlider.width - height : 30; - text: model.hasDescription ? KDE.i18n( "Details: %1", model.singleLineDescription ) : "" - color: "#3B3B3B" - font.pixelSize: 18 - elide: "ElideRight" - }, - KPIM.CompletionSlider { - id: completionSlider - visible: showCompletionSlider - anchors.top: parent.top - anchors.right: parent.right - onPercentageUpdated : { - application.setPercentComplete(model.index, value); - } - }, - QML.Image { - id : importantFlagImage - anchors.verticalCenter : parent.verticalCenter; - anchors.left : parent.left - anchors.leftMargin : 15 - source : KDE.iconPath("emblem-important.png", parent.height + 16) - opacity : model.is_important ? 0.25 : 0 - } - ] - } - ] -} diff --git a/kdepim/mobile/tasks/configwidget.cpp b/kdepim/mobile/tasks/configwidget.cpp deleted file mode 100644 index 0a10e440..00000000 --- a/kdepim/mobile/tasks/configwidget.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 -#include - -using namespace CalendarSupport; - -ConfigWidget::ConfigWidget( QWidget *parent ) - : QWidget( parent ) -{ - Ui_ConfigWidget ui; - ui.setupUi( this ); - - mManager = new KConfigDialogManager( this, Settings::self() ); -} - -void ConfigWidget::setPreferences( const EventViews::PrefsPtr &preferences ) -{ - mViewPrefs = preferences; - load(); -} - -void ConfigWidget::load() -{ - loadFromExternalSettings(); - mManager->updateWidgets(); -} - -void ConfigWidget::save() -{ - mManager->updateSettings(); - saveToExternalSettings(); -} - -void ConfigWidget::loadFromExternalSettings() -{ - // Date and Time - Settings::self()->setRemindersForNewTodos( KCalPrefs::instance()->defaultTodoReminders() ); - Settings::self()->setReminderDefaultTime( KCalPrefs::instance()->reminderTime() ); - Settings::self()->setReminderDefaultUnit( KCalPrefs::instance()->reminderTimeUnits() ); - - // Views - Settings::self()->setTodoDueColor( mViewPrefs->todoDueTodayColor() ); - Settings::self()->setTodoOverdueColor( mViewPrefs->todoOverdueColor() ); - -} - -void ConfigWidget::saveToExternalSettings() -{ - // Date and Time - KCalPrefs::instance()->setDefaultTodoReminders( Settings::self()->remindersForNewTodos() ); - KCalPrefs::instance()->setReminderTime( Settings::self()->reminderDefaultTime() ); - KCalPrefs::instance()->setReminderTimeUnits( Settings::self()->reminderDefaultUnit() ); - - // Views - mViewPrefs->setTodoDueTodayColor( Settings::self()->todoDueColor() ); - mViewPrefs->setTodoOverdueColor( Settings::self()->todoOverdueColor() ); - - Settings::self()->writeConfig(); - KCalPrefs::instance()->writeConfig(); - mViewPrefs->writeConfig(); -} - -DeclarativeConfigWidget::DeclarativeConfigWidget( QGraphicsItem *parent ) - : DeclarativeWidgetBase( parent ) -{ -} - -DeclarativeConfigWidget::~DeclarativeConfigWidget() -{ -} - -void DeclarativeConfigWidget::setPreferences( const EventViews::PrefsPtr &preferences ) -{ - widget()->setPreferences( preferences ); -} - -void DeclarativeConfigWidget::load() -{ - widget()->load(); -} - -void DeclarativeConfigWidget::save() -{ - widget()->save(); -} - diff --git a/kdepim/mobile/tasks/configwidget.h b/kdepim/mobile/tasks/configwidget.h deleted file mode 100644 index f2a42e12..00000000 --- a/kdepim/mobile/tasks/configwidget.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 "calendarviews/eventview.h" -#include "calendarviews/prefs.h" - -#include "declarativewidgetbase.h" -#include "mainview.h" - -#include -#include - -class KConfigDialogManager; - -class ConfigWidget : public QWidget -{ - Q_OBJECT - - public: - explicit ConfigWidget( QWidget *parent = 0 ); - - void setPreferences( const EventViews::PrefsPtr &preferences ); - - public Q_SLOTS: - void load(); - void save(); - - private: - void loadFromExternalSettings(); - void saveToExternalSettings(); - - KConfigDialogManager *mManager; - EventViews::PrefsPtr mViewPrefs; -}; - -class DeclarativeConfigWidget : -#ifndef Q_MOC_RUN -public DeclarativeWidgetBase -#else -public QGraphicsProxyWidget -#endif -{ - Q_OBJECT - - public: - explicit DeclarativeConfigWidget( QGraphicsItem *parent = 0 ); - ~DeclarativeConfigWidget(); - - void setPreferences( const EventViews::PrefsPtr &preferences ); - - public Q_SLOTS: - void load(); - void save(); -}; - -#endif diff --git a/kdepim/mobile/tasks/configwidget.ui b/kdepim/mobile/tasks/configwidget.ui deleted file mode 100644 index fa2e8e29..00000000 --- a/kdepim/mobile/tasks/configwidget.ui +++ /dev/null @@ -1,158 +0,0 @@ - - - ConfigWidget - - - - 0 - 0 - 426 - 207 - - - - - - - - - - 75 - true - - - - Time and Date - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - Enable reminders for new to-dos - - - - - - - Default reminder time: - - - - - - - - - - - minute(s) - - - - - hour(s) - - - - - day(s) - - - - - - - - - - - - - 75 - true - - - - View - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - Always display completed to-dos at the bottom of the list - - - - - - - - - To-do due today color: - - - - - - - - - - To-do overdue color: - - - - - - - - - - - - - - - KPIM::KColorCombo - QComboBox -
kcolorcombo.h
-
-
- - -
diff --git a/kdepim/mobile/tasks/hi48-apps-tasks-mobile.png b/kdepim/mobile/tasks/hi48-apps-tasks-mobile.png deleted file mode 100644 index 4159d98c..00000000 Binary files a/kdepim/mobile/tasks/hi48-apps-tasks-mobile.png and /dev/null differ diff --git a/kdepim/mobile/tasks/hi64-apps-tasks-mobile.png b/kdepim/mobile/tasks/hi64-apps-tasks-mobile.png deleted file mode 100644 index 6782f0a0..00000000 Binary files a/kdepim/mobile/tasks/hi64-apps-tasks-mobile.png and /dev/null differ diff --git a/kdepim/mobile/tasks/hi80-apps-tasks-mobile-harmattan.png b/kdepim/mobile/tasks/hi80-apps-tasks-mobile-harmattan.png deleted file mode 100644 index c7d1f5e8..00000000 Binary files a/kdepim/mobile/tasks/hi80-apps-tasks-mobile-harmattan.png and /dev/null differ diff --git a/kdepim/mobile/tasks/main.cpp b/kdepim/mobile/tasks/main.cpp deleted file mode 100644 index 9eeef51a..00000000 --- a/kdepim/mobile/tasks/main.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* -* This file is part of Akonadi -* -* Copyright (c) 2010 Bertjan Broeksema -* -* 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 -#include -#include - -#include - -#include "mainview.h" - -#ifdef KCALCORE_SERIALIZER_PLUGIN_STATIC -#include - -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 IncidenceEditorNG; - -int main( int argc, char **argv ) -{ - const QByteArray& ba = QByteArray( "tasks-mobile" ); - const KLocalizedString name = ki18n( "Kontact Touch Tasks" ); - - EditorConfig::setEditorConfig( new KOrganizerEditorConfig ); - - KAboutData aboutData( ba, ba, name, ba, name ); - aboutData.setProductName( "KOrganizer Mobile/tasks" ); //has to match the bugzilla product name - - KCmdLineArgs::init( argc, argv, &aboutData ); - KDeclarativeApplication app; - - KGlobal::locale()->insertCatalog( QLatin1String("libkcalutils") ); - KGlobal::locale()->insertCatalog( QLatin1String("libincidenceeditors") ); - - return app.exec(); -} - diff --git a/kdepim/mobile/tasks/mainview.cpp b/kdepim/mobile/tasks/mainview.cpp deleted file mode 100644 index 9e774c6e..00000000 --- a/kdepim/mobile/tasks/mainview.cpp +++ /dev/null @@ -1,480 +0,0 @@ -/* -* This file is part of Akonadi -* -* Copyright (c) 2010 Bertjan Broeksema -* -* 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 "calendar/incidenceview.h" -#include "calendar/kcalitembrowseritem.h" -#include "configwidget.h" -#include "searchwidget.h" -#include "settings.h" -#include "tasklistproxy.h" -#include "tasksactionmanager.h" -#include "tasksfilterproxymodel.h" -#include "tasksexporthandler.h" -#include "tasksimporthandler.h" -#include "taskthreadgroupercomparator.h" -#include "threadgroupermodel.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -using namespace Akonadi; - -QML_DECLARE_TYPE( CalendarSupport::KCal::KCalItemBrowserItem ) -QML_DECLARE_TYPE( DeclarativeConfigWidget ) -QML_DECLARE_TYPE( DeclarativeSearchWidget ) - -MainView::MainView( QWidget *parent ) - : KDeclarativeMainView( QLatin1String("tasks"), new TaskListProxy, parent ) - , mCalendarUtils( 0 ) - , mTasksActionManager( 0 ) - , mCalendarPrefs( new EventViews::Prefs ) - , mCalendar( 0 ) - , mChanger( 0 ) -{ - mCalendarPrefs->readConfig(); - qobject_cast( itemModel() )->setPreferences( mCalendarPrefs ); - - // re-sort the list when config options have changed - connect( Settings::self(), SIGNAL(configChanged()), - qobject_cast( itemModel() ), SLOT(invalidate()) ); -} - -MainView::~MainView() -{ - mCalendarPrefs->writeConfig(); -} - -void MainView::doDelayedInit() -{ - setWindowTitle( i18n( "Tasks" ) ); - - addMimeType( KCalCore::Todo::todoMimeType() ); - itemFetchScope().fetchFullPayload(); - - qmlRegisterType( "org.kde.kcal", 4, 5, "IncidenceView" ); - qmlRegisterType( "org.kde.akonadi.tasks", 4, 5, "ConfigWidget" ); - qmlRegisterType( "org.kde.akonadi.tasks", 4, 5, "SearchWidget" ); - - QStringList mimeTypes; - mimeTypes << KCalCore::Todo::todoMimeType(); - mCalendar = Akonadi::ETMCalendar::Ptr( new Akonadi::ETMCalendar( mimeTypes ) ); - - mChanger = new Akonadi::IncidenceChanger( this ); - - Akonadi::FreeBusyManager::self()->setCalendar( mCalendar ); - - mCalendarUtils = new CalendarSupport::CalendarUtils( mCalendar, this ); - mCalendar->setParent( mCalendarUtils ); - connect( mCalendarUtils, SIGNAL(actionFinished(Akonadi::Item)), - SLOT(processActionFinish(Akonadi::Item)) ); - connect( mCalendarUtils, SIGNAL(actionFailed(Akonadi::Item,QString)), - SLOT(processActionFail(Akonadi::Item,QString)) ); - - mTasksActionManager = new TasksActionManager( actionCollection(), this ); - mTasksActionManager->setCalendar( mCalendar ); - mTasksActionManager->setItemSelectionModel( itemSelectionModel() ); - - connect( entityTreeModel(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), - mTasksActionManager, SLOT(updateActions()) ); - - connect( actionCollection()->action( QLatin1String( "import_tasks" ) ), - SIGNAL(triggered(bool)), SLOT(importItems()) ); - connect( actionCollection()->action( QLatin1String( "export_account_tasks" ) ), - SIGNAL(triggered(bool)), SLOT(exportItems()) ); - connect( actionCollection()->action( QLatin1String( "export_selected_tasks" ) ), - SIGNAL(triggered(bool)), SLOT(exportItems()) ); - connect( actionCollection()->action( QLatin1String( "make_subtask_independent" ) ), - SIGNAL(triggered(bool)), SLOT(makeTaskIndependent()) ); - connect( actionCollection()->action( QLatin1String( "make_all_subtasks_independent" ) ), - SIGNAL(triggered(bool)), SLOT(makeAllSubtasksIndependent()) ); - connect( actionCollection()->action( QLatin1String( "purge_completed_tasks" ) ), - SIGNAL(triggered(bool)), SLOT(purgeCompletedTasks()) ); - connect( actionCollection()->action( QLatin1String( "save_all_attachments" ) ), - SIGNAL(triggered(bool)), SLOT(saveAllAttachments()) ); - connect( actionCollection()->action( QLatin1String( "archive_old_entries" ) ), - SIGNAL(triggered(bool)), SLOT(archiveOldEntries()) ); - - KAction *action = new KAction( i18n( "Configure Categories" ), this ); - connect( action, SIGNAL(triggered(bool)), SLOT(configureCategories()) ); - actionCollection()->addAction( QLatin1String( "configure_categories" ), action ); - - KPIM::ReminderClient::startDaemon(); -} - -void MainView::setConfigWidget( ConfigWidget *configWidget ) -{ - Q_ASSERT( configWidget ); - if ( configWidget ) - configWidget->setPreferences( mCalendarPrefs ); -} - -void MainView::finishEdit( QObject *editor ) -{ - mOpenItemEditors.remove( editor ); -} - -void MainView::newTask() -{ - IncidenceView *editor = new IncidenceView; - editor->setWindowTitle( i18n( "Kontact Touch Tasks" ) ); - - Item item; - item.setMimeType( KCalCore::Todo::todoMimeType() ); - KCalCore::Todo::Ptr todo( new KCalCore::Todo ); - - { // Set some defaults - IncidenceEditorNG::IncidenceDefaults defaults; - // 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 ( CalendarSupport::KCalPrefs::instance()->useGroupwareCommunication() ) - defaults.setGroupWareDomain( KUrl( Akonadi::CalendarSettings::self()->freeBusyRetrieveUrl() ).host() ); - - // make it due one day from now - const KDateTime now = KDateTime::currentLocalDateTime(); - defaults.setStartDateTime( now ); - defaults.setEndDateTime( now.addDays( 1 ) ); - - defaults.setDefaults( todo ); - } - - item.setPayload( todo ); - editor->load( item ); - - if ( regularSelectionModel()->hasSelection() ) { - const QModelIndex index = regularSelectionModel()->selectedIndexes().first(); - const Akonadi::Collection collection = index.data( Akonadi::EntityTreeModel::CollectionRole ).value(); - if ( collection.isValid() ) - editor->setDefaultCollection( collection ); - } - - editor->show(); -} - -void MainView::newSubTask() -{ - Item item = currentItem(); - if ( !item.isValid() ) - return; - - KCalCore::Todo::Ptr parentTodo = item.payload(); - KCalCore::Todo::Ptr todo( new KCalCore::Todo ); - - // make it due one day from now - todo->setDtStart( KDateTime::currentLocalDateTime() ); - todo->setDtDue( KDateTime::currentLocalDateTime().addDays( 1 ) ); - todo->setRelatedTo( parentTodo->uid(), KCalCore::Todo::RelTypeParent ); - - item.setPayload( todo ); - IncidenceView *editor = new IncidenceView; - editor->setWindowTitle( i18n( "Kontact Touch Tasks" ) ); - editor->load( item ); - editor->show(); -} - -void MainView::makeTaskIndependent() -{ - Item item = currentItem(); - if ( !item.isValid() ) - return; - - if ( mCalendarUtils->makeIndependent( item ) ) { - actionCollection()->action( QLatin1String( "make_subtask_independent" ) )->setEnabled( false ); - } -} - -void MainView::makeAllSubtasksIndependent() -{ - Item item = currentItem(); - if ( !item.isValid() ) - return; - - if ( mCalendarUtils->makeChildrenIndependent( item ) ) { - actionCollection()->action( QLatin1String( "make_all_subtasks_independent" ) )->setEnabled( false ); - } -} - -void MainView::purgeCompletedTasks() -{ - const int result = KMessageBox::warningContinueCancel( - this, - i18n( "Delete all completed to-dos?" ), - i18n( "Purge To-dos" ), - KGuiItem( i18n( "Purge" ) ) ); - - if ( result == KMessageBox::Continue ) { - mCalendarUtils->purgeCompletedTodos(); - } -} - -void MainView::setPercentComplete( int row, int percentComplete ) -{ - const QModelIndex index = itemModel()->index( row, 0 ); - itemModel()->setData( index, percentComplete, TaskListProxy::PercentCompleteRole ); -} - -void MainView::editIncidence() -{ - const CalendarSupport::KCal::KCalItemBrowserItem *todoView = rootObject()->findChild(); - Q_ASSERT( todoView ); - if ( todoView ) - editIncidence( todoView->item() ); -} - -void MainView::editIncidence( const Akonadi::Item &item ) -{ - if ( mOpenItemEditors.values().contains( item.id() ) ) - return; // An editor for this item is already open. - - IncidenceView *editor = new IncidenceView; - editor->setWindowTitle( i18n( "Kontact Touch Tasks" ) ); - editor->load( item, QDate() ); - - mOpenItemEditors.insert( editor, item.id() ); - connect( editor, SIGNAL(destroyed(QObject*)), SLOT(finishEdit(QObject*)) ); - - editor->show(); -} - -QAbstractItemModel* MainView::createItemModelContext( QDeclarativeContext *context, QAbstractItemModel *model ) -{ - TaskThreadGrouperComparator *comparator = new TaskThreadGrouperComparator; - ThreadGrouperModel *grouperModel = new ThreadGrouperModel( comparator, this ); - grouperModel->setDynamicModelRepopulation( true ); - grouperModel->setSourceModel( model ); - - // trigger a resort whenever the task status has changed - connect( model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - grouperModel, SLOT(invalidate()) ); - - return KDeclarativeMainView::createItemModelContext( context, grouperModel ); -} - -void MainView::setupStandardActionManager( QItemSelectionModel *collectionSelectionModel, - QItemSelectionModel *itemSelectionModel ) -{ - mStandardActionManager = new Akonadi::StandardCalendarActionManager( actionCollection(), this ); - mStandardActionManager->setCollectionSelectionModel( collectionSelectionModel ); - mStandardActionManager->setItemSelectionModel( itemSelectionModel ); - - mStandardActionManager->createAllActions(); - mStandardActionManager->interceptAction( Akonadi::StandardActionManager::CreateResource ); - mStandardActionManager->interceptAction( Akonadi::StandardCalendarActionManager::CreateTodo ); - mStandardActionManager->interceptAction( Akonadi::StandardCalendarActionManager::CreateSubTodo ); - mStandardActionManager->interceptAction( Akonadi::StandardCalendarActionManager::EditIncidence ); - - connect( mStandardActionManager->action( Akonadi::StandardActionManager::CreateResource ), - SIGNAL(triggered(bool)), SLOT(launchAccountWizard()) ); - connect( mStandardActionManager->action( Akonadi::StandardCalendarActionManager::CreateTodo ), - SIGNAL(triggered(bool)), SLOT(newTask()) ); - connect( mStandardActionManager->action( Akonadi::StandardCalendarActionManager::CreateSubTodo ), - SIGNAL(triggered(bool)), SLOT(newSubTask()) ); - connect( mStandardActionManager->action( Akonadi::StandardCalendarActionManager::EditIncidence ), - SIGNAL(triggered(bool)), SLOT(editIncidence()) ); - connect( mStandardActionManager, SIGNAL(actionStateUpdated()), SLOT(updateActionTexts()) ); - - ActionHelper::adaptStandardActionTexts( mStandardActionManager ); - - mStandardActionManager->action( StandardActionManager::CollectionProperties )->setText( i18n( "Task List Properties" ) ); - mStandardActionManager->action( StandardActionManager::CreateCollection )->setText( i18n( "New Sub Task List" ) ); - mStandardActionManager->action( StandardActionManager::CreateCollection )->setProperty( "ContentMimeTypes", QStringList( KCalCore::Todo::todoMimeType() ) ); - mStandardActionManager->setActionText( StandardActionManager::SynchronizeCollections, ki18np( "Synchronize This Task List", "Synchronize These Task Lists" ) ); - mStandardActionManager->setActionText( StandardActionManager::DeleteCollections, ki18np( "Delete Task List", "Delete Task Lists" ) ); - mStandardActionManager->action( StandardActionManager::MoveCollectionToDialog )->setText( i18n( "Move Task List To" ) ); - mStandardActionManager->action( StandardActionManager::CopyCollectionToDialog )->setText( i18n( "Copy Task List To" ) ); - - mStandardActionManager->action( Akonadi::StandardCalendarActionManager::CreateTodo )->setText( i18n( "New Task" ) ); - mStandardActionManager->action( Akonadi::StandardCalendarActionManager::CreateSubTodo )->setText( i18n( "New Sub Task" ) ); - mStandardActionManager->action( Akonadi::StandardCalendarActionManager::EditIncidence )->setText( i18n( "Edit task" ) ); - - actionCollection()->action( QLatin1String("synchronize_all_items") )->setText( i18n( "Synchronize All Tasks" ) ); -} - -void MainView::updateActionTexts() -{ - const Akonadi::Item::List items = mStandardActionManager->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?" ) ); -} - -QAbstractProxyModel* MainView::createItemFilterModel() const -{ - return new TasksFilterProxyModel(); -} - -ImportHandlerBase* MainView::importHandler() const -{ - return new TasksImportHandler(); -} - -ExportHandlerBase* MainView::exportHandler() const -{ - return new TasksExportHandler(); -} - -void MainView::configureCategories() -{ - CalendarSupport::CategoryConfig config( IncidenceEditorNG::EditorConfig::instance()->config(), 0 ); - IncidenceEditorNG::CategoryEditDialog dialog( &config, 0 ); - if ( dialog.exec() ) - config.writeConfig(); -} - -Item MainView::currentItem() const -{ - const QModelIndexList list = itemSelectionModel()->selectedRows(); - - if ( list.size() != 1 ) - return Item(); - - const QModelIndex index = list.first(); - const Item item = index.data( EntityTreeModel::ItemRole ).value(); - if ( !item.hasPayload() ) - return Item(); - - return item; -} - -void MainView::saveAllAttachments() -{ - const QModelIndexList list = itemSelectionModel()->selectedIndexes(); - if ( list.isEmpty() ) - return; - - 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( job )->items().first(); - CalendarSupport::saveAttachments( item, this ); -} - -void MainView::archiveOldEntries() -{ - CalendarSupport::ArchiveDialog archiveDialog( mCalendar, mChanger, this ); - archiveDialog.exec(); -} - -void MainView::processActionFail( const Akonadi::Item &item, const QString &msg ) -{ - Q_UNUSED( item ); - Q_UNUSED( msg ); - mTasksActionManager->updateActions(); -} - -void MainView::processActionFinish( const Akonadi::Item &item ) -{ - Q_UNUSED( item ); - mTasksActionManager->updateActions(); -} - diff --git a/kdepim/mobile/tasks/mainview.h b/kdepim/mobile/tasks/mainview.h deleted file mode 100644 index 5957370d..00000000 --- a/kdepim/mobile/tasks/mainview.h +++ /dev/null @@ -1,99 +0,0 @@ -/* -* This file is part of Akonadi -* -* Copyright (c) 2010 Bertjan Broeksema -* -* 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 -#include - -#include -#include - -class KJob; -class TasksActionManager; -class ConfigWidget; - -namespace Akonadi { -class StandardCalendarActionManager; -class IncidenceChanger; -} - -namespace CalendarSupport { -class CalendarUtils; -} - -class MainView : public KDeclarativeMainView -{ - Q_OBJECT - public: - explicit MainView( QWidget *parent = 0 ); - ~MainView(); - - void setConfigWidget( ConfigWidget *configWidget ); - - public slots: - void newTask(); - void newSubTask(); - void makeTaskIndependent(); - void makeAllSubtasksIndependent(); - void purgeCompletedTasks(); - void setPercentComplete( int row, int percentComplete ); - void editIncidence(); - void editIncidence( const Akonadi::Item &item ); - void saveAllAttachments(); - - private slots: - void finishEdit( QObject *editor ); - void fetchForSaveAllAttachmentsDone( KJob* job ); - void processActionFail( const Akonadi::Item &item, const QString &msg ); - void processActionFinish( const Akonadi::Item &item ); - void archiveOldEntries(); - void updateActionTexts(); - void configureCategories(); - - protected: - virtual void doDelayedInit(); - virtual QAbstractItemModel* createItemModelContext( QDeclarativeContext *context, QAbstractItemModel *model ); - virtual void setupStandardActionManager( QItemSelectionModel *collectionSelectionModel, - QItemSelectionModel *itemSelectionModel ); - - virtual void setupAgentActionManager( QItemSelectionModel *selectionModel ); - - virtual QAbstractProxyModel* createItemFilterModel() const; - virtual ImportHandlerBase* importHandler() const; - virtual ExportHandlerBase* exportHandler() const; - - Akonadi::Item currentItem() const; - - private: - CalendarSupport::CalendarUtils *mCalendarUtils; - QHash mOpenItemEditors; - Akonadi::StandardCalendarActionManager *mStandardActionManager; - TasksActionManager *mTasksActionManager; - EventViews::PrefsPtr mCalendarPrefs; - Akonadi::ETMCalendar::Ptr mCalendar; - Akonadi::IncidenceChanger *mChanger; -}; - -#endif // MAINVIEW_H diff --git a/kdepim/mobile/tasks/searchwidget.cpp b/kdepim/mobile/tasks/searchwidget.cpp deleted file mode 100644 index ce4ecc6b..00000000 --- a/kdepim/mobile/tasks/searchwidget.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 - -#include -#include -#include - -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::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(); -} - diff --git a/kdepim/mobile/tasks/searchwidget.h b/kdepim/mobile/tasks/searchwidget.h deleted file mode 100644 index 52321477..00000000 --- a/kdepim/mobile/tasks/searchwidget.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - Copyright (c) 2010 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com - Copyright (c) 2010 Tobias Koenig - - 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 -#include - -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 diff --git a/kdepim/mobile/tasks/searchwidget.ui b/kdepim/mobile/tasks/searchwidget.ui deleted file mode 100644 index 07dcf5db..00000000 --- a/kdepim/mobile/tasks/searchwidget.ui +++ /dev/null @@ -1,219 +0,0 @@ - - - SearchWidget - - - - 0 - 0 - 430 - 278 - - - - - QFormLayout::AllNonFixedFieldsGrow - - - - - Search for: - - - - - - - true - - - - - - - In: - - - - - - - - 0 - - - 3 - - - 0 - - - 3 - - - - - Summaries - - - - - - - Descriptions - - - - - - - Categories - - - - - - - Locations - - - - - - - - - - Between: - - - - - - - - - true - - - - - - - - 0 - 0 - - - - and - - - Qt::AlignCenter - - - - - - - true - - - - - - - - - Include To-Dos without a due date - - - - - - - Located in: - - - - - - - - 0 - - - 3 - - - 0 - - - 3 - - - - - any folder - - - true - - - - - - - only in folder - - - - - - - false - - - - - - - - - - - KDateComboBox - QComboBox -
kdatecombobox.h
-
- - KLineEdit - QLineEdit -
klineedit.h
-
- - Akonadi::CollectionComboBox - QComboBox -
akonadi/collectioncombobox.h
-
-
- - - - locatedInSpecificCollection - toggled(bool) - collectionCombo - setEnabled(bool) - - - 138 - 235 - - - 217 - 239 - - - - -
diff --git a/kdepim/mobile/tasks/settings.kcfg b/kdepim/mobile/tasks/settings.kcfg deleted file mode 100644 index 7fc04325..00000000 --- a/kdepim/mobile/tasks/settings.kcfg +++ /dev/null @@ -1,23 +0,0 @@ - - - - kglobalsettings.h - - - - - - - - - - - - - - - - - diff --git a/kdepim/mobile/tasks/settings.kcfgc b/kdepim/mobile/tasks/settings.kcfgc deleted file mode 100644 index 734c1668..00000000 --- a/kdepim/mobile/tasks/settings.kcfgc +++ /dev/null @@ -1,6 +0,0 @@ -File=settings.kcfg -ClassName=Settings -Mutators=true -Singleton=true -ItemAccessors=true -SetUserTexts=true diff --git a/kdepim/mobile/tasks/tasklistproxy.cpp b/kdepim/mobile/tasks/tasklistproxy.cpp deleted file mode 100644 index 23ae30c5..00000000 --- a/kdepim/mobile/tasks/tasklistproxy.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 "tasklistproxy.h" - -#include "settings.h" - -#include - -#include -#include - -using namespace Akonadi; - -TaskListProxy::TaskListProxy( QObject* parent ) - : ListProxy( parent ) -{ -} - -QVariant TaskListProxy::data( const QModelIndex &index, int role ) const -{ - const Akonadi::Item item = QSortFilterProxyModel::data( index, Akonadi::EntityTreeModel::ItemRole ).value(); - - if ( item.isValid() && item.hasPayload() ) { - const KCalCore::Todo::Ptr incidence = item.payload(); - switch ( role ) { - case SummaryRole: - return incidence->summary(); - case DescriptionRole: - return incidence->description(); - case PercentCompleteRole: - return incidence->percentComplete(); - case BackgroundColorRole: - if ( incidence->hasDueDate() ) { - if ( incidence->dtDue().date() == QDate::currentDate() ) { - return mViewPrefs->todoDueTodayColor(); - } else if ( incidence->isOverdue() ) { - return mViewPrefs->todoOverdueColor(); - } - } - return Qt::transparent; - case IsSubTaskRole: - return !incidence->relatedTo( KCalCore::Todo::RelTypeParent ).isEmpty(); - case SingleLineDescriptionRole: - return incidence->description().replace( QLatin1Char('\n'), QLatin1Char(' ') ); - case HasDescriptionRole: - return !incidence->description().isEmpty(); - } - } - - return QSortFilterProxyModel::data( index, role ); -} - -bool TaskListProxy::setData( const QModelIndex &index, const QVariant &value, int role ) -{ - if ( role == PercentCompleteRole ) { - Akonadi::Item item = QSortFilterProxyModel::data( index, Akonadi::EntityTreeModel::ItemRole ).value(); - - if ( item.isValid() && item.hasPayload() ) { - KCalCore::Todo::Ptr incidence = item.payload(); - if ( incidence->percentComplete() != value.toInt() ) { - incidence->setPercentComplete( value.toInt() ); - item.setPayload( incidence ); - return QSortFilterProxyModel::setData( index, QVariant::fromValue( item ), EntityTreeModel::ItemRole ); - } else { - return true; - } - } - } - - return QSortFilterProxyModel::setData( index, value, role ); -} - - -void TaskListProxy::setSourceModel( QAbstractItemModel *sourceModel ) -{ - ListProxy::setSourceModel( sourceModel ); - - QHash names = roleNames(); - names.insert( EntityTreeModel::ItemIdRole, "itemId" ); - names.insert( SummaryRole, "summary" ); - names.insert( DescriptionRole, "description" ); - names.insert( PercentCompleteRole, "percentComplete" ); - names.insert( BackgroundColorRole, "backgroundColor" ); - names.insert( IsSubTaskRole, "isSubTask" ); - names.insert( SingleLineDescriptionRole, "singleLineDescription" ); - names.insert( HasDescriptionRole, "hasDescription" ); - - setRoleNames( names ); -} - -void TaskListProxy::setPreferences( const EventViews::PrefsPtr &preferences ) -{ - mViewPrefs = preferences; -} diff --git a/kdepim/mobile/tasks/tasklistproxy.h b/kdepim/mobile/tasks/tasklistproxy.h deleted file mode 100644 index b1a5cb60..00000000 --- a/kdepim/mobile/tasks/tasklistproxy.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 TASKLISTPROXY_H -#define TASKLISTPROXY_H - -#include "listproxy.h" - -#include "calendarviews/eventview.h" -#include "calendarviews/prefs.h" - -#include - -class TaskListProxy : public ListProxy -{ - Q_OBJECT - - public: - enum Role { - SummaryRole = Akonadi::EntityTreeModel::UserRole, - DescriptionRole, - PercentCompleteRole, - BackgroundColorRole, - IsSubTaskRole, - SingleLineDescriptionRole, - HasDescriptionRole - }; - - explicit TaskListProxy( QObject* parent = 0 ); - - virtual QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const; - virtual bool setData( const QModelIndex& index, const QVariant& value, int role = Qt::EditRole ); - - virtual void setSourceModel( QAbstractItemModel* sourceModel ); - - void setPreferences( const EventViews::PrefsPtr &preferences ); - - private: - EventViews::PrefsPtr mViewPrefs; -}; - -#endif // TASKLISTPROXY_H diff --git a/kdepim/mobile/tasks/tasks-mobile-background.png b/kdepim/mobile/tasks/tasks-mobile-background.png deleted file mode 100644 index 26d4352b..00000000 Binary files a/kdepim/mobile/tasks/tasks-mobile-background.png and /dev/null differ diff --git a/kdepim/mobile/tasks/tasks-mobile.desktop b/kdepim/mobile/tasks/tasks-mobile.desktop deleted file mode 100644 index b0583e88..00000000 --- a/kdepim/mobile/tasks/tasks-mobile.desktop +++ /dev/null @@ -1,52 +0,0 @@ -[Desktop Entry] -Version=1.0 -Name=Tasks -Name[bs]=Zadaci -Name[ca]=Tasques -Name[ca@valencia]=Tasques -Name[cs]=Úkoly -Name[da]=Opgaver -Name[de]=Aufgaben -Name[el]=Εργασίες -Name[en_GB]=Tasks -Name[es]=Tareas -Name[et]=Ülesanded -Name[fi]=Tehtävät -Name[fr]=Tâches -Name[gl]=Tarefas -Name[hu]=Feladatok -Name[ia]=Cargas -Name[it]=Tasks -Name[kk]=Тапсырмалар -Name[km]=ភារកិច្ច​ -Name[ko]=작업 -Name[lt]=Užduotys -Name[mr]=कार्ये -Name[nb]=Oppgaver -Name[nds]=Opgaven -Name[nl]=Taken -Name[pa]=ਟਾਸਕ -Name[pl]=Zadania -Name[pt]=Tarefas -Name[pt_BR]=Tarefas -Name[ro]=Sarcini -Name[ru]=Задачи -Name[sk]=Úlohy -Name[sl]=Opravila -Name[sr]=Задаци -Name[sr@ijekavian]=Задаци -Name[sr@ijekavianlatin]=Zadaci -Name[sr@latin]=Zadaci -Name[sv]=Uppgifter -Name[tr]=Görevler -Name[ug]=ۋەزىپىلەر -Name[uk]=Завдання -Name[wa]=Bouyes -Name[x-test]=xxTasksxx -Name[zh_CN]=任务 -Name[zh_TW]=工作 -Exec=tasks-mobile - -Icon=tasks-mobile -Type=Application -Categories=Qt;KDE;Office;Calendar; diff --git a/kdepim/mobile/tasks/tasks-mobile.ico b/kdepim/mobile/tasks/tasks-mobile.ico deleted file mode 100644 index dc5b6469..00000000 Binary files a/kdepim/mobile/tasks/tasks-mobile.ico and /dev/null differ diff --git a/kdepim/mobile/tasks/tasks-mobile.rc b/kdepim/mobile/tasks/tasks-mobile.rc deleted file mode 100644 index 51c75bcc..00000000 --- a/kdepim/mobile/tasks/tasks-mobile.rc +++ /dev/null @@ -1 +0,0 @@ -TASKS_MOBILE_ICON ICON "tasks-mobile.ico" diff --git a/kdepim/mobile/tasks/tasks.qml b/kdepim/mobile/tasks/tasks.qml deleted file mode 100644 index 1bc81b15..00000000 --- a/kdepim/mobile/tasks/tasks.qml +++ /dev/null @@ -1,422 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - Copyright (c) 2010 Bertjan Broeksema - - 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 org.kde.kcal 4.5 as KCal -import org.kde.akonadi.tasks 4.5 as Tasks -import "../mobileui/ScreenFunctions.js" as Screen - -KPIM.MainView { - id: tasksMobile - - QML.Connections { - target: guiStateManager - onGuiStateChanged: { updateContextActionStates() } - } - - QML.Component.onCompleted : updateContextActionStates(); - - function updateContextActionStates() - { - if ( guiStateManager.inHomeScreenState ) { - taskActions.showOnlyCategory( "home" ) - } else if ( guiStateManager.inAccountScreenState ) { - taskActions.showOnlyCategory( "account" ) - } else if ( guiStateManager.inSingleFolderScreenState ) { - taskActions.showOnlyCategory( "single_folder" ) - } else if ( guiStateManager.inMultipleFolderScreenState || guiStateManager.inSearchResultScreenState ) { - taskActions.showOnlyCategory( "multiple_folder" ) - } else if ( guiStateManager.inViewSingleItemState ) { - taskActions.showOnlyCategory( "todo_viewer" ) - } - } - - KCal.IncidenceView { - id: taskView - visible: guiStateManager.inViewSingleItemState - anchors { fill: parent; topMargin: 40; leftMargin: 40 } - width: parent.width - height: parent.height - - z: 0 - - itemId: -1 - swipeLength: 0.2 // Require at least 20% of screenwidth to trigger next or prev - - onNextItemRequest: { - _itemNavigationModel.requestNext(); - } - - onPreviousItemRequest: { - _itemNavigationModel.requestPrevious(); - } - - KPIM.ItemEditButton { - actionName: "akonadi_incidence_edit" - anchors.bottom: backButton.top - anchors.right: parent.right - anchors.margins: 12 - onClicked: { - application.editIncidence( parent.item ); - } - } - - 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(); - } - } - } - - 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 - anchors.right : parent.right - - QML.Image { - id: backgroundImage - x: 0 - y: 0 -// FIXME: too big, costs about 1.5Mb RAM -// source: "tasks-mobile-background.png" - visible: collectionView.visible - } - - Akonadi.AkonadiBreadcrumbNavigationView { - id : collectionView - anchors.top: parent.top - width: 1/3 * parent.width - anchors.bottom : selectButton.top - //height : parent.height - ( collectionView.hasSelection ? 0 : selectButton.height) - anchors.left: parent.left - 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 tasks", - "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 task","%1 tasks",itemList.count)) - - 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.numSelected == 1) ? -selectButton.height : 0 } - buttonText : (collectionView.numSelected <= 1) ? KDE.i18n("Select") : KDE.i18n("Change Selection") - opacity : { (collectionView.numSelected == 1) ? 0 : 1 } - onClicked : { - application.persistCurrentSelection("preFavSelection"); - guiStateManager.pushState( KPIM.GuiStateManager.MultipleFolderSelectionScreenState ) - } - } - - KPIM.StartCanvas { - id : startPage - visible: !collectionView.hasSelection - anchors.left : collectionView.right - anchors.top : parent.top - anchors.bottom : parent.bottom - anchors.right : parent.right - anchors.leftMargin : 10 - anchors.rightMargin : 10 - showAccountsList : false - favoritesModel : favoritesList - - contextActions : [ - QML.Column { - anchors.fill: parent - height : 70 - KPIM.Button2 { - width: parent.width - buttonText : KDE.i18n( "New Task" ) - onClicked : { - application.newTask(); - } - } - } - ] - } - - QML.Rectangle { - id : emptyFolderPage - visible: (!guiStateManager.inHomeScreenState && collectionView.hasBreadcrumbs && itemList.count == 0) - anchors.left : collectionView.right - anchors.top : parent.top - anchors.bottom : parent.bottom - anchors.right : parent.right - color : "#00000000" - // TODO: content - QML.Text { - text : KDE.i18n("No tasks in this folder"); - height : 20; - font.italic : true - horizontalAlignment : QML.Text.AlignHCenter - anchors.verticalCenter : parent.verticalCenter; - anchors.horizontalCenter : parent.horizontalCenter - } - } - - QML.Rectangle { - id : itemListPage - visible: { guiStateManager.inAccountScreenState || - guiStateManager.inSingleFolderScreenState || - guiStateManager.inMultipleFolderScreenState - } - anchors.left : collectionView.right - anchors.top : parent.top - anchors.bottom : parent.bottom - anchors.right : parent.right - color : "#00000000" - - TaskListView { - id: itemList - model: itemModel - checkModel : _itemActionModel - anchors.left : parent.left - anchors.top : parent.top - anchors.bottom : filterLineEdit.top - anchors.right : parent.right - navigationModel : _itemNavigationModel - itemHeight: Screen.partition( height, 7 ) - } - - Akonadi.FilterLineEdit { - id: filterLineEdit - anchors.left : parent.left - anchors.bottom : parent.bottom - anchors.right : parent.right - visible : false - height : 0 - y: height == 0 ? parent.height : parent.height - height - } - - QML.Connections { - target : _itemNavigationModel - onCurrentRowChanged : { - if ( _itemNavigationModel.currentRow != -1 ) { - taskView.itemId = _itemNavigationModel.currentItemIdHack - guiStateManager.pushUniqueState( KPIM.GuiStateManager.ViewSingleItemState ); - _itemActionModel.select( _itemNavigationModel.currentRow, 3 ); - } - } - } - } - } - - 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 - - QML.Component.onCompleted: { - actionPanel.expanded.connect( taskActions, taskActions.refresh ); - } - - content : [ - TaskActions { - id : taskActions - 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_task" -// 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 : "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: (taskView.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: taskView.attachmentModel - anchors.fill: parent - - onOpenAttachment: { - application.openAttachment(url, mimeType); - } - - onSaveAttachment: { - application.saveAttachment(url, fileName); - } - } - ] - } - } - - QML.Loader { - anchors.fill: parent - source: guiStateManager.inMultipleFolderSelectionScreenState ? KDE.locate( "module", "imports/org/kde/pim/mobileui/MultipleSelectionScreen.qml" ) : "" - onLoaded: { item.backgroundImage = backgroundImage.source; } - } - - QML.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: TaskListView { - id: searchTaskListView - model: itemModel - checkModel : _itemActionModel - navigationModel : _itemNavigationModel - anchors.fill : parent - itemHeight: Screen.partition( height, 7 ) - } - - resultText: KDE.i18np( "One task found", "%1 tasks found", searchTaskListView.count ) - } - - QML.Connections { - target: taskView - onIncidenceRemoved : { guiStateManager.popState(); } - } - - QML.Connections { - target: startPage - onFavoriteSelected : { - application.loadFavorite(favName); - } - } - - QML.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; } - } - - QML.Loader { - anchors.fill: parent - source: guiStateManager.inConfigScreenState ? "ConfigDialog.qml" : "" - onLoaded: item.load(); - } - - KPIM.SearchDialog { - id: searchDialog - searchWidget: Tasks.SearchWidget { - anchors.fill: parent - } - } -} diff --git a/kdepim/mobile/tasks/tasksactionmanager.cpp b/kdepim/mobile/tasks/tasksactionmanager.cpp deleted file mode 100644 index 91eeb8a2..00000000 --- a/kdepim/mobile/tasks/tasksactionmanager.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 "tasksactionmanager.h" - - -#include -#include - -#include - -#include -#include -#include - -#include - -TasksActionManager::TasksActionManager( KActionCollection *actionCollection, QObject *parent) - : QObject( parent ) - , mActionCollection( actionCollection ) - , mCalendar( 0 ) - , mItemSelectionModel( 0 ) -{ - initActions(); -} - -void TasksActionManager::setCalendar( const Akonadi::ETMCalendar::Ptr &calendar ) -{ - // Doesn't take ownership. The calendar is used in updateActions. - mCalendar = calendar; -} - -void TasksActionManager::setItemSelectionModel( QItemSelectionModel *itemSelectionModel ) -{ - if ( mItemSelectionModel ) - disconnect( mItemSelectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)) ); - - mItemSelectionModel = itemSelectionModel; - if ( mItemSelectionModel ) { - connect( mItemSelectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)), - SLOT(updateActions()) ); - } - - updateActions(); -} - -void TasksActionManager::updateActions() -{ - mActionCollection->action( QLatin1String( "make_subtask_independent" ) )->setEnabled( false ); - mActionCollection->action( QLatin1String( "make_all_subtasks_independent" ) )->setEnabled( false ); - - const QModelIndexList list = mItemSelectionModel->selectedRows(); - if ( list.size() != 1 ) - return; - - const QModelIndex idx = list.first(); - Akonadi::Item item = idx.data( Akonadi::EntityTreeModel::ItemRole ).value(); - - if ( !item.isValid() ) - return; - - if ( !item.hasPayload() ) - return; - - if ( mCalendar->childItems( item.id() ).size() >= 1 ) - mActionCollection->action( QLatin1String( "make_all_subtasks_independent" ) )->setEnabled( true ); - - // Only enable the make_subtask_independent action for todos that have a parent. - KCalCore::Todo::Ptr todo = item.payload(); - const bool enable = !todo->relatedTo( KCalCore::Todo::RelTypeParent ).isEmpty(); - mActionCollection->action( QLatin1String( "make_subtask_independent" ) )->setEnabled( enable ); -} - -void TasksActionManager::initActions() -{ - KAction *action = mActionCollection->addAction( QLatin1String( "import_tasks" ) ); - action->setText( i18n( "Import Tasks" ) ); - - action = mActionCollection->addAction( QLatin1String( "export_account_tasks" ) ); - action->setText( i18n( "Export Tasks" ) ); - - action = mActionCollection->addAction( QLatin1String( "export_selected_tasks" ) ); - action->setText( i18n( "Export Displayed Tasks" ) ); - - action = mActionCollection->addAction( QLatin1String( "make_subtask_independent" ) ); - action->setText( i18n( "Make Sub Task Independent" ) ); - - action = mActionCollection->addAction( QLatin1String( "make_all_subtasks_independent" ) ); - action->setText( i18n( "Make All Sub Tasks Independent" ) ); - - action = mActionCollection->addAction( QLatin1String( "purge_completed_tasks" ) ); - action->setText( i18n( "Delete Completed Tasks" ) ); - - action = mActionCollection->addAction( QLatin1String( "save_all_attachments" ) ); - action->setText( i18n( "Save All Attachments" ) ); - - action = mActionCollection->addAction( QLatin1String( "archive_old_entries" ) ); - action->setText( i18n( "Archive Old Tasks" ) ); -} - diff --git a/kdepim/mobile/tasks/tasksactionmanager.h b/kdepim/mobile/tasks/tasksactionmanager.h deleted file mode 100644 index c062f95d..00000000 --- a/kdepim/mobile/tasks/tasksactionmanager.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Copyright (c) 2010 Bertjan Broeksema - - 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 TASKSACTIONMANAGER_H -#define TASKSACTIONMANAGER_H - -#include -#include - -class KActionCollection; -class QItemSelectionModel; - -class TasksActionManager : public QObject -{ - Q_OBJECT -public: - explicit TasksActionManager( KActionCollection *actionCollection, QObject *parent = 0 ); - - void setCalendar( const Akonadi::ETMCalendar::Ptr &calendar ); - void setItemSelectionModel( QItemSelectionModel *itemSelectionModel ); - -public slots: - void updateActions(); - -private: - void initActions(); // Initializes the tasks application specific actions. - -private: - KActionCollection *mActionCollection; - Akonadi::ETMCalendar::Ptr mCalendar; - QItemSelectionModel *mItemSelectionModel; -}; - -#endif // TASKACTIONMANAGER_H diff --git a/kdepim/mobile/tasks/tasksexporthandler.cpp b/kdepim/mobile/tasks/tasksexporthandler.cpp deleted file mode 100644 index 2931cc28..00000000 --- a/kdepim/mobile/tasks/tasksexporthandler.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "tasksexporthandler.h" - -#include -#include -#include -#include -#include -#include - -QString TasksExportHandler::dialogText() const -{ - return i18n( "Which tasks shall be exported?" ); -} - -QString TasksExportHandler::dialogAllText() const -{ - return i18n( "All Tasks" ); -} - -QString TasksExportHandler::dialogLocalOnlyText() const -{ - return i18n( "Tasks in current folder" ); -} - -QStringList TasksExportHandler::mimeTypes() const -{ - return QStringList( KCalCore::Todo::todoMimeType() ); -} - -bool TasksExportHandler::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() ) - calendar->addIncidence( item.payload() ); - } - 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; -} diff --git a/kdepim/mobile/tasks/tasksexporthandler.h b/kdepim/mobile/tasks/tasksexporthandler.h deleted file mode 100644 index dc96651a..00000000 --- a/kdepim/mobile/tasks/tasksexporthandler.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 TASKSEXPORTHANDLER_H -#define TASKSEXPORTHANDLER_H - -#include "../lib/exporthandlerbase.h" - -class TasksExportHandler : 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 diff --git a/kdepim/mobile/tasks/tasksfilterproxymodel.cpp b/kdepim/mobile/tasks/tasksfilterproxymodel.cpp deleted file mode 100644 index 2734de93..00000000 --- a/kdepim/mobile/tasks/tasksfilterproxymodel.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "tasksfilterproxymodel.h" - -#include -#include - -static bool taskMatchesFilter( const KCalCore::Todo::Ptr &task, const QString &filterString ); - -using namespace Akonadi; - -class TasksFilterProxyModel::Private -{ - public: - QString mFilter; -}; - -TasksFilterProxyModel::TasksFilterProxyModel( QObject *parent ) - : QSortFilterProxyModel( parent ), d( new Private ) -{ - setSortLocaleAware( true ); - setDynamicSortFilter( true ); -} - -TasksFilterProxyModel::~TasksFilterProxyModel() -{ - delete d; -} - -void TasksFilterProxyModel::setFilterString( const QString &filter ) -{ - d->mFilter = filter; - invalidateFilter(); -} - -bool TasksFilterProxyModel::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(); - - if ( item.hasPayload() ) { - const KCalCore::Todo::Ptr task = item.payload(); - return taskMatchesFilter( task, d->mFilter ); - } - - return true; -} - -static bool taskMatchesFilter( const KCalCore::Todo::Ptr &task, const QString &filterString ) -{ - if ( task->summary().contains( filterString, Qt::CaseInsensitive ) ) - return true; - - if ( task->description().contains( filterString, Qt::CaseInsensitive ) ) - return true; - - return false; -} - diff --git a/kdepim/mobile/tasks/tasksfilterproxymodel.h b/kdepim/mobile/tasks/tasksfilterproxymodel.h deleted file mode 100644 index 97d0c529..00000000 --- a/kdepim/mobile/tasks/tasksfilterproxymodel.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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_TASKSFILTERPROXYMODEL_H -#define AKONADI_TASKSFILTERPROXYMODEL_H - -#include - -namespace Akonadi { - -/** - * @short A proxy model for \a EntityTreeModel based task models. - * - * This class provides a filter proxy model for an EntityTreeModel. - * The list of shown tasks can be limited by setting a filter pattern. - * Only tasks that contain this pattern as part of their data will be listed. - * - * Example: - * - * @code - * - * Akonadi::TasksFilterProxyModel *filter = new Akonadi::TasksFilterProxyModel; - * 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 - */ -class TasksFilterProxyModel : public QSortFilterProxyModel -{ - Q_OBJECT - - public: - /** - * Creates a new tasks filter proxy model. - * - * @param parent The parent object. - */ - explicit TasksFilterProxyModel( QObject *parent = 0 ); - - /** - * Destroys the tasks filter proxy model. - */ - ~TasksFilterProxyModel(); - - public Q_SLOTS: - /** - * Sets the @p filter that is used to filter for matching tasks. - */ - 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 diff --git a/kdepim/mobile/tasks/tasksimporthandler.cpp b/kdepim/mobile/tasks/tasksimporthandler.cpp deleted file mode 100644 index 7d981bcf..00000000 --- a/kdepim/mobile/tasks/tasksimporthandler.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 "tasksimporthandler.h" - -#include -#include -#include -#include -#include -#include - -QString TasksImportHandler::fileDialogNameFilter() const -{ - return QLatin1String( "*.ics|iCals" ); -} - -QString TasksImportHandler::fileDialogTitle() const -{ - return i18n( "Select iCal to Import" ); -} - -QString TasksImportHandler::collectionDialogText() const -{ - return i18n( "Select the calendar the imported task(s) shall be saved in:" ); -} - -QString TasksImportHandler::collectionDialogTitle() const -{ - return i18n( "Select Calendar" ); -} - -QString TasksImportHandler::importDialogText( int count, const QString &collectionName ) const -{ - return i18np( "Importing one task to %2", "Importing %1 tasks to %2", count, collectionName ); -} - -QString TasksImportHandler::importDialogTitle() const -{ - return i18n( "Import Tasks" ); -} - -QStringList TasksImportHandler::mimeTypes() const -{ - return QStringList( KCalCore::Todo::todoMimeType() ); -} - -Akonadi::Item::List TasksImportHandler::createItems( const QStringList &fileNames, bool *ok ) -{ - *ok = true; - - Akonadi::Item::List items; - - KCalCore::Todo::List tasks; - - 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() ) { - tasks << calendar->todos(); - } else { - const QString caption( i18n( "iCal Import Failed" ) ); - const QString msg = i18nc( "@info", - "Error when trying to read the iCal %1:", - fileName ); - KMessageBox::error( 0, msg, caption ); - *ok = false; - } - } - - if ( tasks.isEmpty() ) { - if ( !(*ok) && fileNames.count() > 1 ) - KMessageBox::information( 0, i18n( "No tasks were imported, due to errors with the iCals." ) ); - else if ( *ok ) - KMessageBox::information( 0, i18n( "The iCal does not contain any tasks." ) ); - - return items; // nothing to import - } - - foreach ( const KCalCore::Todo::Ptr &task, tasks ) { - Akonadi::Item item; - item.setPayload( task ); - item.setMimeType( KCalCore::Todo::todoMimeType() ); - - items << item; - } - - return items; -} diff --git a/kdepim/mobile/tasks/tasksimporthandler.h b/kdepim/mobile/tasks/tasksimporthandler.h deleted file mode 100644 index 274f3266..00000000 --- a/kdepim/mobile/tasks/tasksimporthandler.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Copyright (c) 2010 Tobias Koenig - - 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 TASKSIMPORTHANDLER_H -#define TASKSIMPORTHANDLER_H - -#include "../lib/importhandlerbase.h" - -class TasksImportHandler : 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 diff --git a/kdepim/mobile/tasks/taskthreadgroupercomparator.cpp b/kdepim/mobile/tasks/taskthreadgroupercomparator.cpp deleted file mode 100644 index 659f15f8..00000000 --- a/kdepim/mobile/tasks/taskthreadgroupercomparator.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 "taskthreadgroupercomparator.h" - -#include "settings.h" - -#include -#include - -TaskThreadGrouperComparator::TaskThreadGrouperComparator() -{ -} - -TaskThreadGrouperComparator::~TaskThreadGrouperComparator() -{ -} - -QByteArray TaskThreadGrouperComparator::identifierForItem( const Akonadi::Item &item ) const -{ - Q_ASSERT( item.hasPayload() ); - - const KCalCore::Todo::Ptr todo = item.payload(); - - QByteArray identifier = todo->uid().toLatin1(); - - if ( identifier.isEmpty() ) - identifier = QByteArray::number( item.id() ); - - return identifier; -} - -QByteArray TaskThreadGrouperComparator::parentIdentifierForItem( const Akonadi::Item &item ) const -{ - Q_ASSERT( item.hasPayload() ); - - const KCalCore::Todo::Ptr todo = item.payload(); - - return todo->relatedTo( KCalCore::Todo::RelTypeParent ).toLatin1(); -} - -bool TaskThreadGrouperComparator::lessThan( const Akonadi::Item &leftItem, const Akonadi::Item &rightItem ) const -{ - Q_ASSERT( leftItem.isValid() ); - Q_ASSERT( rightItem.isValid() ); - - const Akonadi::Item leftThreadRootItem = threadItem( leftItem ); - const Akonadi::Item rightThreadRootItem = threadItem( rightItem ); - - Q_ASSERT( rightThreadRootItem.isValid() ); - Q_ASSERT( leftThreadRootItem.isValid() ); - - const bool leftItemIsThreadLeader = (leftThreadRootItem == leftItem); - const bool rightItemIsThreadLeader = (rightThreadRootItem == rightItem); - - if ( leftItemIsThreadLeader && rightItemIsThreadLeader ) { - const KCalCore::Todo::Ptr leftTodo = CalendarSupport::todo( leftThreadRootItem ); - const KCalCore::Todo::Ptr rightTodo = CalendarSupport::todo( rightThreadRootItem ); - - if ( !leftTodo || !rightTodo ) { - kDebug() << "This shouldn't happen, but i didn't check. Better safe than sorry."; - return false; - } - - const bool leftCompleted = leftTodo->isCompleted(); - const bool rightCompleted = rightTodo->isCompleted(); - const int leftPriority = leftTodo->priority(); - const int rightPriority = rightTodo->priority(); - - if ( Settings::self()->showCompletedTodosAtBottom() && leftCompleted != rightCompleted ) { - return rightCompleted; - } - - if ( leftPriority != rightPriority ) { - // higher priority first. ( Also note that 9 is low, and 1 is high ) - return leftPriority < rightPriority; - } else { - // lower id first - return leftItem.id() < rightItem.id(); - } - - return leftThreadRootItem.id() < rightThreadRootItem.id(); - } else if ( leftItemIsThreadLeader && !rightItemIsThreadLeader ) { - if ( leftThreadRootItem == rightThreadRootItem ) - return true; // right item is in thread of left thread leader -> right item located below left item - else - return lessThan( leftThreadRootItem, rightThreadRootItem ); // based on thread leaders order - } else if ( !leftItemIsThreadLeader && rightItemIsThreadLeader ) { - if ( leftThreadRootItem == rightThreadRootItem ) - return false; // left item is in thread of right thread leader -> left item must be located below right item - else - return lessThan( leftThreadRootItem, rightThreadRootItem ); // based on thread leaders order - } else if ( !leftItemIsThreadLeader && !rightItemIsThreadLeader ) { - if ( leftThreadRootItem == rightThreadRootItem ) // both in the same thread - return leftItem.id() < rightItem.id(); // default - else - return lessThan( leftThreadRootItem, rightThreadRootItem ); // based on thread leaders order - } - - return leftItem.id() < rightItem.id(); // default -} - diff --git a/kdepim/mobile/tasks/taskthreadgroupercomparator.h b/kdepim/mobile/tasks/taskthreadgroupercomparator.h deleted file mode 100644 index a3c94c7b..00000000 --- a/kdepim/mobile/tasks/taskthreadgroupercomparator.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (C) 2010 Klarälvdalens Datakonsult AB, - a KDAB Group company, info@kdab.net, - author Tobias Koenig - - 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 TASKTHREADGROUPERCOMPARATOR_H -#define TASKTHREADGROUPERCOMPARATOR_H - -#include "threadgroupermodel.h" - -class TaskThreadGrouperComparator : public ThreadGrouperComparator -{ - public: - /** - * Creates a new task thread grouper comparator. - */ - TaskThreadGrouperComparator(); - - /** - * Destroys the task thread grouper comparator. - */ - ~TaskThreadGrouperComparator(); - - /** - * Returns the unique identifier for the given task @p item. - */ - QByteArray identifierForItem( const Akonadi::Item &item ) const; - - /** - * Returns the parent identifier for the given task @p item. - */ - QByteArray parentIdentifierForItem( const Akonadi::Item &item ) const; - - /** - * Returns if the @p left task item is smaller than the @p right task item. - */ - bool lessThan( const Akonadi::Item &left, const Akonadi::Item &right ) const; -}; - -#endif diff --git a/kdepim/pimcommon/autocorrection/ui/autocorrectionwidget.ui b/kdepim/pimcommon/autocorrection/autocorrectionwidget.ui similarity index 100% rename from kdepim/pimcommon/autocorrection/ui/autocorrectionwidget.ui rename to kdepim/pimcommon/autocorrection/autocorrectionwidget.ui diff --git a/kdepimlibs/CMakeLists.txt b/kdepimlibs/CMakeLists.txt index f342d7c1..94187caf 100644 --- a/kdepimlibs/CMakeLists.txt +++ b/kdepimlibs/CMakeLists.txt @@ -22,7 +22,6 @@ include(KDEPlatformProfile) include(FeatureSummary) set(CMAKE_AUTOMOC ON) -set(CMAKE_LINK_INTERFACE_LIBRARIES "") include(GenerateExportHeader) diff --git a/kdepimlibs/gpgme++/CMakeLists.txt b/kdepimlibs/gpgme++/CMakeLists.txt index f009744e..c7850070 100644 --- a/kdepimlibs/gpgme++/CMakeLists.txt +++ b/kdepimlibs/gpgme++/CMakeLists.txt @@ -1,13 +1,12 @@ project( gpgmepp ) -if (MINGW) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mms-bitfields") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mms-bitfields") -endif() include_directories( ${GPGME_INCLUDES} ${Boost_INCLUDE_DIR} ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}") -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-gpgme++.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-gpgme++.h ) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/config-gpgme++.h.cmake + ${CMAKE_CURRENT_BINARY_DIR}/config-gpgme++.h +) ## gpgme comes in three flavours on each of the platforms: ## Windows: gpgme, gpgme-glib, gpgme-qt @@ -77,9 +76,6 @@ endif() if ( GPGME_QT_FOUND ) add_library( gpgmepp-qt ${LIBRARY_TYPE} ${gpgme_LIB_SRCS} context_qt.cpp ) target_link_libraries( gpgmepp-qt ${GPGME_QT_LIBRARIES} ) - if(WIN32) - target_link_libraries( gpgmepp-qt ${GPGME_VANILLA_LIBRARIES} ) - endif() set_target_properties( gpgmepp-qt PROPERTIES VERSION ${_gpgmepp_version} SOVERSION ${_gpgmepp_soversion} @@ -116,7 +112,10 @@ endif() ########### install files ############### -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/GpgmeppConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/GpgmeppConfig.cmake @ONLY ) +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/GpgmeppConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/GpgmeppConfig.cmake @ONLY +) if ( GPGME_FOUND ) @@ -144,7 +143,6 @@ if ( GPGME_FOUND ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/GpgmeppConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/GpgmeppLibraryDepends.cmake DESTINATION ${LIB_INSTALL_DIR}/gpgmepp )