Comparar commits

..

4 Commits

Autor SHA1 Mensagem Data
Piotr M 7fd00b2cd5 add server capabilities to owncloudcmd 2016-09-12 14:43:40 +02:00
Olivier Goffart 1d09f6b60f Allow to disable Shiboleth to build without QtWebkit (#5166) 2016-09-11 16:14:08 +02:00
Olivier Goffart 98268d102f ExcludeFiles: Fix when the folder casing is not the same in the settings and in the FS
If the folder has different case in the settings and in the FS, we should
not ignore all the files. This is important for the files system watcher.
2016-09-11 12:12:10 +02:00
Olivier Goffart 9e895a6ecc FolderStatusModel: Fix beginInsertRow/endInsertRow
We need to do the change between the begin and the end call so the selection
don't get broken
2016-09-11 12:12:10 +02:00
21 arquivos alterados com 268 adições e 680 exclusões
+7
Ver Arquivo
@@ -136,6 +136,13 @@ if(OWNCLOUD_RESTORE_RENAME)
add_definitions(-DOWNCLOUD_RESTORE_RENAME=1) add_definitions(-DOWNCLOUD_RESTORE_RENAME=1)
endif() endif()
# Disable shibboleth.
# So the client can be built without QtWebKit
option(NO_SHIBBOLETH "Build without Shibboleth support. Allow to build the client without QtWebKit" OFF)
if(NO_SHIBBOLETH)
message("Compiling without shibboleth")
add_definitions(-DNO_SHIBBOLETH=1)
endif()
if(APPLE) if(APPLE)
set( SOCKETAPI_TEAM_IDENTIFIER_PREFIX "" CACHE STRING "SocketApi prefix (including a following dot) that must match the codesign key's TeamIdentifier/Organizational Unit" ) set( SOCKETAPI_TEAM_IDENTIFIER_PREFIX "" CACHE STRING "SocketApi prefix (including a following dot) that must match the codesign key's TeamIdentifier/Organizational Unit" )
+8 -2
Ver Arquivo
@@ -22,12 +22,18 @@ if( Qt5Core_FOUND )
find_package(Qt5Test REQUIRED) find_package(Qt5Test REQUIRED)
endif() endif()
if(NOT TOKEN_AUTH_ONLY) if(NOT TOKEN_AUTH_ONLY)
find_package(Qt5WebKitWidgets REQUIRED)
find_package(Qt5WebKit REQUIRED)
find_package(Qt5Widgets REQUIRED) find_package(Qt5Widgets REQUIRED)
if(APPLE) if(APPLE)
find_package(Qt5MacExtras REQUIRED) find_package(Qt5MacExtras REQUIRED)
endif(APPLE) endif(APPLE)
if(NOT NO_SHIBBOLETH)
find_package(Qt5WebKitWidgets)
find_package(Qt5WebKit)
if(NOT Qt5WebKitWidgets_FOUND)
message(FATAL_ERROR "Qt5WebKit required for Shibboleth. Use -DNO_SHIBBOLETH=1 to disable it.")
endif()
endif()
endif() endif()
else( Qt5Core_FOUND ) else( Qt5Core_FOUND )
+20
Ver Arquivo
@@ -29,6 +29,7 @@
#include "syncengine.h" #include "syncengine.h"
#include "syncjournaldb.h" #include "syncjournaldb.h"
#include "config.h" #include "config.h"
#include "connectionvalidator.h"
#include "cmd.h" #include "cmd.h"
@@ -68,6 +69,8 @@ struct CmdOptions {
// So we have to use a global variable // So we have to use a global variable
CmdOptions *opts = 0; CmdOptions *opts = 0;
const qint64 timeoutToUseMsec = qMax(1000, ConnectionValidator::DefaultCallingIntervalMsec - 5*1000);
class EchoDisabler class EchoDisabler
{ {
public: public:
@@ -388,6 +391,23 @@ int main(int argc, char **argv) {
account->setCredentials(cred); account->setCredentials(cred);
account->setSslErrorHandler(sslErrorHandler); account->setSslErrorHandler(sslErrorHandler);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
//obtain capabilities using event loop
QEventLoop loop;
JsonApiJob *job = new JsonApiJob(account, QLatin1String("ocs/v1.php/cloud/capabilities"));
job->setTimeout(timeoutToUseMsec);
QObject::connect(job, &JsonApiJob::jsonReceived, [&](const QVariantMap &json) {
auto caps = json.value("ocs").toMap().value("data").toMap().value("capabilities");
qDebug() << "Server capabilities" << caps;
account->setCapabilities(caps.toMap());
loop.quit();
});
job->start();
loop.exec();
#endif
// much lower age than the default since this utility is usually made to be run right after a change in the tests // much lower age than the default since this utility is usually made to be run right after a change in the tests
SyncEngine::minimumFileAgeForUpload = 0; SyncEngine::minimumFileAgeForUpload = 0;
+13 -7
Ver Arquivo
@@ -68,7 +68,6 @@ set(client_SRCS
activitylistmodel.cpp activitylistmodel.cpp
activitywidget.cpp activitywidget.cpp
activityitemdelegate.cpp activityitemdelegate.cpp
activityfetcher.cpp
selectivesyncdialog.cpp selectivesyncdialog.cpp
settingsdialog.cpp settingsdialog.cpp
share.cpp share.cpp
@@ -95,22 +94,26 @@ set(client_SRCS
servernotificationhandler.cpp servernotificationhandler.cpp
creds/credentialsfactory.cpp creds/credentialsfactory.cpp
creds/httpcredentialsgui.cpp creds/httpcredentialsgui.cpp
creds/shibbolethcredentials.cpp
creds/shibboleth/shibbolethwebview.cpp
creds/shibboleth/shibbolethuserjob.cpp
wizard/postfixlineedit.cpp wizard/postfixlineedit.cpp
wizard/abstractcredswizardpage.cpp wizard/abstractcredswizardpage.cpp
wizard/owncloudadvancedsetuppage.cpp wizard/owncloudadvancedsetuppage.cpp
wizard/owncloudconnectionmethoddialog.cpp wizard/owncloudconnectionmethoddialog.cpp
wizard/owncloudhttpcredspage.cpp wizard/owncloudhttpcredspage.cpp
wizard/owncloudsetuppage.cpp wizard/owncloudsetuppage.cpp
wizard/owncloudshibbolethcredspage.cpp
wizard/owncloudwizardcommon.cpp wizard/owncloudwizardcommon.cpp
wizard/owncloudwizard.cpp wizard/owncloudwizard.cpp
wizard/owncloudwizardresultpage.cpp wizard/owncloudwizardresultpage.cpp
../3rdparty/qjson/json.cpp ../3rdparty/qjson/json.cpp
) )
IF(NOT NO_SHIBBOLETH)
list(APPEND client_SRCS
creds/shibbolethcredentials.cpp
creds/shibboleth/shibbolethwebview.cpp
creds/shibboleth/shibbolethuserjob.cpp
wizard/owncloudshibbolethcredspage.cpp
)
endif()
set(updater_SRCS set(updater_SRCS
updater/ocupdater.cpp updater/ocupdater.cpp
@@ -233,6 +236,9 @@ set(ownCloud ${ownCloud_old})
if (WITH_DBUS) if (WITH_DBUS)
set(ADDITIONAL_APP_MODULES DBus) set(ADDITIONAL_APP_MODULES DBus)
endif(WITH_DBUS) endif(WITH_DBUS)
if (NOT NO_SHIBBOLETH)
list(APPEND ADDITIONAL_APP_MODULES WebKitWidgets)
endif()
if(NOT BUILD_OWNCLOUD_OSX_BUNDLE) if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
@@ -251,14 +257,14 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
# add_executable( ${APPLICATION_EXECUTABLE} main.cpp ${final_src}) # add_executable( ${APPLICATION_EXECUTABLE} main.cpp ${final_src})
add_executable( ${APPLICATION_EXECUTABLE} WIN32 main.cpp ${final_src}) add_executable( ${APPLICATION_EXECUTABLE} WIN32 main.cpp ${final_src})
qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml WebKitWidgets Sql ${ADDITIONAL_APP_MODULES}) qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml Sql ${ADDITIONAL_APP_MODULES})
else() else()
# set(CMAKE_INSTALL_PREFIX ".") # Examples use /Applications. hurmpf. # set(CMAKE_INSTALL_PREFIX ".") # Examples use /Applications. hurmpf.
set(MACOSX_BUNDLE_ICON_FILE "ownCloud.icns") set(MACOSX_BUNDLE_ICON_FILE "ownCloud.icns")
# we must add MACOSX_BUNDLE only if building a bundle # we must add MACOSX_BUNDLE only if building a bundle
add_executable( ${APPLICATION_EXECUTABLE} WIN32 MACOSX_BUNDLE main.cpp ${final_src}) add_executable( ${APPLICATION_EXECUTABLE} WIN32 MACOSX_BUNDLE main.cpp ${final_src})
qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml WebKitWidgets Sql ${ADDITIONAL_APP_MODULES}) qt5_use_modules(${APPLICATION_EXECUTABLE} Widgets Network Xml Sql ${ADDITIONAL_APP_MODULES})
set (QM_DIR ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/Translations) set (QM_DIR ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/Translations)
install(FILES ${client_I18N} DESTINATION ${QM_DIR}) install(FILES ${client_I18N} DESTINATION ${QM_DIR})
+1 -70
Ver Arquivo
@@ -15,45 +15,10 @@
#include "activitydata.h" #include "activitydata.h"
namespace OCC namespace OCC
{ {
ActivityFile::ActivityFile()
:_type(Unknown)
{
}
ActivityFile::ActivityFile( const QString& file )
:_relFileName(file),
_type(File)
{
}
void ActivityFile::setType( FileType type )
{
_type = type;
}
QString ActivityFile::relativePath() const
{
return _relFileName;
}
QString ActivityFile::fullPath( const QString _accountName ) const
{
QString fullPath(_relFileName);
// FIXME: get the account and prepend the base path.
if( _type == Directory && !fullPath.endsWith('/')) {
fullPath.append('/');
}
return fullPath;
}
/* ==================================================================== */
bool operator<( const Activity& rhs, const Activity& lhs ) { bool operator<( const Activity& rhs, const Activity& lhs ) {
return rhs._dateTime.toMSecsSinceEpoch() > lhs._dateTime.toMSecsSinceEpoch(); return rhs._dateTime.toMSecsSinceEpoch() > lhs._dateTime.toMSecsSinceEpoch();
} }
@@ -66,39 +31,5 @@ Activity::Identifier Activity::ident() const {
return Identifier( _id, _accName ); return Identifier( _id, _accName );
} }
void Activity::addFile( const QString& file )
{
ActivityFile f(file);
_files.append(f);
}
void Activity::addDirectory( const QString& dir )
{
ActivityFile f(dir);
f.setType(ActivityFile::Directory);
_files.append(f);
}
QVector<ActivityFile> Activity::files()
{
return _files;
}
/* ==================================================================== */
ActivityList::ActivityList()
{
}
void ActivityList::setAccountState(AccountState *ast)
{
_ast = ast;
}
AccountState* ActivityList::accountState()
{
return _ast;
}
} }
+1 -52
Ver Arquivo
@@ -16,8 +16,6 @@
#include <QtCore> #include <QtCore>
#include "accountstate.h"
namespace OCC { namespace OCC {
/** /**
* @brief The ActivityLink class describes actions of an activity * @brief The ActivityLink class describes actions of an activity
@@ -35,32 +33,6 @@ public:
}; };
/* ==================================================================== */ /* ==================================================================== */
/**
* @brief ActivityFile Structure
* @ingroup gui
*
* contains information about a file of an activity.
* Can handle the thumbnail and stuff later.
*/
class ActivityFile
{
public:
enum FileType {Unknown, File, Directory};
explicit ActivityFile();
explicit ActivityFile( const QString& file );
void setType( FileType type );
QString relativePath() const;
QString fullPath( const QString _accountName ) const;
private:
QString _relFileName;
FileType _type;
};
/* ==================================================================== */
/** /**
* @brief Activity Structure * @brief Activity Structure
* @ingroup gui * @ingroup gui
@@ -78,11 +50,6 @@ public:
NotificationType NotificationType
}; };
void addFile( const QString& file );
void addDirectory( const QString& dir );
QVector<ActivityFile> files();
Type _type; Type _type;
qlonglong _id; qlonglong _id;
QString _subject; QString _subject;
@@ -101,10 +68,6 @@ public:
Identifier ident() const; Identifier ident() const;
private:
QVector<ActivityFile> _files;
}; };
bool operator==( const Activity& rhs, const Activity& lhs ); bool operator==( const Activity& rhs, const Activity& lhs );
@@ -118,22 +81,8 @@ bool operator<( const Activity& rhs, const Activity& lhs );
* A QList based list of Activities * A QList based list of Activities
*/ */
/** typedef QList<Activity> ActivityList;
* @brief The ActivityList
* @ingroup gui
*
* A QList based list of Activities
*/
class ActivityList:public QList<Activity>
{
public:
ActivityList();
void setAccountState(AccountState *ast);
AccountState* accountState();
private:
AccountState *_ast;
};
} }
-245
Ver Arquivo
@@ -1,245 +0,0 @@
/*
* Copyright (C) by Klaas Freitag <freitag@owncloud.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; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include "activityfetcher.h"
#include "activitydata.h"
#include "account.h"
#include "accountstate.h"
#include "json.h"
#include "networkjobs.h"
namespace OCC {
ActivityFetcher::ActivityFetcher(QObject *parent) : QObject(parent)
{
}
void ActivityFetcher::slotFetch(AccountState* s)
{
if( !(s && s->isConnected() )) {
return;
}
JsonApiJob *job = new JsonApiJob(s->account(), QLatin1String("ocs/v1.php/cloud/activity"), this);
QObject::connect(job, SIGNAL(jsonReceived(QVariantMap, int)),
this, SLOT(slotActivitiesReceived(QVariantMap, int)));
job->setProperty("AccountStatePtr", QVariant::fromValue<AccountState*>(s));
QList< QPair<QString,QString> > params;
params.append(qMakePair(QString::fromLatin1("page"), QString::fromLatin1("0")));
params.append(qMakePair(QString::fromLatin1("pagesize"), QString::fromLatin1("100")));
job->addQueryParams(params);
qDebug() << "Start fetching activities for " << s->account()->displayName();
job->start();
}
void ActivityFetcher::slotActivitiesReceived(const QVariantMap& json, int statusCode)
{
auto activities = json.value("ocs").toMap().value("data").toList();
qDebug() << "*** activities" << activities;
ActivityList list;
AccountState* ai = qvariant_cast<AccountState*>(sender()->property("AccountStatePtr"));
list.setAccountState( ai );
foreach( auto activ, activities ) {
auto json = activ.toMap();
Activity a;
a._accName = ai->account()->displayName();
a._id = json.value("id").toLongLong();
a._subject = json.value("subject").toString();
a._message = json.value("message").toString();
const QString f = json.value("file").toString();
a.addFile(f);
a._link = json.value("link").toUrl();
a._dateTime = json.value("date").toDateTime();
list.append(a);
}
// activity app is not enabled, signalling.
if( statusCode == 999 ) {
emit accountWithoutActivityApp(ai);
}
emit newActivityList(list);
}
/* ==================================================================== */
ActivityFetcherV2::ActivityFetcherV2()
: ActivityFetcher()
{
}
ActivityList ActivityFetcherV2::fetchFromDb( const QString& accountId )
{
// TODO fetch from database
ActivityList dbActivities;
return dbActivities;
}
int ActivityFetcherV2::lastSeenId()
{
int lastId = 0;
return lastId;
}
void ActivityFetcherV2::slotFetch(AccountState* s)
{
if( !(s && s->isConnected() )) {
return;
}
JsonApiJob *job = new JsonApiJob(s->account(), QLatin1String("ocs/v2.php/apps/activity/api/v2/activity"), this);
QObject::connect(job, SIGNAL(jsonReceived(QVariantMap, int)),
this, SLOT(slotActivitiesReceived(QVariantMap, int)));
job->setProperty("AccountStatePtr", QVariant::fromValue<AccountState*>(s));
QList< QPair<QString,QString> > params;
int lastId = lastSeenId();
if( lastId > 0 ) {
params.append(qMakePair(QString::fromLatin1("since"), QString::number(lastId)));
job->addQueryParams(params);
}
qDebug() << "Start fetching V2 activities for " << s->account()->displayName();
job->start();
}
#define QL1(X) QLatin1String(X)
bool ActivityFetcherV2::parseActionString( Activity *activity, const QString& subject, const QVariantList& params)
{
// the action contains a string describing what happened
bool re = true;
if( subject == QL1("shared_user_self") ) {
} else if( subject == QL1("reshared_user_by") ) {
} else if( subject == QL1("shared_group_self") ) {
} else if( subject == QL1("reshared_group_by") ) {
} else if( subject == QL1("reshared_link_by") ) {
} else if( subject == QL1("shared_user_self") ) {
} else if( subject == QL1("created_self") ) {
} else if( subject == QL1("created_by") ) {
} else if( subject == QL1("created_public") ) {
} else if( subject == QL1("changed_self") ) {
} else if( subject == QL1("changed_by") ) {
} else if( subject == QL1("deleted_self") ) {
} else if( subject == QL1("deleted_by") ) {
} else if( subject == QL1("restored_self") ) {
} else if( subject == QL1("restored_by") ) {
} else {
// unknown action.
re = false;
}
// parse the params
foreach( QVariant v, params ) {
QVariantMap vm = v.toMap();
if( vm.contains("type") ) {
const QString type = vm.value("type").toString();
const QString val = vm.value("value").toString();
if( type == QL1("collection") ) {
QVariantList items = vm.value("value").toList();
foreach( QVariant vFile, items ) {
QVariantMap vMap = vFile.toMap();
const QString fileType = vMap.value("type").toString();
const QString relFileName = vMap.value("value").toString();
if( fileType != QL1("file")) {
activity->addDirectory(relFileName);
} else {
activity->addFile(relFileName);
}
}
} else if( type == QL1("file")) {
const QString relFileName = val;
activity->addFile(relFileName);
} else if( type == QL1("dir")) {
const QString relFileName = val;
activity->addDirectory(relFileName);
// needs verification!
} else if( type == QL1("username")) {
const QString user = val;
} else if( type == QL1("typeicon")) {
const QString icon = val;
} else {
}
}
}
return re;
}
void ActivityFetcherV2::slotActivitiesReceived(const QVariantMap& json, int statusCode)
{
auto activities = json.value("ocs").toMap().value("data").toList();
qDebug() << "*** activities" << activities;
AccountState* ai = qvariant_cast<AccountState*>(sender()->property("AccountStatePtr"));
ActivityList list;
if( ai ) {
list = fetchFromDb(ai->account()->id());
list.setAccountState( ai );
foreach( auto activ, activities ) {
auto json = activ.toMap();
Activity a;
a._accName = ai->account()->displayName();
a._id = json.value("activity_id").toLongLong();
QString subject = json.value("subject").toString();
QVariantList subjectParams = json.value("subjectparams").toList();
bool knownAction = parseActionString( &a, subject, subjectParams );
a._subject = json.value("subject").toString();
a._message = json.value("message_prepared").toString();
// a._file = json.value("file").toString();
// a._link = json.value("link").toUrl();
a._dateTime = json.value("datetime").toDateTime();
list.append(a);
}
// activity app is not enabled, signalling.
if( statusCode == 999 ) {
emit accountWithoutActivityApp(ai);
}
}
emit newActivityList(list);
}
}
-79
Ver Arquivo
@@ -1,79 +0,0 @@
/*
* Copyright (C) by Klaas Freitag <freitag@owncloud.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; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef ACTIVITYFETCHER_H
#define ACTIVITYFETCHER_H
#include <QtCore>
#include "activitydata.h"
#include "accountstate.h"
/**
* @brief The ActivityFetcher class
*
* Used to fetch the list of server acitivities from the server. Accesses
* the old ocs based API.
*/
namespace OCC {
class ActivityFetcher : public QObject
{
Q_OBJECT
public:
explicit ActivityFetcher(QObject *parent = 0);
public slots:
virtual void slotFetch(AccountState* s);
private slots:
virtual void slotActivitiesReceived(const QVariantMap& json, int statusCode);
signals:
void newActivityList( ActivityList list );
void accountWithoutActivityApp(AccountState*);
};
/* ==================================================================== */
/**
* @brief The ActivityFetcherV2 class
*
* To be used with the next version of the activity API. By now, it is
* completely unused.
*/
class ActivityFetcherV2 : public ActivityFetcher
{
Q_OBJECT
public:
explicit ActivityFetcherV2();
public slots:
virtual void slotFetch(AccountState* s);
private slots:
virtual void slotActivitiesReceived(const QVariantMap& json, int statusCode);
private:
bool parseActionString( Activity *activity, const QString& subject, const QVariantList& params);
ActivityList fetchFromDb(const QString &accountId );
int lastSeenId();
};
}
#endif // ACTIVITYFETCHER_H
+75 -132
Ver Arquivo
@@ -26,35 +26,10 @@
#include "activitydata.h" #include "activitydata.h"
#include "activitylistmodel.h" #include "activitylistmodel.h"
#define FETCH_ACTIVITIES_AMOUNT 1000
namespace OCC { namespace OCC {
/* ==================================================================== */
ActivitySortProxyModel::ActivitySortProxyModel(QObject *parent)
:QSortFilterProxyModel(parent)
{
setFilterRole(ActivityItemDelegate::ActionTextRole);
}
bool ActivitySortProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
{
QVariant leftData = sourceModel()->data(left);
QVariant rightData = sourceModel()->data(right);
if (leftData.type() == QVariant::DateTime) {
return leftData.toDateTime() < rightData.toDateTime();
} else {
qDebug() << "OOOOO " << endl;
}
return true;
}
/* ==================================================================== */
ActivityListModel::ActivityListModel(QWidget *parent) ActivityListModel::ActivityListModel(QWidget *parent)
:QAbstractListModel(parent), :QAbstractListModel(parent)
_fetchEntriesAmount(FETCH_ACTIVITIES_AMOUNT)
{ {
} }
@@ -65,8 +40,7 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
if (!index.isValid()) if (!index.isValid())
return QVariant(); return QVariant();
a = findItem(index.row()); a = _finalList.at(index.row());
AccountStatePtr ast = AccountManager::instance()->account(a._accName); AccountStatePtr ast = AccountManager::instance()->account(a._accName);
QStringList list; QStringList list;
@@ -115,48 +89,47 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
int ActivityListModel::rowCount(const QModelIndex&) const int ActivityListModel::rowCount(const QModelIndex&) const
{ {
int cnt = 0; return _finalList.count();
foreach( ActivityList al, _activityLists) {
cnt += al.count();
}
return cnt;
} }
void ActivityListModel::startFetchJob(AccountState* ast) // current strategy: Fetch 100 items per Account
// ATTENTION: This method is const and thus it is not possible to modify
// the _activityLists hash or so. Doesn't make it easier...
bool ActivityListModel::canFetchMore(const QModelIndex& ) const
{ {
if( !ast->isConnected() || _currentlyFetching.contains(ast)) { if( _activityLists.count() == 0 ) return true;
for(auto i = _activityLists.begin() ; i != _activityLists.end(); ++i) {
AccountState *ast = i.key();
if( ast && ast->isConnected() ) {
ActivityList activities = i.value();
if( activities.count() == 0 &&
! _currentlyFetching.contains(ast) ) {
return true;
}
}
}
return false;
}
void ActivityListModel::startFetchJob(AccountState* s)
{
if( !s->isConnected() ) {
return; return;
} }
JsonApiJob *job = new JsonApiJob(s->account(), QLatin1String("ocs/v1.php/cloud/activity"), this);
int activityListIndx = activityListIndxForAccountState(ast);
ActivityList activityList = _activityLists.at(activityListIndx);
// remove entries that might exist in this list.
int startItem = 0;
for( int i = 0; i < activityListIndx; i++ ) {
ActivityList al = _activityLists.at(i);
startItem += al.count();
}
beginRemoveRows(QModelIndex(), startItem, activityList.count() );
activityList.clear();
endRemoveRows();
_activityLists[activityListIndx] = activityList;
// start a new fetch job.
JsonApiJob *job = new JsonApiJob(ast->account(), QLatin1String("ocs/v1.php/cloud/activity"), this);
QObject::connect(job, SIGNAL(jsonReceived(QVariantMap, int)), QObject::connect(job, SIGNAL(jsonReceived(QVariantMap, int)),
this, SLOT(slotActivitiesReceived(QVariantMap, int))); this, SLOT(slotActivitiesReceived(QVariantMap, int)));
job->setProperty("AccountStatePtr", QVariant::fromValue<AccountState*>(ast)); job->setProperty("AccountStatePtr", QVariant::fromValue<AccountState*>(s));
QList< QPair<QString,QString> > params; QList< QPair<QString,QString> > params;
params.append(qMakePair(QString::fromLatin1("start"), QLatin1String("0"))); params.append(qMakePair(QString::fromLatin1("page"), QString::fromLatin1("0")));
params.append(qMakePair(QString::fromLatin1("count"), QString::number(_fetchEntriesAmount))); params.append(qMakePair(QString::fromLatin1("pagesize"), QString::fromLatin1("100")));
job->addQueryParams(params); job->addQueryParams(params);
_currentlyFetching.insert(ast); _currentlyFetching.insert(s);
qDebug() << Q_FUNC_INFO << "Start fetching activities for " << ast->account()->displayName(); qDebug() << Q_FUNC_INFO << "Start fetching activities for " << s->account()->displayName();
job->start(); job->start();
} }
@@ -164,14 +137,12 @@ void ActivityListModel::slotActivitiesReceived(const QVariantMap& json, int stat
{ {
auto activities = json.value("ocs").toMap().value("data").toList(); auto activities = json.value("ocs").toMap().value("data").toList();
ActivityList list;
AccountState* ast = qvariant_cast<AccountState*>(sender()->property("AccountStatePtr")); AccountState* ast = qvariant_cast<AccountState*>(sender()->property("AccountStatePtr"));
_currentlyFetching.remove(ast); _currentlyFetching.remove(ast);
// Read the new entries into a temporary list foreach( auto activ, activities ) {
ActivityList list; auto json = activ.toMap();
foreach( auto activity, activities ) {
auto json = activity.toMap();
Activity a; Activity a;
a._type = Activity::ActivityType; a._type = Activity::ActivityType;
@@ -185,101 +156,73 @@ void ActivityListModel::slotActivitiesReceived(const QVariantMap& json, int stat
list.append(a); list.append(a);
} }
_activityLists[ast] = list;
emit activityJobStatusCode(ast, statusCode); emit activityJobStatusCode(ast, statusCode);
addNewActivities(ast, list); combineActivityLists();
} }
void ActivityListModel::addNewActivities(AccountState* ast, const ActivityList& newItemsList) void ActivityListModel::combineActivityLists()
{ {
int startItem = 0; // the start number of items to delete in the virtual overall list ActivityList resultList;
int activityListIndx = activityListIndxForAccountState(ast);
Q_ASSERT(activityListIndx != -1);
ActivityList accountList = _activityLists.at(activityListIndx); foreach( ActivityList list, _activityLists.values() ) {
resultList.append(list);
for( int i = 0; i < activityListIndx; i++ ) {
ActivityList li = _activityLists.at(i);
startItem += li.count();
} }
// insert the new list std::sort( resultList.begin(), resultList.end() );
beginInsertRows(QModelIndex(), startItem, newItemsList.count() );
accountList.append(newItemsList); beginResetModel();
_finalList.clear();
endResetModel();
beginInsertRows(QModelIndex(), 0, resultList.count());
_finalList = resultList;
endInsertRows(); endInsertRows();
_activityLists[activityListIndx] = accountList;
} }
int ActivityListModel::activityListIndxForAccountState(AccountState *ast) void ActivityListModel::fetchMore(const QModelIndex &)
{ {
int i; QList<AccountStatePtr> accounts = AccountManager::instance()->accounts();
for( i = 0; i < _activityLists.count(); i++ ) { foreach (const AccountStatePtr& asp, accounts) {
ActivityList li = _activityLists.at(i);
if( li.accountState() == ast ) if( !_activityLists.contains(asp.data()) && asp->isConnected() ) {
return i; _activityLists[asp.data()] = ActivityList();
startFetchJob(asp.data());
}
} }
// if the AccountState was not found yet, add it to the list
if( i == _activityLists.count() ) {
ActivityList li;
li.setAccountState(ast);
_activityLists.append(li);
}
return i;
} }
void ActivityListModel::slotRefreshActivity(AccountState *ast) void ActivityListModel::slotRefreshActivity(AccountState *ast)
{ {
if(ast ) { if(ast && _activityLists.contains(ast)) {
qDebug() << "**** Refreshing Activity list for" << ast->account()->displayName(); _activityLists.remove(ast);
startFetchJob(ast);
} }
startFetchJob(ast);
} }
void ActivityListModel::slotRemoveAccount(AccountState *ast ) void ActivityListModel::slotRemoveAccount(AccountState *ast )
{ {
int removeIndx = activityListIndxForAccountState(ast); if( _activityLists.contains(ast) ) {
int i = 0;
const QString accountToRemove = ast->account()->displayName();
int startRow = 0; QMutableListIterator<Activity> it(_finalList);
for( int i = 0; i < removeIndx; i++) {
ActivityList al = _activityLists.at(i);
startRow += al.count();
}
beginRemoveRows(QModelIndex(), startRow, startRow+_activityLists.at(removeIndx).count()); while (it.hasNext()) {
_activityLists.removeAt(removeIndx); Activity activity = it.next();
endRemoveRows(); if( activity._accName == accountToRemove ) {
_currentlyFetching.remove(ast); beginRemoveRows(QModelIndex(), i, i+1);
} it.remove();
endRemoveRows();
// combine all activities into one big result list }
ActivityList ActivityListModel::activityList()
{
ActivityList all;
int i;
for( i = 0; i < _activityLists.count(); i++) {
ActivityList al = _activityLists.at(i);
all.append(al);
}
return all;
}
Activity ActivityListModel::findItem(int indx) const
{
Activity a;
foreach( ActivityList al, _activityLists ) {
if( indx < al.count() ) {
a = al.at(indx);
break;
} }
indx -= al.count(); _activityLists.remove(ast);
_currentlyFetching.remove(ast);
} }
return a;
} }
} }
+8 -19
Ver Arquivo
@@ -17,21 +17,10 @@
#include <QtCore> #include <QtCore>
#include "activitydata.h" #include "activitydata.h"
#include "accountstate.h"
namespace OCC { namespace OCC {
class ActivitySortProxyModel : public QSortFilterProxyModel class AccountState;
{
Q_OBJECT
public:
ActivitySortProxyModel(QObject *parent = 0);
protected:
bool lessThan(const QModelIndex &left, const QModelIndex &right) const Q_DECL_OVERRIDE;
};
/** /**
* @brief The ActivityListModel * @brief The ActivityListModel
@@ -49,8 +38,10 @@ public:
QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE; int rowCount(const QModelIndex& parent = QModelIndex()) const Q_DECL_OVERRIDE;
ActivityList activityList(); bool canFetchMore(const QModelIndex& ) const Q_DECL_OVERRIDE;
Activity findItem(int indx) const; void fetchMore(const QModelIndex&) Q_DECL_OVERRIDE;
ActivityList activityList() { return _finalList; }
public slots: public slots:
void slotRefreshActivity(AccountState* ast); void slotRefreshActivity(AccountState* ast);
@@ -63,16 +54,14 @@ signals:
void activityJobStatusCode(AccountState* ast, int statusCode); void activityJobStatusCode(AccountState* ast, int statusCode);
private: private:
void addNewActivities(AccountState* ast, const ActivityList& newItemsList); void startFetchJob(AccountState* s);
void startFetchJob(AccountState *ast);
void combineActivityLists(); void combineActivityLists();
int activityListIndxForAccountState(AccountState *ast );
QList<ActivityList> _activityLists; QMap<AccountState*, ActivityList> _activityLists;
ActivityList _finalList; ActivityList _finalList;
QSet<AccountState*> _currentlyFetching; QSet<AccountState*> _currentlyFetching;
int _fetchEntriesAmount;
}; };
} }
#endif // ACTIVITYLISTMODEL_H #endif // ACTIVITYLISTMODEL_H
+30 -22
Ver Arquivo
@@ -63,19 +63,15 @@ ActivityWidget::ActivityWidget(QWidget *parent) :
_ui->_activityList->setMinimumWidth(400); _ui->_activityList->setMinimumWidth(400);
#endif #endif
_model = new ActivitySortProxyModel(this); _model = new ActivityListModel(this);
ActivityListModel *rawModel = new ActivityListModel;
_model->setSourceModel(rawModel);
ActivityItemDelegate *delegate = new ActivityItemDelegate; ActivityItemDelegate *delegate = new ActivityItemDelegate;
delegate->setParent(this); delegate->setParent(this);
_ui->_activityList->setItemDelegate(delegate); _ui->_activityList->setItemDelegate(delegate);
_ui->_activityList->setAlternatingRowColors(true); _ui->_activityList->setAlternatingRowColors(true);
_ui->_activityList->setModel(_model); _ui->_activityList->setModel(_model);
_ui->_filterEdit->setClearButtonEnabled(true); _ui->_notifyLabel->hide();
connect(_ui->_filterEdit, SIGNAL(textChanged(QString)), _ui->_notifyScroll->hide();
SLOT(slotFilterTextChanged(QString)));
// Create a widget container for the notifications. The ui file defines // Create a widget container for the notifications. The ui file defines
// a scroll area that get a widget with a layout as children // a scroll area that get a widget with a layout as children
@@ -83,10 +79,12 @@ ActivityWidget::ActivityWidget(QWidget *parent) :
_notificationsLayout = new QVBoxLayout; _notificationsLayout = new QVBoxLayout;
w->setLayout(_notificationsLayout); w->setLayout(_notificationsLayout);
_notificationsLayout->setAlignment(Qt::AlignTop); _notificationsLayout->setAlignment(Qt::AlignTop);
_ui->_notifyScroll->setAlignment(Qt::AlignTop);
_ui->_notifyScroll->setWidget(w);
showLabels(); showLabels();
connect(rawModel, SIGNAL(activityJobStatusCode(AccountState*,int)), connect(_model, SIGNAL(activityJobStatusCode(AccountState*,int)),
this, SLOT(slotAccountActivityStatus(AccountState*,int))); this, SLOT(slotAccountActivityStatus(AccountState*,int)));
_copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole); _copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
@@ -107,17 +105,11 @@ ActivityWidget::~ActivityWidget()
delete _ui; delete _ui;
} }
void ActivityWidget::slotFilterTextChanged(const QString& exp)
{
_model->setFilterRegExp(QRegExp(exp, Qt::CaseInsensitive, QRegExp::RegExp));
}
void ActivityWidget::slotRefreshActivities(AccountState *ptr) void ActivityWidget::slotRefreshActivities(AccountState *ptr)
{ {
qobject_cast<ActivityListModel*>(_model->sourceModel())->slotRefreshActivity(ptr); _model->slotRefreshActivity(ptr);
} }
void ActivityWidget::slotRefreshNotifications(AccountState *ptr) void ActivityWidget::slotRefreshNotifications(AccountState *ptr)
{ {
// start a server notification handler if no notification requests // start a server notification handler if no notification requests
@@ -127,7 +119,7 @@ void ActivityWidget::slotRefreshNotifications(AccountState *ptr)
connect(snh, SIGNAL(newNotificationList(ActivityList)), this, connect(snh, SIGNAL(newNotificationList(ActivityList)), this,
SLOT(slotBuildNotificationDisplay(ActivityList))); SLOT(slotBuildNotificationDisplay(ActivityList)));
snh->fetchNotifications(ptr); snh->slotFetchNotifications(ptr);
} else { } else {
qDebug() << Q_FUNC_INFO << "========> notification request counter not zero."; qDebug() << Q_FUNC_INFO << "========> notification request counter not zero.";
} }
@@ -135,20 +127,24 @@ void ActivityWidget::slotRefreshNotifications(AccountState *ptr)
void ActivityWidget::slotRemoveAccount( AccountState *ptr ) void ActivityWidget::slotRemoveAccount( AccountState *ptr )
{ {
qobject_cast<ActivityListModel*>(_model->sourceModel())->slotRemoveAccount(ptr); _model->slotRemoveAccount(ptr);
} }
void ActivityWidget::showLabels() void ActivityWidget::showLabels()
{ {
QString t; QString t = tr("Server Activities");
_ui->_headerLabel->setTextFormat(Qt::RichText);
_ui->_headerLabel->setText(t);
_ui->_notifyLabel->setText(tr("Action Required: Notifications"));
t.clear();
QSetIterator<QString> i(_accountsWithoutActivities); QSetIterator<QString> i(_accountsWithoutActivities);
while (i.hasNext() ) { while (i.hasNext() ) {
t.append( tr("<br/>Account %1 does not have activities enabled.").arg(i.next())); t.append( tr("<br/>Account %1 does not have activities enabled.").arg(i.next()));
} }
_ui->_bottomLabel->setTextFormat(Qt::RichText); _ui->_bottomLabel->setTextFormat(Qt::RichText);
_ui->_bottomLabel->setText(t); _ui->_bottomLabel->setText(t);
_ui->_bottomLabel->setVisible(!t.isEmpty());
} }
void ActivityWidget::slotAccountActivityStatus(AccountState *ast, int statusCode) void ActivityWidget::slotAccountActivityStatus(AccountState *ast, int statusCode)
@@ -178,7 +174,7 @@ QString ActivityWidget::timeString(QDateTime dt, QLocale::FormatType format) con
void ActivityWidget::storeActivityList( QTextStream& ts ) void ActivityWidget::storeActivityList( QTextStream& ts )
{ {
ActivityList activities = qobject_cast<ActivityListModel*>(_model->sourceModel())->activityList(); ActivityList activities = _model->activityList();
foreach( Activity activity, activities ) { foreach( Activity activity, activities ) {
ts << right ts << right
@@ -222,9 +218,11 @@ void ActivityWidget::checkActivityTabVisibility()
_accountsWithoutActivities.count() != accountCount; _accountsWithoutActivities.count() != accountCount;
bool hasNotifications = !_widgetForNotifId.isEmpty(); bool hasNotifications = !_widgetForNotifId.isEmpty();
_ui->_filterLabel->setVisible( hasAccountsWithActivity ); _ui->_headerLabel->setVisible( hasAccountsWithActivity );
_ui->_activityList->setVisible( hasAccountsWithActivity ); _ui->_activityList->setVisible( hasAccountsWithActivity );
_ui->_filterEdit->setVisible(hasAccountsWithActivity);
_ui->_notifyLabel->setVisible( hasNotifications );
_ui->_notifyScroll->setVisible( hasNotifications );
emit hideActivityTab(!hasAccountsWithActivity && !hasNotifications); emit hideActivityTab(!hasAccountsWithActivity && !hasNotifications);
} }
@@ -271,6 +269,10 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList& list)
this, SLOT(slotRequestCleanupAndBlacklist(Activity))); this, SLOT(slotRequestCleanupAndBlacklist(Activity)));
_notificationsLayout->addWidget(widget); _notificationsLayout->addWidget(widget);
// _ui->_notifyScroll->setMinimumHeight( widget->height());
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
_ui->_notifyScroll->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContentsOnFirstShow);
#endif
_widgetForNotifId[activity.ident()] = widget; _widgetForNotifId[activity.ident()] = widget;
newNotificationShown = true; newNotificationShown = true;
} }
@@ -498,6 +500,12 @@ void ActivityWidget::slotCheckToCleanWidgets()
if( _widgetsToRemove.isEmpty() ) { if( _widgetsToRemove.isEmpty() ) {
_removeTimer.stop(); _removeTimer.stop();
} }
// check to see if the whole notification pane should be hidden
if( _widgetForNotifId.isEmpty() ) {
_ui->_notifyLabel->setHidden(true);
_ui->_notifyScroll->setHidden(true);
}
} }
+1 -3
Ver Arquivo
@@ -42,7 +42,6 @@ namespace Ui {
class ActivityWidget; class ActivityWidget;
} }
class Application; class Application;
class ActivitySortProxyModel;
/** /**
* @brief The ActivityWidget class * @brief The ActivityWidget class
@@ -85,7 +84,6 @@ signals:
void newNotification(); void newNotification();
private slots: private slots:
void slotFilterTextChanged(const QString& exp);
void slotBuildNotificationDisplay(const ActivityList& list); void slotBuildNotificationDisplay(const ActivityList& list);
void slotSendNotificationRequest(const QString &accountName, const QString& link, const QByteArray &verb); void slotSendNotificationRequest(const QString &accountName, const QString& link, const QByteArray &verb);
void slotNotifyNetworkError( QNetworkReply* ); void slotNotifyNetworkError( QNetworkReply* );
@@ -113,7 +111,7 @@ private:
// no query for notifications is started. // no query for notifications is started.
int _notificationRequestsRunning; int _notificationRequestsRunning;
ActivitySortProxyModel *_model; ActivityListModel *_model;
QVBoxLayout *_notificationsLayout; QVBoxLayout *_notificationsLayout;
}; };
+67 -39
Ver Arquivo
@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>690</width> <width>693</width>
<height>513</height> <height>556</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@@ -15,53 +15,81 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout"> <widget class="QLabel" name="_notifyLabel">
<item> <property name="sizePolicy">
<spacer name="horizontalSpacer"> <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<property name="orientation"> <horstretch>0</horstretch>
<enum>Qt::Horizontal</enum> <verstretch>0</verstretch>
</property> </sizepolicy>
<property name="sizeHint" stdset="0"> </property>
<size> <property name="text">
<width>40</width> <string>TextLabel</string>
<height>20</height> </property>
</size> </widget>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="_filterLabel">
<property name="text">
<string>&amp;Filter</string>
</property>
<property name="buddy">
<cstring>_filterEdit</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="_filterEdit">
<property name="maximumSize">
<size>
<width>180</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
</layout>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QListView" name="_activityList"/> <widget class="QScrollArea" name="_notifyScroll">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<widget class="QWidget" name="_scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>677</width>
<height>70</height>
</rect>
</property>
</widget>
</widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="_bottomLabel"> <widget class="QLabel" name="_headerLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>TextLabel</string> <string>TextLabel</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QListView" name="_activityList">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="_bottomLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QDialogButtonBox" name="_dialogButtonBox"/> <widget class="QDialogButtonBox" name="_dialogButtonBox"/>
</item> </item>
</layout> </layout>
+4
Ver Arquivo
@@ -16,7 +16,9 @@
#include "creds/credentialsfactory.h" #include "creds/credentialsfactory.h"
#include "creds/httpcredentialsgui.h" #include "creds/httpcredentialsgui.h"
#include "creds/dummycredentials.h" #include "creds/dummycredentials.h"
#ifndef NO_SHIBBOLETH
#include "creds/shibbolethcredentials.h" #include "creds/shibbolethcredentials.h"
#endif
namespace OCC namespace OCC
{ {
@@ -31,8 +33,10 @@ AbstractCredentials* create(const QString& type)
return new HttpCredentialsGui; return new HttpCredentialsGui;
} else if (type == "dummy") { } else if (type == "dummy") {
return new DummyCredentials; return new DummyCredentials;
#ifndef NO_SHIBBOLETH
} else if (type == "shibboleth") { } else if (type == "shibboleth") {
return new ShibbolethCredentials; return new ShibbolethCredentials;
#endif
} else { } else {
qWarning("Unknown credentials type: %s", qPrintable(type)); qWarning("Unknown credentials type: %s", qPrintable(type));
return new DummyCredentials; return new DummyCredentials;
+5 -2
Ver Arquivo
@@ -1076,11 +1076,14 @@ void FolderStatusModel::slotShowFetchProgress()
auto idx = it.key(); auto idx = it.key();
auto* info = infoForIndex(idx); auto* info = infoForIndex(idx);
if (info && info->_fetching) { if (info && info->_fetching) {
if (!info->hasLabel()) { bool add = !info->hasLabel();
if (add) {
beginInsertRows(idx, 0, 0); beginInsertRows(idx, 0, 0);
endInsertRows();
} }
info->_fetchingLabel = true; info->_fetchingLabel = true;
if (add) {
endInsertRows();
}
} }
it.remove(); it.remove();
} }
+4 -1
Ver Arquivo
@@ -539,12 +539,15 @@ bool DetermineAuthTypeJob::finished()
setupConnections(reply()); setupConnections(reply());
return false; // don't discard return false; // don't discard
} else { } else {
#ifndef NO_SHIBBOLETH
QRegExp shibbolethyWords("SAML|wayf"); QRegExp shibbolethyWords("SAML|wayf");
shibbolethyWords.setCaseSensitivity(Qt::CaseInsensitive); shibbolethyWords.setCaseSensitivity(Qt::CaseInsensitive);
if (redirection.toString().contains(shibbolethyWords)) { if (redirection.toString().contains(shibbolethyWords)) {
emit authType(WizardCommon::Shibboleth); emit authType(WizardCommon::Shibboleth);
} else { } else
#endif
{
// TODO: Send an error. // TODO: Send an error.
// eh? // eh?
emit authType(WizardCommon::HttpCreds); emit authType(WizardCommon::HttpCreds);
+3 -4
Ver Arquivo
@@ -26,14 +26,14 @@ ServerNotificationHandler::ServerNotificationHandler(QObject *parent)
} }
bool ServerNotificationHandler::fetchNotifications(AccountState *ptr) void ServerNotificationHandler::slotFetchNotifications(AccountState *ptr)
{ {
// check connectivity and credentials // check connectivity and credentials
if( !( ptr && ptr->isConnected() && ptr->account() && if( !( ptr && ptr->isConnected() && ptr->account() &&
ptr->account()->credentials() && ptr->account()->credentials() &&
ptr->account()->credentials()->ready() ) ) { ptr->account()->credentials()->ready() ) ) {
deleteLater(); deleteLater();
return false; return;
} }
// check if the account has notifications enabled. If the capabilities are // check if the account has notifications enabled. If the capabilities are
// not yet valid, its assumed that notifications are available. // not yet valid, its assumed that notifications are available.
@@ -41,7 +41,7 @@ bool ServerNotificationHandler::fetchNotifications(AccountState *ptr)
if( ! ptr->account()->capabilities().notificationsAvailable() ) { if( ! ptr->account()->capabilities().notificationsAvailable() ) {
qDebug() << Q_FUNC_INFO << "Account" << ptr->account()->displayName() << "does not have notifications enabled."; qDebug() << Q_FUNC_INFO << "Account" << ptr->account()->displayName() << "does not have notifications enabled.";
deleteLater(); deleteLater();
return false; return;
} }
} }
@@ -52,7 +52,6 @@ bool ServerNotificationHandler::fetchNotifications(AccountState *ptr)
_notificationJob->setProperty("AccountStatePtr", QVariant::fromValue<AccountState*>(ptr)); _notificationJob->setProperty("AccountStatePtr", QVariant::fromValue<AccountState*>(ptr));
_notificationJob->start(); _notificationJob->start();
return true;
} }
void ServerNotificationHandler::slotNotificationsReceived(const QVariantMap& json, int statusCode) void ServerNotificationHandler::slotNotificationsReceived(const QVariantMap& json, int statusCode)
+1 -1
Ver Arquivo
@@ -26,12 +26,12 @@ class ServerNotificationHandler : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit ServerNotificationHandler(QObject *parent = 0); explicit ServerNotificationHandler(QObject *parent = 0);
bool fetchNotifications(AccountState *ptr);
signals: signals:
void newNotificationList(ActivityList); void newNotificationList(ActivityList);
public slots: public slots:
void slotFetchNotifications(AccountState *ptr);
private slots: private slots:
void slotNotificationsReceived(const QVariantMap& json, int statusCode); void slotNotificationsReceived(const QVariantMap& json, int statusCode);
+14 -1
Ver Arquivo
@@ -20,7 +20,9 @@
#include "wizard/owncloudwizard.h" #include "wizard/owncloudwizard.h"
#include "wizard/owncloudsetuppage.h" #include "wizard/owncloudsetuppage.h"
#include "wizard/owncloudhttpcredspage.h" #include "wizard/owncloudhttpcredspage.h"
#ifndef NO_SHIBBOLETH
#include "wizard/owncloudshibbolethcredspage.h" #include "wizard/owncloudshibbolethcredspage.h"
#endif
#include "wizard/owncloudadvancedsetuppage.h" #include "wizard/owncloudadvancedsetuppage.h"
#include "wizard/owncloudwizardresultpage.h" #include "wizard/owncloudwizardresultpage.h"
@@ -39,7 +41,9 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
_account(0), _account(0),
_setupPage(new OwncloudSetupPage(this)), _setupPage(new OwncloudSetupPage(this)),
_httpCredsPage(new OwncloudHttpCredsPage(this)), _httpCredsPage(new OwncloudHttpCredsPage(this)),
#ifndef NO_SHIBBOLETH
_shibbolethCredsPage(new OwncloudShibbolethCredsPage), _shibbolethCredsPage(new OwncloudShibbolethCredsPage),
#endif
_advancedSetupPage(new OwncloudAdvancedSetupPage), _advancedSetupPage(new OwncloudAdvancedSetupPage),
_resultPage(new OwncloudWizardResultPage), _resultPage(new OwncloudWizardResultPage),
_credentialsPage(0), _credentialsPage(0),
@@ -48,7 +52,9 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setPage(WizardCommon::Page_ServerSetup, _setupPage); setPage(WizardCommon::Page_ServerSetup, _setupPage);
setPage(WizardCommon::Page_HttpCreds, _httpCredsPage); setPage(WizardCommon::Page_HttpCreds, _httpCredsPage);
#ifndef NO_SHIBBOLETH
setPage(WizardCommon::Page_ShibbolethCreds, _shibbolethCredsPage); setPage(WizardCommon::Page_ShibbolethCreds, _shibbolethCredsPage);
#endif
setPage(WizardCommon::Page_AdvancedSetup, _advancedSetupPage); setPage(WizardCommon::Page_AdvancedSetup, _advancedSetupPage);
setPage(WizardCommon::Page_Result, _resultPage); setPage(WizardCommon::Page_Result, _resultPage);
@@ -61,7 +67,9 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
connect( this, SIGNAL(currentIdChanged(int)), SLOT(slotCurrentPageChanged(int))); connect( this, SIGNAL(currentIdChanged(int)), SLOT(slotCurrentPageChanged(int)));
connect( _setupPage, SIGNAL(determineAuthType(QString)), SIGNAL(determineAuthType(QString))); connect( _setupPage, SIGNAL(determineAuthType(QString)), SIGNAL(determineAuthType(QString)));
connect( _httpCredsPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString))); connect( _httpCredsPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString)));
#ifndef NO_SHIBBOLETH
connect( _shibbolethCredsPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString))); connect( _shibbolethCredsPage, SIGNAL(connectToOCUrl(QString)), SIGNAL(connectToOCUrl(QString)));
#endif
connect( _advancedSetupPage, SIGNAL(createLocalAndRemoteFolders(QString, QString)), connect( _advancedSetupPage, SIGNAL(createLocalAndRemoteFolders(QString, QString)),
SIGNAL(createLocalAndRemoteFolders(QString, QString))); SIGNAL(createLocalAndRemoteFolders(QString, QString)));
connect(this, SIGNAL(customButtonClicked(int)), this, SIGNAL(skipFolderConfiguration())); connect(this, SIGNAL(customButtonClicked(int)), this, SIGNAL(skipFolderConfiguration()));
@@ -128,9 +136,11 @@ void OwncloudWizard::successfulStep()
_httpCredsPage->setConnected(); _httpCredsPage->setConnected();
break; break;
#ifndef NO_SHIBBOLETH
case WizardCommon::Page_ShibbolethCreds: case WizardCommon::Page_ShibbolethCreds:
_shibbolethCredsPage->setConnected(); _shibbolethCredsPage->setConnected();
break; break;
#endif
case WizardCommon::Page_AdvancedSetup: case WizardCommon::Page_AdvancedSetup:
_advancedSetupPage->directoriesCreated(); _advancedSetupPage->directoriesCreated();
@@ -148,9 +158,12 @@ void OwncloudWizard::successfulStep()
void OwncloudWizard::setAuthType(WizardCommon::AuthType type) void OwncloudWizard::setAuthType(WizardCommon::AuthType type)
{ {
_setupPage->setAuthType(type); _setupPage->setAuthType(type);
#ifndef NO_SHIBBOLETH
if (type == WizardCommon::Shibboleth) { if (type == WizardCommon::Shibboleth) {
_credentialsPage = _shibbolethCredsPage; _credentialsPage = _shibbolethCredsPage;
} else { } else
#endif
{
_credentialsPage = _httpCredsPage; _credentialsPage = _httpCredsPage;
} }
next(); next();
+4
Ver Arquivo
@@ -25,7 +25,9 @@ namespace OCC {
class OwncloudSetupPage; class OwncloudSetupPage;
class OwncloudHttpCredsPage; class OwncloudHttpCredsPage;
#ifndef NO_SHIBBOLETH
class OwncloudShibbolethCredsPage; class OwncloudShibbolethCredsPage;
#endif
class OwncloudAdvancedSetupPage; class OwncloudAdvancedSetupPage;
class OwncloudWizardResultPage; class OwncloudWizardResultPage;
class AbstractCredentials; class AbstractCredentials;
@@ -88,7 +90,9 @@ private:
AccountPtr _account; AccountPtr _account;
OwncloudSetupPage* _setupPage; OwncloudSetupPage* _setupPage;
OwncloudHttpCredsPage* _httpCredsPage; OwncloudHttpCredsPage* _httpCredsPage;
#ifndef NO_SHIBBOLETH
OwncloudShibbolethCredsPage* _shibbolethCredsPage; OwncloudShibbolethCredsPage* _shibbolethCredsPage;
#endif
OwncloudAdvancedSetupPage* _advancedSetupPage; OwncloudAdvancedSetupPage* _advancedSetupPage;
OwncloudWizardResultPage* _resultPage; OwncloudWizardResultPage* _resultPage;
AbstractCredentialsWizardPage* _credentialsPage; AbstractCredentialsWizardPage* _credentialsPage;
+2 -1
Ver Arquivo
@@ -12,6 +12,7 @@
*/ */
#include "excludedfiles.h" #include "excludedfiles.h"
#include "utility.h"
#include <QFileInfo> #include <QFileInfo>
@@ -70,7 +71,7 @@ bool ExcludedFiles::isExcluded(
const QString& basePath, const QString& basePath,
bool excludeHidden) const bool excludeHidden) const
{ {
if (!filePath.startsWith(basePath)) { if (!filePath.startsWith(basePath, Utility::fsCasePreserving() ? Qt::CaseInsensitive : Qt::CaseSensitive)) {
// Mark paths we're not responsible for as excluded... // Mark paths we're not responsible for as excluded...
return true; return true;
} }