[Pkg-owncloud-commits] [owncloud-client] 218/470: Remove null-checks for FolderMan::_socketApi
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu May 12 16:25:05 UTC 2016
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit dac4bd8370bb38c6a37aaa99292c681c9879b259
Author: Jocelyn Turcotte <jturcotte at woboq.com>
Date: Fri Mar 18 18:31:01 2016 +0100
Remove null-checks for FolderMan::_socketApi
It's now created in the constructor and won't be null.
---
src/gui/folderman.cpp | 41 +++++++++++++++--------------------------
src/gui/folderman.h | 3 +--
src/gui/socketapi.h | 2 +-
3 files changed, 17 insertions(+), 29 deletions(-)
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index 69d028c..661d0f3 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -32,7 +32,6 @@
#endif
#include <QMessageBox>
-#include <QPointer>
#include <QtCore>
#include <QMutableSetIterator>
#include <QSet>
@@ -50,7 +49,7 @@ FolderMan::FolderMan(QObject *parent) :
Q_ASSERT(!_instance);
_instance = this;
- _socketApi = new SocketApi(this);
+ _socketApi.reset(new SocketApi);
ConfigFile cfg;
int polltime = cfg.remotePollInterval();
@@ -89,9 +88,7 @@ void FolderMan::unloadFolder( Folder *f )
return;
}
- if( _socketApi ) {
- _socketApi->slotUnregisterPath(f->alias());
- }
+ _socketApi->slotUnregisterPath(f->alias());
if( _folderWatchers.contains(f->alias())) {
_folderWatchers.remove(f->alias());
@@ -150,9 +147,7 @@ void FolderMan::registerFolderMonitor( Folder *folder )
}
// register the folder with the socket API
- if( _socketApi ) {
- _socketApi->slotRegisterPath(folder->alias());
- }
+ _socketApi->slotRegisterPath(folder->alias());
}
void FolderMan::addMonitorPath( const QString& alias, const QString& path )
@@ -303,7 +298,7 @@ QString FolderMan::escapeAlias( const QString& alias )
SocketApi *FolderMan::socketApi()
{
- return this->_socketApi;
+ return this->_socketApi.data();
}
QString FolderMan::unescapeAlias( const QString& alias )
@@ -472,21 +467,17 @@ void FolderMan::slotScheduleSync( Folder *f )
}
auto alias = f->alias();
- if( _socketApi ) {
- // We want the SocketAPI to already now update so that it can show the EVAL icon
- // for files/folders. Only do this when not syncing, else we might get a lot
- // of those notifications.
- _socketApi->slotUpdateFolderView(f);
- }
+ // We want the SocketAPI to already now update so that it can show the EVAL icon
+ // for files/folders. Only do this when not syncing, else we might get a lot
+ // of those notifications.
+ _socketApi->slotUpdateFolderView(f);
qDebug() << "Schedule folder " << alias << " to sync!";
if( ! _scheduleQueue.contains(f) ) {
if( !f->canSync() ) {
qDebug() << "Folder is not ready to sync, not scheduled!";
- if( _socketApi ) {
- _socketApi->slotUpdateFolderView(f);
- }
+ _socketApi->slotUpdateFolderView(f);
return;
}
f->prepareToSync();
@@ -928,15 +919,13 @@ bool FolderMan::startFromScratch( const QString& localFolder )
}
// Disconnect the socket api from the database to avoid that locking of the
// db file does not allow to move this dir.
- if( _socketApi ) {
- Folder *f = folderForPath(localFolder);
- if(f) {
- if( localFolder.startsWith(f->path()) ) {
- _socketApi->slotUnregisterPath(f->alias());
- }
- f->journalDb()->close();
- f->slotTerminateSync(); // Normally it should not be running, but viel hilft viel
+ Folder *f = folderForPath(localFolder);
+ if(f) {
+ if( localFolder.startsWith(f->path()) ) {
+ _socketApi->slotUnregisterPath(f->alias());
}
+ f->journalDb()->close();
+ f->slotTerminateSync(); // Normally it should not be running, but viel hilft viel
}
// Make a backup of the folder/file.
diff --git a/src/gui/folderman.h b/src/gui/folderman.h
index 59b467a..124863f 100644
--- a/src/gui/folderman.h
+++ b/src/gui/folderman.h
@@ -19,7 +19,6 @@
#include <QObject>
#include <QQueue>
#include <QList>
-#include <QPointer>
#include "folder.h"
#include "folderwatcher.h"
@@ -228,7 +227,7 @@ private:
QPointer<RequestEtagJob> _currentEtagJob; // alias of Folder running the current RequestEtagJob
QMap<QString, FolderWatcher*> _folderWatchers;
- QPointer<SocketApi> _socketApi;
+ QScopedPointer<SocketApi> _socketApi;
/** The aliases of folders that shall be synced. */
QQueue<Folder*> _scheduleQueue;
diff --git a/src/gui/socketapi.h b/src/gui/socketapi.h
index 6e69c2e..5e29def 100644
--- a/src/gui/socketapi.h
+++ b/src/gui/socketapi.h
@@ -44,7 +44,7 @@ class SocketApi : public QObject
Q_OBJECT
public:
- SocketApi(QObject* parent);
+ SocketApi(QObject* parent = 0);
virtual ~SocketApi();
public slots:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list