Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KDE Pim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Unmaintained
KDE Pim
Commits
1306400d
Commit
1306400d
authored
Jan 29, 2014
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add storage service to blogilo
parent
a26aaadb
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
195 additions
and
8 deletions
+195
-8
blogilo/src/CMakeLists.txt
blogilo/src/CMakeLists.txt
+1
-0
blogilo/src/blogiloui.rc
blogilo/src/blogiloui.rc
+5
-1
blogilo/src/configuredialog.cpp
blogilo/src/configuredialog.cpp
+7
-0
blogilo/src/configuredialog.h
blogilo/src/configuredialog.h
+4
-1
blogilo/src/configurestorageservicewidget.cpp
blogilo/src/configurestorageservicewidget.cpp
+72
-0
blogilo/src/configurestorageservicewidget.h
blogilo/src/configurestorageservicewidget.h
+47
-0
blogilo/src/mainwindow.cpp
blogilo/src/mainwindow.cpp
+22
-2
blogilo/src/mainwindow.h
blogilo/src/mainwindow.h
+3
-0
pimcommon/storageservice/dialog/storageservicedownloaddialog.cpp
...on/storageservice/dialog/storageservicedownloaddialog.cpp
+3
-0
pimcommon/storageservice/storageservicemanager.cpp
pimcommon/storageservice/storageservicemanager.cpp
+29
-2
pimcommon/storageservice/storageservicemanager.h
pimcommon/storageservice/storageservicemanager.h
+2
-2
No files found.
blogilo/src/CMakeLists.txt
View file @
1306400d
...
...
@@ -33,6 +33,7 @@ set(blogilo_SRCS
composer/bilbobrowser.cpp
composer/blogilocomposerwidget.cpp
storageservice/storageservicemanagersettingsjob.cpp
configurestorageservicewidget.cpp
)
...
...
blogilo/src/blogiloui.rc
View file @
1306400d
<?xml version="1.0"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui
name=
"blogilo"
version=
"1
0
"
>
<kpartgui
name=
"blogilo"
version=
"1
1
"
>
<MenuBar>
<Menu
name=
"blog"
><text>
Blog
</text>
<Action
name=
"add_blog"
/>
...
...
@@ -11,6 +11,10 @@
<Action
name=
"save_locally"
/>
<Action
name=
"publish_post"
/>
</Menu>
<Menu
name=
"storageservice"
><text>
Import Export File
</text>
<Action
name=
"upload_file"
/>
<Action
name=
"download_file"
/>
</Menu>
<Menu
name=
"settings"
><text>
Settings
</text>
<Action
name=
"toggle_toolbox"
/>
</Menu>
...
...
blogilo/src/configuredialog.cpp
View file @
1306400d
...
...
@@ -21,6 +21,8 @@
#include "ui_settingsbase.h"
#include "ui_editorsettingsbase.h"
#include "configurestorageservicewidget.h"
#include "settings.h"
#include "blogsettings.h"
...
...
@@ -53,10 +55,15 @@ ConfigureDialog::ConfigureDialog(QWidget *parent, const QString& name, KConfigSk
Ui
::
AdvancedSettingsBase
ui_advancedsettings_base
;
ui_advancedsettings_base
.
setupUi
(
advancedSettingsDlg
);
mConfigStorageService
=
new
ConfigureStorageServiceWidget
;
mConfigStorageService
->
setAttribute
(
Qt
::
WA_DeleteOnClose
);
addPage
(
generalSettingsDlg
,
i18nc
(
"Configure Page"
,
"General"
),
QLatin1String
(
"configure"
)
);
addPage
(
blogSettingsDlg
,
i18nc
(
"Configure Page"
,
"Blogs"
),
QLatin1String
(
"document-properties"
));
addPage
(
editorSettingsDlg
,
i18nc
(
"Configure Page"
,
"Editor"
),
QLatin1String
(
"accessories-text-editor"
));
addPage
(
advancedSettingsDlg
,
i18nc
(
"Configure Page"
,
"Advanced"
),
QLatin1String
(
"applications-utilities"
));
addPage
(
mConfigStorageService
,
i18nc
(
"Configure Page"
,
"Storage Service"
),
QLatin1String
(
"applications-utilities"
));
connect
(
this
,
SIGNAL
(
settingsChanged
(
QString
)),
this
,
SIGNAL
(
settingsChanged
())
);
connect
(
this
,
SIGNAL
(
destroyed
(
QObject
*
)),
this
,
SIGNAL
(
dialogDestroyed
(
QObject
*
)));
setAttribute
(
Qt
::
WA_DeleteOnClose
);
...
...
blogilo/src/configuredialog.h
View file @
1306400d
...
...
@@ -20,7 +20,7 @@
#include <KConfigDialog>
#include "bilboblog.h"
class
ConfigureStorageServiceWidget
;
class
ConfigureDialog
:
public
KConfigDialog
{
Q_OBJECT
...
...
@@ -34,6 +34,9 @@ Q_SIGNALS:
void
blogEdited
(
const
BilboBlog
&
);
void
dialogDestroyed
(
QObject
*
);
void
settingsChanged
();
private:
ConfigureStorageServiceWidget
*
mConfigStorageService
;
};
#endif // CONFIGUREDIALOG_H
blogilo/src/configurestorageservicewidget.cpp
0 → 100644
View file @
1306400d
/*
Copyright (c) 2014 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 "pimcommon/storageservice/settings/storageservicesettingswidget.h"
#include <KLocalizedString>
#include <KStandardDirs>
#include <KMessageBox>
#include <QVBoxLayout>
#include <QProcess>
#include <QPushButton>
ConfigureStorageServiceWidget
::
ConfigureStorageServiceWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
{
QVBoxLayout
*
lay
=
new
QVBoxLayout
;
mStorageServiceWidget
=
new
PimCommon
::
StorageServiceSettingsWidget
;
connect
(
mStorageServiceWidget
,
SIGNAL
(
changed
()),
this
,
SIGNAL
(
changed
()));
lay
->
addWidget
(
mStorageServiceWidget
);
QHBoxLayout
*
hbox
=
new
QHBoxLayout
;
mManageStorageService
=
new
QPushButton
(
i18n
(
"Manage Storage Service"
));
hbox
->
addWidget
(
mManageStorageService
);
hbox
->
addStretch
();
lay
->
addLayout
(
hbox
);
if
(
KStandardDirs
::
findExe
(
QLatin1String
(
"storageservicemanager"
)).
isEmpty
())
{
mManageStorageService
->
setEnabled
(
false
);
}
else
{
connect
(
mManageStorageService
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
slotManageStorageService
()));
}
setLayout
(
lay
);
}
ConfigureStorageServiceWidget
::~
ConfigureStorageServiceWidget
()
{
}
void
ConfigureStorageServiceWidget
::
slotManageStorageService
()
{
if
(
!
QProcess
::
startDetached
(
QLatin1String
(
"storageservicemanager"
)
)
)
KMessageBox
::
error
(
this
,
i18n
(
"Could not start storage service manager; "
"please check your installation."
),
i18n
(
"KMail Error"
)
);
}
void
ConfigureStorageServiceWidget
::
save
()
{
//storageServiceManager()->setListService(mStorageServiceWidget->listService());
}
void
ConfigureStorageServiceWidget
::
doLoadFromGlobalSettings
()
{
//mStorageServiceWidget->setListService(KMKernel::self()->storageServiceManager()->listService(), PimCommon::StorageServiceAbstract::ShareLinkCapability);
}
#include "moc_configurestorageservicewidget.cpp"
blogilo/src/configurestorageservicewidget.h
0 → 100644
View file @
1306400d
/*
Copyright (c) 2014 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>
class
QPushButton
;
namespace
PimCommon
{
class
StorageServiceSettingsWidget
;
}
class
ConfigureStorageServiceWidget
:
public
QWidget
{
Q_OBJECT
public:
explicit
ConfigureStorageServiceWidget
(
QWidget
*
parent
=
0
);
~
ConfigureStorageServiceWidget
();
void
save
();
void
doLoadFromGlobalSettings
();
Q_SIGNALS:
void
changed
();
private
slots
:
void
slotManageStorageService
();
private:
PimCommon
::
StorageServiceSettingsWidget
*
mStorageServiceWidget
;
QPushButton
*
mManageStorageService
;
};
#endif // CONFIGURESTORAGESERVICEWIDGET_H
blogilo/src/mainwindow.cpp
View file @
1306400d
...
...
@@ -52,10 +52,11 @@
#include <kstatusbar.h>
#include <KToggleAction>
#include <kactioncollection.h>
#include <KActionMenu>
#include <kconfigdialog.h>
#include <kdebug.h>
#include <kmessagebox.h>
#include <K
DE/K
Locale>
#include <KLocale>
#include <KSelectAction>
#include <kimagefilepreview.h>
#include <KToolInvocation>
...
...
@@ -78,6 +79,7 @@ MainWindow::MainWindow()
mCurrentBlogId
(
__currentBlogId
)
{
setWindowTitle
(
i18n
(
"Blogilo"
)
);
initStorageService
();
tabPosts
=
new
PostsTabWidget
(
this
);
setCentralWidget
(
tabPosts
);
...
...
@@ -130,7 +132,6 @@ MainWindow::MainWindow()
}
connect
(
blogs
,
SIGNAL
(
triggered
(
QAction
*
)),
this
,
SLOT
(
currentBlogChanged
(
QAction
*
))
);
QTimer
::
singleShot
(
0
,
this
,
SLOT
(
loadTempPosts
())
);
initStorageService
();
}
MainWindow
::~
MainWindow
()
...
...
@@ -144,6 +145,22 @@ void MainWindow::initStorageService()
configJob
->
registerConfigIf
(
settingsJob
);
mStorageManager
=
new
PimCommon
::
StorageServiceManager
(
this
);
connect
(
mStorageManager
,
SIGNAL
(
uploadFileDone
(
QString
,
QString
)),
this
,
SLOT
(
slotUploadFileDone
(
QString
,
QString
)));
connect
(
mStorageManager
,
SIGNAL
(
shareLinkDone
(
QString
,
QString
)),
this
,
SLOT
(
slotUploadFileDone
(
QString
,
QString
)));
connect
(
mStorageManager
,
SIGNAL
(
uploadFileFailed
(
QString
,
QString
)),
this
,
SLOT
(
slotUploadFileFailed
(
QString
,
QString
)));
}
void
MainWindow
::
slotUploadFileDone
(
const
QString
&
serviceName
,
const
QString
&
link
)
{
Q_UNUSED
(
serviceName
);
KMessageBox
::
information
(
this
,
i18n
(
"File uploaded. You can access to it at this url %1"
,
link
),
i18n
(
"Upload File"
));
}
void
MainWindow
::
slotUploadFileFailed
(
const
QString
&
serviceName
,
const
QString
&
filename
)
{
Q_UNUSED
(
serviceName
);
Q_UNUSED
(
filename
);
KMessageBox
::
error
(
this
,
i18n
(
"Error during upload."
),
i18n
(
"Upload File"
));
}
void
MainWindow
::
slotCloseTabClicked
()
...
...
@@ -214,6 +231,9 @@ void MainWindow::setupActions()
actionCollection
()
->
addAction
(
QLatin1String
(
"open_blog_in_browser"
),
actOpenBlog
);
actOpenBlog
->
setToolTip
(
i18n
(
"Open current blog in browser"
));
connect
(
actOpenBlog
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
slotOpenCurrentBlogInBrowser
())
);
actionCollection
()
->
addAction
(
QLatin1String
(
"upload_file"
),
mStorageManager
->
menuUploadServices
(
this
)
);
actionCollection
()
->
addAction
(
QLatin1String
(
"download_file"
),
mStorageManager
->
menuDownloadServices
(
this
)
);
}
void
MainWindow
::
loadTempPosts
()
...
...
blogilo/src/mainwindow.h
View file @
1306400d
...
...
@@ -107,6 +107,9 @@ private slots:
void
slotCloseTabClicked
();
void
slotRemoveAllExclude
(
int
);
void
slotUploadFileDone
(
const
QString
&
serviceName
,
const
QString
&
filename
);
void
slotUploadFileFailed
(
const
QString
&
serviceName
,
const
QString
&
filename
);
protected:
void
keyPressEvent
(
QKeyEvent
*
event
);
virtual
bool
queryExit
();
...
...
pimcommon/storageservice/dialog/storageservicedownloaddialog.cpp
View file @
1306400d
...
...
@@ -117,6 +117,7 @@ void StorageServiceDownloadDialog::slotDownloadFile()
}
const
QString
fileId
=
mStorage
->
fileIdentifier
(
mTreeWidget
->
itemInformationSelected
());
mTreeWidget
->
setEnabled
(
false
);
enableButton
(
User1
,
false
);
mStorage
->
downloadFile
(
filename
,
fileId
,
destination
);
}
}
...
...
@@ -127,6 +128,7 @@ void StorageServiceDownloadDialog::slotDownfileDone(const QString &serviceName,
Q_UNUSED
(
filename
);
KMessageBox
::
information
(
this
,
i18n
(
"File was correctly downloaded."
),
i18n
(
"Download file"
));
mTreeWidget
->
setEnabled
(
true
);
enableButton
(
User1
,
true
);
}
void
StorageServiceDownloadDialog
::
slotDownfileFailed
(
const
QString
&
serviceName
,
const
QString
&
filename
)
...
...
@@ -135,6 +137,7 @@ void StorageServiceDownloadDialog::slotDownfileFailed(const QString &serviceName
Q_UNUSED
(
filename
);
KMessageBox
::
information
(
this
,
i18n
(
"Error during download file."
),
i18n
(
"Download file"
));
mTreeWidget
->
setEnabled
(
true
);
enableButton
(
User1
,
true
);
}
#include "moc_storageservicedownloaddialog.cpp"
pimcommon/storageservice/storageservicemanager.cpp
View file @
1306400d
...
...
@@ -19,6 +19,8 @@
#include "settings/pimcommonsettings.h"
#include "storageservice/dialog/storageservicedownloaddialog.h"
#include "dropbox/dropboxstorageservice.h"
#include "hubic/hubicstorageservice.h"
#include "ubuntuone/ubuntuonestorageservice.h"
...
...
@@ -102,8 +104,6 @@ KActionMenu *StorageServiceManager::menuWithCapability(PimCommon::StorageService
act
->
setIcon
(
icon
);
switch
(
capability
)
{
case
PimCommon
::
StorageServiceAbstract
::
NoCapability
:
case
PimCommon
::
StorageServiceAbstract
::
UploadFileCapability
:
case
PimCommon
::
StorageServiceAbstract
::
DownloadFileCapability
:
case
PimCommon
::
StorageServiceAbstract
::
CreateFolderCapability
:
case
PimCommon
::
StorageServiceAbstract
::
DeleteFolderCapability
:
case
PimCommon
::
StorageServiceAbstract
::
ListFolderCapability
:
...
...
@@ -115,13 +115,24 @@ KActionMenu *StorageServiceManager::menuWithCapability(PimCommon::StorageService
case
PimCommon
::
StorageServiceAbstract
::
CopyFolderCapability
:
qDebug
()
<<
" not implemented "
;
break
;
case
PimCommon
::
StorageServiceAbstract
::
DownloadFileCapability
:
menuService
->
setText
(
i18n
(
"Download File..."
));
connect
(
act
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
slotDownloadFile
()));
break
;
case
PimCommon
::
StorageServiceAbstract
::
UploadFileCapability
:
menuService
->
setText
(
i18n
(
"Upload File..."
));
connect
(
act
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
slotShareFile
()));
break
;
case
PimCommon
::
StorageServiceAbstract
::
ShareLinkCapability
:
menuService
->
setText
(
i18n
(
"Share File..."
));
connect
(
act
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
slotShareFile
()));
break
;
case
PimCommon
::
StorageServiceAbstract
::
DeleteFileCapability
:
menuService
->
setText
(
i18n
(
"Delete File..."
));
connect
(
act
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
slotDeleteFile
()));
break
;
case
PimCommon
::
StorageServiceAbstract
::
AccountInfoCapability
:
menuService
->
setText
(
i18n
(
"Account Info..."
));
connect
(
act
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
slotAccountInfo
()));
break
;
}
...
...
@@ -157,6 +168,22 @@ void StorageServiceManager::slotShareFile()
}
}
void
StorageServiceManager
::
slotDownloadFile
()
{
QAction
*
act
=
qobject_cast
<
QAction
*
>
(
sender
()
);
if
(
act
)
{
const
QString
type
=
act
->
data
().
toString
();
if
(
mListService
.
contains
(
type
))
{
StorageServiceAbstract
*
service
=
mListService
.
value
(
type
);
QPointer
<
PimCommon
::
StorageServiceDownloadDialog
>
dlg
=
new
PimCommon
::
StorageServiceDownloadDialog
(
service
,
0
);
if
(
dlg
->
exec
())
{
//TODO ?
}
delete
dlg
;
}
}
}
void
StorageServiceManager
::
defaultConnect
(
StorageServiceAbstract
*
service
)
{
connect
(
service
,
SIGNAL
(
actionFailed
(
QString
,
QString
)),
this
,
SIGNAL
(
actionFailed
(
QString
,
QString
)),
Qt
::
UniqueConnection
);
...
...
pimcommon/storageservice/storageservicemanager.h
View file @
1306400d
...
...
@@ -61,7 +61,7 @@ public:
static
QString
serviceToI18n
(
ServiceType
type
);
static
QString
serviceName
(
ServiceType
type
);
static
QString
description
(
ServiceType
type
);
static
QUrl
serviceUrl
(
ServiceType
type
);
static
QUrl
serviceUrl
(
ServiceType
type
);
static
QString
icon
(
ServiceType
type
);
static
StorageServiceAbstract
::
Capabilities
capabilities
(
ServiceType
type
);
static
QString
kconfigName
();
...
...
@@ -82,7 +82,7 @@ private Q_SLOTS:
void
slotAccountInfo
();
void
slotShareFile
();
void
slotDeleteFile
();
void
slotDownloadFile
();
private:
void
defaultConnect
(
StorageServiceAbstract
*
service
);
void
readConfig
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment