mirror of
https://github.com/chylex/Nextcloud-Desktop.git
synced 2026-04-11 20:57:41 +02:00
Compare commits
66 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14a25f9d3f | ||
|
|
4e777aae33 | ||
|
|
5a84452102 | ||
|
|
8aa75ba4a4 | ||
|
|
2f24172bac | ||
|
|
10fba886dc | ||
|
|
046d955f5c | ||
|
|
d0d362664b | ||
|
|
f841450dae | ||
|
|
1fccb23442 | ||
|
|
bfd50ffcd0 | ||
|
|
4f2a171913 | ||
|
|
005d70a73c | ||
|
|
592291cbcb | ||
|
|
7236bd7dd4 | ||
|
|
c02d5f41a5 | ||
|
|
5a7cd815ab | ||
|
|
c2c01bccfc | ||
|
|
fb4728c7ee | ||
|
|
f34621578e | ||
|
|
5e50b1f1fd | ||
|
|
9b62104f30 | ||
|
|
86e42a9cf0 | ||
|
|
3e31d86596 | ||
|
|
ab007e2bb2 | ||
|
|
c45d55b94b | ||
|
|
7048bd8cc9 | ||
|
|
cae6ca987f | ||
|
|
65171cfb3a | ||
|
|
7ec636aeb6 | ||
|
|
c96980a57d | ||
|
|
0959ceeff2 | ||
|
|
1988c9d8c4 | ||
|
|
1eaa1e47fe | ||
|
|
31923b314e | ||
|
|
ee840b62e5 | ||
|
|
363efaa408 | ||
|
|
b0beeea95f | ||
|
|
d0a4650d69 | ||
|
|
ec5a84cf01 | ||
|
|
a057eb8590 | ||
|
|
6a8753b119 | ||
|
|
23fab90a31 | ||
|
|
8fdf9cac6b | ||
|
|
525d12f5a2 | ||
|
|
15d247a708 | ||
|
|
a1d0b85277 | ||
|
|
5e5a77b040 | ||
|
|
e420ae6942 | ||
|
|
0be7c0273e | ||
|
|
864b7cd41e | ||
|
|
78c8f13645 | ||
|
|
c87c456ae0 | ||
|
|
94d9b8fb39 | ||
|
|
2dad027001 | ||
|
|
f97bb240d7 | ||
|
|
80332fb6ab | ||
|
|
287ec2f3df | ||
|
|
eb5824f713 | ||
|
|
eded901f69 | ||
|
|
fd30df82cb | ||
|
|
d8888432c3 | ||
|
|
51712fea53 | ||
|
|
f597f99198 | ||
|
|
74ec37f3c7 | ||
|
|
05178f0fbf |
38
ChangeLog
38
ChangeLog
@@ -1,5 +1,43 @@
|
|||||||
ChangeLog
|
ChangeLog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
version 1.4.2 (release 2013-10-18 ), csync 0.90.4 required
|
||||||
|
|
||||||
|
* Do not show the warning icon in the tray (#944)
|
||||||
|
* Fix manual proxy support when switching (#1016)
|
||||||
|
* Add folder column to detailed sync protocol (#1037)
|
||||||
|
* Fix possible endless loop in inotify (#1041)
|
||||||
|
* Do not elide the progress text (#1049)
|
||||||
|
* Fix high CPU load (#1073)
|
||||||
|
* Reconnect if network is unavailable after startup (#1080)
|
||||||
|
* Ensure paused folder stays paused when syncing with more than one folder (#1083)
|
||||||
|
* Don't show desktop notification when the user doesn't want to (#1093)
|
||||||
|
* System tray: Avoid quick flickering up of the ok-icon for the sync prepare state
|
||||||
|
* Progress: Do not show progress if nothing is transmitted
|
||||||
|
* Progress: Show number of deletes.
|
||||||
|
|
||||||
|
version 1.4.1 (release 2013-09-24 ), csync 0.90.1 required
|
||||||
|
|
||||||
|
* Translation and documentation fixes.
|
||||||
|
* Fixed error display in settings/status dialog, displays multi
|
||||||
|
line error messages now correctly.
|
||||||
|
* Wait up to 30 secs before complaining about missing systray
|
||||||
|
Fixes bug #949
|
||||||
|
* Fixed utf8 issues with basic auth authentication, fixes bug #941
|
||||||
|
* Fixed remote folder selector, avoid recursive syncing, fixes bug #962
|
||||||
|
* Handle and display network problems at startup correctly.
|
||||||
|
* Enable and disable the folder watcher during syncs correctly.
|
||||||
|
* Fix setting of thread priority.
|
||||||
|
* Fixed file size display.
|
||||||
|
* Fixed various folder wizard issues, bug #992
|
||||||
|
* Made "Sync started" message optional, fixes bug #934
|
||||||
|
* Fixed shutdown, avoid crashed config on win32, fixes bug #945
|
||||||
|
* Pop up config wizard if no server url is configured, fixes bug #1018
|
||||||
|
* Settings: calculate sidebar width dynamically, fixes bug #1020
|
||||||
|
* Fixed a crash if sync folders were removed, fixes bug #713
|
||||||
|
* Do proper resync after network disconnect, fixes bug #1007
|
||||||
|
* Various minor code fixes
|
||||||
|
|
||||||
version 1.4.0 (release 2013-09-04 ), csync 0.90.0 required
|
version 1.4.0 (release 2013-09-04 ), csync 0.90.0 required
|
||||||
|
|
||||||
* New Scheduler: Only sync when there are actual changes in the server
|
* New Scheduler: Only sync when there are actual changes in the server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
set( VERSION_MAJOR 1 )
|
set( VERSION_MAJOR 1 )
|
||||||
set( VERSION_MINOR 4 )
|
set( VERSION_MINOR 4 )
|
||||||
set( VERSION_PATCH 0 )
|
set( VERSION_PATCH 2 )
|
||||||
set( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX}")
|
set( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX}")
|
||||||
set( SOVERSION 0 )
|
set( SOVERSION 0 )
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#cmakedefine APPLICATION_NAME "@APPLICATION_NAME@"
|
#cmakedefine APPLICATION_NAME "@APPLICATION_NAME@"
|
||||||
#cmakedefine APPLICATION_SHORTNAME "@APPLICATION_SHORTNAME@"
|
#cmakedefine APPLICATION_SHORTNAME "@APPLICATION_SHORTNAME@"
|
||||||
|
#cmakedefine APPLICATION_EXECUTABLE "@APPLICATION_EXECUTABLE@"
|
||||||
|
|
||||||
#cmakedefine SYSCONFDIR "@SYSCONFDIR@"
|
#cmakedefine SYSCONFDIR "@SYSCONFDIR@"
|
||||||
#cmakedefine DATADIR "@DATADIR@"
|
#cmakedefine DATADIR "@DATADIR@"
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ if(SPHINX_FOUND)
|
|||||||
add_custom_target(doc DEPENDS doc-html doc-man COMMENT "Building documentation...")
|
add_custom_target(doc DEPENDS doc-html doc-man COMMENT "Building documentation...")
|
||||||
endif(WITH_DOC)
|
endif(WITH_DOC)
|
||||||
|
|
||||||
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ocdoc")
|
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/ocdoc/_shared_assets")
|
||||||
add_dependencies(doc doc-html-org)
|
add_dependencies(doc doc-html-org)
|
||||||
add_dependencies(doc doc-html-com)
|
add_dependencies(doc doc-html-com)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -36,9 +36,14 @@ its own repository which contains non-standard recipes. Add it with::
|
|||||||
|
|
||||||
Next, install the missing dependencies::
|
Next, install the missing dependencies::
|
||||||
|
|
||||||
brew install $(brew deps ocsync)
|
brew install $(brew deps ocsync)
|
||||||
brew install $(brew deps mirall)
|
brew install $(brew deps mirall)
|
||||||
|
|
||||||
|
bug:
|
||||||
|
iniparser is not provideed by $(brew deps ocsync)
|
||||||
|
fix with brew install iniparser
|
||||||
|
|
||||||
|
|
||||||
To build mirall and csync, follow the `generic build instructions`_.
|
To build mirall and csync, follow the `generic build instructions`_.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ release = '@VERSION@'
|
|||||||
|
|
||||||
# List of patterns, relative to source directory, that match files and
|
# List of patterns, relative to source directory, that match files and
|
||||||
# directories to ignore when looking for source files.
|
# directories to ignore when looking for source files.
|
||||||
exclude_patterns = ['_build']
|
exclude_patterns = ['_build','scripts/*']
|
||||||
|
|
||||||
# The reST default role (used for this markup: `text`) to use for all documents.
|
# The reST default role (used for this markup: `text`) to use for all documents.
|
||||||
#default_role = None
|
#default_role = None
|
||||||
|
|||||||
@@ -5,4 +5,4 @@ Exec=@APPLICATION_EXECUTABLE@
|
|||||||
Name=@APPLICATION_NAME@ desktop sync client
|
Name=@APPLICATION_NAME@ desktop sync client
|
||||||
GenericName=Folder Sync
|
GenericName=Folder Sync
|
||||||
Icon=@APPLICATION_EXECUTABLE@
|
Icon=@APPLICATION_EXECUTABLE@
|
||||||
Keywords=@APPLICATION_NAME@;syncing;file;sharing
|
Keywords=@APPLICATION_NAME@;syncing;file;sharing;
|
||||||
|
|||||||
@@ -254,7 +254,15 @@ set( final_src
|
|||||||
include( AddAppIconMacro )
|
include( AddAppIconMacro )
|
||||||
set(ownCloud_old ${ownCloud})
|
set(ownCloud_old ${ownCloud})
|
||||||
|
|
||||||
kde4_add_app_icon( ownCloud "${theme_dir}/colored/${APPLICATION_EXECUTABLE}-icon*.png")
|
# set an icon_app_name. For historical reasons we can not use the
|
||||||
|
# application_shortname for ownCloud but must rather set it manually.
|
||||||
|
if ( EXISTS ${OEM_THEME_DIR}/OEM.cmake )
|
||||||
|
set(ICON_APP_NAME ${APPLICATION_SHORTNAME})
|
||||||
|
else()
|
||||||
|
set(ICON_APP_NAME "owncloud")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
kde4_add_app_icon( ownCloud "${theme_dir}/colored/${ICON_APP_NAME}-icon*.png")
|
||||||
list(APPEND final_src ${ownCloud})
|
list(APPEND final_src ${ownCloud})
|
||||||
set(ownCloud ${ownCloud_old})
|
set(ownCloud ${ownCloud_old})
|
||||||
|
|
||||||
@@ -262,11 +270,11 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
|
|||||||
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
file( GLOB _icons "${theme_dir}/colored/${APPLICATION_EXECUTABLE}-icon-*.png" )
|
file( GLOB _icons "${theme_dir}/colored/${ICON_APP_NAME}-icon-*.png" )
|
||||||
foreach( _file ${_icons} )
|
foreach( _file ${_icons} )
|
||||||
string( REPLACE "${theme_dir}/colored/${APPLICATION_EXECUTABLE}-icon-" "" _res ${_file} )
|
string( REPLACE "${theme_dir}/colored/${ICON_APP_NAME}-icon-" "" _res ${_file} )
|
||||||
string( REPLACE ".png" "" _res ${_res} )
|
string( REPLACE ".png" "" _res ${_res} )
|
||||||
install( FILES ${_file} RENAME ${APPLICATION_EXECUTABLE}.png DESTINATION ${DATADIR}/icons/hicolor/${_res}x${_res}/apps )
|
install( FILES ${_file} RENAME ${ICON_APP_NAME}.png DESTINATION ${DATADIR}/icons/hicolor/${_res}x${_res}/apps )
|
||||||
endforeach( _file )
|
endforeach( _file )
|
||||||
endif(NOT WIN32)
|
endif(NOT WIN32)
|
||||||
|
|
||||||
|
|||||||
@@ -67,11 +67,25 @@ int getauth(const char *prompt,
|
|||||||
|
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
|
class HttpCredentialsAccessManager : public MirallAccessManager {
|
||||||
|
public:
|
||||||
|
HttpCredentialsAccessManager(const HttpCredentials *cred, QObject* parent = 0)
|
||||||
|
: MirallAccessManager(parent), _cred(cred) {}
|
||||||
|
protected:
|
||||||
|
QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, QIODevice *outgoingData) {
|
||||||
|
QByteArray credHash = QByteArray(_cred->user().toUtf8()+":"+_cred->password().toUtf8()).toBase64();
|
||||||
|
QNetworkRequest req(request);
|
||||||
|
req.setRawHeader(QByteArray("Authorization"), QByteArray("Basic ") + credHash);
|
||||||
|
return MirallAccessManager::createRequest(op, req, outgoingData);\
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
const HttpCredentials *_cred;
|
||||||
|
};
|
||||||
|
|
||||||
HttpCredentials::HttpCredentials()
|
HttpCredentials::HttpCredentials()
|
||||||
: _user(),
|
: _user(),
|
||||||
_password(),
|
_password(),
|
||||||
_ready(false),
|
_ready(false)
|
||||||
_attempts()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
HttpCredentials::HttpCredentials(const QString& user, const QString& password)
|
HttpCredentials::HttpCredentials(const QString& user, const QString& password)
|
||||||
@@ -134,7 +148,7 @@ QString HttpCredentials::password() const
|
|||||||
|
|
||||||
QNetworkAccessManager* HttpCredentials::getQNAM() const
|
QNetworkAccessManager* HttpCredentials::getQNAM() const
|
||||||
{
|
{
|
||||||
MirallAccessManager* qnam = new MirallAccessManager;
|
MirallAccessManager* qnam = new HttpCredentialsAccessManager(this);
|
||||||
|
|
||||||
connect( qnam, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
|
connect( qnam, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)),
|
||||||
this, SLOT(slotAuthentication(QNetworkReply*,QAuthenticator*)));
|
this, SLOT(slotAuthentication(QNetworkReply*,QAuthenticator*)));
|
||||||
@@ -180,30 +194,12 @@ void HttpCredentials::slotCredentialsFetched(bool ok)
|
|||||||
|
|
||||||
void HttpCredentials::slotAuthentication(QNetworkReply* reply, QAuthenticator* authenticator)
|
void HttpCredentials::slotAuthentication(QNetworkReply* reply, QAuthenticator* authenticator)
|
||||||
{
|
{
|
||||||
if( !(authenticator && reply) ) return;
|
Q_UNUSED(authenticator)
|
||||||
|
// we cannot use QAuthenticator, because it sends username and passwords with latin1
|
||||||
qDebug() << "Authenticating request for " << reply->url();
|
// instead of utf8 encoding. Instead, we send it manually. Thus, if we reach this signal,
|
||||||
|
// those credentials were invalid and we terminate.
|
||||||
if (_attempts.contains(reply)) {
|
qDebug() << "Stop request: Authentication failed for " << reply->url().toString();
|
||||||
++_attempts[reply];
|
reply->close();
|
||||||
} else {
|
|
||||||
connect(reply, SIGNAL(finished()),
|
|
||||||
this, SLOT(slotReplyFinished()));
|
|
||||||
_attempts[reply] = 1;
|
|
||||||
}
|
|
||||||
// TODO: Replace it with something meaningful...
|
|
||||||
//if( reply->url().toString().startsWith( webdavUrl( _connection ) ) ) {
|
|
||||||
if (_attempts[reply] > 1) {
|
|
||||||
qDebug() << "Too many attempts to authenticate. Stop request.";
|
|
||||||
reply->close();
|
|
||||||
} else {
|
|
||||||
authenticator->setUser( _user );
|
|
||||||
authenticator->setPassword( _password );
|
|
||||||
}
|
|
||||||
//} else {
|
|
||||||
// qDebug() << "WRN: attempt to authenticate to different url - closing.";
|
|
||||||
// reply->close();
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpCredentials::slotReplyFinished()
|
void HttpCredentials::slotReplyFinished()
|
||||||
@@ -212,7 +208,6 @@ void HttpCredentials::slotReplyFinished()
|
|||||||
|
|
||||||
disconnect(reply, SIGNAL(finished()),
|
disconnect(reply, SIGNAL(finished()),
|
||||||
this, SLOT(slotReplyFinished()));
|
this, SLOT(slotReplyFinished()));
|
||||||
_attempts.remove (reply);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ns Mirall
|
} // ns Mirall
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ private:
|
|||||||
QString _user;
|
QString _user;
|
||||||
QString _password;
|
QString _password;
|
||||||
bool _ready;
|
bool _ready;
|
||||||
QMap<QNetworkReply*, int> _attempts;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // ns Mirall
|
} // ns Mirall
|
||||||
|
|||||||
30
src/main.cpp
30
src/main.cpp
@@ -14,8 +14,20 @@
|
|||||||
|
|
||||||
#include "mirall/application.h"
|
#include "mirall/application.h"
|
||||||
#include "mirall/theme.h"
|
#include "mirall/theme.h"
|
||||||
|
#include "mirall/utility.h"
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
void warnSystray()
|
||||||
|
{
|
||||||
|
QMessageBox::critical(0, qApp->translate("main.cpp", "System Tray not available"),
|
||||||
|
qApp->translate("main.cpp", "%1 requires on a working system tray. "
|
||||||
|
"If you are running XFCE, please follow "
|
||||||
|
"<a href=\"http://docs.xfce.org/xfce/xfce4-panel/systray\">these instructions</a>. "
|
||||||
|
"Otherwise, please install a system tray application such as 'trayer' and try again.")
|
||||||
|
.arg(Mirall::Theme::instance()->appNameGUI()));
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
@@ -39,13 +51,17 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
if (!QSystemTrayIcon::isSystemTrayAvailable() && qgetenv("DESKTOP_SESSION") != "ubuntu") {
|
int attempts = 0;
|
||||||
QMessageBox::critical(0, qApp->translate("main.cpp", "System Tray not available"),
|
forever {
|
||||||
qApp->translate("main.cpp", "%1 requires on a working system tray. "
|
if (!QSystemTrayIcon::isSystemTrayAvailable() && qgetenv("DESKTOP_SESSION") != "ubuntu") {
|
||||||
"If you are running XFCE, please follow "
|
Mirall::Utility::sleep(1);
|
||||||
"<a href=\"http://docs.xfce.org/xfce/xfce4-panel/systray\">these instructions</a>. "
|
attempts++;
|
||||||
"Otherwise, please install a system tray application such as 'trayer' and try again.")
|
if (attempts < 30) continue;
|
||||||
.arg(Mirall::Theme::instance()->appNameGUI()));
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
warnSystray();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
|||||||
@@ -35,6 +35,8 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
|
#include <QIcon>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
namespace Mirall {
|
namespace Mirall {
|
||||||
|
|
||||||
@@ -51,7 +53,7 @@ static const char progressBarStyleC[] =
|
|||||||
AccountSettings::AccountSettings(QWidget *parent) :
|
AccountSettings::AccountSettings(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::AccountSettings),
|
ui(new Ui::AccountSettings),
|
||||||
_item(0)
|
_wasDisabledBefore(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
@@ -205,9 +207,9 @@ void AccountSettings::buttonsSetEnabled()
|
|||||||
ui->_ButtonInfo->setEnabled(isSelected);
|
ui->_ButtonInfo->setEnabled(isSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountSettings::setListWidgetItem( QListWidgetItem *item )
|
void AccountSettings::setGeneralErrors( const QStringList& errors )
|
||||||
{
|
{
|
||||||
_item = item;
|
_generalErrors = errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f )
|
void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f )
|
||||||
@@ -217,33 +219,41 @@ void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f )
|
|||||||
item->setData( f->nativePath(), FolderStatusDelegate::FolderPathRole );
|
item->setData( f->nativePath(), FolderStatusDelegate::FolderPathRole );
|
||||||
item->setData( f->secondPath(), FolderStatusDelegate::FolderSecondPathRole );
|
item->setData( f->secondPath(), FolderStatusDelegate::FolderSecondPathRole );
|
||||||
item->setData( f->alias(), FolderStatusDelegate::FolderAliasRole );
|
item->setData( f->alias(), FolderStatusDelegate::FolderAliasRole );
|
||||||
item->setData( f->syncEnabled(), FolderStatusDelegate::FolderSyncEnabled );
|
item->setData( f->userSyncEnabled() && f->syncEnabled(), FolderStatusDelegate::FolderSyncEnabled );
|
||||||
|
|
||||||
SyncResult res = f->syncResult();
|
SyncResult res = f->syncResult();
|
||||||
SyncResult::Status status = res.status();
|
SyncResult::Status status = res.status();
|
||||||
|
|
||||||
QStringList errorList = res.errorStrings();
|
QStringList errorList = res.errorStrings();
|
||||||
QString errors;
|
|
||||||
if( ! errorList.isEmpty() ) {
|
|
||||||
errors = res.errorStrings().join(QLatin1String("<br/>"));
|
|
||||||
}
|
|
||||||
|
|
||||||
Theme *theme = Theme::instance();
|
Theme *theme = Theme::instance();
|
||||||
item->setData( theme->statusHeaderText( status ), Qt::ToolTipRole );
|
item->setData( theme->statusHeaderText( status ), Qt::ToolTipRole );
|
||||||
if( f->syncEnabled() ) {
|
if( f->syncEnabled() && f->userSyncEnabled() ) {
|
||||||
item->setData( theme->syncStateIcon( status ), FolderStatusDelegate::FolderStatusIconRole );
|
if( status == SyncResult::SyncPrepare ) {
|
||||||
|
if( _wasDisabledBefore ) {
|
||||||
|
// if the folder was disabled before, set the sync icon
|
||||||
|
item->setData( theme->syncStateIcon( SyncResult::SyncRunning), FolderStatusDelegate::FolderStatusIconRole );
|
||||||
|
} // we keep the previous icon for the SyncPrepare state.
|
||||||
|
} else {
|
||||||
|
// kepp the previous icon for the prepare phase.
|
||||||
|
item->setData( theme->syncStateIcon( status ), FolderStatusDelegate::FolderStatusIconRole );
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
item->setData( theme->folderDisabledIcon( ), FolderStatusDelegate::FolderStatusIconRole ); // size 48 before
|
item->setData( theme->folderDisabledIcon( ), FolderStatusDelegate::FolderStatusIconRole ); // size 48 before
|
||||||
|
_wasDisabledBefore = false;
|
||||||
}
|
}
|
||||||
item->setData( theme->statusHeaderText( status ), FolderStatusDelegate::FolderStatus );
|
item->setData( theme->statusHeaderText( status ), FolderStatusDelegate::FolderStatus );
|
||||||
item->setData( errors, FolderStatusDelegate::FolderErrorMsg );
|
|
||||||
|
|
||||||
if( errors.isEmpty() && (status == SyncResult::Error ||
|
if( errorList.isEmpty() ) {
|
||||||
status == SyncResult::SetupError ||
|
if( (status == SyncResult::Error ||
|
||||||
status == SyncResult::Unavailable )) {
|
status == SyncResult::SetupError ||
|
||||||
item->setData( theme->statusHeaderText(status), FolderStatusDelegate::FolderErrorMsg);
|
status == SyncResult::Unavailable )) {
|
||||||
|
errorList << theme->statusHeaderText(status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item->setData( errorList, FolderStatusDelegate::FolderErrorMsg);
|
||||||
|
|
||||||
bool ongoing = false;
|
bool ongoing = false;
|
||||||
item->setData( QVariant(res.warnCount()), FolderStatusDelegate::WarningCount );
|
item->setData( QVariant(res.warnCount()), FolderStatusDelegate::WarningCount );
|
||||||
if( status == SyncResult::SyncRunning ) {
|
if( status == SyncResult::SyncRunning ) {
|
||||||
@@ -257,6 +267,8 @@ void AccountSettings::slotRemoveCurrentFolder()
|
|||||||
{
|
{
|
||||||
QModelIndex selected = ui->_folderList->selectionModel()->currentIndex();
|
QModelIndex selected = ui->_folderList->selectionModel()->currentIndex();
|
||||||
if( selected.isValid() ) {
|
if( selected.isValid() ) {
|
||||||
|
int row = selected.row();
|
||||||
|
|
||||||
QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString();
|
QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString();
|
||||||
qDebug() << "Remove Folder alias " << alias;
|
qDebug() << "Remove Folder alias " << alias;
|
||||||
if( !alias.isEmpty() ) {
|
if( !alias.isEmpty() ) {
|
||||||
@@ -270,9 +282,22 @@ void AccountSettings::slotRemoveCurrentFolder()
|
|||||||
if( ret == QMessageBox::No ) {
|
if( ret == QMessageBox::No ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/* Remove the selected item from the timer hash. */
|
||||||
|
QStandardItem *item = NULL;
|
||||||
|
if( selected.isValid() )
|
||||||
|
item = _model->itemFromIndex(selected);
|
||||||
|
|
||||||
|
if( selected.isValid() && item && _hideProgressTimers.contains(item) ) {
|
||||||
|
QTimer *t = _hideProgressTimers[item];
|
||||||
|
t->stop();
|
||||||
|
_hideProgressTimers.remove(item);
|
||||||
|
delete(t);
|
||||||
|
}
|
||||||
|
|
||||||
FolderMan *folderMan = FolderMan::instance();
|
FolderMan *folderMan = FolderMan::instance();
|
||||||
folderMan->slotRemoveFolder( alias );
|
folderMan->slotRemoveFolder( alias );
|
||||||
setFolderList(folderMan->map());
|
_model->removeRow(row);
|
||||||
|
|
||||||
emit folderChanged();
|
emit folderChanged();
|
||||||
slotCheckConnection();
|
slotCheckConnection();
|
||||||
}
|
}
|
||||||
@@ -308,6 +333,22 @@ void AccountSettings::slotDoubleClicked( const QModelIndex& indx )
|
|||||||
emit openFolderAlias( alias );
|
emit openFolderAlias( alias );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AccountSettings::showConnectionLabel( const QString& message, const QString& tooltip )
|
||||||
|
{
|
||||||
|
const QString errStyle = QLatin1String("color:#ffffff; background-color:#bb4d4d;padding:5px;"
|
||||||
|
"border-width: 1px; border-style: solid; border-color: #aaaaaa;"
|
||||||
|
"border-radius:5px;");
|
||||||
|
if( _generalErrors.isEmpty() ) {
|
||||||
|
ui->connectLabel->setText( message );
|
||||||
|
ui->connectLabel->setToolTip(tooltip);
|
||||||
|
} else {
|
||||||
|
const QString msg = _generalErrors.join(QLatin1String("\n"));
|
||||||
|
ui->connectLabel->setText( msg );
|
||||||
|
ui->connectLabel->setToolTip(QString());
|
||||||
|
ui->connectLabel->setStyleSheet(errStyle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AccountSettings::slotCheckConnection()
|
void AccountSettings::slotCheckConnection()
|
||||||
{
|
{
|
||||||
if( ownCloudInfo::instance()->isConfigured() ) {
|
if( ownCloudInfo::instance()->isConfigured() ) {
|
||||||
@@ -316,12 +357,12 @@ void AccountSettings::slotCheckConnection()
|
|||||||
connect(ownCloudInfo::instance(), SIGNAL(noOwncloudFound(QNetworkReply*)),
|
connect(ownCloudInfo::instance(), SIGNAL(noOwncloudFound(QNetworkReply*)),
|
||||||
this, SLOT(slotOCInfoFail(QNetworkReply*)));
|
this, SLOT(slotOCInfoFail(QNetworkReply*)));
|
||||||
|
|
||||||
ui->connectLabel->setText( tr("Checking %1 connection...").arg(Theme::instance()->appNameGUI()));
|
showConnectionLabel( tr("Checking %1 connection...").arg(Theme::instance()->appNameGUI()));
|
||||||
qDebug() << "Check status.php from statusdialog.";
|
qDebug() << "Check status.php from statusdialog.";
|
||||||
ownCloudInfo::instance()->checkInstallation();
|
ownCloudInfo::instance()->checkInstallation();
|
||||||
} else {
|
} else {
|
||||||
// ownCloud is not yet configured.
|
// ownCloud is not yet configured.
|
||||||
ui->connectLabel->setText( tr("No %1 connection configured.").arg(Theme::instance()->appNameGUI()));
|
showConnectionLabel( tr("No %1 connection configured.").arg(Theme::instance()->appNameGUI()) );
|
||||||
ui->_ButtonAdd->setEnabled( false);
|
ui->_ButtonAdd->setEnabled( false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -329,8 +370,14 @@ void AccountSettings::slotCheckConnection()
|
|||||||
void AccountSettings::setFolderList( const Folder::Map &folders )
|
void AccountSettings::setFolderList( const Folder::Map &folders )
|
||||||
{
|
{
|
||||||
_model->clear();
|
_model->clear();
|
||||||
|
|
||||||
|
foreach(QTimer *t, _hideProgressTimers) {
|
||||||
|
t->stop();
|
||||||
|
delete t;
|
||||||
|
}
|
||||||
|
_hideProgressTimers.clear();
|
||||||
|
|
||||||
foreach( Folder *f, folders ) {
|
foreach( Folder *f, folders ) {
|
||||||
qDebug() << "Folder: " << f;
|
|
||||||
slotAddFolder( f );
|
slotAddFolder( f );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,7 +445,11 @@ void AccountSettings::slotEnableCurrentFolder()
|
|||||||
if ( f->isBusy() && terminate )
|
if ( f->isBusy() && terminate )
|
||||||
folderMan->terminateSyncProcess( alias );
|
folderMan->terminateSyncProcess( alias );
|
||||||
|
|
||||||
folderMan->slotEnableFolder( alias, !folderEnabled );
|
folderMan->slotGuiPauseFolder( alias, !folderEnabled );
|
||||||
|
|
||||||
|
// keep state for the icon setting.
|
||||||
|
if( !folderEnabled ) _wasDisabledBefore = true;
|
||||||
|
|
||||||
slotUpdateFolderState (f);
|
slotUpdateFolderState (f);
|
||||||
// set the button text accordingly.
|
// set the button text accordingly.
|
||||||
slotFolderActivated( selected );
|
slotFolderActivated( selected );
|
||||||
@@ -450,8 +501,8 @@ void AccountSettings::slotOCInfo( const QString& url, const QString& versionStr,
|
|||||||
ui->connectLabel->setOpenExternalLinks(true);
|
ui->connectLabel->setOpenExternalLinks(true);
|
||||||
QUrl safeUrl(url);
|
QUrl safeUrl(url);
|
||||||
safeUrl.setPassword(QString()); // Remove the password from the URL to avoid showing it in the UI
|
safeUrl.setPassword(QString()); // Remove the password from the URL to avoid showing it in the UI
|
||||||
ui->connectLabel->setText( tr("Connected to <a href=\"%1\">%2</a>.").arg(url, safeUrl.toString()) );
|
showConnectionLabel( tr("Connected to <a href=\"%1\">%2</a>.").arg(url, safeUrl.toString()),
|
||||||
ui->connectLabel->setToolTip( tr("Version: %1 (%2)").arg(versionStr).arg(version));
|
tr("Version: %1 (%2)").arg(versionStr).arg(version) );
|
||||||
ui->_ButtonAdd->setEnabled(true);
|
ui->_ButtonAdd->setEnabled(true);
|
||||||
|
|
||||||
disconnect(ownCloudInfo::instance(), SIGNAL(ownCloudInfoFound(const QString&, const QString&, const QString&, const QString&)),
|
disconnect(ownCloudInfo::instance(), SIGNAL(ownCloudInfoFound(const QString&, const QString&, const QString&, const QString&)),
|
||||||
@@ -465,7 +516,7 @@ void AccountSettings::slotOCInfoFail( QNetworkReply *reply)
|
|||||||
QString errStr = tr("unknown problem.");
|
QString errStr = tr("unknown problem.");
|
||||||
if( reply ) errStr = reply->errorString();
|
if( reply ) errStr = reply->errorString();
|
||||||
|
|
||||||
ui->connectLabel->setText( tr("<p>Failed to connect to %1: <tt>%2</tt></p>").arg(Theme::instance()->appNameGUI()).arg(errStr) );
|
showConnectionLabel( tr("<p>Failed to connect to %1: <tt>%2</tt></p>").arg(Theme::instance()->appNameGUI()).arg(errStr) );
|
||||||
ui->_ButtonAdd->setEnabled( false);
|
ui->_ButtonAdd->setEnabled( false);
|
||||||
|
|
||||||
disconnect(ownCloudInfo::instance(), SIGNAL(ownCloudInfoFound(const QString&, const QString&, const QString&, const QString&)),
|
disconnect(ownCloudInfo::instance(), SIGNAL(ownCloudInfoFound(const QString&, const QString&, const QString&, const QString&)),
|
||||||
@@ -538,7 +589,7 @@ void AccountSettings::slotProgressProblem(const QString& folder, const Progress:
|
|||||||
|
|
||||||
void AccountSettings::slotSetProgress(const QString& folder, const Progress::Info &progress )
|
void AccountSettings::slotSetProgress(const QString& folder, const Progress::Info &progress )
|
||||||
{
|
{
|
||||||
// qDebug() << "================================> Progress for folder " << folder << " file " << file << ": "<< p1;
|
// qDebug() << "================================> Progress for folder " << folder << " progress " << Progress::asResultString(progress.kind);
|
||||||
QStandardItem *item = itemForFolder( folder );
|
QStandardItem *item = itemForFolder( folder );
|
||||||
qint64 prog1 = progress.current_file_bytes;
|
qint64 prog1 = progress.current_file_bytes;
|
||||||
qint64 prog2 = progress.file_size;
|
qint64 prog2 = progress.file_size;
|
||||||
@@ -552,6 +603,11 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
|
|||||||
qDebug() << "================================> INVALID Progress for folder " << folder;
|
qDebug() << "================================> INVALID Progress for folder " << folder;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if( (progress.kind == Progress::StartSync || progress.kind == Progress::EndSync)
|
||||||
|
&& progress.overall_file_count == 0 ) {
|
||||||
|
// do not show progress if nothing is transmitted.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QString itemFileName = shortenFilename(folder, progress.current_file);
|
QString itemFileName = shortenFilename(folder, progress.current_file);
|
||||||
QString syncFileProgressString;
|
QString syncFileProgressString;
|
||||||
@@ -654,12 +710,21 @@ void AccountSettings::slotHideProgress()
|
|||||||
while (i != _hideProgressTimers.constEnd()) {
|
while (i != _hideProgressTimers.constEnd()) {
|
||||||
if( i.value() == send_timer ) {
|
if( i.value() == send_timer ) {
|
||||||
QStandardItem *item = i.key();
|
QStandardItem *item = i.key();
|
||||||
item->setData( QVariant(false), FolderStatusDelegate::AddProgressSpace );
|
|
||||||
item->setData( QVariant(QString::null), FolderStatusDelegate::SyncProgressOverallString );
|
|
||||||
item->setData( QVariant(QString::null), FolderStatusDelegate::SyncProgressItemString );
|
|
||||||
item->setData( 0, FolderStatusDelegate::SyncProgressOverallPercent );
|
|
||||||
|
|
||||||
ui->_folderList->repaint();
|
/* Check if this item is still existing */
|
||||||
|
bool ok = false;
|
||||||
|
for( int r = 0; !ok && r < _model->rowCount(); r++) {
|
||||||
|
if( item == _model->item(r,0) ) {
|
||||||
|
ok = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ok ) {
|
||||||
|
item->setData( QVariant(false), FolderStatusDelegate::AddProgressSpace );
|
||||||
|
item->setData( QVariant(QString::null), FolderStatusDelegate::SyncProgressOverallString );
|
||||||
|
item->setData( QVariant(QString::null), FolderStatusDelegate::SyncProgressItemString );
|
||||||
|
item->setData( 0, FolderStatusDelegate::SyncProgressOverallPercent );
|
||||||
|
}
|
||||||
_hideProgressTimers.remove(item);
|
_hideProgressTimers.remove(item);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ public:
|
|||||||
|
|
||||||
void setFolderList( const Folder::Map& );
|
void setFolderList( const Folder::Map& );
|
||||||
void buttonsSetEnabled();
|
void buttonsSetEnabled();
|
||||||
void setListWidgetItem(QListWidgetItem* item);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void folderChanged();
|
void folderChanged();
|
||||||
@@ -74,6 +73,8 @@ public slots:
|
|||||||
void slotUpdateQuota( qint64,qint64 );
|
void slotUpdateQuota( qint64,qint64 );
|
||||||
void slotIgnoreFilesEditor();
|
void slotIgnoreFilesEditor();
|
||||||
|
|
||||||
|
void setGeneralErrors( const QStringList& errors );
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void slotAddFolder();
|
void slotAddFolder();
|
||||||
void slotAddFolder( Folder* );
|
void slotAddFolder( Folder* );
|
||||||
@@ -90,16 +91,17 @@ private:
|
|||||||
QString shortenFilename( const QString& folder, const QString& file ) const;
|
QString shortenFilename( const QString& folder, const QString& file ) const;
|
||||||
void folderToModelItem( QStandardItem *, Folder * );
|
void folderToModelItem( QStandardItem *, Folder * );
|
||||||
QStandardItem* itemForFolder(const QString& );
|
QStandardItem* itemForFolder(const QString& );
|
||||||
|
void showConnectionLabel( const QString& message, const QString& tooltip = QString() );
|
||||||
|
|
||||||
Ui::AccountSettings *ui;
|
Ui::AccountSettings *ui;
|
||||||
QPointer<ItemProgressDialog> _fileItemDialog;
|
QPointer<ItemProgressDialog> _fileItemDialog;
|
||||||
QPointer<IgnoreListEditor> _ignoreEditor;
|
QPointer<IgnoreListEditor> _ignoreEditor;
|
||||||
QStandardItemModel *_model;
|
QStandardItemModel *_model;
|
||||||
QListWidgetItem *_item;
|
|
||||||
QUrl _OCUrl;
|
QUrl _OCUrl;
|
||||||
QHash<QStandardItem*, QTimer*> _hideProgressTimers;
|
QHash<QStandardItem*, QTimer*> _hideProgressTimers;
|
||||||
QString _kindContext;
|
QString _kindContext;
|
||||||
|
QStringList _generalErrors;
|
||||||
|
bool _wasDisabledBefore;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Mirall
|
} // namespace Mirall
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#include "mirall/folder.h"
|
#include "mirall/folder.h"
|
||||||
#include "mirall/folderman.h"
|
#include "mirall/folderman.h"
|
||||||
#include "mirall/folderwatcher.h"
|
#include "mirall/folderwatcher.h"
|
||||||
#include "mirall/folderwizard.h"
|
|
||||||
#include "mirall/networklocation.h"
|
#include "mirall/networklocation.h"
|
||||||
#include "mirall/folder.h"
|
#include "mirall/folder.h"
|
||||||
#include "mirall/owncloudsetupwizard.h"
|
#include "mirall/owncloudsetupwizard.h"
|
||||||
@@ -83,7 +82,7 @@ static const char optionsC[] =
|
|||||||
QString applicationTrPath()
|
QString applicationTrPath()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
return QString::fromLatin1(DATADIR"/i18n/");
|
return QString::fromLatin1(DATADIR"/"APPLICATION_EXECUTABLE"/i18n/");
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
return QApplication::applicationDirPath()+QLatin1String("/../Resources/Translations"); // path defaults to app dir.
|
return QApplication::applicationDirPath()+QLatin1String("/../Resources/Translations"); // path defaults to app dir.
|
||||||
@@ -105,6 +104,7 @@ Application::Application(int &argc, char **argv) :
|
|||||||
_recentActionsMenu(0),
|
_recentActionsMenu(0),
|
||||||
_theme(Theme::instance()),
|
_theme(Theme::instance()),
|
||||||
_logBrowser(0),
|
_logBrowser(0),
|
||||||
|
_startupNetworkError(false),
|
||||||
_logExpire(0),
|
_logExpire(0),
|
||||||
_showLogWindow(false),
|
_showLogWindow(false),
|
||||||
_logFlush(false),
|
_logFlush(false),
|
||||||
@@ -156,15 +156,17 @@ Application::Application(int &argc, char **argv) :
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// connect(_networkMgr, SIGNAL(onlineStateChanged(bool)), SLOT(slotCheckConnection()));
|
||||||
|
|
||||||
MirallConfigFile cfg;
|
MirallConfigFile cfg;
|
||||||
_theme->setSystrayUseMonoIcons(cfg.monoIcons());
|
_theme->setSystrayUseMonoIcons(cfg.monoIcons());
|
||||||
connect (_theme, SIGNAL(systrayUseMonoIconsChanged(bool)), SLOT(slotUseMonoIconsChanged(bool)));
|
connect (_theme, SIGNAL(systrayUseMonoIconsChanged(bool)), SLOT(slotUseMonoIconsChanged(bool)));
|
||||||
|
|
||||||
setupActions();
|
setupActions();
|
||||||
setupSystemTray();
|
setupSystemTray();
|
||||||
slotSetupProxy();
|
|
||||||
|
|
||||||
folderMan->setupFolders();
|
folderMan->setupFolders();
|
||||||
|
slotSetupProxy(); // folders have to be defined first.
|
||||||
|
|
||||||
// startup procedure.
|
// startup procedure.
|
||||||
QTimer::singleShot( 0, this, SLOT( slotCheckConnection() ));
|
QTimer::singleShot( 0, this, SLOT( slotCheckConnection() ));
|
||||||
@@ -179,18 +181,13 @@ Application::Application(int &argc, char **argv) :
|
|||||||
connect( ownCloudInfo::instance(), SIGNAL(quotaUpdated(qint64,qint64)),
|
connect( ownCloudInfo::instance(), SIGNAL(quotaUpdated(qint64,qint64)),
|
||||||
SLOT(slotRefreshQuotaDisplay(qint64, qint64)));
|
SLOT(slotRefreshQuotaDisplay(qint64, qint64)));
|
||||||
|
|
||||||
|
connect (this, SIGNAL(aboutToQuit()), SLOT(slotCleanup()));
|
||||||
|
|
||||||
qDebug() << "Network Location: " << NetworkLocation::currentLocation().encoded();
|
qDebug() << "Network Location: " << NetworkLocation::currentLocation().encoded();
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application()
|
Application::~Application()
|
||||||
{
|
{
|
||||||
if (_settingsDialog) {
|
|
||||||
delete _settingsDialog.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
delete _logBrowser;
|
|
||||||
delete _tray; // needed, see ctor
|
|
||||||
|
|
||||||
qDebug() << "* Mirall shutdown";
|
qDebug() << "* Mirall shutdown";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,8 +226,24 @@ void Application::slotCredentialsFetched()
|
|||||||
runValidator();
|
runValidator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Application::slotCleanup()
|
||||||
|
{
|
||||||
|
// explicitly close windows. This is somewhat of a hack to ensure
|
||||||
|
// that saving the geometries happens ASAP during a OS shutdown
|
||||||
|
|
||||||
|
// those do delete on close
|
||||||
|
if (!_settingsDialog.isNull()) _settingsDialog->close();
|
||||||
|
if (!_progressDialog.isNull()) _progressDialog->close();
|
||||||
|
|
||||||
|
// those need an extra invitation
|
||||||
|
if (!_tray.isNull()) _tray->deleteLater();
|
||||||
|
if (!_logBrowser.isNull()) _logBrowser->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
void Application::runValidator()
|
void Application::runValidator()
|
||||||
{
|
{
|
||||||
|
_startupFail.clear();
|
||||||
|
|
||||||
_conValidator = new ConnectionValidator();
|
_conValidator = new ConnectionValidator();
|
||||||
connect( _conValidator, SIGNAL(connectionResult(ConnectionValidator::Status)),
|
connect( _conValidator, SIGNAL(connectionResult(ConnectionValidator::Status)),
|
||||||
this, SLOT(slotConnectionValidatorResult(ConnectionValidator::Status)) );
|
this, SLOT(slotConnectionValidatorResult(ConnectionValidator::Status)) );
|
||||||
@@ -245,24 +258,25 @@ void Application::slotConnectionValidatorResult(ConnectionValidator::Status stat
|
|||||||
FolderMan *folderMan = FolderMan::instance();
|
FolderMan *folderMan = FolderMan::instance();
|
||||||
qDebug() << "######## Connection and Credentials are ok!";
|
qDebug() << "######## Connection and Credentials are ok!";
|
||||||
folderMan->setSyncEnabled(true);
|
folderMan->setSyncEnabled(true);
|
||||||
_tray->setIcon( _theme->syncStateIcon( SyncResult::NotYetStarted, true ) );
|
|
||||||
_tray->show();
|
|
||||||
|
|
||||||
int cnt = folderMan->map().size();
|
int cnt = folderMan->map().size();
|
||||||
slotShowTrayMessage(tr("%1 Sync Started").arg(_theme->appNameGUI()),
|
slotShowOptionalTrayMessage(tr("%1 Sync Started").arg(_theme->appNameGUI()),
|
||||||
tr("Sync started for %n configured sync folder(s).","", cnt));
|
tr("Sync started for %n configured sync folder(s).","", cnt));
|
||||||
|
|
||||||
// queue up the sync for all folders.
|
// queue up the sync for all folders.
|
||||||
folderMan->slotScheduleAllFolders();
|
folderMan->slotScheduleAllFolders();
|
||||||
|
|
||||||
computeOverallSyncStatus();
|
|
||||||
|
|
||||||
setupContextMenu();
|
|
||||||
} else if( status == ConnectionValidator::NotConfigured ) {
|
|
||||||
// this can not happen, it should be caught in first step of startup.
|
|
||||||
} else {
|
} else {
|
||||||
// What else?
|
// if we have problems here, it's unlikely that syncing will work.
|
||||||
|
FolderMan::instance()->setSyncEnabled(false);
|
||||||
|
|
||||||
|
_startupFail = _conValidator->errors();
|
||||||
|
_startupNetworkError = _conValidator->networkError();
|
||||||
|
QTimer::singleShot(30*1000, this, SLOT(slotCheckConnection()));
|
||||||
}
|
}
|
||||||
|
computeOverallSyncStatus();
|
||||||
|
setupContextMenu();
|
||||||
|
|
||||||
_conValidator->deleteLater();
|
_conValidator->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,7 +361,7 @@ void Application::setupSystemTray()
|
|||||||
_tray = new Systray();
|
_tray = new Systray();
|
||||||
_tray->setIcon( _theme->syncStateIcon( SyncResult::NotYetStarted, true ) );
|
_tray->setIcon( _theme->syncStateIcon( SyncResult::NotYetStarted, true ) );
|
||||||
|
|
||||||
connect(_tray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
connect(_tray.data(), SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
|
||||||
SLOT(slotTrayClicked(QSystemTrayIcon::ActivationReason)));
|
SLOT(slotTrayClicked(QSystemTrayIcon::ActivationReason)));
|
||||||
|
|
||||||
setupContextMenu();
|
setupContextMenu();
|
||||||
@@ -425,7 +439,7 @@ void Application::setupContextMenu()
|
|||||||
void Application::setupLogBrowser()
|
void Application::setupLogBrowser()
|
||||||
{
|
{
|
||||||
// might be called from second instance
|
// might be called from second instance
|
||||||
if (!_logBrowser) {
|
if (_logBrowser.isNull()) {
|
||||||
// init the log browser.
|
// init the log browser.
|
||||||
qInstallMsgHandler( mirallLogCatcher );
|
qInstallMsgHandler( mirallLogCatcher );
|
||||||
_logBrowser = new LogBrowser;
|
_logBrowser = new LogBrowser;
|
||||||
@@ -503,6 +517,7 @@ void Application::slotSetupProxy()
|
|||||||
|
|
||||||
switch(proxyType) {
|
switch(proxyType) {
|
||||||
case QNetworkProxy::NoProxy:
|
case QNetworkProxy::NoProxy:
|
||||||
|
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||||
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
|
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
|
||||||
break;
|
break;
|
||||||
case QNetworkProxy::DefaultProxy:
|
case QNetworkProxy::DefaultProxy:
|
||||||
@@ -510,10 +525,12 @@ void Application::slotSetupProxy()
|
|||||||
break;
|
break;
|
||||||
case QNetworkProxy::Socks5Proxy:
|
case QNetworkProxy::Socks5Proxy:
|
||||||
proxy.setType(QNetworkProxy::Socks5Proxy);
|
proxy.setType(QNetworkProxy::Socks5Proxy);
|
||||||
|
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||||
QNetworkProxy::setApplicationProxy(proxy);
|
QNetworkProxy::setApplicationProxy(proxy);
|
||||||
break;
|
break;
|
||||||
case QNetworkProxy::HttpProxy:
|
case QNetworkProxy::HttpProxy:
|
||||||
proxy.setType(QNetworkProxy::HttpProxy);
|
proxy.setType(QNetworkProxy::HttpProxy);
|
||||||
|
QNetworkProxyFactory::setUseSystemConfiguration(false);
|
||||||
QNetworkProxy::setApplicationProxy(proxy);
|
QNetworkProxy::setApplicationProxy(proxy);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -662,7 +679,7 @@ bool Application::checkConfigExists(bool openSettings)
|
|||||||
// if no config file is there, start the configuration wizard.
|
// if no config file is there, start the configuration wizard.
|
||||||
MirallConfigFile cfgFile;
|
MirallConfigFile cfgFile;
|
||||||
|
|
||||||
if( cfgFile.exists() ) {
|
if( cfgFile.exists() && !cfgFile.ownCloudUrl().isEmpty() ) {
|
||||||
if( openSettings ) {
|
if( openSettings ) {
|
||||||
slotSettings();
|
slotSettings();
|
||||||
}
|
}
|
||||||
@@ -694,7 +711,9 @@ void Application::slotSettings()
|
|||||||
_settingsDialog->setAttribute( Qt::WA_DeleteOnClose, true );
|
_settingsDialog->setAttribute( Qt::WA_DeleteOnClose, true );
|
||||||
_settingsDialog->show();
|
_settingsDialog->show();
|
||||||
}
|
}
|
||||||
Utility::raiseDialog(_settingsDialog);
|
|
||||||
|
_settingsDialog->setGeneralErrors( _startupFail );
|
||||||
|
Utility::raiseDialog(_settingsDialog.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::slotItemProgressDialog()
|
void Application::slotItemProgressDialog()
|
||||||
@@ -705,7 +724,7 @@ void Application::slotItemProgressDialog()
|
|||||||
_progressDialog->setupList();
|
_progressDialog->setupList();
|
||||||
_progressDialog->show();
|
_progressDialog->show();
|
||||||
}
|
}
|
||||||
Utility::raiseDialog(_progressDialog);
|
Utility::raiseDialog(_progressDialog.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::slotParseOptions(const QString &opts)
|
void Application::slotParseOptions(const QString &opts)
|
||||||
@@ -816,23 +835,36 @@ void Application::computeOverallSyncStatus()
|
|||||||
Folder::Map map = folderMan->map();
|
Folder::Map map = folderMan->map();
|
||||||
SyncResult overallResult = FolderMan::accountStatus(map.values());
|
SyncResult overallResult = FolderMan::accountStatus(map.values());
|
||||||
|
|
||||||
// create the tray blob message, check if we have an defined state
|
// if there have been startup problems, show an error message.
|
||||||
if( overallResult.status() != SyncResult::Undefined ) {
|
if( !_startupFail.isEmpty() ) {
|
||||||
QStringList allStatusStrings;
|
trayMessage = _startupFail.join(QLatin1String("\n"));
|
||||||
foreach(Folder* folder, map.values()) {
|
QIcon statusIcon;
|
||||||
qDebug() << "Folder in overallStatus Message: " << folder << " with name " << folder->alias();
|
if (_startupNetworkError) {
|
||||||
QString folderMessage = folderMan->statusToString(folder->syncResult().status(), folder->syncEnabled());
|
statusIcon = _theme->syncStateIcon( SyncResult::NotYetStarted, true );
|
||||||
allStatusStrings += tr("Folder %1: %2").arg(folder->alias(), folderMessage);
|
} else {
|
||||||
|
statusIcon = _theme->syncStateIcon( SyncResult::Error, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! allStatusStrings.isEmpty() )
|
|
||||||
trayMessage = allStatusStrings.join(QLatin1String("\n"));
|
|
||||||
else
|
|
||||||
trayMessage = tr("No sync folders configured.");
|
|
||||||
|
|
||||||
QIcon statusIcon = _theme->syncStateIcon( overallResult.status(), true);
|
|
||||||
_tray->setIcon( statusIcon );
|
_tray->setIcon( statusIcon );
|
||||||
_tray->setToolTip(trayMessage);
|
_tray->setToolTip(trayMessage);
|
||||||
|
} else {
|
||||||
|
// create the tray blob message, check if we have an defined state
|
||||||
|
if( overallResult.status() != SyncResult::Undefined ) {
|
||||||
|
QStringList allStatusStrings;
|
||||||
|
foreach(Folder* folder, map.values()) {
|
||||||
|
qDebug() << "Folder in overallStatus Message: " << folder << " with name " << folder->alias();
|
||||||
|
QString folderMessage = folderMan->statusToString(folder->syncResult().status(), folder->syncEnabled());
|
||||||
|
allStatusStrings += tr("Folder %1: %2").arg(folder->alias(), folderMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! allStatusStrings.isEmpty() )
|
||||||
|
trayMessage = allStatusStrings.join(QLatin1String("\n"));
|
||||||
|
else
|
||||||
|
trayMessage = tr("No sync folders configured.");
|
||||||
|
|
||||||
|
QIcon statusIcon = _theme->syncStateIcon( overallResult.status(), true);
|
||||||
|
_tray->setIcon( statusIcon );
|
||||||
|
_tray->setToolTip(trayMessage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ namespace Mirall {
|
|||||||
class Theme;
|
class Theme;
|
||||||
class Folder;
|
class Folder;
|
||||||
class FolderWatcher;
|
class FolderWatcher;
|
||||||
class FolderWizard;
|
|
||||||
class ownCloudInfo;
|
class ownCloudInfo;
|
||||||
class SslErrorDialog;
|
class SslErrorDialog;
|
||||||
class SettingsDialog;
|
class SettingsDialog;
|
||||||
@@ -107,13 +106,14 @@ protected slots:
|
|||||||
void slotDisplayIdle();
|
void slotDisplayIdle();
|
||||||
void slotHelp();
|
void slotHelp();
|
||||||
void slotCredentialsFetched();
|
void slotCredentialsFetched();
|
||||||
|
void slotCleanup();
|
||||||
private:
|
private:
|
||||||
void setHelp();
|
void setHelp();
|
||||||
void raiseDialog( QWidget* );
|
void raiseDialog( QWidget* );
|
||||||
void rebuildRecentMenus();
|
void rebuildRecentMenus();
|
||||||
void runValidator();
|
void runValidator();
|
||||||
|
|
||||||
Systray *_tray;
|
QPointer<Systray> _tray;
|
||||||
QAction *_actionOpenoC;
|
QAction *_actionOpenoC;
|
||||||
QAction *_actionSettings;
|
QAction *_actionSettings;
|
||||||
QAction *_actionQuota;
|
QAction *_actionQuota;
|
||||||
@@ -124,7 +124,6 @@ private:
|
|||||||
|
|
||||||
QNetworkConfigurationManager *_networkMgr;
|
QNetworkConfigurationManager *_networkMgr;
|
||||||
|
|
||||||
QPointer<FolderWizard> _folderWizard;
|
|
||||||
SslErrorDialog *_sslErrorDialog;
|
SslErrorDialog *_sslErrorDialog;
|
||||||
ConnectionValidator *_conValidator;
|
ConnectionValidator *_conValidator;
|
||||||
|
|
||||||
@@ -134,12 +133,14 @@ private:
|
|||||||
|
|
||||||
Theme *_theme;
|
Theme *_theme;
|
||||||
QSignalMapper *_folderOpenActionMapper;
|
QSignalMapper *_folderOpenActionMapper;
|
||||||
LogBrowser *_logBrowser;
|
QPointer<LogBrowser>_logBrowser;
|
||||||
QPointer<SettingsDialog> _settingsDialog;
|
QPointer<SettingsDialog> _settingsDialog;
|
||||||
QPointer<ItemProgressDialog> _progressDialog;
|
QPointer<ItemProgressDialog> _progressDialog;
|
||||||
|
|
||||||
QString _logFile;
|
QString _logFile;
|
||||||
QString _logDirectory;
|
QString _logDirectory;
|
||||||
|
QStringList _startupFail;
|
||||||
|
bool _startupNetworkError;
|
||||||
|
|
||||||
int _logExpire;
|
int _logExpire;
|
||||||
bool _showLogWindow;
|
bool _showLogWindow;
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ ConnectionValidator::ConnectionValidator(QObject *parent) :
|
|||||||
|
|
||||||
ConnectionValidator::ConnectionValidator(const QString& connection, QObject *parent)
|
ConnectionValidator::ConnectionValidator(const QString& connection, QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
_connection(connection)
|
_connection(connection),
|
||||||
|
_networkError(QNetworkReply::NoError)
|
||||||
{
|
{
|
||||||
ownCloudInfo::instance()->setCustomConfigHandle(_connection);
|
ownCloudInfo::instance()->setCustomConfigHandle(_connection);
|
||||||
}
|
}
|
||||||
@@ -38,6 +39,11 @@ QStringList ConnectionValidator::errors() const
|
|||||||
return _errors;
|
return _errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ConnectionValidator::networkError() const
|
||||||
|
{
|
||||||
|
return _networkError;
|
||||||
|
}
|
||||||
|
|
||||||
QString ConnectionValidator::statusString( Status stat ) const
|
QString ConnectionValidator::statusString( Status stat ) const
|
||||||
{
|
{
|
||||||
QString re;
|
QString re;
|
||||||
@@ -89,6 +95,7 @@ void ConnectionValidator::checkConnection()
|
|||||||
// checks for status.php
|
// checks for status.php
|
||||||
ownCloudInfo::instance()->checkInstallation();
|
ownCloudInfo::instance()->checkInstallation();
|
||||||
} else {
|
} else {
|
||||||
|
_errors << tr("No ownCloud connection configured");
|
||||||
emit connectionResult( NotConfigured );
|
emit connectionResult( NotConfigured );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,8 +116,8 @@ void ConnectionValidator::slotStatusFound( const QString& url, const QString& ve
|
|||||||
this, SLOT(slotNoStatusFound(QNetworkReply*)));
|
this, SLOT(slotNoStatusFound(QNetworkReply*)));
|
||||||
|
|
||||||
if( version.startsWith("4.0") ) {
|
if( version.startsWith("4.0") ) {
|
||||||
_errors.append( tr("<p>The configured server for this client is too old.</p>"
|
_errors.append( tr("The configured server for this client is too old") );
|
||||||
"<p>Please update to the latest server and restart the client.</p>"));
|
_errors.append( tr("Please update to the latest server and restart the client.") );
|
||||||
emit connectionResult( ServerVersionMismatch );
|
emit connectionResult( ServerVersionMismatch );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -129,6 +136,7 @@ void ConnectionValidator::slotNoStatusFound(QNetworkReply *reply)
|
|||||||
this, SLOT(slotNoStatusFound(QNetworkReply*)));
|
this, SLOT(slotNoStatusFound(QNetworkReply*)));
|
||||||
|
|
||||||
_errors.append( reply->errorString() );
|
_errors.append( reply->errorString() );
|
||||||
|
_networkError = (reply->error() != QNetworkReply::NoError);
|
||||||
emit connectionResult( StatusNotFound );
|
emit connectionResult( StatusNotFound );
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -144,15 +152,17 @@ void ConnectionValidator::slotCheckAuthentication()
|
|||||||
// continue in slotAuthCheck here :-)
|
// continue in slotAuthCheck here :-)
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionValidator::slotAuthCheck( const QString& ,QNetworkReply *reply )
|
void ConnectionValidator::slotAuthCheck( const QString&, QNetworkReply *reply )
|
||||||
{
|
{
|
||||||
Status stat = Connected;
|
Status stat = Connected;
|
||||||
|
|
||||||
if( reply->error() == QNetworkReply::AuthenticationRequiredError ||
|
if( reply->error() == QNetworkReply::AuthenticationRequiredError ||
|
||||||
reply->error() == QNetworkReply::OperationCanceledError ) { // returned if the user is wrong.
|
reply->error() == QNetworkReply::OperationCanceledError ) { // returned if the user is wrong.
|
||||||
qDebug() << "******** Password is wrong!";
|
qDebug() << "******** Password is wrong!";
|
||||||
_errors << "The provided credentials are wrong.";
|
_errors << tr("The provided credentials are not correct");
|
||||||
stat = CredentialsWrong;
|
stat = CredentialsWrong;
|
||||||
|
} else if( reply->error() != QNetworkReply::NoError ) {
|
||||||
|
_errors << reply->errorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// disconnect from ownCloud Info signals
|
// disconnect from ownCloud Info signals
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
QStringList errors() const;
|
QStringList errors() const;
|
||||||
|
bool networkError() const;
|
||||||
|
|
||||||
void checkConnection();
|
void checkConnection();
|
||||||
|
|
||||||
@@ -64,6 +65,7 @@ protected slots:
|
|||||||
private:
|
private:
|
||||||
QStringList _errors;
|
QStringList _errors;
|
||||||
QString _connection;
|
QString _connection;
|
||||||
|
bool _networkError;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ QString CSyncThread::csyncErrorToString( CSYNC_ERROR_CODE err, const char *errSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( errString ) {
|
if( errString ) {
|
||||||
errStr += tr("<br/>Backend Message: ")+QString::fromUtf8(errString);
|
errStr += tr(" Backend Message: ")+QString::fromUtf8(errString);
|
||||||
}
|
}
|
||||||
return errStr;
|
return errStr;
|
||||||
|
|
||||||
|
|||||||
@@ -50,10 +50,13 @@ Folder::Folder(const QString &alias, const QString &path, const QString& secondP
|
|||||||
, _secondPath(secondPath)
|
, _secondPath(secondPath)
|
||||||
, _alias(alias)
|
, _alias(alias)
|
||||||
, _enabled(true)
|
, _enabled(true)
|
||||||
|
, _userSyncEnabled(true)
|
||||||
, _thread(0)
|
, _thread(0)
|
||||||
, _csync(0)
|
, _csync(0)
|
||||||
, _csyncError(false)
|
, _csyncError(false)
|
||||||
, _csyncUnavail(false)
|
, _csyncUnavail(false)
|
||||||
|
, _wipeDb(false)
|
||||||
|
, _proxyDirty(true)
|
||||||
, _csync_ctx(0)
|
, _csync_ctx(0)
|
||||||
{
|
{
|
||||||
qsrand(QTime::currentTime().msec());
|
qsrand(QTime::currentTime().msec());
|
||||||
@@ -111,6 +114,7 @@ bool Folder::init()
|
|||||||
}
|
}
|
||||||
return _csync_ctx;
|
return _csync_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
Folder::~Folder()
|
Folder::~Folder()
|
||||||
{
|
{
|
||||||
if( _thread ) {
|
if( _thread ) {
|
||||||
@@ -196,19 +200,33 @@ bool Folder::syncEnabled() const
|
|||||||
void Folder::setSyncEnabled( bool doit )
|
void Folder::setSyncEnabled( bool doit )
|
||||||
{
|
{
|
||||||
_enabled = doit;
|
_enabled = doit;
|
||||||
_watcher->setEventsEnabled( doit );
|
|
||||||
|
|
||||||
qDebug() << "setSyncEnabled - ############################ " << doit;
|
if( doit && userSyncEnabled() ) {
|
||||||
if( doit ) {
|
// qDebug() << "Syncing enabled on folder " << name();
|
||||||
// undefined until next sync
|
_pollTimer.start();
|
||||||
_syncResult.setStatus( SyncResult::NotYetStarted);
|
_watcher->clearPendingEvents(); // FIXME 1.5: Why isn't that happening in setEventsEnabled?
|
||||||
_syncResult.clearErrors();
|
_watcher->setEventsEnabled(true);
|
||||||
evaluateSync( QStringList() );
|
_timeSinceLastSync.restart();
|
||||||
} else {
|
} else {
|
||||||
|
// do not stop or start the watcher here, that is done internally by
|
||||||
|
// folder class. Even if the watcher fires, the folder does not
|
||||||
|
// schedule itself because it checks the var. _enabled before.
|
||||||
_pollTimer.stop();
|
_pollTimer.stop();
|
||||||
|
_watcher->setEventsEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Folder::userSyncEnabled()
|
||||||
|
{
|
||||||
|
return _userSyncEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Folder::slotSetSyncUserEnabled( bool enable )
|
||||||
|
{
|
||||||
|
_userSyncEnabled = enable;
|
||||||
|
setSyncEnabled( syncEnabled() ); // no change on the system enable flag.
|
||||||
|
}
|
||||||
|
|
||||||
void Folder::setSyncState(SyncResult::Status state)
|
void Folder::setSyncState(SyncResult::Status state)
|
||||||
{
|
{
|
||||||
_syncResult.setStatus(state);
|
_syncResult.setStatus(state);
|
||||||
@@ -221,12 +239,17 @@ SyncResult Folder::syncResult() const
|
|||||||
|
|
||||||
void Folder::evaluateSync(const QStringList &/*pathList*/)
|
void Folder::evaluateSync(const QStringList &/*pathList*/)
|
||||||
{
|
{
|
||||||
if( !_enabled ) {
|
if( !syncEnabled() ) {
|
||||||
qDebug() << "*" << alias() << "sync skipped, disabled!";
|
qDebug() << "*" << alias() << "sync skipped, disabled!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( !userSyncEnabled() ) {
|
||||||
|
qDebug() << "*" << alias() << "sync skipped, user disabled!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
_syncResult.setStatus( SyncResult::NotYetStarted );
|
_syncResult.setStatus( SyncResult::NotYetStarted );
|
||||||
|
_syncResult.clearErrors();
|
||||||
emit scheduleToSync( alias() );
|
emit scheduleToSync( alias() );
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -235,8 +258,10 @@ void Folder::slotPollTimerTimeout()
|
|||||||
{
|
{
|
||||||
qDebug() << "* Polling" << alias() << "for changes. (time since next sync:" << (_timeSinceLastSync.elapsed() / 1000) << "s)";
|
qDebug() << "* Polling" << alias() << "for changes. (time since next sync:" << (_timeSinceLastSync.elapsed() / 1000) << "s)";
|
||||||
|
|
||||||
if (quint64(_timeSinceLastSync.elapsed()) > MirallConfigFile().forceSyncInterval()) {
|
// Force sync if the last sync is a long time ago or if there was a serious problem.
|
||||||
qDebug() << "* Force Sync now";
|
if (quint64(_timeSinceLastSync.elapsed()) > MirallConfigFile().forceSyncInterval() ||
|
||||||
|
!(_syncResult.status() == SyncResult::Success || _syncResult.status() == SyncResult::Problem)) {
|
||||||
|
qDebug() << "** Force Sync now";
|
||||||
evaluateSync(QStringList());
|
evaluateSync(QStringList());
|
||||||
} else {
|
} else {
|
||||||
RequestEtagJob* job = new RequestEtagJob(secondPath(), this);
|
RequestEtagJob* job = new RequestEtagJob(secondPath(), this);
|
||||||
@@ -288,7 +313,7 @@ void Folder::bubbleUpSyncResult()
|
|||||||
foreach (const SyncFileItem &item, _syncResult.syncFileItemVector() ) {
|
foreach (const SyncFileItem &item, _syncResult.syncFileItemVector() ) {
|
||||||
if( item._instruction == CSYNC_INSTRUCTION_ERROR ) {
|
if( item._instruction == CSYNC_INSTRUCTION_ERROR ) {
|
||||||
slotCSyncError( tr("File %1: %2").arg(item._file).arg(item._errorString) );
|
slotCSyncError( tr("File %1: %2").arg(item._file).arg(item._errorString) );
|
||||||
logger->postGuiLog(tr("File %1").arg(item._file), item._errorString);
|
logger->postOptionalGuiLog(tr("File %1").arg(item._file), item._errorString);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (item._dir == SyncFileItem::Down) {
|
if (item._dir == SyncFileItem::Down) {
|
||||||
@@ -339,25 +364,25 @@ void Folder::bubbleUpSyncResult()
|
|||||||
if (newItems > 0) {
|
if (newItems > 0) {
|
||||||
QString file = QDir::toNativeSeparators(firstItemNew._file);
|
QString file = QDir::toNativeSeparators(firstItemNew._file);
|
||||||
if (newItems == 1)
|
if (newItems == 1)
|
||||||
logger->postGuiLog(tr("New file available"), tr("'%1' has been synced to this machine.").arg(file));
|
logger->postOptionalGuiLog(tr("New file available"), tr("'%1' has been synced to this machine.").arg(file));
|
||||||
else
|
else
|
||||||
logger->postGuiLog(tr("New files available"), tr("'%1' and %n other file(s) have been synced to this machine.",
|
logger->postOptionalGuiLog(tr("New files available"), tr("'%1' and %n other file(s) have been synced to this machine.",
|
||||||
"", newItems-1).arg(file));
|
"", newItems-1).arg(file));
|
||||||
}
|
}
|
||||||
if (removedItems > 0) {
|
if (removedItems > 0) {
|
||||||
QString file = QDir::toNativeSeparators(firstItemDeleted._file);
|
QString file = QDir::toNativeSeparators(firstItemDeleted._file);
|
||||||
if (removedItems == 1)
|
if (removedItems == 1)
|
||||||
logger->postGuiLog(tr("File removed"), tr("'%1' has been removed.").arg(file));
|
logger->postOptionalGuiLog(tr("File removed"), tr("'%1' has been removed.").arg(file));
|
||||||
else
|
else
|
||||||
logger->postGuiLog(tr("Files removed"), tr("'%1' and %n other file(s) have been removed.",
|
logger->postOptionalGuiLog(tr("Files removed"), tr("'%1' and %n other file(s) have been removed.",
|
||||||
"", removedItems-1).arg(file));
|
"", removedItems-1).arg(file));
|
||||||
}
|
}
|
||||||
if (updatedItems > 0) {
|
if (updatedItems > 0) {
|
||||||
QString file = QDir::toNativeSeparators(firstItemUpdated._file);
|
QString file = QDir::toNativeSeparators(firstItemUpdated._file);
|
||||||
if (updatedItems == 1)
|
if (updatedItems == 1)
|
||||||
logger->postGuiLog(tr("File updated"), tr("'%1' has been updated.").arg(file));
|
logger->postOptionalGuiLog(tr("File updated"), tr("'%1' has been updated.").arg(file));
|
||||||
else
|
else
|
||||||
logger->postGuiLog(tr("Files updated"), tr("'%1' and %n other file(s) have been updated.",
|
logger->postOptionalGuiLog(tr("Files updated"), tr("'%1' and %n other file(s) have been updated.",
|
||||||
"", updatedItems-1).arg(file));
|
"", updatedItems-1).arg(file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -399,7 +424,7 @@ void Folder::slotThreadTreeWalkResult(const SyncFileItemVector& items)
|
|||||||
|
|
||||||
void Folder::slotCatchWatcherError(const QString& error)
|
void Folder::slotCatchWatcherError(const QString& error)
|
||||||
{
|
{
|
||||||
Logger::instance()->postGuiLog(tr("Error"), error);
|
Logger::instance()->postOptionalGuiLog(tr("Error"), error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Folder::slotTerminateSync()
|
void Folder::slotTerminateSync()
|
||||||
@@ -432,6 +457,7 @@ void Folder::slotTerminateSync()
|
|||||||
_csyncError = true;
|
_csyncError = true;
|
||||||
qDebug() << "-> CSync Terminated!";
|
qDebug() << "-> CSync Terminated!";
|
||||||
slotCSyncFinished();
|
slotCSyncFinished();
|
||||||
|
setSyncEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This removes the csync File database if the sync folder definition is removed
|
// This removes the csync File database if the sync folder definition is removed
|
||||||
@@ -499,10 +525,21 @@ void Folder::setProxy()
|
|||||||
csync_set_module_property(_csync_ctx, "proxy_user", proxy.user().toUtf8().data() );
|
csync_set_module_property(_csync_ctx, "proxy_user", proxy.user().toUtf8().data() );
|
||||||
csync_set_module_property(_csync_ctx, "proxy_pwd" , proxy.password().toUtf8().data() );
|
csync_set_module_property(_csync_ctx, "proxy_pwd" , proxy.password().toUtf8().data() );
|
||||||
|
|
||||||
FolderMan::instance()->setDirtyProxy(false);
|
setProxyDirty(false);
|
||||||
|
} else {
|
||||||
|
qDebug() << "WRN: Unable to set Proxy without csync-ctx!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Folder::setProxyDirty(bool value)
|
||||||
|
{
|
||||||
|
_proxyDirty = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Folder::proxyDirty()
|
||||||
|
{
|
||||||
|
return _proxyDirty;
|
||||||
|
}
|
||||||
|
|
||||||
const char* Folder::proxyTypeToCStr(QNetworkProxy::ProxyType type)
|
const char* Folder::proxyTypeToCStr(QNetworkProxy::ProxyType type)
|
||||||
{
|
{
|
||||||
@@ -538,7 +575,7 @@ void Folder::startSync(const QStringList &pathList)
|
|||||||
QMetaObject::invokeMethod(this, "slotCSyncFinished", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(this, "slotCSyncFinished", Qt::QueuedConnection);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (FolderMan::instance()->isDirtyProxy()) {
|
} else if (proxyDirty()) {
|
||||||
setProxy();
|
setProxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,7 +598,6 @@ void Folder::startSync(const QStringList &pathList)
|
|||||||
|
|
||||||
qDebug() << "*** Start syncing";
|
qDebug() << "*** Start syncing";
|
||||||
_thread = new QThread(this);
|
_thread = new QThread(this);
|
||||||
_thread->setPriority(QThread::LowPriority);
|
|
||||||
setIgnoredFiles();
|
setIgnoredFiles();
|
||||||
_csync = new CSyncThread( _csync_ctx );
|
_csync = new CSyncThread( _csync_ctx );
|
||||||
_csync->moveToThread(_thread);
|
_csync->moveToThread(_thread);
|
||||||
@@ -584,6 +620,7 @@ void Folder::startSync(const QStringList &pathList)
|
|||||||
connect(_csync, SIGNAL(transmissionProgress(Progress::Info)), this, SLOT(slotTransmissionProgress(Progress::Info)));
|
connect(_csync, SIGNAL(transmissionProgress(Progress::Info)), this, SLOT(slotTransmissionProgress(Progress::Info)));
|
||||||
|
|
||||||
_thread->start();
|
_thread->start();
|
||||||
|
_thread->setPriority(QThread::LowPriority);
|
||||||
QMetaObject::invokeMethod(_csync, "startSync", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(_csync, "startSync", Qt::QueuedConnection);
|
||||||
|
|
||||||
// disable events until syncing is done
|
// disable events until syncing is done
|
||||||
@@ -612,10 +649,13 @@ void Folder::slotCsyncUnavailable()
|
|||||||
|
|
||||||
void Folder::slotCSyncFinished()
|
void Folder::slotCSyncFinished()
|
||||||
{
|
{
|
||||||
qDebug() << "-> CSync Finished slot with error " << _csyncError;
|
qDebug() << "-> CSync Finished slot for" << alias() << "with error" << _csyncError;
|
||||||
_watcher->setEventsEnabledDelayed(2000);
|
if( syncEnabled() && userSyncEnabled() ) {
|
||||||
_pollTimer.start();
|
qDebug() << "Sync is enabled - starting the polltimer again.";
|
||||||
_timeSinceLastSync.restart();
|
_watcher->setEventsEnabledDelayed(2000);
|
||||||
|
_pollTimer.start();
|
||||||
|
_timeSinceLastSync.restart();
|
||||||
|
}
|
||||||
|
|
||||||
bubbleUpSyncResult();
|
bubbleUpSyncResult();
|
||||||
|
|
||||||
|
|||||||
@@ -150,6 +150,16 @@ public slots:
|
|||||||
*/
|
*/
|
||||||
void startSync(const QStringList &pathList = QStringList());
|
void startSync(const QStringList &pathList = QStringList());
|
||||||
|
|
||||||
|
void setProxyDirty(bool value);
|
||||||
|
bool proxyDirty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief slotSetSyncUserEnabled - slot that sets the enable/disable flag from the GUI
|
||||||
|
* @param enable
|
||||||
|
*/
|
||||||
|
void slotSetSyncUserEnabled( bool enable );
|
||||||
|
bool userSyncEnabled();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotCSyncStarted();
|
void slotCSyncStarted();
|
||||||
void slotCSyncError(const QString& );
|
void slotCSyncError(const QString& );
|
||||||
@@ -194,6 +204,7 @@ protected:
|
|||||||
QString _configFile;
|
QString _configFile;
|
||||||
QFileSystemWatcher *_pathWatcher;
|
QFileSystemWatcher *_pathWatcher;
|
||||||
bool _enabled;
|
bool _enabled;
|
||||||
|
bool _userSyncEnabled; // enabled by user interaction?
|
||||||
FolderWatcher *_watcher;
|
FolderWatcher *_watcher;
|
||||||
SyncResult _syncResult;
|
SyncResult _syncResult;
|
||||||
QThread *_thread;
|
QThread *_thread;
|
||||||
@@ -202,6 +213,7 @@ protected:
|
|||||||
bool _csyncError;
|
bool _csyncError;
|
||||||
bool _csyncUnavail;
|
bool _csyncUnavail;
|
||||||
bool _wipeDb;
|
bool _wipeDb;
|
||||||
|
bool _proxyDirty;
|
||||||
Progress::Kind _progressKind;
|
Progress::Kind _progressKind;
|
||||||
QTimer _pollTimer;
|
QTimer _pollTimer;
|
||||||
QString _lastEtag;
|
QString _lastEtag;
|
||||||
|
|||||||
@@ -37,8 +37,7 @@ FolderMan* FolderMan::_instance = 0;
|
|||||||
|
|
||||||
FolderMan::FolderMan(QObject *parent) :
|
FolderMan::FolderMan(QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
_syncEnabled( true ),
|
_syncEnabled( true )
|
||||||
_dirtyProxy( true )
|
|
||||||
{
|
{
|
||||||
// if QDir::mkpath would not be so stupid, I would not need to have this
|
// if QDir::mkpath would not be so stupid, I would not need to have this
|
||||||
// duplication of folderConfigPath() here
|
// duplication of folderConfigPath() here
|
||||||
@@ -270,7 +269,7 @@ Folder* FolderMan::setupFolderFromConfigFile(const QString &file) {
|
|||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FolderMan::slotEnableFolder( const QString& alias, bool enable )
|
void FolderMan::slotGuiPauseFolder( const QString& alias, bool enable )
|
||||||
{
|
{
|
||||||
if( ! _folderMap.contains( alias ) ) {
|
if( ! _folderMap.contains( alias ) ) {
|
||||||
qDebug() << "!! Can not enable alias " << alias << ", can not be found in folderMap.";
|
qDebug() << "!! Can not enable alias " << alias << ", can not be found in folderMap.";
|
||||||
@@ -279,7 +278,8 @@ void FolderMan::slotEnableFolder( const QString& alias, bool enable )
|
|||||||
|
|
||||||
Folder *f = _folderMap[alias];
|
Folder *f = _folderMap[alias];
|
||||||
if( f ) {
|
if( f ) {
|
||||||
f->setSyncEnabled(enable);
|
f->slotSetSyncUserEnabled(enable);
|
||||||
|
f->evaluateSync(QStringList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -361,6 +361,10 @@ void FolderMan::setSyncEnabled( bool enabled )
|
|||||||
QTimer::singleShot(200, this, SLOT(slotScheduleFolderSync()));
|
QTimer::singleShot(200, this, SLOT(slotScheduleFolderSync()));
|
||||||
}
|
}
|
||||||
_syncEnabled = enabled;
|
_syncEnabled = enabled;
|
||||||
|
|
||||||
|
foreach( Folder *f, _folderMap.values() ) {
|
||||||
|
f->setSyncEnabled(enabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -386,8 +390,8 @@ void FolderMan::slotScheduleFolderSync()
|
|||||||
if( _folderMap.contains( alias ) ) {
|
if( _folderMap.contains( alias ) ) {
|
||||||
ownCloudInfo::instance()->getQuotaRequest("/");
|
ownCloudInfo::instance()->getQuotaRequest("/");
|
||||||
Folder *f = _folderMap[alias];
|
Folder *f = _folderMap[alias];
|
||||||
_currentSyncFolder = alias;
|
if( f->syncEnabled() ) {
|
||||||
if (f->syncEnabled()) {
|
_currentSyncFolder = alias;
|
||||||
f->startSync( QStringList() );
|
f->startSync( QStringList() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -467,7 +471,10 @@ void FolderMan::removeFolder( const QString& alias )
|
|||||||
qDebug() << "Remove folder config file " << file.fileName();
|
qDebug() << "Remove folder config file " << file.fileName();
|
||||||
file.remove();
|
file.remove();
|
||||||
}
|
}
|
||||||
f->deleteLater();
|
// FIXME: this is a temporar dirty fix against a crash happening because
|
||||||
|
// the csync owncloud module still has static components. Activate the
|
||||||
|
// delete once the module is fixed.
|
||||||
|
// f->deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,6 +520,14 @@ bool FolderMan::startFromScratch( const QString& localFolder )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FolderMan::setDirtyProxy(bool value)
|
||||||
|
{
|
||||||
|
foreach( Folder *f, _folderMap.values() ) {
|
||||||
|
f->setProxyDirty(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SyncResult FolderMan::accountStatus(const QList<Folder*> &folders)
|
SyncResult FolderMan::accountStatus(const QList<Folder*> &folders)
|
||||||
{
|
{
|
||||||
SyncResult overallResult(SyncResult::Undefined);
|
SyncResult overallResult(SyncResult::Undefined);
|
||||||
@@ -538,6 +553,7 @@ SyncResult FolderMan::accountStatus(const QList<Folder*> &folders)
|
|||||||
case SyncResult::Unavailable:
|
case SyncResult::Unavailable:
|
||||||
overallResult.setStatus( SyncResult::Unavailable );
|
overallResult.setStatus( SyncResult::Unavailable );
|
||||||
break;
|
break;
|
||||||
|
case SyncResult::Problem:
|
||||||
case SyncResult::Success:
|
case SyncResult::Success:
|
||||||
if( overallResult.status() == SyncResult::Undefined )
|
if( overallResult.status() == SyncResult::Undefined )
|
||||||
overallResult.setStatus( SyncResult::Success );
|
overallResult.setStatus( SyncResult::Success );
|
||||||
@@ -549,10 +565,7 @@ SyncResult FolderMan::accountStatus(const QList<Folder*> &folders)
|
|||||||
if ( overallResult.status() != SyncResult::Error )
|
if ( overallResult.status() != SyncResult::Error )
|
||||||
overallResult.setStatus( SyncResult::SetupError );
|
overallResult.setStatus( SyncResult::SetupError );
|
||||||
break;
|
break;
|
||||||
case SyncResult::Problem:
|
|
||||||
if ( overallResult.status() != SyncResult::Problem )
|
|
||||||
overallResult.setStatus( SyncResult::Problem );
|
|
||||||
break;
|
|
||||||
// no default case on purpose, check compiler warnings
|
// no default case on purpose, check compiler warnings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ signals:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void slotRemoveFolder( const QString& );
|
void slotRemoveFolder( const QString& );
|
||||||
void slotEnableFolder( const QString&, bool );
|
void slotGuiPauseFolder( const QString&, bool );
|
||||||
|
|
||||||
void slotFolderSyncStarted();
|
void slotFolderSyncStarted();
|
||||||
void slotFolderSyncFinished( const SyncResult& );
|
void slotFolderSyncFinished( const SyncResult& );
|
||||||
@@ -109,8 +109,7 @@ public slots:
|
|||||||
|
|
||||||
void slotScheduleAllFolders();
|
void slotScheduleAllFolders();
|
||||||
|
|
||||||
bool isDirtyProxy() { return _dirtyProxy; }
|
void setDirtyProxy(bool value = true);
|
||||||
void setDirtyProxy(bool value = true) { _dirtyProxy = value; }
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// slot to add a folder to the syncing queue
|
// slot to add a folder to the syncing queue
|
||||||
|
|||||||
@@ -81,8 +81,9 @@ QSize FolderStatusDelegate::sizeHint(const QStyleOptionViewItem & option ,
|
|||||||
h += aliasMargin; // bottom margin
|
h += aliasMargin; // bottom margin
|
||||||
|
|
||||||
// add some space to show an error condition.
|
// add some space to show an error condition.
|
||||||
if( ! qvariant_cast<QString>(index.data(FolderErrorMsg)).isEmpty() ) {
|
if( ! qvariant_cast<QStringList>(index.data(FolderErrorMsg)).isEmpty() ) {
|
||||||
h += aliasMargin*2+fm.height();
|
QStringList errMsgs = qvariant_cast<QStringList>(index.data(FolderErrorMsg));
|
||||||
|
h += aliasMargin*2 + errMsgs.count()*fm.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( qvariant_cast<bool>(index.data(AddProgressSpace)) ) {
|
if( qvariant_cast<bool>(index.data(AddProgressSpace)) ) {
|
||||||
@@ -122,7 +123,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||||||
QString aliasText = qvariant_cast<QString>(index.data(FolderAliasRole));
|
QString aliasText = qvariant_cast<QString>(index.data(FolderAliasRole));
|
||||||
QString pathText = qvariant_cast<QString>(index.data(FolderPathRole));
|
QString pathText = qvariant_cast<QString>(index.data(FolderPathRole));
|
||||||
QString remotePath = qvariant_cast<QString>(index.data(FolderSecondPathRole));
|
QString remotePath = qvariant_cast<QString>(index.data(FolderSecondPathRole));
|
||||||
QString errorText = qvariant_cast<QString>(index.data(FolderErrorMsg));
|
QStringList errorTexts= qvariant_cast<QStringList>(index.data(FolderErrorMsg));
|
||||||
|
|
||||||
int overallPercent = qvariant_cast<int>(index.data(SyncProgressOverallPercent));
|
int overallPercent = qvariant_cast<int>(index.data(SyncProgressOverallPercent));
|
||||||
QString overallString = qvariant_cast<QString>(index.data(SyncProgressOverallString));
|
QString overallString = qvariant_cast<QString>(index.data(SyncProgressOverallString));
|
||||||
@@ -211,12 +212,12 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||||||
// paint an error overlay if there is an error string
|
// paint an error overlay if there is an error string
|
||||||
|
|
||||||
int h = iconRect.bottom();
|
int h = iconRect.bottom();
|
||||||
if( !errorText.isEmpty() ) {
|
if( !errorTexts.isEmpty() ) {
|
||||||
h += aliasMargin;
|
h += aliasMargin;
|
||||||
QRect errorRect = localPathRect;
|
QRect errorRect = localPathRect;
|
||||||
errorRect.setLeft( iconRect.left());
|
errorRect.setLeft( iconRect.left());
|
||||||
errorRect.setTop( h );
|
errorRect.setTop( h );
|
||||||
errorRect.setHeight(subFm.height()+aliasMargin);
|
errorRect.setHeight(errorTexts.count() * subFm.height()+aliasMargin);
|
||||||
errorRect.setRight( option.rect.right()-aliasMargin );
|
errorRect.setRight( option.rect.right()-aliasMargin );
|
||||||
|
|
||||||
painter->setBrush( QColor(0xbb, 0x4d, 0x4d) );
|
painter->setBrush( QColor(0xbb, 0x4d, 0x4d) );
|
||||||
@@ -226,15 +227,16 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||||||
painter->setPen( Qt::white );
|
painter->setPen( Qt::white );
|
||||||
painter->setFont(errorFont);
|
painter->setFont(errorFont);
|
||||||
QRect errorTextRect = errorRect;
|
QRect errorTextRect = errorRect;
|
||||||
errorTextRect.setLeft( errorTextRect.left()+aliasMargin +16);
|
errorTextRect.setLeft( errorTextRect.left()+aliasMargin );
|
||||||
errorTextRect.setTop( errorTextRect.top()+aliasMargin/2 );
|
errorTextRect.setTop( errorTextRect.top()+aliasMargin/2 );
|
||||||
|
|
||||||
int linebreak = errorText.indexOf(QLatin1String("<br"));
|
int x = errorTextRect.left();
|
||||||
QString eText = errorText;
|
int y = errorTextRect.top()+aliasMargin/2 + subFm.height()/2;
|
||||||
if(linebreak) {
|
|
||||||
eText = errorText.left(linebreak);
|
foreach( QString eText, errorTexts ) {
|
||||||
|
painter->drawText(x, y, subFm.elidedText( eText, Qt::ElideLeft, errorTextRect.width()-2*aliasMargin));
|
||||||
|
y += subFm.height();
|
||||||
}
|
}
|
||||||
painter->drawText(errorTextRect, eText);
|
|
||||||
|
|
||||||
h = errorRect.bottom();
|
h = errorRect.bottom();
|
||||||
}
|
}
|
||||||
@@ -249,8 +251,8 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
// Sizes-Text
|
// Sizes-Text
|
||||||
QRect octetRect = subFm.boundingRect( overallString );
|
QRect octetRect = progressFm.boundingRect( overallString );
|
||||||
int progressTextWidth = octetRect.width();
|
int progressTextWidth = octetRect.width() + 2;
|
||||||
|
|
||||||
// Overall Progress Bar.
|
// Overall Progress Bar.
|
||||||
QRect pBRect;
|
QRect pBRect;
|
||||||
@@ -279,8 +281,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||||||
overallProgressRect.setWidth( progressTextWidth );
|
overallProgressRect.setWidth( progressTextWidth );
|
||||||
painter->setFont(progressFont);
|
painter->setFont(progressFont);
|
||||||
|
|
||||||
QString elidedText = progressFm.elidedText(overallString, Qt::ElideLeft, overallProgressRect.width());
|
painter->drawText( overallProgressRect, Qt::AlignRight+Qt::AlignVCenter, overallString);
|
||||||
painter->drawText( overallProgressRect, Qt::AlignRight+Qt::AlignVCenter, elidedText);
|
|
||||||
// painter->drawRect(overallProgressRect);
|
// painter->drawRect(overallProgressRect);
|
||||||
|
|
||||||
// Individual File Progress
|
// Individual File Progress
|
||||||
@@ -289,7 +290,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
|
|||||||
fileRect.setLeft( iconRect.left());
|
fileRect.setLeft( iconRect.left());
|
||||||
fileRect.setWidth(overallWidth);
|
fileRect.setWidth(overallWidth);
|
||||||
fileRect.setHeight(fileNameTextHeight);
|
fileRect.setHeight(fileNameTextHeight);
|
||||||
elidedText = progressFm.elidedText(itemString, Qt::ElideLeft, fileRect.width());
|
QString elidedText = progressFm.elidedText(itemString, Qt::ElideLeft, fileRect.width());
|
||||||
|
|
||||||
painter->drawText( fileRect, Qt::AlignLeft+Qt::AlignVCenter, elidedText);
|
painter->drawText( fileRect, Qt::AlignLeft+Qt::AlignVCenter, elidedText);
|
||||||
|
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ void FolderWatcher::addIgnoreListFile( const QString& file )
|
|||||||
|
|
||||||
while (!infile.atEnd()) {
|
while (!infile.atEnd()) {
|
||||||
QString line = QString::fromLocal8Bit( infile.readLine() ).trimmed();
|
QString line = QString::fromLocal8Bit( infile.readLine() ).trimmed();
|
||||||
if( !line.startsWith( QLatin1Char('#') ) && line.isEmpty() ) {
|
if( !(line.startsWith( QLatin1Char('#') ) || line.isEmpty()) ) {
|
||||||
_ignores.append(line);
|
_ignores.append(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,16 @@ void FolderWatcherPrivate::slotINotifyEvent(int mask, int /*cookie*/, const QStr
|
|||||||
//qDebug() << cookie << " OTHER " << mask << " :" << path;
|
//qDebug() << cookie << " OTHER " << mask << " :" << path;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (const QString& pattern, _parent->ignores()) {
|
QStringList ignores = _parent->ignores();
|
||||||
|
|
||||||
|
if( path.endsWith(".csync_journal.db.ctmp") ||
|
||||||
|
path.endsWith(".csync_journal.db.ctmp-journal") ||
|
||||||
|
path.endsWith(".csync_journal.db")) {
|
||||||
|
qDebug() << " ** Inotify ignored for " <<path;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (const QString& pattern, ignores) {
|
||||||
QRegExp regexp(pattern);
|
QRegExp regexp(pattern);
|
||||||
regexp.setPatternSyntax(QRegExp::Wildcard);
|
regexp.setPatternSyntax(QRegExp::Wildcard);
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mirall/folderwizard.h"
|
#include "mirall/folderwizard.h"
|
||||||
|
#include "mirall/folderman.h"
|
||||||
#include "mirall/owncloudinfo.h"
|
#include "mirall/owncloudinfo.h"
|
||||||
#include "mirall/mirallconfigfile.h"
|
#include "mirall/mirallconfigfile.h"
|
||||||
#include "mirall/theme.h"
|
#include "mirall/theme.h"
|
||||||
@@ -242,6 +243,7 @@ static void recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QStr
|
|||||||
item = new QTreeWidgetItem(parent);
|
item = new QTreeWidgetItem(parent);
|
||||||
item->setIcon(0, folderIcon);
|
item->setIcon(0, folderIcon);
|
||||||
item->setText(0, pathTrail.first());
|
item->setText(0, pathTrail.first());
|
||||||
|
item->setData(0, Qt::UserRole, pathTrail.first());
|
||||||
item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
|
item->setChildIndicatorPolicy(QTreeWidgetItem::ShowIndicator);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,17 +254,13 @@ static void recursiveInsert(QTreeWidgetItem *parent, QStringList pathTrail, QStr
|
|||||||
|
|
||||||
void FolderWizardTargetPage::slotUpdateDirectories(QStringList list)
|
void FolderWizardTargetPage::slotUpdateDirectories(QStringList list)
|
||||||
{
|
{
|
||||||
QFileIconProvider prov;
|
|
||||||
QIcon folderIcon = prov.icon(QFileIconProvider::Folder);
|
|
||||||
|
|
||||||
QString webdavFolder = QUrl(ownCloudInfo::instance()->webdavUrl()).path();
|
QString webdavFolder = QUrl(ownCloudInfo::instance()->webdavUrl()).path();
|
||||||
connect(_ui.folderTreeWidget, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(slotItemExpanded(QTreeWidgetItem*)));
|
|
||||||
|
|
||||||
QTreeWidgetItem *root = _ui.folderTreeWidget->topLevelItem(0);
|
QTreeWidgetItem *root = _ui.folderTreeWidget->topLevelItem(0);
|
||||||
if (!root) {
|
if (!root) {
|
||||||
root = new QTreeWidgetItem(_ui.folderTreeWidget);
|
root = new QTreeWidgetItem(_ui.folderTreeWidget);
|
||||||
root->setText(0, tr("Root (\"/\")", "root folder"));
|
root->setText(0, Theme::instance()->appNameGUI());
|
||||||
root->setIcon(0, folderIcon);
|
root->setIcon(0, Theme::instance()->applicationIcon());
|
||||||
root->setToolTip(0, tr("Choose this to sync the entire account"));
|
root->setToolTip(0, tr("Choose this to sync the entire account"));
|
||||||
root->setData(0, Qt::UserRole, "/");
|
root->setData(0, Qt::UserRole, "/");
|
||||||
}
|
}
|
||||||
@@ -283,7 +281,7 @@ void FolderWizardTargetPage::slotRefreshFolders()
|
|||||||
|
|
||||||
void FolderWizardTargetPage::slotItemExpanded(QTreeWidgetItem *item)
|
void FolderWizardTargetPage::slotItemExpanded(QTreeWidgetItem *item)
|
||||||
{
|
{
|
||||||
ownCloudInfo::instance()->getDirectoryListing(item->text(0));
|
ownCloudInfo::instance()->getDirectoryListing(item->data(0, Qt::UserRole).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
FolderWizardTargetPage::~FolderWizardTargetPage()
|
FolderWizardTargetPage::~FolderWizardTargetPage()
|
||||||
@@ -298,6 +296,22 @@ bool FolderWizardTargetPage::isComplete() const
|
|||||||
QString dir = _ui.folderTreeWidget->currentItem()->data(0, Qt::UserRole).toString();
|
QString dir = _ui.folderTreeWidget->currentItem()->data(0, Qt::UserRole).toString();
|
||||||
wizard()->setProperty("targetPath", dir);
|
wizard()->setProperty("targetPath", dir);
|
||||||
|
|
||||||
|
Folder::Map map = _folderMap;
|
||||||
|
Folder::Map::const_iterator i = map.constBegin();
|
||||||
|
for(i = map.constBegin();i != map.constEnd(); i++ ) {
|
||||||
|
Folder *f = static_cast<Folder*>(i.value());
|
||||||
|
QString curDir = f->secondPath();
|
||||||
|
if (dir == curDir) {
|
||||||
|
showWarn( tr("This directory is already being synced.") );
|
||||||
|
return false;
|
||||||
|
} else if (dir.startsWith(curDir)) {
|
||||||
|
if (dir.isEmpty()) dir = QLatin1Char('/');
|
||||||
|
if (curDir.isEmpty()) curDir = QLatin1Char('/');
|
||||||
|
showWarn( tr("You are already syncing <i>%1</i>, which is a parent folder of <i>%2</i>.").arg(curDir).arg(dir) );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( dir == QLatin1String("/") ) {
|
if( dir == QLatin1String("/") ) {
|
||||||
showWarn( tr("If you sync the root folder, you can <b>not</b> configure another sync directory."));
|
showWarn( tr("If you sync the root folder, you can <b>not</b> configure another sync directory."));
|
||||||
return true;
|
return true;
|
||||||
@@ -325,6 +339,8 @@ void FolderWizardTargetPage::initializePage()
|
|||||||
SLOT(slotCreateRemoteFolderFinished( QNetworkReply::NetworkError )));
|
SLOT(slotCreateRemoteFolderFinished( QNetworkReply::NetworkError )));
|
||||||
connect( ocInfo, SIGNAL(directoryListingUpdated(QStringList)),
|
connect( ocInfo, SIGNAL(directoryListingUpdated(QStringList)),
|
||||||
SLOT(slotUpdateDirectories(QStringList)));
|
SLOT(slotUpdateDirectories(QStringList)));
|
||||||
|
connect(_ui.folderTreeWidget, SIGNAL(itemExpanded(QTreeWidgetItem*)),
|
||||||
|
SLOT(slotItemExpanded(QTreeWidgetItem*)));
|
||||||
|
|
||||||
slotRefreshFolders();
|
slotRefreshFolders();
|
||||||
}
|
}
|
||||||
@@ -370,6 +386,7 @@ FolderWizard::~FolderWizard()
|
|||||||
void FolderWizard::setFolderMap( const Folder::Map& fm)
|
void FolderWizard::setFolderMap( const Folder::Map& fm)
|
||||||
{
|
{
|
||||||
_folderWizardSourcePage->setFolderMap( fm );
|
_folderWizardSourcePage->setFolderMap( fm );
|
||||||
|
_folderWizardTargetPage->setFolderMap( fm );
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ public:
|
|||||||
virtual void initializePage();
|
virtual void initializePage();
|
||||||
virtual void cleanupPage();
|
virtual void cleanupPage();
|
||||||
|
|
||||||
|
void setFolderMap( const Folder::Map &fm ) { _folderMap = fm; }
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
|
|
||||||
void showWarn( const QString& = QString() ) const;
|
void showWarn( const QString& = QString() ) const;
|
||||||
@@ -83,6 +85,7 @@ private:
|
|||||||
ownCloudInfo *_ownCloudDirCheck;
|
ownCloudInfo *_ownCloudDirCheck;
|
||||||
bool _dirChecked;
|
bool _dirChecked;
|
||||||
bool _warnWasVisible;
|
bool _warnWasVisible;
|
||||||
|
Folder::Map _folderMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ void INotify::slotActivated(int /*fd*/)
|
|||||||
// with the help of watch descriptor, retrieve, corresponding INotify
|
// with the help of watch descriptor, retrieve, corresponding INotify
|
||||||
if (event == NULL) {
|
if (event == NULL) {
|
||||||
qDebug() << "NULL event";
|
qDebug() << "NULL event";
|
||||||
|
i += sizeof(struct inotify_event);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ ItemProgressDialog::ItemProgressDialog(Application*, QWidget *parent) :
|
|||||||
connect(ProgressDispatcher::instance(), SIGNAL(progressSyncProblem(const QString&,const Progress::SyncProblem&)),
|
connect(ProgressDispatcher::instance(), SIGNAL(progressSyncProblem(const QString&,const Progress::SyncProblem&)),
|
||||||
this, SLOT(slotProgressErrors(const QString&, const Progress::SyncProblem&)));
|
this, SLOT(slotProgressErrors(const QString&, const Progress::SyncProblem&)));
|
||||||
|
|
||||||
|
// Adjust copyToClipboard() when making changes here!
|
||||||
QStringList header;
|
QStringList header;
|
||||||
header << tr("Time");
|
header << tr("Time");
|
||||||
header << tr("File");
|
header << tr("File");
|
||||||
@@ -210,13 +211,16 @@ void ItemProgressDialog::copyToClipboard()
|
|||||||
int topLevelItems = _ui->_treeWidget->topLevelItemCount();
|
int topLevelItems = _ui->_treeWidget->topLevelItemCount();
|
||||||
for (int i = 0; i < topLevelItems; i++) {
|
for (int i = 0; i < topLevelItems; i++) {
|
||||||
QTreeWidgetItem *child = _ui->_treeWidget->topLevelItem(i);
|
QTreeWidgetItem *child = _ui->_treeWidget->topLevelItem(i);
|
||||||
// time stamp
|
ts << left
|
||||||
ts << left << qSetFieldWidth(10)
|
// time stamp
|
||||||
|
<< qSetFieldWidth(10)
|
||||||
<< child->data(0,Qt::DisplayRole).toString()
|
<< child->data(0,Qt::DisplayRole).toString()
|
||||||
// file name
|
// file name
|
||||||
<< qSetFieldWidth(64)
|
<< qSetFieldWidth(64)
|
||||||
<< child->data(1,Qt::DisplayRole).toString()
|
<< child->data(1,Qt::DisplayRole).toString()
|
||||||
<< qSetFieldWidth(0) << ' '
|
// folder
|
||||||
|
<< qSetFieldWidth(15)
|
||||||
|
<< child->data(2, Qt::DisplayRole).toString()
|
||||||
// action
|
// action
|
||||||
<< qSetFieldWidth(15)
|
<< qSetFieldWidth(15)
|
||||||
<< child->data(3, Qt::DisplayRole).toString()
|
<< child->data(3, Qt::DisplayRole).toString()
|
||||||
|
|||||||
@@ -127,11 +127,16 @@ LogBrowser::LogBrowser(QWidget *parent) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogBrowser::~LogBrowser()
|
LogBrowser::~LogBrowser()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void LogBrowser::closeEvent(QCloseEvent *)
|
||||||
{
|
{
|
||||||
MirallConfigFile cfg;
|
MirallConfigFile cfg;
|
||||||
cfg.saveGeometry(this);
|
cfg.saveGeometry(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LogBrowser::slotNewLog( const QString& msg )
|
void LogBrowser::slotNewLog( const QString& msg )
|
||||||
{
|
{
|
||||||
if( _logWidget->isVisible() ) {
|
if( _logWidget->isVisible() ) {
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ public:
|
|||||||
|
|
||||||
void setLogFile(const QString& , bool );
|
void setLogFile(const QString& , bool );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void closeEvent(QCloseEvent *);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void slotNewLog( const QString &msg );
|
void slotNewLog( const QString &msg );
|
||||||
void slotFind();
|
void slotFind();
|
||||||
|
|||||||
@@ -138,7 +138,8 @@ QNetworkReply* ownCloudInfo::mkdirRequest( const QString& dir )
|
|||||||
qDebug() << "OCInfo Making dir " << dir;
|
qDebug() << "OCInfo Making dir " << dir;
|
||||||
_authAttempts = 0;
|
_authAttempts = 0;
|
||||||
QNetworkRequest req;
|
QNetworkRequest req;
|
||||||
QUrl url = QUrl(webdavUrl(_connection));
|
QUrl url( webdavUrl(_connection) );
|
||||||
|
// ensure #, ? and co are interpreted as part of the path and nothing else
|
||||||
url.setEncodedPath(url.encodedPath()+QUrl::toPercentEncoding(dir, "/"));
|
url.setEncodedPath(url.encodedPath()+QUrl::toPercentEncoding(dir, "/"));
|
||||||
|
|
||||||
req.setUrl( url );
|
req.setUrl( url );
|
||||||
@@ -162,7 +163,7 @@ QNetworkReply* ownCloudInfo::mkdirRequest( const QString& dir )
|
|||||||
QNetworkReply* ownCloudInfo::getQuotaRequest( const QString& dir )
|
QNetworkReply* ownCloudInfo::getQuotaRequest( const QString& dir )
|
||||||
{
|
{
|
||||||
QNetworkRequest req;
|
QNetworkRequest req;
|
||||||
req.setUrl( QUrl( webdavUrl(_connection) + dir ) );
|
req.setUrl( QUrl( webdavUrl(_connection) + QUrl::toPercentEncoding(dir, "/") ) );
|
||||||
req.setRawHeader("Depth", "0");
|
req.setRawHeader("Depth", "0");
|
||||||
QByteArray xml("<?xml version=\"1.0\" ?>\n"
|
QByteArray xml("<?xml version=\"1.0\" ?>\n"
|
||||||
"<d:propfind xmlns:d=\"DAV:\">\n"
|
"<d:propfind xmlns:d=\"DAV:\">\n"
|
||||||
@@ -190,7 +191,10 @@ QNetworkReply* ownCloudInfo::getQuotaRequest( const QString& dir )
|
|||||||
QNetworkReply* ownCloudInfo::getDirectoryListing( const QString& dir )
|
QNetworkReply* ownCloudInfo::getDirectoryListing( const QString& dir )
|
||||||
{
|
{
|
||||||
QNetworkRequest req;
|
QNetworkRequest req;
|
||||||
req.setUrl( QUrl( webdavUrl(_connection) + dir ) );
|
QUrl url( webdavUrl(_connection) );
|
||||||
|
// ensure #, ? and co are interpreted as part of the path and nothing else
|
||||||
|
url.setPath(url.path() + dir );
|
||||||
|
req.setUrl( url );
|
||||||
req.setRawHeader("Depth", "1");
|
req.setRawHeader("Depth", "1");
|
||||||
QByteArray xml("<?xml version=\"1.0\" ?>\n"
|
QByteArray xml("<?xml version=\"1.0\" ?>\n"
|
||||||
"<d:propfind xmlns:d=\"DAV:\">\n"
|
"<d:propfind xmlns:d=\"DAV:\">\n"
|
||||||
|
|||||||
@@ -63,8 +63,15 @@ OwncloudSetupWizard::~OwncloudSetupWizard()
|
|||||||
|
|
||||||
void OwncloudSetupWizard::runWizard(QObject* obj, const char* amember, QWidget *parent)
|
void OwncloudSetupWizard::runWizard(QObject* obj, const char* amember, QWidget *parent)
|
||||||
{
|
{
|
||||||
OwncloudSetupWizard *wiz = new OwncloudSetupWizard(parent);
|
static QPointer<OwncloudSetupWizard> wiz;
|
||||||
|
|
||||||
|
if (!wiz.isNull()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wiz = new OwncloudSetupWizard(parent);
|
||||||
connect( wiz, SIGNAL(ownCloudWizardDone(int)), obj, amember);
|
connect( wiz, SIGNAL(ownCloudWizardDone(int)), obj, amember);
|
||||||
|
connect( wiz, SIGNAL(ownCloudWizardDone(int)), wiz, SLOT(deleteLater()));
|
||||||
FolderMan::instance()->setSyncEnabled(false);
|
FolderMan::instance()->setSyncEnabled(false);
|
||||||
wiz->startWizard();
|
wiz->startWizard();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,11 +171,17 @@ void ProgressDispatcher::setProgressInfo(const QString& folder, const Progress::
|
|||||||
} else {
|
} else {
|
||||||
if( newProgress.kind == Progress::StartSync ) {
|
if( newProgress.kind == Progress::StartSync ) {
|
||||||
_recentProblems.clear();
|
_recentProblems.clear();
|
||||||
|
_timer.start();
|
||||||
}
|
}
|
||||||
if( newProgress.kind == Progress::EndSync ) {
|
if( newProgress.kind == Progress::EndSync ) {
|
||||||
newProgress.overall_current_bytes = newProgress.overall_transmission_size;
|
newProgress.overall_current_bytes = newProgress.overall_transmission_size;
|
||||||
newProgress.current_file_no = newProgress.overall_file_count;
|
newProgress.current_file_no = newProgress.overall_file_count;
|
||||||
_currentAction.remove(newProgress.folder);
|
_currentAction.remove(newProgress.folder);
|
||||||
|
qint64 msecs = _timer.elapsed();
|
||||||
|
|
||||||
|
qDebug()<< "[PROGRESS] progressed " << newProgress.overall_transmission_size
|
||||||
|
<< " bytes in " << newProgress.overall_file_count << " files"
|
||||||
|
<< " in msec " << msecs;
|
||||||
}
|
}
|
||||||
if( newProgress.kind == Progress::EndDownload ||
|
if( newProgress.kind == Progress::EndDownload ||
|
||||||
newProgress.kind == Progress::EndUpload ||
|
newProgress.kind == Progress::EndUpload ||
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QQueue>
|
#include <QQueue>
|
||||||
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
namespace Mirall {
|
namespace Mirall {
|
||||||
|
|
||||||
@@ -116,6 +117,8 @@ private:
|
|||||||
QList<Progress::SyncProblem> _recentProblems;
|
QList<Progress::SyncProblem> _recentProblems;
|
||||||
|
|
||||||
QHash<QString, Progress::Kind> _currentAction;
|
QHash<QString, Progress::Kind> _currentAction;
|
||||||
|
|
||||||
|
QElapsedTimer _timer;
|
||||||
static ProgressDispatcher* _instance;
|
static ProgressDispatcher* _instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -95,15 +95,29 @@ SettingsDialog::SettingsDialog(Application *app, QWidget *parent) :
|
|||||||
connect(showLogWindow, SIGNAL(triggered()), app, SLOT(slotOpenLogBrowser()));
|
connect(showLogWindow, SIGNAL(triggered()), app, SLOT(slotOpenLogBrowser()));
|
||||||
addAction(showLogWindow);
|
addAction(showLogWindow);
|
||||||
|
|
||||||
|
int iconSize = 32;
|
||||||
|
QListWidget *listWidget = _ui->labelWidget;
|
||||||
|
int spacing = 20;
|
||||||
|
// reverse at least ~8 characters
|
||||||
|
int effectiveWidth = fontMetrics().averageCharWidth() * 8 + iconSize + spacing;
|
||||||
|
// less than ~16 characters, elide otherwise
|
||||||
|
int maxWidth = fontMetrics().averageCharWidth() * 16 + iconSize + spacing;
|
||||||
|
for (int i = 0; i < listWidget->count(); i++) {
|
||||||
|
QListWidgetItem *item = listWidget->item(i);
|
||||||
|
QFontMetrics fm(item->font());
|
||||||
|
int curWidth = fm.width(item->text()) + iconSize + spacing;
|
||||||
|
effectiveWidth = qMax(curWidth, effectiveWidth);
|
||||||
|
if (curWidth > maxWidth) item->setToolTip(item->text());
|
||||||
|
}
|
||||||
|
effectiveWidth = qMin(effectiveWidth, maxWidth);
|
||||||
|
listWidget->setFixedWidth(effectiveWidth);
|
||||||
|
|
||||||
MirallConfigFile cfg;
|
MirallConfigFile cfg;
|
||||||
cfg.restoreGeometry(this);
|
cfg.restoreGeometry(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsDialog::~SettingsDialog()
|
SettingsDialog::~SettingsDialog()
|
||||||
{
|
{
|
||||||
MirallConfigFile cfg;
|
|
||||||
cfg.saveGeometry(this);
|
|
||||||
|
|
||||||
delete _ui;
|
delete _ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,4 +137,23 @@ void SettingsDialog::slotUpdateAccountState()
|
|||||||
_accountItem->setIcon(Theme::instance()->syncStateIcon(state.status()));
|
_accountItem->setIcon(Theme::instance()->syncStateIcon(state.status()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::setGeneralErrors(const QStringList &errors)
|
||||||
|
{
|
||||||
|
_accountSettings->setGeneralErrors(errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// close event is not being called here
|
||||||
|
void SettingsDialog::reject() {
|
||||||
|
MirallConfigFile cfg;
|
||||||
|
cfg.saveGeometry(this);
|
||||||
|
QDialog::reject();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::accept() {
|
||||||
|
MirallConfigFile cfg;
|
||||||
|
cfg.saveGeometry(this);
|
||||||
|
QDialog::accept();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Mirall
|
} // namespace Mirall
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ public:
|
|||||||
~SettingsDialog();
|
~SettingsDialog();
|
||||||
|
|
||||||
void addAccount(const QString &title, QWidget *widget);
|
void addAccount(const QString &title, QWidget *widget);
|
||||||
|
void setGeneralErrors( const QStringList& errors );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void reject();
|
||||||
|
void accept();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void slotUpdateAccountState();
|
void slotUpdateAccountState();
|
||||||
@@ -48,7 +53,6 @@ private:
|
|||||||
Ui::SettingsDialog *_ui;
|
Ui::SettingsDialog *_ui;
|
||||||
AccountSettings *_accountSettings;
|
AccountSettings *_accountSettings;
|
||||||
QListWidgetItem *_accountItem;
|
QListWidgetItem *_accountItem;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,16 +14,7 @@
|
|||||||
<string>Settings</string>
|
<string>Settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
@@ -37,12 +28,6 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>200</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
|
|||||||
@@ -22,13 +22,13 @@
|
|||||||
class QSslError;
|
class QSslError;
|
||||||
class QSslCertificate;
|
class QSslCertificate;
|
||||||
|
|
||||||
|
namespace Mirall
|
||||||
|
{
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class SslErrorDialog;
|
class SslErrorDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Mirall
|
|
||||||
{
|
|
||||||
|
|
||||||
class SslErrorDialog : public QDialog
|
class SslErrorDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -57,7 +57,7 @@ private:
|
|||||||
|
|
||||||
QList<QSslCertificate> _unknownCerts;
|
QList<QSslCertificate> _unknownCerts;
|
||||||
QString _customConfigHandle;
|
QString _customConfigHandle;
|
||||||
::Ui::SslErrorDialog *_ui;
|
Ui::SslErrorDialog *_ui;
|
||||||
};
|
};
|
||||||
} // end namespace
|
} // end namespace
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>SslErrorDialog</class>
|
<class>Mirall::SslErrorDialog</class>
|
||||||
<widget class="QWidget" name="SslErrorDialog">
|
<widget class="QWidget" name="Mirall::SslErrorDialog">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
|
|||||||
@@ -1,3 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* 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 SYNCFILEITEM_H
|
#ifndef SYNCFILEITEM_H
|
||||||
#define SYNCFILEITEM_H
|
#define SYNCFILEITEM_H
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
#include <sys/statvfs.h>
|
#include <sys/statvfs.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -37,6 +38,7 @@
|
|||||||
#elif defined(Q_OS_WIN)
|
#elif defined(Q_OS_WIN)
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <winbase.h>
|
#include <winbase.h>
|
||||||
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Mirall {
|
namespace Mirall {
|
||||||
@@ -103,10 +105,10 @@ void Utility::setupFavLink(const QString &folder)
|
|||||||
|
|
||||||
QString Utility::octetsToString( qint64 octets )
|
QString Utility::octetsToString( qint64 octets )
|
||||||
{
|
{
|
||||||
static const qint64 kb = 1000;
|
static const qint64 kb = 1024;
|
||||||
static const qint64 mb = 1000 * kb;
|
static const qint64 mb = 1024 * kb;
|
||||||
static const qint64 gb = 1000 * mb;
|
static const qint64 gb = 1024 * mb;
|
||||||
static const qint64 tb = 1000 * gb;
|
static const qint64 tb = 1024 * gb;
|
||||||
|
|
||||||
QString s;
|
QString s;
|
||||||
qreal value = octets;
|
qreal value = octets;
|
||||||
@@ -366,4 +368,12 @@ QString Utility::toCSyncScheme(const QString &urlStr)
|
|||||||
return url.toString();
|
return url.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Utility::sleep(int sec)
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
::Sleep(sec*1000);
|
||||||
|
#else
|
||||||
|
::sleep(sec);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
} // namespace Mirall
|
} // namespace Mirall
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ namespace Mirall {
|
|||||||
|
|
||||||
namespace Utility
|
namespace Utility
|
||||||
{
|
{
|
||||||
|
void sleep(int sec);
|
||||||
QString formatFingerprint( const QByteArray& );
|
QString formatFingerprint( const QByteArray& );
|
||||||
void setupFavLink( const QString &folder );
|
void setupFavLink( const QString &folder );
|
||||||
QString octetsToString( qint64 octets );
|
QString octetsToString( qint64 octets );
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include "QProgressIndicator.h"
|
#include "QProgressIndicator.h"
|
||||||
|
|
||||||
@@ -26,7 +27,6 @@
|
|||||||
#include "mirall/theme.h"
|
#include "mirall/theme.h"
|
||||||
#include "mirall/mirallconfigfile.h"
|
#include "mirall/mirallconfigfile.h"
|
||||||
#include "creds/abstractcredentials.h"
|
#include "creds/abstractcredentials.h"
|
||||||
|
|
||||||
namespace Mirall
|
namespace Mirall
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -89,8 +89,8 @@ void OwncloudAdvancedSetupPage::initializePage()
|
|||||||
// call to init label
|
// call to init label
|
||||||
updateStatus();
|
updateStatus();
|
||||||
|
|
||||||
// TODO: focus
|
// ensure "next" gets the focus, not obSelectLocalFolder
|
||||||
_ui.pbSelectLocalFolder->setFocus();
|
QTimer::singleShot(0, wizard()->button(QWizard::NextButton), SLOT(setFocus()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called if the user changes the user- or url field. Adjust the texts and
|
// Called if the user changes the user- or url field. Adjust the texts and
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Enter the url of the ownCloud you want to connect to (without http or https).</string>
|
<string>Enter the URL of the server that you want to connect to (without http or https).</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>https://...</string>
|
<string>https://...</string>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ OwncloudSetupPage::OwncloudSetupPage()
|
|||||||
|
|
||||||
Theme *theme = Theme::instance();
|
Theme *theme = Theme::instance();
|
||||||
setTitle(WizardCommon::titleTemplate().arg(tr("Connect to %1").arg(theme->appNameGUI())));
|
setTitle(WizardCommon::titleTemplate().arg(tr("Connect to %1").arg(theme->appNameGUI())));
|
||||||
setSubTitle(WizardCommon::subTitleTemplate().arg(tr("Setup ownCloud server")));
|
setSubTitle(WizardCommon::subTitleTemplate().arg(tr("Setup %1 server").arg(theme->appNameGUI())));
|
||||||
|
|
||||||
registerField( QLatin1String("OCUrl*"), _ui.leUrl );
|
registerField( QLatin1String("OCUrl*"), _ui.leUrl );
|
||||||
|
|
||||||
@@ -227,7 +227,8 @@ void OwncloudSetupPage::setConfigExists( bool config )
|
|||||||
_configExists = config;
|
_configExists = config;
|
||||||
|
|
||||||
if (config == true) {
|
if (config == true) {
|
||||||
setSubTitle(WizardCommon::subTitleTemplate().arg(tr("Update ownCloud server")));
|
setSubTitle(WizardCommon::subTitleTemplate().arg(tr("Update %1 server")
|
||||||
|
.arg(Theme::instance()->appNameGUI())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,8 @@ void OwncloudWizardResultPage::initializePage()
|
|||||||
text = tr("Your entire account is synced to the local folder <i>%1</i>")
|
text = tr("Your entire account is synced to the local folder <i>%1</i>")
|
||||||
.arg(QDir::toNativeSeparators(localFolder));
|
.arg(QDir::toNativeSeparators(localFolder));
|
||||||
} else {
|
} else {
|
||||||
text = tr("ownCloud folder <i>%1</i> is synced to local folder <i>%2</i>")
|
text = tr("%1 folder <i>%1</i> is synced to local folder <i>%2</i>")
|
||||||
|
.arg(Theme::instance()->appNameGUI())
|
||||||
.arg(_remoteFolder).arg(QDir::toNativeSeparators(localFolder));
|
.arg(_remoteFolder).arg(QDir::toNativeSeparators(localFolder));
|
||||||
}
|
}
|
||||||
_ui.localFolderLabel->setText( text );
|
_ui.localFolderLabel->setText( text );
|
||||||
|
|||||||
@@ -26,27 +26,31 @@ private slots:
|
|||||||
}
|
}
|
||||||
void testOctetsToString()
|
void testOctetsToString()
|
||||||
{
|
{
|
||||||
|
QLocale::setDefault(QLocale("en"));
|
||||||
QCOMPARE(octetsToString(999) , QString("999 B"));
|
QCOMPARE(octetsToString(999) , QString("999 B"));
|
||||||
QCOMPARE(octetsToString(1000) , QString("1 kB"));
|
QCOMPARE(octetsToString(1000) , QString("1,000 B"));
|
||||||
QCOMPARE(octetsToString(1010) , QString("1 kB"));
|
QCOMPARE(octetsToString(1010) , QString("1,010 B"));
|
||||||
|
QCOMPARE(octetsToString(1024) , QString("1 kB"));
|
||||||
QCOMPARE(octetsToString(1110) , QString("1.1 kB"));
|
QCOMPARE(octetsToString(1110) , QString("1.1 kB"));
|
||||||
|
|
||||||
QCOMPARE(octetsToString(9110) , QString("9.1 kB"));
|
QCOMPARE(octetsToString(9110) , QString("8.9 kB"));
|
||||||
QCOMPARE(octetsToString(9910) , QString("9.9 kB"));
|
QCOMPARE(octetsToString(9910) , QString("9.7 kB"));
|
||||||
QCOMPARE(octetsToString(9999) , QString("10 kB"));
|
QCOMPARE(octetsToString(9999) , QString("9.8 kB"));
|
||||||
|
QCOMPARE(octetsToString(10240) , QString("10 kB"));
|
||||||
|
|
||||||
QCOMPARE(octetsToString(123456) , QString("123 kB"));
|
QCOMPARE(octetsToString(123456) , QString("121 kB"));
|
||||||
QCOMPARE(octetsToString(1234567) , QString("1.2 MB"));
|
QCOMPARE(octetsToString(1234567) , QString("1.2 MB"));
|
||||||
QCOMPARE(octetsToString(12345678) , QString("12 MB"));
|
QCOMPARE(octetsToString(12345678) , QString("12 MB"));
|
||||||
QCOMPARE(octetsToString(123456789) , QString("123 MB"));
|
QCOMPARE(octetsToString(123456789) , QString("118 MB"));
|
||||||
QCOMPARE(octetsToString(1000LL*1000*1000 * 5) , QString("5 GB"));
|
QCOMPARE(octetsToString(1000LL*1000*1000 * 5) , QString("4.7 GB"));
|
||||||
|
QCOMPARE(octetsToString(1024LL*1024*1024 * 5) , QString("5 GB"));
|
||||||
|
|
||||||
QCOMPARE(octetsToString(1), QString("1 B"));
|
QCOMPARE(octetsToString(1), QString("1 B"));
|
||||||
QCOMPARE(octetsToString(2), QString("2 B"));
|
QCOMPARE(octetsToString(2), QString("2 B"));
|
||||||
QCOMPARE(octetsToString(1024), QString("1 kB"));
|
QCOMPARE(octetsToString(1024), QString("1 kB"));
|
||||||
QCOMPARE(octetsToString(1024*1024), QString("1 MB"));
|
QCOMPARE(octetsToString(1024*1024), QString("1 MB"));
|
||||||
QCOMPARE(octetsToString(1024LL*1024*1024), QString("1.1 GB"));
|
QCOMPARE(octetsToString(1024LL*1024*1024), QString("1 GB"));
|
||||||
QCOMPARE(octetsToString(1024LL*1024*1024*1024), QString("1.1 TB"));
|
QCOMPARE(octetsToString(1024LL*1024*1024*1024), QString("1 TB"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void testLaunchOnStartup()
|
void testLaunchOnStartup()
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 739 B After Width: | Height: | Size: 781 B |
Reference in New Issue
Block a user