Commit 0d0dd803 authored by Laurent Montel's avatar Laurent Montel 😁

Remove storageservice blocken for the moment and I will rewrite it in the future

parent 7d1a7c83
......@@ -32,8 +32,6 @@ set(blogilo_SRCS
composer/stylegetter.cpp
composer/bilbobrowser.cpp
storageservice/storageservicemanagersettingsjob.cpp
configurestorageservicewidget.cpp
)
......
......@@ -25,12 +25,6 @@
</entry>
</group>
<group name="Storage Service">
<entry name="DownloadDirectory" type="string">
<default></default>
</entry>
</group>
<group name="Editor">
<entry name="autosaveInterval" type="Int">
<default>5</default>
......
......@@ -21,15 +21,13 @@
#include "ui_settingsbase.h"
#include "ui_editorsettingsbase.h"
#include "configurestorageservicewidget.h"
#include "settings.h"
#include "blogsettings.h"
#include <KLocalizedString>
ConfigureDialog::ConfigureDialog(PimCommon::StorageServiceManager *storageManager, QWidget *parent, const QString &name, KConfigSkeleton *config)
ConfigureDialog::ConfigureDialog(QWidget *parent, const QString &name, KConfigSkeleton *config)
: KConfigDialog(parent, name, config),
mHasChanged(false)
{
......@@ -53,20 +51,14 @@ ConfigureDialog::ConfigureDialog(PimCommon::StorageServiceManager *storageManage
Ui::AdvancedSettingsBase ui_advancedsettings_base;
ui_advancedsettings_base.setupUi(advancedSettingsDlg);
mConfigStorageService = new ConfigureStorageServiceWidget(storageManager);
mConfigStorageService->setAttribute(Qt::WA_DeleteOnClose);
connect(mConfigStorageService, &ConfigureStorageServiceWidget::changed, this, &ConfigureDialog::slotStorageServiceChanged);
addPage(generalSettingsDlg, i18nc("Configure Page", "General"), QStringLiteral("configure"));
addPage(blogSettingsDlg, i18nc("Configure Page", "Blogs"), QStringLiteral("document-properties"));
addPage(editorSettingsDlg, i18nc("Configure Page", "Editor"), QStringLiteral("accessories-text-editor"));
addPage(advancedSettingsDlg, i18nc("Configure Page", "Advanced"), QStringLiteral("applications-utilities"));
addPage(mConfigStorageService, i18nc("Configure Page", "Storage Service"), QStringLiteral("applications-utilities"));
connect(this, &KConfigDialog::settingsChanged, this, &ConfigureDialog::configurationChanged);
connect(this, &ConfigureDialog::destroyed, this, &ConfigureDialog::dialogDestroyed);
connect(button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &ConfigureDialog::slotApplySettingsClicked);
connect(button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, &ConfigureDialog::slotDefaultClicked);
connect(button(QDialogButtonBox::Apply), &QPushButton::clicked, this, &ConfigureDialog::slotApplySettingsClicked);
setAttribute(Qt::WA_DeleteOnClose);
resize(Settings::configWindowSize());
......@@ -83,22 +75,8 @@ bool ConfigureDialog::hasChanged()
return (KConfigDialog::hasChanged() || mHasChanged);
}
void ConfigureDialog::slotStorageServiceChanged()
{
qCDebug(BLOGILO_LOG) << " void ConfigureDialog::slotStorageServiceChanged()";
mHasChanged = true;
Q_EMIT configurationChanged();
updateButtons();
}
void ConfigureDialog::slotDefaultClicked()
{
mConfigStorageService->doLoadFromGlobalSettings();
}
void ConfigureDialog::slotApplySettingsClicked()
{
mConfigStorageService->save();
mHasChanged = false;
updateButtons();
Q_EMIT configurationChanged();
......
......@@ -21,17 +21,12 @@
#include <KConfigDialog>
#include "bilboblog.h"
class KConfigSkeleton;
namespace PimCommon
{
class StorageServiceManager;
}
class ConfigureStorageServiceWidget;
class ConfigureDialog : public KConfigDialog
{
Q_OBJECT
public:
explicit ConfigureDialog(PimCommon::StorageServiceManager *storageManager, QWidget *parent, const QString &name, KConfigSkeleton *config);
explicit ConfigureDialog(QWidget *parent, const QString &name, KConfigSkeleton *config);
~ConfigureDialog();
Q_SIGNALS:
......@@ -46,10 +41,7 @@ protected:
private Q_SLOTS:
void slotApplySettingsClicked();
void slotDefaultClicked();
void slotStorageServiceChanged();
private:
ConfigureStorageServiceWidget *mConfigStorageService;
bool mHasChanged;
};
......
/*
Copyright (c) 2014-2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
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 "configurestorageservicewidget.h"
#include "settings.h"
#include "PimCommon/StorageServiceConfigureWidget"
#include "PimCommon/StorageServiceSettingsWidget"
#include "PimCommon/StorageServiceManager"
#include <KLocalizedString>
#include <KMessageBox>
#include <KUrlRequester>
#include <QUrl>
#include <QVBoxLayout>
#include <QProcess>
#include <QPushButton>
#include <QStandardPaths>
StorageServiceConfigureWidget::StorageServiceConfigureWidget(QWidget *parent)
: PimCommon::StorageServiceConfigureWidget(parent)
{
}
StorageServiceConfigureWidget::~StorageServiceConfigureWidget()
{
}
void StorageServiceConfigureWidget::loadSettings()
{
downloadFolder()->setUrl(QUrl::fromLocalFile(Settings::self()->downloadDirectory()));
}
void StorageServiceConfigureWidget::writeSettings()
{
Settings::self()->setDownloadDirectory(downloadFolder()->url().path());
Settings::self()->save();
}
ConfigureStorageServiceWidget::ConfigureStorageServiceWidget(PimCommon::StorageServiceManager *storageManager, QWidget *parent)
: QWidget(parent),
mStorageManager(storageManager)
{
QVBoxLayout *lay = new QVBoxLayout;
mStorageServiceConfigureWidget = new StorageServiceConfigureWidget;
connect(mStorageServiceConfigureWidget, &StorageServiceConfigureWidget::changed, this, &ConfigureStorageServiceWidget::changed);
lay->addWidget(mStorageServiceConfigureWidget);
QHBoxLayout *hbox = new QHBoxLayout;
mManageStorageService = new QPushButton(i18n("Manage Storage Service"));
hbox->addWidget(mManageStorageService);
hbox->addStretch();
lay->addLayout(hbox);
if (QStandardPaths::findExecutable(QStringLiteral("storageservicemanager")).isEmpty()) {
mManageStorageService->setEnabled(false);
} else {
connect(mManageStorageService, &QPushButton::clicked, this, &ConfigureStorageServiceWidget::slotManageStorageService);
}
setLayout(lay);
//TODO need to implement save/load from KDialogConfig
QList<PimCommon::StorageServiceAbstract::Capability> lst;
lst.append(PimCommon::StorageServiceAbstract::UploadFileCapability);
lst.append(PimCommon::StorageServiceAbstract::DownloadFileCapability);
mStorageServiceConfigureWidget->storageServiceSettingsWidget()->setListService(mStorageManager->listService(), lst);
doLoadFromGlobalSettings();
}
ConfigureStorageServiceWidget::~ConfigureStorageServiceWidget()
{
}
void ConfigureStorageServiceWidget::slotManageStorageService()
{
if (!QProcess::startDetached(QStringLiteral("storageservicemanager")))
KMessageBox::error(this, i18n("Could not start storage service manager; "
"please check your installation."),
i18n("KMail Error"));
}
void ConfigureStorageServiceWidget::save()
{
mStorageManager->setListService(mStorageServiceConfigureWidget->storageServiceSettingsWidget()->listService());
mStorageServiceConfigureWidget->writeSettings();
}
void ConfigureStorageServiceWidget::doLoadFromGlobalSettings()
{
mStorageServiceConfigureWidget->loadSettings();
}
/*
Copyright (c) 2014-2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
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 CONFIGURESTORAGESERVICEWIDGET_H
#define CONFIGURESTORAGESERVICEWIDGET_H
#include <QWidget>
#include "PimCommon/StorageServiceConfigureWidget"
class QPushButton;
class StorageServiceConfigureWidget : public PimCommon::StorageServiceConfigureWidget
{
Q_OBJECT
public:
explicit StorageServiceConfigureWidget(QWidget *parent = Q_NULLPTR);
~StorageServiceConfigureWidget();
void loadSettings() Q_DECL_OVERRIDE;
void writeSettings() Q_DECL_OVERRIDE;
};
namespace PimCommon
{
class StorageServiceManager;
}
class ConfigureStorageServiceWidget : public QWidget
{
Q_OBJECT
public:
explicit ConfigureStorageServiceWidget(PimCommon::StorageServiceManager *storageManager, QWidget *parent = Q_NULLPTR);
~ConfigureStorageServiceWidget();
void save();
void doLoadFromGlobalSettings();
Q_SIGNALS:
void changed();
private Q_SLOTS:
void slotManageStorageService();
private:
StorageServiceConfigureWidget *mStorageServiceConfigureWidget;
QPushButton *mManageStorageService;
PimCommon::StorageServiceManager *mStorageManager;
};
#endif // CONFIGURESTORAGESERVICEWIDGET_H
......@@ -36,17 +36,11 @@
#include "poststabwidget.h"
#include "uploadmediadialog.h"
#include "configuredialog.h"
#include "storageservice/storageservicemanagersettingsjob.h"
#include "ui_advancedsettingsbase.h"
#include "ui_settingsbase.h"
#include "ui_editorsettingsbase.h"
#include "PimCommon/StorageServiceManager"
#include "PimCommon/StorageServiceJobConfig"
#include "PimCommon/StorageServiceAbstract"
#include "PimCommon/StorageServiceProgressManager"
#include "Libkdepim/ProgressDialog"
#include "Libkdepim/StatusbarProgressWidget"
#include "Libkdepim/ProgressStatusBarWidget"
......@@ -85,7 +79,6 @@ MainWindow::MainWindow()
mCurrentBlogId(__currentBlogId)
{
setWindowTitle(i18n("Blogilo"));
initStorageService();
tabPosts = new PostsTabWidget(this);
setCentralWidget(tabPosts);
......@@ -142,22 +135,6 @@ MainWindow::~MainWindow()
void MainWindow::setupStatusBar()
{
KPIM::ProgressStatusBarWidget *progressStatusBarWidget = new KPIM::ProgressStatusBarWidget(statusBar(), this, PimCommon::StorageServiceProgressManager::progressTypeValue());
statusBar()->addPermanentWidget(progressStatusBarWidget->littleProgress(), 0);
statusBar()->show();
}
void MainWindow::initStorageService()
{
StorageServiceManagerSettingsJob *settingsJob = new StorageServiceManagerSettingsJob;
PimCommon::StorageServiceJobConfig *configJob = PimCommon::StorageServiceJobConfig::self();
configJob->registerConfigIf(settingsJob);
mStorageManager = new PimCommon::StorageServiceManager(this);
connect(mStorageManager, &PimCommon::StorageServiceManager::uploadFileDone, this, &MainWindow::slotUploadFileDone);
connect(mStorageManager, &PimCommon::StorageServiceManager::shareLinkDone, this, &MainWindow::slotUploadFileDone);
connect(mStorageManager, &PimCommon::StorageServiceManager::uploadFileFailed, this, &MainWindow::slotUploadFileFailed);
connect(mStorageManager, &PimCommon::StorageServiceManager::actionFailed, this, &MainWindow::slotActionFailed);
}
void MainWindow::slotUploadFileDone(const QString &serviceName, const QString &link)
......@@ -246,9 +223,6 @@ void MainWindow::setupActions()
actOpenBlog->setToolTip(i18n("Open current blog in browser"));
connect(actOpenBlog, &QAction::triggered, this, &MainWindow::slotOpenCurrentBlogInBrowser);
actionCollection()->addAction(QStringLiteral("upload_file"), mStorageManager->menuUploadServices(this));
actionCollection()->addAction(QStringLiteral("download_file"), mStorageManager->menuDownloadServices(this));
mStorageManager->setDefaultUploadFolder(Settings::self()->downloadDirectory());
}
void MainWindow::loadTempPosts()
......@@ -341,7 +315,7 @@ void MainWindow::optionsPreferences()
if (KConfigDialog::showDialog(QStringLiteral("settings"))) {
return;
}
ConfigureDialog *dialog = new ConfigureDialog(mStorageManager, this, QStringLiteral("settings"), Settings::self());
ConfigureDialog *dialog = new ConfigureDialog(this, QStringLiteral("settings"), Settings::self());
connect(dialog, &ConfigureDialog::blogAdded, this, &MainWindow::slotBlogAdded);
connect(dialog, &ConfigureDialog::blogEdited, this, &MainWindow::slotBlogEdited);
connect(dialog, &ConfigureDialog::blogRemoved, this, &MainWindow::slotBlogRemoved);
......@@ -355,7 +329,6 @@ void MainWindow::optionsPreferences()
void MainWindow::slotSettingsChanged()
{
setupSystemTray();
mStorageManager->setDefaultUploadFolder(Settings::self()->downloadDirectory());
}
void MainWindow::slotDialogDestroyed(QObject *win)
......
......@@ -45,12 +45,6 @@ Main window of blogilo...
@author Mehrdad Momeny <mehrdad.momeny@gmail.com>
@author Golnaz Nilieh <g382nilieh@gmail.com>
*/
namespace PimCommon
{
class StorageServiceManager;
}
class MainWindow : public KXmlGuiWindow
{
Q_OBJECT
......@@ -119,7 +113,6 @@ private:
void setupActions();
void setupSystemTray();
void writeConfigs();
void initStorageService();
void setupStatusBar();
/**
Create a new post entry,
......@@ -142,6 +135,5 @@ private:
int &mCurrentBlogId;
QToolButton *mCloseTabButton;
QToolButton *mNewTabButton;
PimCommon::StorageServiceManager *mStorageManager;
};
#endif
/*
Copyright (c) 2014-2016 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "storageservicemanagersettingsjob.h"
using namespace PimCommon;
StorageServiceManagerSettingsJob::StorageServiceManagerSettingsJob()
{
}
StorageServiceManagerSettingsJob::~StorageServiceManagerSettingsJob()
{
}
QString StorageServiceManagerSettingsJob::youSendItApiKey() const
{
//TODO customize it
return QStringLiteral("fnab8fkgwrka7v6zs2ycd34a");
}
QString StorageServiceManagerSettingsJob::dropboxOauthConsumerKey() const
{
//TODO customize it
return QStringLiteral("e40dvomckrm48ci");
}
QString StorageServiceManagerSettingsJob::dropboxOauthSignature() const
{
//TODO customize it
return QStringLiteral("0icikya464lny9g&");
}
QString StorageServiceManagerSettingsJob::boxClientId() const
{
//Blogilo id
return QStringLiteral("y7out38qqnbdmfsa099h00fmnzuhudgo");
}
QString StorageServiceManagerSettingsJob::boxClientSecret() const
{
//Blogilo secret
return QStringLiteral("wEN5qWmwkEE6nZHm3jUUKmRcy8blApDH");
}
QString StorageServiceManagerSettingsJob::hubicClientId() const
{
return QStringLiteral("api_hubic_zBKQ6UDUj2vDT7ciDsgjmXA78OVDnzJi");
}
QString StorageServiceManagerSettingsJob::hubicClientSecret() const
{
return QStringLiteral("pkChgk2sRrrCEoVHmYYCglEI9E2Y2833Te5Vn8n2J6qPdxLU6K8NPUvzo1mEhyzf");
}
QString StorageServiceManagerSettingsJob::dropboxRootPath() const
{
return QStringLiteral("dropbox");
}
QString StorageServiceManagerSettingsJob::oauth2RedirectUrl() const
{
return QStringLiteral("https://bugs.kde.org/");
}
QString StorageServiceManagerSettingsJob::hubicScope() const
{
return QStringLiteral("usage.r,account.r,credentials.r,links.wd");
}
QString StorageServiceManagerSettingsJob::gdriveClientId() const
{
return QStringLiteral("735222197981-mrcgtaqf05914buqjkts7mk79blsquas.apps.googleusercontent.com");
//return QStringLiteral("76182239499-2krm3lvlrqrj446loaqrrep594n3u2o8.apps.googleusercontent.com");
}
QString StorageServiceManagerSettingsJob::gdriveClientSecret() const
{
return QStringLiteral("4MJOS0u1-_AUEKJ0ObA-j22U");
//return QStringLiteral("7SinUSCxfbrJYN7az3VvxTJ9");
}
QString StorageServiceManagerSettingsJob::defaultUploadFolder() const
{
return QString();
}
/*
Copyright (c) 2014-2016 Montel Laurent <montel@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef STORAGESERVICEMANAGERSETTINGSJOB_H
#define STORAGESERVICEMANAGERSETTINGSJOB_H
#include <QObject>
#include "pimcommon/isettingsjob.h"
class StorageServiceManagerSettingsJob : public PimCommon::ISettingsJob
{
public:
StorageServiceManagerSettingsJob();
~StorageServiceManagerSettingsJob();
QString youSendItApiKey() const Q_DECL_OVERRIDE;
QString dropboxOauthConsumerKey() const Q_DECL_OVERRIDE;
QString dropboxOauthSignature() const Q_DECL_OVERRIDE;
QString boxClientId() const Q_DECL_OVERRIDE;
QString boxClientSecret() const Q_DECL_OVERRIDE;
QString hubicClientId() const Q_DECL_OVERRIDE;
QString hubicClientSecret() const Q_DECL_OVERRIDE;
QString dropboxRootPath() const Q_DECL_OVERRIDE;
QString oauth2RedirectUrl() const Q_DECL_OVERRIDE;
QString hubicScope() const Q_DECL_OVERRIDE;
QString gdriveClientId() const Q_DECL_OVERRIDE;
QString gdriveClientSecret() const Q_DECL_OVERRIDE;
QString defaultUploadFolder() const Q_DECL_OVERRIDE;
};
#endif // STORAGESERVICEMANAGERSETTINGSJOB_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment