Git commit 7834a2f80a1d0ba74e3926309a2ca1cae4227676 by Friedrich W. H. Kossebau. Committed on 30/04/2015 at 22:59. Pushed by kossebau into branch 'calligra/2.9'.
Remove broken and for some time unbuild Google Docs plugin would need to be rewritten a little, as it was based on KPart::Plugin, which after the change from KPart to KoPart no longer works REVIEW: 123391 M +0 -1 CalligraProducts.cmake M +0 -2 doc/stage/menus.docbook M +0 -4 plugins/staging/CMakeLists.txt D +0 -39 plugins/staging/googledocs/CMakeLists.txt D +0 -6 plugins/staging/googledocs/Messages.sh D +0 -141 plugins/staging/googledocs/authenticationdialog.ui D +0 -80 plugins/staging/googledocs/documentlist.ui D +0 -86 plugins/staging/googledocs/documentlistwindow.cpp D +0 -51 plugins/staging/googledocs/documentlistwindow.h D +0 -166 plugins/staging/googledocs/googlecontenthandler.cpp D +0 -58 plugins/staging/googledocs/googlecontenthandler.h D +0 -9 plugins/staging/googledocs/googledocs-sheets.rc D +0 -9 plugins/staging/googledocs/googledocs-stage.rc D +0 -9 plugins/staging/googledocs/googledocs-words.rc D +0 -86 plugins/staging/googledocs/googledocument.cpp D +0 -58 plugins/staging/googledocs/googledocument.h D +0 -98 plugins/staging/googledocs/googledocumentlist.cpp D +0 -65 plugins/staging/googledocs/googledocumentlist.h D +0 -226 plugins/staging/googledocs/googledocumentservice.cpp D +0 -75 plugins/staging/googledocs/googledocumentservice.h D +- -- plugins/staging/googledocs/images/dialog-cancel.png D +- -- plugins/staging/googledocs/images/document-import.png D +- -- plugins/staging/googledocs/images/document.png D +- -- plugins/staging/googledocs/images/presentation.png D +- -- plugins/staging/googledocs/images/spreadsheet.png D +0 -158 plugins/staging/googledocs/loginwindow.cpp D +0 -61 plugins/staging/googledocs/loginwindow.h D +0 -103 plugins/staging/googledocs/onlinedocument.cpp D +0 -49 plugins/staging/googledocs/onlinedocument.h D +0 -9 plugins/staging/googledocs/onlineservices.qrc http://commits.kde.org/calligra/7834a2f80a1d0ba74e3926309a2ca1cae4227676 diff --git a/CalligraProducts.cmake b/CalligraProducts.cmake index d63f2f1..4174cd7 100644 --- a/CalligraProducts.cmake +++ b/CalligraProducts.cmake @@ -139,7 +139,6 @@ calligra_define_product(PLUGIN_SEMANTICITEMS "Semantic items plugins" REQUIRES calligra_define_product(PLUGIN_CALLIGRAGEMINI_GIT "Git support plugin for Calligra Gemini") # staging plugins -calligra_define_product(PLUGIN_GOOGLEDOCS "Plugin for integration with Google Docs" STAGING REQUIRES LIB_CALLIGRA) calligra_define_product(PLUGIN_THREEDSHAPE "3D shape plugin" STAGING REQUIRES LIB_CALLIGRA) # Sheets filters diff --git a/doc/stage/menus.docbook b/doc/stage/menus.docbook index 2044bbe..5695558 100644 --- a/doc/stage/menus.docbook +++ b/doc/stage/menus.docbook @@ -267,8 +267,6 @@ section <xref linkend="html-wizard"/>. </listitem> </varlistentry> -<!--FIXME Google Online Document item missing--> - <!-- <varlistentry> <term> diff --git a/plugins/staging/CMakeLists.txt b/plugins/staging/CMakeLists.txt index 16f36d7..6881c65 100644 --- a/plugins/staging/CMakeLists.txt +++ b/plugins/staging/CMakeLists.txt @@ -1,7 +1,3 @@ -if(SHOULD_BUILD_PLUGIN_GOOGLEDOCS) -# add_subdirectory(googledocs) -endif() - if (SHOULD_BUILD_PLUGIN_THREEDSHAPE) add_subdirectory(threedshape) endif () diff --git a/plugins/staging/googledocs/CMakeLists.txt b/plugins/staging/googledocs/CMakeLists.txt deleted file mode 100644 index 07a9569..0000000 --- a/plugins/staging/googledocs/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -include_directories( ${KOMAIN_INCLUDES} ${KOTEXT_INCLUDES} ) - -#find_package(Qt4 4.5.0 REQUIRED) -#INCLUDE(${QT_USE_FILE}) - -########### next target ############### - -set(onlinedocs_RCCS onlineservices.qrc) -qt4_add_resources(onlinedocs_RCC_SRCS ${onlinedocs_RCCS}) - -set(calligragoogledocs_PART_SRCS - onlinedocument.cpp - googlecontenthandler.cpp - googledocument.cpp - googledocumentlist.cpp - googledocumentservice.cpp - documentlistwindow.cpp - loginwindow.cpp - ${onlinedocs_RCC_SRCS} -) - -kde4_add_ui_files( calligragoogledocs_PART_SRCS - authenticationdialog.ui - documentlist.ui -) -kde4_add_plugin(calligragoogledocs ${calligragoogledocs_PART_SRCS}) - -target_link_libraries(calligragoogledocs ${QT_LIBRARIES} komain ) - -install(TARGETS calligragoogledocs DESTINATION ${PLUGIN_INSTALL_DIR}) - - -########### install files ############### - -install( FILES googledocs-stage.rc DESTINATION ${DATA_INSTALL_DIR}/stage/kpartplugins) -install( FILES googledocs-sheets.rc DESTINATION ${DATA_INSTALL_DIR}/sheets/kpartplugins) -install( FILES googledocs-words.rc DESTINATION ${DATA_INSTALL_DIR}/words/kpartplugins) - - diff --git a/plugins/staging/googledocs/Messages.sh b/plugins/staging/googledocs/Messages.sh deleted file mode 100755 index d6dd433..0000000 --- a/plugins/staging/googledocs/Messages.sh +++ /dev/null @@ -1,6 +0,0 @@ -#! /bin/sh -source ../../../calligra_xgettext.sh - -$EXTRACTRC *.rc *.ui >> rc.cpp -calligra_xgettext googledocs_plugin.pot *.cpp -rm -f rc.cpp diff --git a/plugins/staging/googledocs/authenticationdialog.ui b/plugins/staging/googledocs/authenticationdialog.ui deleted file mode 100644 index b1c1853..0000000 --- a/plugins/staging/googledocs/authenticationdialog.ui +++ /dev/null @@ -1,141 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>Dialog</class> - <widget class="QDialog" name="Dialog"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>449</width> - <height>175</height> - </rect> - </property> - <layout class="QGridLayout"> - <item row="4" column="0"> - <widget class="QLabel" name="usernameLabel"> - <property name="text"> - <string>Username:</string> - </property> - </widget> - </item> - <item row="0" column="0" colspan="3"> - <widget class="QLabel" name="headerLabel"> - <property name="text"> - <string>Provide Username and Password</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - <property name="wordWrap"> - <bool>false</bool> - </property> - <property name="textInteractionFlags"> - <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> - </property> - </widget> - </item> - <item row="4" column="2"> - <widget class="QLineEdit" name="userEdit"> - <property name="text"> - <string>@gmail.com</string> - </property> - </widget> - </item> - <item row="5" column="0"> - <widget class="QLabel" name="passwordLabel"> - <property name="text"> - <string>Password:</string> - </property> - </widget> - </item> - <item row="19" column="2"> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="loginButton"> - <property name="text"> - <string>Sign In</string> - </property> - </widget> - </item> - </layout> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="service"> - <property name="text"> - <string>Service</string> - </property> - </widget> - </item> - <item row="7" column="2"> - <widget class="QProgressBar" name="progressBar"> - <property name="maximum"> - <number>0</number> - </property> - <property name="value"> - <number>3282</number> - </property> - <property name="textVisible"> - <bool>true</bool> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="invertedAppearance"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QComboBox" name="comboBox"/> - </item> - <item row="5" column="2"> - <widget class="QLineEdit" name="passwordEdit"> - <property name="inputMask"> - <string/> - </property> - <property name="text"> - <string/> - </property> - <property name="echoMode"> - <enum>QLineEdit::Password</enum> - </property> - </widget> - </item> - <item row="19" column="0"> - <spacer> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - <item row="6" column="2"> - <widget class="QCheckBox" name="saveUserDetails"> - <property name="text"> - <string>Remember Me</string> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections/> -</ui> diff --git a/plugins/staging/googledocs/documentlist.ui b/plugins/staging/googledocs/documentlist.ui deleted file mode 100644 index 7354879..0000000 --- a/plugins/staging/googledocs/documentlist.ui +++ /dev/null @@ -1,80 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>ListDialog</class> - <widget class="QDialog" name="ListDialog"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>551</width> - <height>292</height> - </rect> - </property> - <property name="windowTitle"> - <string>Google Document List</string> - </property> - <widget class="QWidget" name="verticalLayoutWidget"> - <property name="geometry"> - <rect> - <x>1</x> - <y>1</y> - <width>551</width> - <height>291</height> - </rect> - </property> - <layout class="QVBoxLayout" name="verticalLayout"> - <property name="spacing"> - <number>6</number> - </property> - <item> - <widget class="QTreeView" name="listView"/> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QPushButton" name="okButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Download</string> - </property> - <property name="icon"> - <iconset resource="onlineservices.qrc"> - <normaloff>:/images/document-import.png</normaloff>:/images/document-import.png</iconset> - </property> - <property name="flat"> - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="closeButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Close</string> - </property> - <property name="icon"> - <iconset resource="onlineservices.qrc"> - <normaloff>:/images/dialog-cancel.png</normaloff>:/images/dialog-cancel.png</iconset> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> - </widget> - <resources> - <include location="onlineservices.qrc"/> - </resources> - <connections/> -</ui> diff --git a/plugins/staging/googledocs/documentlistwindow.cpp b/plugins/staging/googledocs/documentlistwindow.cpp deleted file mode 100644 index f72fbe1..0000000 --- a/plugins/staging/googledocs/documentlistwindow.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "documentlistwindow.h" - -#include <QList> -#include <QListWidgetItem> -#include <QDebug> - -#include "googledocumentservice.h" -#include "googledocumentlist.h" -#include "googledocument.h" - -DocumentListWindow::DocumentListWindow(GoogleDocumentService *service, GoogleDocumentList *gList) - : m_docListDialog(new Ui_ListDialog), - m_gService(service) -{ - m_docListDialog->setupUi(this); - connect(m_docListDialog->listView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(getClickedDocument(const QModelIndex &))); - connect(m_docListDialog->okButton, SIGNAL(clicked()), this, SLOT(fetchDocument())); - connect(m_docListDialog->closeButton, SIGNAL(clicked()), this, SLOT(hideDialog())); - - m_docListDialog->listView->setModel(gList->documentModel()); - m_docListDialog->listView->hideColumn(1); - m_docListDialog->listView->setItemsExpandable(false); - show(); - m_docListDialog->listView->setColumnWidth(0, m_docListDialog->listView->rect().width() * 0.75); -} - -DocumentListWindow::~DocumentListWindow() -{ - delete m_docListDialog; -} - -void DocumentListWindow::fetchDocument() -{ - int selectedRow = m_docListDialog->listView->currentIndex().row(); - qDebug() << m_docListDialog->listView->model()->index(selectedRow, 2).data(); - m_gService->downloadDocument(m_docListDialog->listView->model()->index(selectedRow, 1).data().toString(), - m_docListDialog->listView->model()->index(selectedRow, 2).data().toString()); - m_docListDialog->okButton->setEnabled(false); -} - -void DocumentListWindow::getClickedDocument( const QModelIndex & index) -{ - Q_UNUSED(index); -} - -QString DocumentListWindow::currentDocument() -{ - int selectedRow = m_docListDialog->listView->currentIndex().row(); - QString name = m_docListDialog->listView->model()->index(selectedRow, 0).data().toString(); - QString type = m_docListDialog->listView->model()->index(selectedRow, 2).data().toString(); - QString ext; - - if (QString::compare(type, "document", Qt::CaseInsensitive) == 0 ) { - ext = ".odt"; - } else if (QString::compare(type, "spreadsheet", Qt::CaseInsensitive) == 0 ) { - ext = ".ods"; - } else if (QString::compare(type, "presentation", Qt::CaseInsensitive) == 0 ) { - ext = ".ppt"; - } - - return (name + ext); -} - -void DocumentListWindow::hideDialog() -{ - m_docListDialog->okButton->setEnabled(true); - hide(); -} diff --git a/plugins/staging/googledocs/documentlistwindow.h b/plugins/staging/googledocs/documentlistwindow.h deleted file mode 100644 index 149598d..0000000 --- a/plugins/staging/googledocs/documentlistwindow.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef DOCUMENTLISTWINDOW_H -#define DOCUMENTLISTWINDOW_H - -#include <QDialog> - -#include "ui_documentlist.h" - -class GoogleDocumentService; -class GoogleDocument; -class GoogleDocumentList; - -class DocumentListWindow : public QDialog -{ - Q_OBJECT - -public: - DocumentListWindow(GoogleDocumentService *service, GoogleDocumentList *gList); - ~DocumentListWindow(); - QString currentDocument(); - -public Q_SLOTS: - void hideDialog(); - -private Q_SLOTS: - void getClickedDocument(const QModelIndex & index); - void fetchDocument(); - -private: - Ui_ListDialog *m_docListDialog; - GoogleDocumentService *m_gService; -}; - -#endif // DOCUMENTLISTWINDOW_H diff --git a/plugins/staging/googledocs/googlecontenthandler.cpp b/plugins/staging/googledocs/googlecontenthandler.cpp deleted file mode 100644 index fe27cdf..0000000 --- a/plugins/staging/googledocs/googlecontenthandler.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -#include "googledocumentlist.h" -#include "googledocument.h" -#include "googlecontenthandler.h" -#include <QDebug> - -GoogleContentHandler::GoogleContentHandler() - : m_docList(0), - m_docEntry(0) -{ - m_docList = new GoogleDocumentList(); -} - -GoogleContentHandler::~GoogleContentHandler() -{ - delete m_docList; -} - -bool GoogleContentHandler::characters ( const QString & ch ) -{ - if (!insideEntry) { - if (QString::compare(m_nodeStack.top(), "title", Qt::CaseInsensitive) == 0) { - if (m_nodeStack.count() == 2) - m_docList->setTitle(ch); - } - else if (QString::compare(m_nodeStack.top(), "name", Qt::CaseInsensitive) == 0) { - if (m_nodeStack.count() == 3) - m_docList->setAuthor(ch); - } - else if (QString::compare(m_nodeStack.top(), "email", Qt::CaseInsensitive) == 0) { - if (m_nodeStack.count() == 3) - m_docList->setEmail(ch); - } - } - else - { - if (m_docEntry == 0) - return true; - - if (QString::compare(m_nodeStack.top(), "title", Qt::CaseInsensitive) == 0) { - m_docEntry->setTitle(ch); - } - else if (QString::compare(m_nodeStack.top(), "name", Qt::CaseInsensitive) == 0) { - m_docEntry->setAuthor(ch); - } - else if (QString::compare(m_nodeStack.top(), "resourceId", Qt::CaseInsensitive) == 0) { - m_docEntry->setId(ch); - } - } - return true; -} - -bool GoogleContentHandler::endDocument () -{ -// qDebug() << "GoogleContentHandler::endDocument()"; - return true; -} - -bool GoogleContentHandler::endElement ( const QString & /*namespaceURI*/, const QString & /*localName*/, const QString & /*qName */) -{ -// printName(localName); - QString element = m_nodeStack.pop(); - if (QString::compare(element, "entry") == 0) { - insideEntry = false; - m_docList->append(m_docEntry); - m_docEntry = 0; - } - return true; -} - -bool GoogleContentHandler::endPrefixMapping ( const QString & /*prefix */) -{ - return true; -} - -QString GoogleContentHandler::errorString () const -{ - return QString(); -} - -bool GoogleContentHandler::ignorableWhitespace ( const QString & /*ch */) -{ - return true; -} - -bool GoogleContentHandler::processingInstruction ( const QString & /*target*/, const QString & /*data */) -{ - return true; -} - -void GoogleContentHandler::setDocumentLocator ( QXmlLocator * /*locator*/ ) -{ -} - -bool GoogleContentHandler::skippedEntity ( const QString & /*name*/ ) -{ - return true; -} - -bool GoogleContentHandler::startDocument () -{ - return true; -} - -bool GoogleContentHandler::startElement ( const QString & /*namespaceURI*/, const QString & localName, - const QString & /*qName*/, const QXmlAttributes & atts ) -{ - m_nodeStack.push(localName); - - if ((m_nodeStack.count() == 1) && (m_docList != 0)) { //Feed element - m_docList->setEtag(atts.value("gd:etag")); - } - - if (QString::compare(localName, "entry", Qt::CaseInsensitive) == 0 ) { - m_docEntry = new GoogleDocument(); - m_docEntry->setEtag(atts.value("gd:etag")); - insideEntry = true; - } - if ( insideEntry && (m_docEntry != 0)) { - if (QString::compare(localName, "content", Qt::CaseInsensitive) == 0 ) { - m_docEntry->setDocumentUrl(atts.value("src")); - } else if ((QString::compare(localName, "category", Qt::CaseInsensitive) == 0 ) && - QString::compare(atts.value("scheme"), "http://schemas.google.com/g/2005#kind", Qt::CaseInsensitive) == 0){ - m_docEntry->setDocumentType(atts.value("label")); - } - } - -// printName(localName); - return true; -} - -bool GoogleContentHandler::startPrefixMapping ( const QString & /*prefix*/, const QString & /*uri */) -{ - //qDebug() << "GoogleContentHandler::startPrefixMapping() " << prefix << uri; - return true; -} - -void GoogleContentHandler::printName(const QString & name) -{ - int count = m_nodeStack.count(); - QString indent; - for (int i=0; i < count; i++) - indent.append("\t"); - indent.append(name); - - if (insideEntry) - qDebug() << indent; -} diff --git a/plugins/staging/googledocs/googlecontenthandler.h b/plugins/staging/googledocs/googlecontenthandler.h deleted file mode 100644 index 6bcce67..0000000 --- a/plugins/staging/googledocs/googlecontenthandler.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef GOOGLECONTENTHANDLER_H -#define GOOGLECONTENTHANDLER_H - -#include <QXmlContentHandler> -#include <QStack> - -class GoogleDocumentList; -class GoogleDocument; - -class GoogleContentHandler : public QXmlContentHandler -{ -public: - GoogleContentHandler(); - virtual ~GoogleContentHandler(); - - virtual bool characters ( const QString & ch ); - virtual bool endDocument (); - virtual bool endElement ( const QString & namespaceURI, const QString & localName, const QString & qName ); - virtual bool endPrefixMapping ( const QString & prefix ); - virtual QString errorString () const; - virtual bool ignorableWhitespace ( const QString & ch ); - virtual bool processingInstruction ( const QString & target, const QString & data ); - virtual void setDocumentLocator ( QXmlLocator * locator ); - virtual bool skippedEntity ( const QString & name ); - virtual bool startDocument (); - virtual bool startElement ( const QString & namespaceURI, const QString & localName, const QString & qName, const QXmlAttributes & atts ); - virtual bool startPrefixMapping ( const QString & prefix, const QString & uri ); - - GoogleDocumentList *documentList() { return m_docList; } - -private: - QStack<QString> m_nodeStack; - bool insideEntry; - GoogleDocumentList *m_docList; - GoogleDocument *m_docEntry; - - void printName(const QString & name); -}; - -#endif // GOOGLECONTENTHANDLER_H diff --git a/plugins/staging/googledocs/googledocs-sheets.rc b/plugins/staging/googledocs/googledocs-sheets.rc deleted file mode 100644 index 209c84a..0000000 --- a/plugins/staging/googledocs/googledocs-sheets.rc +++ /dev/null @@ -1,9 +0,0 @@ -<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui library="calligragoogledocs" version="1"> -<MenuBar> - <Menu name="file"><text>&File</text> - <Separator/> - <Action name="google_docs"/> - </Menu> -</MenuBar> -</kpartgui> diff --git a/plugins/staging/googledocs/googledocs-stage.rc b/plugins/staging/googledocs/googledocs-stage.rc deleted file mode 100644 index 209c84a..0000000 --- a/plugins/staging/googledocs/googledocs-stage.rc +++ /dev/null @@ -1,9 +0,0 @@ -<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui library="calligragoogledocs" version="1"> -<MenuBar> - <Menu name="file"><text>&File</text> - <Separator/> - <Action name="google_docs"/> - </Menu> -</MenuBar> -</kpartgui> diff --git a/plugins/staging/googledocs/googledocs-words.rc b/plugins/staging/googledocs/googledocs-words.rc deleted file mode 100644 index 209c84a..0000000 --- a/plugins/staging/googledocs/googledocs-words.rc +++ /dev/null @@ -1,9 +0,0 @@ -<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> -<kpartgui library="calligragoogledocs" version="1"> -<MenuBar> - <Menu name="file"><text>&File</text> - <Separator/> - <Action name="google_docs"/> - </Menu> -</MenuBar> -</kpartgui> diff --git a/plugins/staging/googledocs/googledocument.cpp b/plugins/staging/googledocs/googledocument.cpp deleted file mode 100644 index 6b0bc42..0000000 --- a/plugins/staging/googledocs/googledocument.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "googledocument.h" - -GoogleDocument::GoogleDocument() -{ -} - -void GoogleDocument::setEtag(const QString & etag) -{ - m_etag = etag; -} - -QString GoogleDocument::etag () const -{ - return m_etag; -} - -void GoogleDocument::setId (const QString & id) -{ - m_id = id; - - setDocumentType(id.left(id.indexOf(':'))); -} - -QString GoogleDocument::id () const -{ - return m_id; -} - -void GoogleDocument::setTitle (const QString & title) -{ - m_title = title; -} - -QString GoogleDocument::title () const -{ - return m_title; -} - -void GoogleDocument::setAuthor (const QString & author) -{ - m_author = author; -} - -QString GoogleDocument::author () const -{ - return m_author; -} - -void GoogleDocument::setDocumentType (const QString & docType) -{ - m_docType = docType; -} - -QString GoogleDocument::documentType () const -{ - return m_docType; -} - -void GoogleDocument::setDocumentUrl (const QString & url) -{ - m_documetUrl = url; -} - -QString GoogleDocument::documentUrl () const -{ - return m_documetUrl; -} - diff --git a/plugins/staging/googledocs/googledocument.h b/plugins/staging/googledocs/googledocument.h deleted file mode 100644 index 88b4aaa..0000000 --- a/plugins/staging/googledocs/googledocument.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef GOOGLEDOCUMENT_H -#define GOOGLEDOCUMENT_H - -#include <QObject> - -class GoogleDocument : public QObject -{ - Q_OBJECT - -public: - GoogleDocument(); - - void setEtag(const QString & etag); - QString etag () const; - - void setId (const QString & id); - QString id () const; - - void setTitle (const QString & title); - QString title () const; - - void setAuthor (const QString & author); - QString author () const; - - void setDocumentType (const QString & docType); - QString documentType () const; - - void setDocumentUrl (const QString & url); - QString documentUrl () const; - -private: - QString m_etag; - QString m_id; - QString m_title; - QString m_author; - QString m_docType; - QString m_documetUrl; -}; - -#endif // GOOGLEDOCUMENT_H diff --git a/plugins/staging/googledocs/googledocumentlist.cpp b/plugins/staging/googledocs/googledocumentlist.cpp deleted file mode 100644 index 40b7ece..0000000 --- a/plugins/staging/googledocs/googledocumentlist.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "googledocumentlist.h" -#include "googledocument.h" - -GoogleDocumentList::GoogleDocumentList() -{ - docModel = new QStandardItemModel(0, 3); - docModel->setHeaderData(0, Qt::Horizontal, "FileName"); - docModel->setHeaderData(2, Qt::Horizontal, "Type"); -} - -void GoogleDocumentList::setEtag(const QString &etag) -{ - m_etag = etag; -} - -QString GoogleDocumentList::etag () -{ - return m_etag; -} - -void GoogleDocumentList::setEmail (const QString &email) -{ - m_email = email; -} - -QString GoogleDocumentList::email () -{ - return m_email; -} - -void GoogleDocumentList::setTitle (const QString &title) -{ - m_title = title; -} - -QString GoogleDocumentList::title () -{ - return m_title; -} - -void GoogleDocumentList::setAuthor (const QString &author) -{ - m_author = author; -} - -QString GoogleDocumentList::author () -{ - return m_author; -} - -void GoogleDocumentList::append(GoogleDocument *entry) -{ - if (entry != 0 ) { - QString iconPath; - if (QString::compare(entry->documentType(), "document", Qt::CaseInsensitive) == 0) { - iconPath = ":/images/document.png"; - } else if (QString::compare(entry->documentType(), "spreadsheet", Qt::CaseInsensitive) == 0) { - iconPath = ":/images/spreadsheet.png"; - } else if (QString::compare(entry->documentType(), "presentation", Qt::CaseInsensitive) == 0) { - iconPath = ":/images/presentation.png"; - } else { - delete entry; - return; - } - - int rows = docModel->rowCount(); - docModel->insertRows(rows, 1, QModelIndex()); - docModel->setData(docModel->index(rows, 0, QModelIndex()), entry->title()); - docModel->setData(docModel->index(rows, 0, QModelIndex()), - QPixmap(iconPath), - Qt::DecorationRole); - docModel->setData(docModel->index(rows, 1, QModelIndex()), entry->documentUrl()); - docModel->setData(docModel->index(rows, 2, QModelIndex()), entry->documentType().toUpper()); - } -} - -int GoogleDocumentList::documentsCount() -{ - return docModel->rowCount(); -} diff --git a/plugins/staging/googledocs/googledocumentlist.h b/plugins/staging/googledocs/googledocumentlist.h deleted file mode 100644 index a929914..0000000 --- a/plugins/staging/googledocs/googledocumentlist.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef GOOGLEDOCUMENTLIST_H -#define GOOGLEDOCUMENTLIST_H - -#include <QObject> -#include <QList> -#include <QStandardItemModel> - -class GoogleDocument; - -class GoogleDocumentList : public QObject -{ - Q_OBJECT - -public: - GoogleDocumentList(); - - void setEtag(const QString &etag); - QString etag (); - - void setEmail (const QString &email); - QString email (); - - void setTitle (const QString &title); - QString title (); - - void setAuthor (const QString &author); - QString author (); - - void append(GoogleDocument *entry); - int documentsCount(); - - QList<GoogleDocument *> entries (); - - QStandardItemModel * documentModel() { return docModel; } - -private: - QString m_author; - QString m_email; - QString m_title; - QString m_etag; - - QList <GoogleDocument *>m_entries; - - QStandardItemModel *docModel; -}; - -#endif // GOOGLEDOCUMENTLIST_H diff --git a/plugins/staging/googledocs/googledocumentservice.cpp b/plugins/staging/googledocs/googledocumentservice.cpp deleted file mode 100644 index e8d377a..0000000 --- a/plugins/staging/googledocs/googledocumentservice.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include <QMessageBox> - -#include "googledocumentservice.h" -#include "googledocumentlist.h" -#include "googledocument.h" -#include "googlecontenthandler.h" - -#include <QDir> -#include <QDebug> -#include <QNetworkRequest> -#include <QNetworkProxy> -#include <QNetworkReply> -#include <QTimer> - -GoogleDocumentService::GoogleDocumentService(OnlineDocument::DocumentType type) - : newInformation(true) - , waitingForDoc(false) - , haveDocAuthToken(false) - , documentList(0) - , loggedin(false) - , m_type(type) -{ - //QNetworkProxy::setApplicationProxy(QNetworkProxy(QNetworkProxy::HttpProxy, "proxy.jf.intel.com", 911)); - connect(&networkManager, SIGNAL(finished(QNetworkReply*)), - this, SLOT(handleNetworkData(QNetworkReply*))); - - gHandler = new GoogleContentHandler(); - xmlReader.setContentHandler(gHandler); -} - -GoogleDocumentService::~GoogleDocumentService() -{ - delete documentList; - documentList = 0; - - delete gHandler; - gHandler = 0; -} - -void GoogleDocumentService::clientLogin(const QString & username, const QString & password) -{ - QByteArray data; - data.append(QString("accountType=HOSTED_OR_GOOGLE&Email=" + username + "&Passwd=" + password).toUtf8()); - - if(!haveDocAuthToken) { - data.append(QString("&service=writely&source=Calligrav2").toUtf8()); - this->username = username; - this->password = password; - } else { - data.append(QString("&service=wise&source=Calligrav2").toUtf8()); - } - - QNetworkRequest req(QUrl("https://www.google.com/accounts/ClientLogin")); - req.setRawHeader("Host", "www.google.com"); - req.setRawHeader("GData-Version", "3.0"); - req.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); - req.setHeader(QNetworkRequest::ContentLengthHeader, data.length()); - - networkManager.post(req, data); -} - -void GoogleDocumentService::listDocuments() -{ - authToken = docAuthToken; - QString url; - switch (m_type) { - case OnlineDocument::WORDS: - url = "https://docs.google.com/feeds/default/private/full/-/document"; - break; - case OnlineDocument::STAGE: - url = "https://docs.google.com/feeds/default/private/full/-/presentation"; - break; - case OnlineDocument::SHEETS: - url = "https://docs.google.com/feeds/default/private/full/-/spreadsheet"; - break; - } - - QNetworkRequest requestHeader(QUrl(url.toUtf8())); - requestHeader.setRawHeader("Host", "docs.google.com"); - requestHeader.setRawHeader("User-Agent", "Calligra"); - requestHeader.setRawHeader("GData-Version", "3.0"); - requestHeader.setRawHeader("Content-Type", "application/atom+xml"); - requestHeader.setRawHeader("Authorization", authToken.toUtf8()); - - networkManager.get(requestHeader); - emit progressUpdate("Successfully authenticated!!! Retreiving document list..."); -} - -void GoogleDocumentService::handleNetworkData(QNetworkReply *networkReply) -{ - if (!networkReply->error()) { - if (!loggedin) { - QString text(networkReply->readAll()); - text = text.right(text.length() - text.indexOf("Auth=") - 5); - authToken = QString("GoogleLogin auth=") + text.left(text.indexOf('\n')); - if(authToken.length() > 20) { - if(!haveDocAuthToken) { - docAuthToken = authToken; - haveDocAuthToken = true; - qDebug() << "Received Doc token = " << docAuthToken; - clientLogin(this->username, this->password); - return; - } - spreadAuthToken = authToken; - authToken.clear(); - loggedin = true; - qDebug() << "Received Spreadsheet token = " << spreadAuthToken; - listDocuments(); - emit userAuthenticated(loggedin, ""); - } - } - else if (waitingForDoc) { - QByteArray data = networkReply->readAll(); - QFile file(QDir::tempPath() + QLatin1Char('/') + documentList->currentDocument()); - file.open(QIODevice::ReadWrite); - file.write(data); - file.close(); - qDebug() << "Received Document!!!!! " << file.fileName(); - emit receivedDocument(file.fileName()); - waitingForDoc = false; - showDocumentListWindow(false); - } - else { - QByteArray bytAry = networkReply->readAll(); -// qDebug() << bytAry; - -// xmlInput.setData(networkReply->readAll()); - xmlInput.setData(bytAry); - qDebug() << "Part received........."; - if (newInformation) { - emit progressUpdate("Parsing document list..."); - newInformation = xmlReader.parse(&xmlInput, true); - qDebug() << "New Information = " << newInformation; -// newInformation = false; - getDocument(); - } - } - } else { - QString errorString(networkReply->readAll()); - qDebug() << "Error occurred !!!! " << errorString; - errorString = errorString.right(errorString.length() - errorString.indexOf("Error=") - 6); - if (!loggedin) { - emit userAuthenticated(loggedin, errorString); - } else { - QMessageBox msgBox(QMessageBox::Information, i18n("Online Document Services"), - "Error occurred !!!! " + errorString); - msgBox.exec(); - } - } -} - -void GoogleDocumentService::getDocument() -{ - if(gHandler->documentList()->documentsCount() > 0) { - emit showingDocumentList(); - documentList = new DocumentListWindow(this, gHandler->documentList()); - } - else { - QMessageBox msgBox(QMessageBox::Information, i18n("Online Document Services"), i18n("No Documents Found !!!")); - msgBox.exec(); - } -} - -void GoogleDocumentService::downloadDocument(const QString & _url, const QString & _type) -{ - authToken = docAuthToken; - QString url = _url; - QString type = _type; - url.replace("docId", "docID", Qt::CaseInsensitive); - QString exportFormat; - - if(QString::compare(type, "spreadsheet", Qt::CaseInsensitive) == 0) { - exportFormat = "&exportFormat=ods&format=ods"; - authToken = spreadAuthToken; - } else if(QString::compare(type, "presentation", Qt::CaseInsensitive) == 0) { - exportFormat = "&exportFormat=ppt&format=ppt"; - } - else if(QString::compare(type, "document", Qt::CaseInsensitive) == 0) { - exportFormat = "&exportFormat=odt&format=odt"; - } - - qDebug() << "URL = " << url + exportFormat; - QUrl documentUrl(url + exportFormat); - - QNetworkRequest requestHeader(documentUrl); - requestHeader.setRawHeader("User-Agent", "Calligra"); - requestHeader.setRawHeader("GData-Version", "3.0"); - requestHeader.setRawHeader("Authorization", authToken.toUtf8()); - - QList<QByteArray> headerlist = requestHeader.rawHeaderList(); - foreach (const QByteArray &element, headerlist) - qDebug() << element << requestHeader.rawHeader(element); - - networkManager.get(requestHeader); - - waitingForDoc = true; - -} - -void GoogleDocumentService::showDocumentListWindow(bool visible) -{ - if (visible) { - if (documentList) - documentList->show(); - } else { - documentList->hideDialog(); - } -} diff --git a/plugins/staging/googledocs/googledocumentservice.h b/plugins/staging/googledocs/googledocumentservice.h deleted file mode 100644 index db1f918..0000000 --- a/plugins/staging/googledocs/googledocumentservice.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef GOOGLEDOCUMENTSERVICE_H -#define GOOGLEDOCUMENTSERVICE_H - -#include <QObject> -#include <QXmlInputSource> -#include <QNetworkAccessManager> - -#include "onlinedocument.h" -#include "documentlistwindow.h" - -class GoogleDocument; -class GoogleContentHandler; -class DocumentListWindow; - -class GoogleDocumentService : public QObject -{ - Q_OBJECT - -public: - explicit GoogleDocumentService(OnlineDocument::DocumentType type); - virtual ~GoogleDocumentService(); - void clientLogin(const QString & username, const QString & password); - void getDocument(); - void downloadDocument (const QString & url, const QString & type); - bool alreadyAuthenticated() { return loggedin; } - void showDocumentListWindow(bool visible); - -Q_SIGNALS: - void receivedDocument(QString path); - void userAuthenticated(bool success, QString error); - void progressUpdate(const QString &msg); - void showingDocumentList(); - -private Q_SLOTS: - void handleNetworkData(QNetworkReply *networkReply); - -private: - void listDocuments(); - - QXmlSimpleReader xmlReader; - QXmlInputSource xmlInput; - bool newInformation; - bool waitingForDoc; - bool haveDocAuthToken; - GoogleContentHandler *gHandler; - QString authToken; - DocumentListWindow *documentList; - QString docAuthToken; - QString spreadAuthToken; - QString username; - QString password; - QNetworkAccessManager networkManager; - bool loggedin; - OnlineDocument::DocumentType m_type; -}; - -#endif // GOOGLEDOCUMENTSERVICE_H diff --git a/plugins/staging/googledocs/images/dialog-cancel.png b/plugins/staging/googledocs/images/dialog-cancel.png deleted file mode 100644 index edc89a8..0000000 Binary files a/plugins/staging/googledocs/images/dialog-cancel.png and /dev/null differ diff --git a/plugins/staging/googledocs/images/document-import.png b/plugins/staging/googledocs/images/document-import.png deleted file mode 100644 index 0453157..0000000 Binary files a/plugins/staging/googledocs/images/document-import.png and /dev/null differ diff --git a/plugins/staging/googledocs/images/document.png b/plugins/staging/googledocs/images/document.png deleted file mode 100644 index 8d7b377..0000000 Binary files a/plugins/staging/googledocs/images/document.png and /dev/null differ diff --git a/plugins/staging/googledocs/images/presentation.png b/plugins/staging/googledocs/images/presentation.png deleted file mode 100644 index d2a21d9..0000000 Binary files a/plugins/staging/googledocs/images/presentation.png and /dev/null differ diff --git a/plugins/staging/googledocs/images/spreadsheet.png b/plugins/staging/googledocs/images/spreadsheet.png deleted file mode 100644 index 9f8c807..0000000 Binary files a/plugins/staging/googledocs/images/spreadsheet.png and /dev/null differ diff --git a/plugins/staging/googledocs/loginwindow.cpp b/plugins/staging/googledocs/loginwindow.cpp deleted file mode 100644 index d1bf866..0000000 --- a/plugins/staging/googledocs/loginwindow.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "loginwindow.h" -#include "googledocumentservice.h" -#include "documentlistwindow.h" - -#include <KoGlobal.h> - -#include <kwallet.h> - -#include <QMessageBox> - - -LoginWindow::LoginWindow(OnlineDocument::DocumentType type, QWidget *parent) - : QDialog(parent), - m_type(type), - m_authDialog(new Ui_Dialog), - m_wallet(0) -{ - m_authDialog->setupUi(this); - - QStringList onlineServices; - onlineServices << "Google Documents"; - // Add services here - m_authDialog->comboBox->addItems(onlineServices); - - connect(m_authDialog->loginButton, SIGNAL(clicked()), this, SLOT(loginService())); - connect(m_authDialog->comboBox, SIGNAL(activated(int)), this, SLOT(serviceSelected(int))); - - const QString settingsGroup = "Google-Documents"; - KConfigGroup interface = KoGlobal::calligraConfig()->group(settingsGroup); - if (interface.exists()) { - QString userName = interface.readEntry("userEmailId", ""); - if (!userName.isEmpty()) { - m_authDialog->userEdit->setText(userName); - - QString password; - if (wallet()) { - wallet()->readPassword(QString("%1-%2").arg(settingsGroup).arg(userName), password); - } - - if (!password.isEmpty()) { - m_authDialog->passwordEdit->setText(password); - } - } - } - - m_authDialog->userEdit->setFocus(); - showProgressIndicator(false); - setWindowTitle("Online Document Services"); - show(); -} - -LoginWindow::~LoginWindow() -{ - delete m_authDialog; - delete m_wallet; -} - -void LoginWindow::loginService() -{ - if (m_authDialog->saveUserDetails->isChecked()) { - saveUserDetails(); - } - - if (0 == m_authDialog->comboBox->currentIndex()) { - gdoc = new GoogleDocumentService(m_type); - showProgressIndicator(true); - m_authDialog->headerLabel->setText("Signing in..."); - gdoc->clientLogin(m_authDialog->userEdit->text(), m_authDialog->passwordEdit->text()); - connect(gdoc, SIGNAL(userAuthenticated(bool, QString)), this, SLOT(authenticated(bool, QString))); - connect(gdoc, SIGNAL(progressUpdate(QString)), this, SLOT(updateProgress(QString))); - connect(gdoc, SIGNAL(showingDocumentList()), this, SLOT(accept())); - } -} - -void LoginWindow::saveUserDetails() -{ - const QString settingsGroup = "Google-Documents"; - KConfigGroup interface = KoGlobal::calligraConfig()->group(settingsGroup); - interface.writeEntry("userEmailId", m_authDialog->userEdit->text()); - - if (wallet()) { - wallet()->writePassword(QString("%1-%2").arg(settingsGroup).arg(m_authDialog->userEdit->text()), - m_authDialog->passwordEdit->text()); - } -} - -void LoginWindow::serviceSelected(int index) -{ - Q_UNUSED(index); -// if (index == 0) { -// m_authDialog->documentBox->setVisible(true); -// m_authDialog->presentationBox->setVisible(true); -// m_authDialog->spreadsheetBox->setVisible(true); -// } else if (index == 1) { -// m_authDialog->documentBox->setVisible(false); -// m_authDialog->presentationBox->setVisible(true); -// m_authDialog->spreadsheetBox->setVisible(false); -// } -} - -void LoginWindow::authenticated(bool success, QString errorString) -{ - if (success) { -// showProgressIndicator(false); -// m_authDialog->label->setText("Successfully authenticated!!! Retreiving document list..."); -// accept(); - } else { - QString msg = "Error occurred while signing in "; - if (!errorString.isEmpty()) { - msg = msg + "- " + errorString; - } - m_authDialog->headerLabel->setText(msg); - showProgressIndicator(false); - } -} - -void LoginWindow::showProgressIndicator(bool visible) -{ - m_authDialog->progressBar->setVisible(visible); -} - -void LoginWindow::updateProgress(QString msg) -{ - m_authDialog->headerLabel->setText(msg); -} - -KWallet::Wallet *LoginWindow::wallet() -{ - if (!m_wallet) { - m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), winId()); - connect(m_wallet, SIGNAL(walletClosed()), this, SLOT(closeWallet())); - } - return m_wallet; -} - -void LoginWindow::closeWallet() -{ - delete m_wallet; - m_wallet = 0; -} diff --git a/plugins/staging/googledocs/loginwindow.h b/plugins/staging/googledocs/loginwindow.h deleted file mode 100644 index a96abbf..0000000 --- a/plugins/staging/googledocs/loginwindow.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef LOGINWINDOW_H -#define LOGINWINDOW_H - -#include <onlinedocument.h> - -#include <QDialog> - -#include "ui_authenticationdialog.h" - -class GoogleDocumentService; - -namespace KWallet { - class Wallet; -} - -class LoginWindow : public QDialog -{ - Q_OBJECT - -public: - explicit LoginWindow(OnlineDocument::DocumentType docType, QWidget *parent = 0); - ~LoginWindow(); - GoogleDocumentService * googleService() { return gdoc; } - void showProgressIndicator(bool visible); - -private Q_SLOTS: - void loginService(); - void serviceSelected(int index); - void authenticated(bool success, QString errorString); - void updateProgress(QString msg); - void closeWallet(); - -private: - OnlineDocument::DocumentType m_type; - Ui_Dialog *m_authDialog; - GoogleDocumentService *gdoc; - KWallet::Wallet *m_wallet; - - void saveUserDetails(); - KWallet::Wallet *wallet(); -}; - -#endif // LOGINWINDOW_H diff --git a/plugins/staging/googledocs/onlinedocument.cpp b/plugins/staging/googledocs/onlinedocument.cpp deleted file mode 100644 index d6d0872..0000000 --- a/plugins/staging/googledocs/onlinedocument.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * Copyright (c) 2012 Gopalakrishna Bhat A <gopalakbhat at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include <klocale.h> -#include <kactioncollection.h> -#include <kcomponentdata.h> -#include <kdebug.h> -#include <kurl.h> -#include <kpluginfactory.h> -#include <kcmdlineargs.h> -#include <kaboutdata.h> - -#include <KoView.h> -#include <KoDocument.h> -#include <KoMainWindow.h> -#include <KoDocumentEntry.h> - -#include "loginwindow.h" -#include "googledocumentservice.h" - -K_PLUGIN_FACTORY(OnlineDocumentFactory, registerPlugin<OnlineDocument>();) -K_EXPORT_PLUGIN(OnlineDocumentFactory("googledocs_plugin")) - -OnlineDocument::OnlineDocument(QObject *parent, const QVariantList &) - : KoParts::Plugin(parent) - , m_login(0) -{ - setComponentData(OnlineDocumentFactory::componentData()); - - KAction *action = new KAction(i18n("&Google Online Document..."), this); - actionCollection()->addAction("google_docs", action ); - connect(action, SIGNAL(triggered(bool)), SLOT(slotOnlineDocument())); - - const KAboutData *about = KCmdLineArgs::aboutData(); - m_type = OnlineDocument::UNKNOWN; // default - if (about) { - QString name = about->appName(); - - if (name.contains("words")) { - m_type = OnlineDocument::WORDS; - } else if (name.contains("stage")) { - m_type = OnlineDocument::STAGE; - } else if (name.contains("sheets")) { - m_type = OnlineDocument::SHEETS; - } - } -} - -OnlineDocument::~OnlineDocument() -{ - delete m_login; -} - -void OnlineDocument::slotOnlineDocument() -{ - if (!m_login) { - m_login = new LoginWindow(m_type); - if (QDialog::Accepted == m_login->exec()) { - connect(m_login->googleService(), SIGNAL(receivedDocument(QString)), this, - SLOT(receivedOnlineDocument(QString ))); - } else { - delete m_login; - m_login = 0; - } - } else { - GoogleDocumentService *service = m_login->googleService(); - if (service) { - service->showDocumentListWindow(true); - } else { - m_login->show(); - m_login->activateWindow(); - m_login->raise(); - } - } -} - -void OnlineDocument::receivedOnlineDocument(QString path) -{ - KoView *view = dynamic_cast<KoView *>(parent()); - if (!view) { - return; - } - KUrl url; - url.setPath(path); - view->shell()->openDocument(url); -} -#include <onlinedocument.moc> diff --git a/plugins/staging/googledocs/onlinedocument.h b/plugins/staging/googledocs/onlinedocument.h deleted file mode 100644 index bdf7666..0000000 --- a/plugins/staging/googledocs/onlinedocument.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2010 Mani Chandrasekar <maninc at gmail.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef ONLINEDOCUMENT_H -#define ONLINEDOCUMENT_H - -#include <plugin.h> - -class LoginWindow; - -class OnlineDocument : public KoParts::Plugin -{ - Q_OBJECT -public: - enum DocumentType { - WORDS, - STAGE, - SHEETS, - UNKNOWN - }; - - OnlineDocument(QObject *parent, const QVariantList &); - virtual ~OnlineDocument(); - -private Q_SLOTS: - void slotOnlineDocument(); - void receivedOnlineDocument(QString path); - -private: - LoginWindow *m_login; - DocumentType m_type; -}; - -#endif diff --git a/plugins/staging/googledocs/onlineservices.qrc b/plugins/staging/googledocs/onlineservices.qrc deleted file mode 100644 index 9c32924..0000000 --- a/plugins/staging/googledocs/onlineservices.qrc +++ /dev/null @@ -1,9 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>images/document.png</file> - <file>images/presentation.png</file> - <file>images/spreadsheet.png</file> - <file>images/dialog-cancel.png</file> - <file>images/document-import.png</file> - </qresource> -</RCC>
