diff --git a/cmake/modules/QtVersionAbstraction.cmake b/cmake/modules/QtVersionAbstraction.cmake index b83f373588..c05b226b4d 100644 --- a/cmake/modules/QtVersionAbstraction.cmake +++ b/cmake/modules/QtVersionAbstraction.cmake @@ -11,13 +11,15 @@ endif( BUILD_WITH_QT4 ) if( Qt5Core_FOUND ) message(STATUS "Found Qt5 core, checking for further dependencies...") - find_package(Qt5Widgets REQUIRED) - find_package(Qt5Quick REQUIRED) - find_package(Qt5PrintSupport REQUIRED) - find_package(Qt5WebKit REQUIRED) find_package(Qt5Network REQUIRED) find_package(Qt5Xml REQUIRED) - find_package(Qt5WebKitWidgets REQUIRED) + if(NOT TOKEN_AUTH_ONLY) + find_package(Qt5WebKitWidgets REQUIRED) + find_package(Qt5WebKit REQUIRED) + find_package(Qt5PrintSupport REQUIRED) + find_package(Qt5Quick REQUIRED) + find_package(Qt5Widgets REQUIRED) + endif() if(APPLE) find_package(Qt5MacExtras REQUIRED) endif(APPLE) @@ -37,23 +39,27 @@ if( Qt5Core_FOUND ) include_directories(${Qt5DBus_INCLUDES}) add_definitions(${Qt5DBus_DEFINITIONS}) endif (WITH_DBUS) - - include_directories(${Qt5Widgets_INCLUDES}) - add_definitions(${Qt5Widgets_DEFINITIONS}) + include_directories(${Qt5Core_INCLUDES}) + add_definitions(${Qt5Core_DEFINITIONS}) if (NOT WIN32) #implied on Win32 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") endif(NOT WIN32) # set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") - if(APPLE) + if(APPLE AND NOT TOKEN_AUTH_ONLY) include_directories(${Qt5MacExtras_INCLUDE_DIRS}) add_definitions(${Qt5MacExtras_DEFINITIONS}) set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5MacExtras_LIBRARIES}) - endif(APPLE) + endif() +if(NOT BUILD_LIBRARIES_ONLY) macro(qt_wrap_ui) qt5_wrap_ui(${ARGN}) endmacro() +else() + # hack + SET(QT_UIC_EXECUTABLE "") +endif() macro(qt_add_resources) qt5_add_resources(${ARGN}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 310fa746c3..ab455106b3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,9 +27,9 @@ IF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") ) ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") -if(SPARKLE_FOUND) +if(SPARKLE_FOUND AND NOT BUILD_LIBRARIES_ONLY) list (APPEND OS_SPECIFIC_LINK_LIBRARIES ${SPARKLE_LIBRARY}) -endif(SPARKLE_FOUND) +endif() set(3rdparty_SRC 3rdparty/qtsingleapplication/qtsingleapplication.cpp @@ -195,7 +195,11 @@ if(NEON_FOUND) endif() add_library(${synclib_NAME} SHARED ${libsync_SRCS} ${syncMoc}) -qt5_use_modules(${synclib_NAME} Widgets Network Xml WebKitWidgets Sql) +if(TOKEN_AUTH_ONLY) + qt5_use_modules(${synclib_NAME} Network Xml Sql) +else() + qt5_use_modules(${synclib_NAME} Widgets Network Xml WebKitWidgets Sql) +endif() set_target_properties( ${synclib_NAME} PROPERTIES VERSION ${MIRALL_VERSION} @@ -207,15 +211,15 @@ set_target_properties( ${synclib_NAME} PROPERTIES target_link_libraries(${synclib_NAME} ${libsync_LINK_TARGETS} ) if(BUILD_LIBRARIES_ONLY) - add_library(${synclib_NAME}_static STATIC ${libsync_SRCS} ${syncMoc}) - qt5_use_modules(${synclib_NAME}_static Widgets Network Xml WebKitWidgets Sql) + #add_library(${synclib_NAME}_static STATIC ${libsync_SRCS} ${syncMoc}) + #qt5_use_modules(${synclib_NAME}_static Widgets Network Xml Sql) - set_target_properties( ${synclib_NAME}_static PROPERTIES - VERSION ${MIRALL_VERSION} - SOVERSION ${MIRALL_SOVERSION} - ) + #set_target_properties( ${synclib_NAME}_static PROPERTIES + # VERSION ${MIRALL_VERSION} + # SOVERSION ${MIRALL_SOVERSION} + #) - target_link_libraries(${synclib_NAME}_static ${libsync_LINK_TARGETS} ) + #target_link_libraries(${synclib_NAME}_static ${libsync_LINK_TARGETS} ) endif() @@ -420,11 +424,11 @@ elseif(NOT BUILD_LIBRARIES_ONLY) install(FILES ${qtkeychain_I18N} DESTINATION ${QM_DIR}) endif() -add_library(updater STATIC ${updater_SRCS} ${updaterMoc}) -target_link_libraries(updater ${synclib_NAME}) -qt5_use_modules(updater Widgets Network Xml) - if(NOT BUILD_LIBRARIES_ONLY) + add_library(updater STATIC ${updater_SRCS} ${updaterMoc}) + target_link_libraries(updater ${synclib_NAME}) + qt5_use_modules(updater Widgets Network Xml) + set_target_properties( ${APPLICATION_EXECUTABLE} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY} ) diff --git a/src/creds/tokencredentials.cpp b/src/creds/tokencredentials.cpp index fe3cf457fa..0804cc5d44 100644 --- a/src/creds/tokencredentials.cpp +++ b/src/creds/tokencredentials.cpp @@ -17,8 +17,6 @@ #include #include #include -#include - #include "mirall/account.h" #include "mirall/mirallaccessmanager.h" @@ -179,17 +177,7 @@ bool TokenCredentials::stillValid(QNetworkReply *reply) QString TokenCredentials::queryPassword(bool *ok) { - qDebug() << AccountManager::instance()->account()->state(); - if (ok) { - QString str = QInputDialog::getText(0, tr("Enter Password"), - tr("Please enter %1 password for user '%2':") - .arg(Theme::instance()->appNameGUI(), _user), - QLineEdit::Password, QString(), ok); - qDebug() << AccountManager::instance()->account()->state(); - return str; - } else { - return QString(); - } + return QString(); } void TokenCredentials::invalidateToken(Account *account) diff --git a/src/mirall/folder.cpp b/src/mirall/folder.cpp index 7537eb9bdc..fae0a0e509 100644 --- a/src/mirall/folder.cpp +++ b/src/mirall/folder.cpp @@ -49,8 +49,11 @@ CSYNC_EXCLUDE_TYPE csync_excluded(CSYNC *ctx, const char *path, int filetype); #include #include #include + +#ifndef TOKEN_AUTH_ONLY #include #include +#endif namespace Mirall { @@ -672,6 +675,7 @@ void Folder::slotTransmissionProgress(const Progress::Info &pi) void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction direction, bool *cancel) { +#ifndef TOKEN_AUTH_ONLY QString msg = direction == SyncFileItem::Down ? tr("This sync would remove all the files in the local sync folder '%1'.\n" "If you or your administrator have reset your account on the server, choose " @@ -692,6 +696,7 @@ void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction direction, bool * if (*cancel) { wipe(); } +#endif } SyncFileStatus Folder::fileStatus( const QString& fileName ) diff --git a/src/mirall/folderman.cpp b/src/mirall/folderman.cpp index c4a5a2e477..86b087533c 100644 --- a/src/mirall/folderman.cpp +++ b/src/mirall/folderman.cpp @@ -27,8 +27,10 @@ #include #endif -#include +#ifndef TOKEN_AUTH_ONLY #include +#endif + #include namespace Mirall { @@ -163,7 +165,8 @@ int FolderMan::setupFolders() bool FolderMan::ensureJournalGone(const QString &localPath) { - + // FIXME move this to UI, not libowncloudsync +#ifndef TOKEN_AUTH_ONLY // remove old .csync_journal file QString stateDbFile = localPath+QLatin1String("/.csync_journal.db"); while (QFile::exists(stateDbFile) && !QFile::remove(stateDbFile)) { @@ -177,6 +180,7 @@ bool FolderMan::ensureJournalGone(const QString &localPath) return false; } } +#endif return true; } diff --git a/src/mirall/mirallconfigfile.cpp b/src/mirall/mirallconfigfile.cpp index 11c36780b5..48f806e6bd 100644 --- a/src/mirall/mirallconfigfile.cpp +++ b/src/mirall/mirallconfigfile.cpp @@ -22,7 +22,11 @@ #include "creds/abstractcredentials.h" #include "creds/credentialsfactory.h" +#ifndef TOKEN_AUTH_ONLY #include +#include +#endif + #include #include #include @@ -30,7 +34,6 @@ #include #include #include -#include #define DEFAULT_REMOTE_POLL_INTERVAL 30000 // default remote poll time in milliseconds #define DEFAULT_MAX_LOG_LINES 20000 @@ -109,20 +112,25 @@ void MirallConfigFile::setOptionalDesktopNotifications(bool show) void MirallConfigFile::saveGeometry(QWidget *w) { +#ifndef TOKEN_AUTH_ONLY Q_ASSERT(!w->objectName().isNull()); QSettings settings(configFile(), QSettings::IniFormat); settings.beginGroup(w->objectName()); settings.setValue(QLatin1String(geometryC), w->saveGeometry()); settings.sync(); +#endif } void MirallConfigFile::restoreGeometry(QWidget *w) { +#ifndef TOKEN_AUTH_ONLY w->restoreGeometry(getValue(geometryC, w->objectName()).toByteArray()); +#endif } void MirallConfigFile::saveGeometryHeader(QHeaderView *header) { +#ifndef TOKEN_AUTH_ONLY if(!header) return; Q_ASSERT(!header->objectName().isNull()); @@ -130,16 +138,19 @@ void MirallConfigFile::saveGeometryHeader(QHeaderView *header) settings.beginGroup(header->objectName()); settings.setValue(QLatin1String(geometryC), header->saveState()); settings.sync(); +#endif } void MirallConfigFile::restoreGeometryHeader(QHeaderView *header) { +#ifndef TOKEN_AUTH_ONLY if(!header) return; Q_ASSERT(!header->objectName().isNull()); QSettings settings(configFile(), QSettings::IniFormat); settings.beginGroup(header->objectName()); header->restoreState(getValue(geometryC, header->objectName()).toByteArray()); +#endif } QVariant MirallConfigFile::getPolicySetting(const QString &setting, const QVariant& defaultValue) const diff --git a/src/mirall/owncloudtheme.cpp b/src/mirall/owncloudtheme.cpp index e4b2024031..f2a8645ba2 100644 --- a/src/mirall/owncloudtheme.cpp +++ b/src/mirall/owncloudtheme.cpp @@ -16,10 +16,13 @@ #include #include +#ifndef TOKEN_AUTH_ONLY #include #include #include #include +#endif +#include #include @@ -66,6 +69,7 @@ QString ownCloudTheme::about() const } +#ifndef TOKEN_AUTH_ONLY QIcon ownCloudTheme::trayFolderIcon( const QString& ) const { QPixmap fallback = qApp->style()->standardPixmap(QStyle::SP_FileDialogNewFolder); @@ -83,6 +87,8 @@ QIcon ownCloudTheme::applicationIcon( ) const return themeIcon( QLatin1String("owncloud-icon") ); } +#endif + QVariant ownCloudTheme::customMedia(Theme::CustomMediaType type) { if (type == Theme::oCSetupTop) { @@ -100,6 +106,7 @@ QString ownCloudTheme::helpUrl() const return QString::fromLatin1("http://doc.owncloud.org/desktop/%1.%2/").arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR); } +#ifndef TOKEN_AUTH_ONLY QColor ownCloudTheme::wizardHeaderBackgroundColor() const { return QColor("#1d2d42"); @@ -114,7 +121,7 @@ QPixmap ownCloudTheme::wizardHeaderLogo() const { return QPixmap(":/mirall/theme/colored/wizard_logo.png"); } - +#endif } diff --git a/src/mirall/syncengine.cpp b/src/mirall/syncengine.cpp index cf383aa767..930eed939e 100644 --- a/src/mirall/syncengine.cpp +++ b/src/mirall/syncengine.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include #include diff --git a/src/mirall/theme.cpp b/src/mirall/theme.cpp index 74a6cf4871..3f8f610056 100644 --- a/src/mirall/theme.cpp +++ b/src/mirall/theme.cpp @@ -17,7 +17,9 @@ #include "config.h" #include +#ifndef TOKEN_AUTH_ONLY #include +#endif #include "mirall/owncloudtheme.h" @@ -96,6 +98,8 @@ QString Theme::version() const return QString::fromLocal8Bit( MIRALL_STRINGIFY( MIRALL_VERSION )); } +#ifndef TOKEN_AUTH_ONLY + QIcon Theme::trayFolderIcon( const QString& backend ) const { Q_UNUSED(backend) @@ -147,6 +151,7 @@ QIcon Theme::themeIcon( const QString& name, bool sysTray ) const } return icon; } +#endif // if this option return true, the client only supports one folder to sync. // The Add-Button is removed accoringly. @@ -211,6 +216,7 @@ QString Theme::about() const .arg(MIRALL_STRINGIFY(APPLICATION_DOMAIN)).arg(APPLICATION_VENDOR).arg(APPLICATION_NAME); } +#ifndef TOKEN_AUTH_ONLY QVariant Theme::customMedia( CustomMediaType type ) { QVariant re; @@ -305,6 +311,7 @@ QPixmap Theme::wizardHeaderBanner() const pix.fill(wizardHeaderBackgroundColor()); return pix; } +#endif } // end namespace mirall diff --git a/src/mirall/theme.h b/src/mirall/theme.h index d819ce29f3..36e4b0e85a 100644 --- a/src/mirall/theme.h +++ b/src/mirall/theme.h @@ -79,6 +79,7 @@ public: */ virtual QString configFileName() const = 0; +#ifndef TOKEN_AUTH_ONLY /** * the icon that is shown in the tray context menu left of the folder name */ @@ -91,6 +92,7 @@ public: virtual QIcon folderDisabledIcon() const = 0; virtual QIcon applicationIcon() const = 0; +#endif virtual QString statusHeaderText( SyncResult::Status ) const; virtual QString version() const; @@ -130,6 +132,7 @@ public: /** colored, white or black */ QString systrayIconFlavor(bool mono) const; +#ifndef TOKEN_AUTH_ONLY /** * Override to use a string or a custom image name. * The default implementation will try to look up @@ -154,6 +157,7 @@ public: * @return banner for the setup wizard. */ virtual QPixmap wizardHeaderBanner() const; +#endif /** * About dialog contents diff --git a/src/mirall/utility.cpp b/src/mirall/utility.cpp index 0291c7ba73..e2e224690c 100644 --- a/src/mirall/utility.cpp +++ b/src/mirall/utility.cpp @@ -22,16 +22,19 @@ #include #include #include +#ifndef TOKEN_AUTH_ONLY #include +#endif #include -#include #include #include #include #include #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) +#ifndef TOKEN_AUTH_ONLY #include +#endif #include #else #include @@ -165,6 +168,7 @@ QByteArray Utility::userAgentString() void Utility::raiseDialog( QWidget *raiseWidget ) { +#ifndef TOKEN_AUTH_ONLY // viel hilft viel ;-) if( raiseWidget ) { #if defined(Q_OS_WIN) || defined (Q_OS_MAC) @@ -181,6 +185,7 @@ void Utility::raiseDialog( QWidget *raiseWidget ) raiseWidget->raise(); raiseWidget->activateWindow(); } +#endif } bool Utility::hasLaunchOnStartup(const QString &appName) @@ -261,7 +266,11 @@ QString Utility::dataLocation() { // Qt 5's QStandardPaths::writableLocation gives us wrong results (without /data/), // so we'll have to use the deprecated version for now +#ifndef TOKEN_AUTH_ONLY return QDesktopServices::storageLocation(QDesktopServices::DataLocation); +#else + return QString(); +#endif } #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) @@ -435,7 +444,9 @@ void Utility::showInFileManager(const QString &localPath) if (app.isEmpty() || args.isEmpty() || !canHandleFile) { // fall back: open the default file manager, without ever selecting the file +#ifndef TOKEN_AUTH_ONLY QDesktopServices::openUrl(QUrl::fromLocalFile(pathToOpen)); +#endif } else { QProcess::startDetached(app, args); }