1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2026-04-08 12:13:05 +02:00

Compare commits

..

120 Commits

Author SHA1 Message Date
Daniel Molkentin
18a58f73de Startup: Unity has no proper Systray implementation
...so it can't respond to isSysTrayAvailable()
2013-08-28 15:45:52 +02:00
Daniel Molkentin
d1451a3c90 Mac: Use hdiutil attach instead of open during signing 2013-08-28 12:53:34 +02:00
Jenkins for ownCloud
0bef47b2f3 [tx-robot] updated from transifex 2013-08-28 05:24:20 -04:00
Jenkins for ownCloud
ccc05d6658 [tx-robot] updated from transifex 2013-08-27 10:23:30 -04:00
Olivier Goffart
c15de69156 Reconfigure the proxy when needed 2013-08-27 10:02:59 +02:00
Thomas Müller
8bfb44fd28 Inverting the logic to set the prefix for SYSCONF_INSTALL_DIR 2013-08-26 22:42:17 +02:00
Daniel Molkentin
79d3b84fad Reintroduce workaround for /etc in root if files go to /usr 2013-08-26 21:59:52 +02:00
Daniel Molkentin
b97701586e Properly install icons 2013-08-26 21:18:56 +02:00
Daniel Molkentin
b120345fe7 Icon file needs to use app_executable as well 2013-08-26 20:54:10 +02:00
Daniel Molkentin
ec5c65a530 install correct file 2013-08-26 20:35:56 +02:00
Daniel Molkentin
77e7a1fa8d Fix casing in settings dialog 2013-08-26 20:22:24 +02:00
Daniel Molkentin
f6d45b68ef More clear error messages 2013-08-26 20:20:10 +02:00
Daniel Molkentin
24d76a0d75 desktop file == executable 2013-08-26 20:20:10 +02:00
Olivier Goffart
c3326efe94 Do not sort the entries in the syc protocol dialog alphabetically
The entries should be sorted chronogically.  But now the QTreeWidget can
only sort them alphabetically by the time,  which is not what we want.
Disalbe the sorting, and always insert the elements in the reverse
order.

Fix #890
2013-08-26 17:27:44 +02:00
Daniel Molkentin
c0e056bb84 Only show help if a URL is provided 2013-08-26 14:27:39 +02:00
Jenkins for ownCloud
8a7df36701 [tx-robot] updated from transifex 2013-08-25 18:19:18 -04:00
Jenkins for ownCloud
39ec6b1bb2 [tx-robot] updated from transifex 2013-08-23 19:15:56 -04:00
Daniel Molkentin
30b2406533 Fix windows packaging 2013-08-23 15:37:24 +02:00
Daniel Molkentin
076d5dda0e RC1 2013-08-23 14:35:15 +02:00
Olivier Goffart
e78eab46ff Fix saving the geometry of the log browser 2013-08-23 12:41:29 +02:00
Olivier Goffart
19a08f8d5e Make remember the size of the settings dialog
Before, we saved the geometry in the closeEvent which is only called if
the user press the [x] in the title bar.  But it is not called when the
user accept the dialog (by pressing the close button or the enter key)
So save the geometry in the destructor of the dialog instead.

One also must call delete from the Application destructor because it was
leaking
2013-08-23 12:25:16 +02:00
Olivier Goffart
c6319117fd Better default size for the setting dialog 2013-08-23 11:59:49 +02:00
Olivier Goffart
4c10ed4ada Remove some entries from the default exclude list.
If the user really want to have those entries excluded it can add them
manually.
But one cannot change the default so if user want the .bak files synced,
he would not be able to do it
2013-08-23 11:17:02 +02:00
Daniel Molkentin
b0ab3ca80b Theme: Add documentation after recent changes 2013-08-23 10:36:09 +02:00
Daniel Molkentin
9f89a2fe76 More adjustments around the application name
- libname is now derived from binary name (which is lowercase)
- remove superflouos reimplementation of appName() in owncloud theme
- APPLICATION_SHORTNAME is now optional (and if not set, equals
  APPLICATION_NAME
2013-08-23 10:30:03 +02:00
Daniel Molkentin
e386bfb550 fix x-compilation 2013-08-23 00:36:05 +02:00
Jenkins for ownCloud
0189a3f1bd [tx-robot] updated from transifex 2013-08-22 10:35:38 -04:00
Olivier Goffart
d3a333e03c Fix the 'copy button' in the protocol log
Fix #863

Also added more padding for the filename because it might be big, and in
case it's not enough, always add at least a space.
2013-08-22 16:20:04 +02:00
Olivier Goffart
04d3e282fb Stop the poll timer when the folder is disabled
No need to request etag every 30 second for disabled folder.

When the folder is re-enabled, the Timer is actived again after the sync
2013-08-22 12:35:28 +02:00
Olivier Goffart
4be5f970d5 Default to no limit upload
We don't want to make the transfer slow by default
2013-08-22 12:26:34 +02:00
Daniel Molkentin
31ceff181e Amendment to last commit 2013-08-22 09:51:35 +02:00
Daniel Molkentin
42abf4101c Honor cmake's install prefix
since the entire ting is so incredibly broken in cmake,
use the approach taken by csync (which emulates the
approach of autotools), to get the directories right.

This mandates changes in the theme, which need discussion
(APPLICATION_SHORTNAME must now equal appName(), and
APPLICATION_NAME should equal appGuiName()).
2013-08-22 09:40:25 +02:00
Daniel Molkentin
f09cae74fb Merge pull request #897 from onnozweers/patch-1
Adding "Type=Application" to desktop file (to fix autostart in Ubuntu)
2013-08-21 16:50:25 -07:00
onnozweers
13a6393ec5 Adding "Type=Application" to desktop file (to fix autostart in Ubuntu) 2013-08-21 22:11:02 +02:00
Jenkins for ownCloud
ace57f9dd4 [tx-robot] updated from transifex 2013-08-21 07:10:45 -04:00
Daniel Molkentin
e5117a98c9 Quota bar: Reduce border width to 1px per request
As requested by Jan
2013-08-21 11:34:49 +02:00
Daniel Molkentin
c1f7af7e6f Write desktop file manually, add gnome startup property
Fixes #893
2013-08-21 11:09:56 +02:00
Olivier Goffart
b4c116e2a2 Add the new directories comming from the sync in the watcher 2013-08-21 00:45:36 +02:00
Jenkins for ownCloud
a19a960b5e [tx-robot] updated from transifex 2013-08-19 14:08:05 -04:00
Olivier Goffart
29d2094626 Hide password in the account settings
Fix #811
2013-08-19 13:42:01 +02:00
Klaas Freitag
c3b82e6818 Fix sequence for recently changed items. 2013-08-19 13:06:48 +02:00
Olivier Goffart
1a7c89326b Fix crash when finishing the wizard
As shown on this backtrace:

=13334== Invalid read of size 8
QCoreApplication::postEvent(QObject*,QEvent*, int)
Mirall::ownCloudInfo::slotReplyFinished()
[...]

==13334==  Address 0x1afb91d8 is 8 bytes inside a block of size 16 free'd
operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
QNetworkAccessManager::~QNetworkAccessManager()
Mirall::MirallAccessManager::~MirallAccessManager()
[...]
Mirall::ownCloudInfo::setNetworkAccessManager(QNetworkAccessManager*)
Mirall::ownCloudInfo::setCustomConfigHandle(QString const&)
Mirall::OwncloudSetupWizard::slotAssistantFinished(int)
[...]
Mirall::OwncloudWizard::basicSetupFinished(int)
Mirall::OwncloudWizard::slotCurrentPageChanged(int)
[...]
QWizard::currentIdChanged(int) (in
Mirall::OwncloudWizard::successfulStep()
Mirall::OwncloudSetupWizard::finalizeSetup(bool)
Mirall::OwncloudSetupWizard::slotAuthCheckReply(QString const&,
[...]
Mirall::ownCloudInfo::ownCloudDirExists(QString const&, QNetworkReply*)
Mirall::ownCloudInfo::slotReplyFinished()

The QNetworkManager was destroyed in a slot connected to a signal emited
by slotReplyFinished,  but we did not finish with the QNetworkReply yet.

Fix the crash by using QueuedConnection so the QNetworkAccessManager is
not destroyed before slotReplyFinished has completed.
2013-08-19 12:43:52 +02:00
Daniel Molkentin
3a1f04ac2d Allow folders with characters that need percent-encoding
Fixes #191
2013-08-18 20:24:24 +02:00
Daniel Molkentin
2c8e95a0f4 Be more specific when disconnecting the signal
Fixes a crash, amends be48cb646c
2013-08-18 19:41:01 +02:00
Klaas Freitag
a9d94ef732 Show error message in status dialog in error case. 2013-08-18 19:27:20 +02:00
Klaas Freitag
2756d17873 Fix/add missing status strings to theme. 2013-08-18 19:20:25 +02:00
Klaas Freitag
34d7f84fc2 Minor cleanup. 2013-08-18 17:59:03 +02:00
Daniel Molkentin
cea9b389bf Account Settings: Use native highlight color 2013-08-18 17:00:37 +02:00
Daniel Molkentin
71b1e881d8 Setup Wizard: Only label button "Connect" where suitable 2013-08-18 15:23:52 +02:00
Daniel Molkentin
7ba47e9d44 Code formatting fixes 2013-08-18 15:23:52 +02:00
Daniel Molkentin
be48cb646c Setup wizard: Start sync when displaying result page 2013-08-18 15:23:52 +02:00
Klaas Freitag
47eb5ff1d9 Do not keep the log if the log window is not visible. 2013-08-18 13:28:40 +02:00
Klaas Freitag
b608f5a670 Progressbar and quota bar tweaking. 2013-08-17 22:56:02 +02:00
Klaas Freitag
e81dc34c4e Add a tooltip in the sync protocol list. 2013-08-17 17:57:33 +02:00
Klaas Freitag
1603e627a3 Remove superflous conflict case. 2013-08-17 17:57:33 +02:00
Klaas Freitag
bf978b3e0f Handle Progress as a namespace rather than a class. 2013-08-17 17:57:33 +02:00
Klaas Freitag
0fdaf33288 Use correct translation call from QCoreApplication. 2013-08-17 17:57:33 +02:00
Klaas Freitag
367c4153c1 Show a bubble if the quota was exceeded. 2013-08-17 17:57:33 +02:00
Klaas Freitag
395c673a24 Fix the quota bar for quotas larger 100%. 2013-08-17 17:57:32 +02:00
Olivier Goffart
22de23c651 Fix the 'no limit' upload setting
Fix issue #879
2013-08-17 16:11:45 +02:00
Olivier Goffart
23926d2461 small leak 2013-08-16 20:18:35 +02:00
Olivier Goffart
c03f31b6ba put the 'Account' item first 2013-08-16 15:09:54 +02:00
Olivier Goffart
a1060a8538 fixup the layout of the account settings 2013-08-16 15:03:38 +02:00
Daniel Molkentin
24251bc223 Add "Keyword" to the desktop template
Fixes #876
2013-08-16 12:29:11 +02:00
Jenkins for ownCloud
f78749d2cd [tx-robot] updated from transifex 2013-08-15 16:57:02 -04:00
Daniel Molkentin
0995377d39 1.4.0 beta2 2013-08-15 17:32:46 +02:00
Daniel Molkentin
b9228e64ff Make Folder Reset an expert option (F5)
This feature should not be required, but might be helpful
in the debugging process.
2013-08-15 17:00:07 +02:00
Olivier Goffart
c4084de716 Remove the 'Remove Account' button
It is not doing anything right now, and we have no plans to implement it
in a short future

Fix Issue #866
2013-08-15 16:42:08 +02:00
Olivier Goffart
3c667918e7 Fix Reconfiguration keeps sync folder definition
Issue #875
2013-08-15 16:35:03 +02:00
Olivier Goffart
e55745cbcf Remove connection from unexisting signal to unexisting slot 2013-08-15 16:16:22 +02:00
Daniel Molkentin
e01ce20431 Wizard: Do not use FormLayout for URL line edit
Looks ugly on Mac

Fixes #870
2013-08-15 15:58:20 +02:00
Olivier Goffart
dce8cb83d9 Do not forget the config on the second page of the wizzard
Fixes mirral issue #874 where certificate was not stored on the first
page
2013-08-15 15:45:16 +02:00
Olivier Goffart
8dc956c55b Put all the debug in the log window
Don't emit debug before we installed the hook and created he log window
Also no debug if we use --help
2013-08-15 15:45:16 +02:00
Daniel Molkentin
6c77921a32 Admendment of last commit 2013-08-15 13:09:20 +02:00
Daniel Molkentin
55e4748f06 allow relative directories for --confdir 2013-08-15 13:01:05 +02:00
Daniel Molkentin
5ff9e02517 Implement --logfile - (log to stdout) 2013-08-15 12:24:52 +02:00
Daniel Molkentin
7f7ebc36f5 Fix showing help when app is running 2013-08-15 12:24:52 +02:00
Klaas Freitag
0e5bfc03ce Removed label on request of Jan. 2013-08-15 12:17:01 +02:00
Klaas Freitag
b309d333a6 Minor wording and margin fixes. 2013-08-15 11:30:48 +02:00
Daniel Molkentin
ee439382ed Logger: always log to log widget 2013-08-15 10:56:16 +02:00
Klaas Freitag
192212c682 Handle quota exceeding as error. 2013-08-15 08:15:43 +02:00
Klaas Freitag
148bdfdcd6 Some minor cleanups. 2013-08-15 08:15:43 +02:00
hefee
066c0ba189 Make building documantation parallelable.
sphinx will fail in a race condition, if every sphinx target
uses the same CACHE dir:

Exception occurred:
	File "/usr/lib/pymodules/python2.7/sphinx/cmdline.py", line 189, in main
app.build(force_all, filenames)
	File "/usr/lib/pymodules/python2.7/sphinx/application.py", line 204, in build
self.builder.build_update()
	File "/usr/lib/pymodules/python2.7/sphinx/builders/__init__.py", line 196, in build_update
	'out of date' % len(to_build))
	File "/usr/lib/pymodules/python2.7/sphinx/builders/__init__.py", line 238, in build
self.env.topickle(path.join(self.doctreedir, ENV_PICKLE_FILENAME))
	File "/usr/lib/pymodules/python2.7/sphinx/environment.py", line 351, in topickle
	movefile(filename + '.tmp', filename)
	File "/usr/lib/pymodules/python2.7/sphinx/util/osutil.py", line 104, in movefile
os.rename(source, dest)
	OSError: [Errno 2] No such file or directory
2013-08-15 02:36:44 +02:00
Daniel Molkentin
9651f1cddf Folder Wizard: Decode percent encoding 2013-08-14 19:24:02 +02:00
Daniel Molkentin
5feb9b0806 folderwizard: layout fixes 2013-08-14 19:24:02 +02:00
Klaas Freitag
44b9ee19e7 Flatten the itemprogressdialog and show a flat list. 2013-08-14 18:24:06 +02:00
Klaas Freitag
cc16d19bc4 Removed unused defines. 2013-08-14 18:24:06 +02:00
Klaas Freitag
b96c2de2b7 Cleaned folder class, removed a couple of signals and helper classes. 2013-08-14 18:24:06 +02:00
Klaas Freitag
f882b80708 Fix wording to more consolidated style, Jan request. 2013-08-14 18:24:06 +02:00
Daniel Molkentin
4d7c014b23 Resize dialog 2013-08-14 17:47:10 +02:00
Daniel Molkentin
1f274699e5 Pressing F12 in Settings now open the log browser 2013-08-14 17:46:58 +02:00
Daniel Molkentin
697e355f07 Hide mono icon options if the resource has no mono icons 2013-08-14 16:35:42 +02:00
Olivier Goffart
e89bdfc422 Make the Pause button stop the sync 2013-08-14 14:57:56 +02:00
Olivier Goffart
c2cc9e62a7 Fix the brandwith limit
The unit in mirall are in kbytes/s,  but csync expect  byte/s
2013-08-14 14:57:56 +02:00
Daniel Molkentin
1f2ae0d061 Folder Wizard UI clean up
Input from Jan
2013-08-14 14:01:33 +02:00
Olivier Goffart
91a39588c6 re-enable the sync if the syncing was disabled because the connection is down at startup 2013-08-14 12:59:56 +02:00
Olivier Goffart
a642f86d5b Detect connection failure from the polling 2013-08-14 12:34:03 +02:00
Olivier Goffart
00cf290574 reduce a bit the log output 2013-08-14 12:34:03 +02:00
Daniel Molkentin
b59952b539 Wrap custom message label 2013-08-14 11:58:03 +02:00
Daniel Molkentin
88b4ff9809 Wording changes proposed by Jan 2013-08-14 11:57:19 +02:00
Daniel Molkentin
ddd0965a82 Fix include after class rename 2013-08-14 11:11:47 +02:00
Klaas Freitag
0a9491ff46 Improved timestamp formatting in item sync progress dialog. 2013-08-14 08:04:46 +02:00
Klaas Freitag
32b44e3d87 Removed unused dialog class. 2013-08-14 08:04:46 +02:00
Klaas Freitag
268004b4ff Get correct action kind from progress Dispatcher in case of Context
kind.
2013-08-14 08:04:46 +02:00
Daniel Molkentin
6c0f6ae62e Make copy action copy all fields again
Fixes #863
2013-08-13 15:39:28 +02:00
Jenkins for ownCloud
094f2bb540 [tx-robot] updated from transifex 2013-08-13 08:12:11 -04:00
Daniel Molkentin
f4da7f1fb0 Merge pull request #857 from Arakmar/hiddenFix
Don't add empty entries in hidden files editor with an empty string or when cancel is clicked
2013-08-13 03:43:02 -07:00
Yoann Laissus
b058185d3b Don't add empty entries in hidden files editor with an empty string
or when cancel is clicked
2013-08-12 13:10:16 +02:00
Jenkins for ownCloud
eecb981736 [tx-robot] updated from transifex 2013-08-11 07:07:58 -04:00
Daniel Molkentin
46b870e260 Revert "run tests verbosely"
This reverts commit ff2d59d32f.
2013-08-09 14:45:49 +02:00
Olivier Goffart
1ffab7337d add the temporary downloaded files to the exclude list 2013-08-09 14:10:21 +02:00
Olivier Goffart
82fb8c49cf Do not clear the pending event in the polling anymore
This is useless,  and can even cause problems now since polling only do
a sync when the server has actually changed
2013-08-09 14:10:21 +02:00
Daniel Molkentin
ff2d59d32f run tests verbosely 2013-08-09 13:27:05 +02:00
Daniel Molkentin
0ced165b3e Add tests for Utility namespace 2013-08-09 13:09:41 +02:00
Daniel Molkentin
d3378c131a Fix formatting for 1 byte size in octetsToString() 2013-08-09 13:02:24 +02:00
Jenkins for ownCloud
0300a85295 [tx-robot] updated from transifex 2013-08-09 07:01:08 -04:00
Daniel Molkentin
60a116f3e0 Add tests for Utility namespace 2013-08-09 12:56:43 +02:00
Daniel Molkentin
ff4d2d488f Add cancel button to wizard on Mac
Fixes #848
2013-08-09 01:08:46 +02:00
Daniel Molkentin
b0852b4cf5 No ... for entires that do not spawn a dialog 2013-08-08 20:27:16 +02:00
Daniel Molkentin
c047b4d4de Seems autowrapping doesn't work everywhere. Enforce it 2013-08-08 17:52:09 +02:00
95 changed files with 14591 additions and 18560 deletions

View File

@@ -13,12 +13,16 @@ else ()
include ( ${CMAKE_SOURCE_DIR}/OWNCLOUD.cmake )
endif()
if (NOT DEFINED APPLICATION_SHORTNAME)
set ( APPLICATION_SHORTNAME ${APPLICATION_NAME} )
endif()
include(${CMAKE_SOURCE_DIR}/VERSION.cmake)
configure_file( ${CMAKE_SOURCE_DIR}/src/mirall/version.h.in "${CMAKE_CURRENT_BINARY_DIR}/src/mirall/version.h" )
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR} "${CMAKE_CURRENT_BINARY_DIR}/src/mirall/")
include(GNUInstallDirs)
include(DefineInstallationPaths)
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
@@ -34,10 +38,8 @@ if (${GIT_SHA1} STREQUAL "GITDIR-NOTFOUND")
endif()
endif()
## stupid, we should upstream this
if("${CMAKE_INSTALL_PREFIX}" STREQUAL "/usr" AND NOT CMAKE_INSTALL_SYSCONFDIR)
set(CMAKE_INSTALL_SYSCONFDIR "/etc")
endif()
set(SYSCONFDIR ${SYSCONF_INSTALL_DIR})
set(DATADIR ${DATA_INSTALL_DIR})
#####
## handle BUILD_OWNCLOUD_OSX_BUNDLE
@@ -83,25 +85,6 @@ set(USE_INOTIFY ${INOTIFY_FOUND})
configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
set(CPACK_SOURCE_IGNORE_FILES
# hidden files
"/\\\\..+$"
# temporary files
"\\\\.swp$"
# backup files
"~$"
# others
"\\\\.#"
"/#"
"/build/"
"/_build/"
# used before
"\\\\.o$"
"\\\\.lo$"
"\\\\.la$"
"Makefile\\\\.in$"
)
include(OwnCloudCPack.cmake)
add_definitions(-DUNICODE)
@@ -123,5 +106,5 @@ endif(UNIT_TESTING)
if(BUILD_OWNCLOUD_OSX_BUNDLE)
configure_file(sync-exclude.lst ${OWNCLOUD_OSX_BUNDLE}/Contents/Resources/sync-exclude.lst COPYONLY)
else()
install( FILES sync-exclude.lst DESTINATION ${CMAKE_INSTALL_SYSCONFDIR} )
install( FILES sync-exclude.lst DESTINATION ${SYSCONFDIR}/${APPLICATION_SHORTNAME} )
endif()

View File

@@ -1,9 +1,9 @@
set( APPLICATION_SHORTNAME "owncloud" )
set( APPLICATION_NAME "ownCloud" )
set( APPLICATION_EXECUTABLE "owncloud" )
set( APPLICATION_DOMAIN "owncloud.com" )
set( APPLICATION_VENDOR "ownCloud, Inc" )
set( THEME_CLASS "ownCloudTheme" )
#set( APPLICATION_SHORTNAME ${APPLICATION_NAME} )
set( APPLICATION_EXECUTABLE "owncloud" )
set( APPLICATION_DOMAIN "owncloud.com" )
set( APPLICATION_VENDOR "ownCloud, Inc" )
set( THEME_CLASS "ownCloudTheme" )
set( APPLICATION_REV_DOMAIN "com.owncloud.desktopclient" )
set( WIN_SETUP_BITMAP_PATH "${CMAKE_SOURCE_DIR}/admin/win/nsi" )
# set( THEME_INCLUDE "${OEM_THEME_DIR}/mytheme.h" )

View File

@@ -1,6 +1,6 @@
set( VERSION_MAJOR 1 )
set( VERSION_MINOR 4 )
set( VERSION_PATCH 0 )
set( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX}beta1")
set( VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX}rc1")
set( SOVERSION 0 )

View File

@@ -10,8 +10,7 @@ mount="/Volumes/$(basename $src_dmg|cut -d"-" -f1)"
test -e $tmp_dmg && rm -rf $tmp_dmg
hdiutil convert $src_dmg -format UDRW -o $tmp_dmg
open $tmp_dmg
sleep 12s
hdiutil attach $tmp_dmg
pushd $mount
codesign -s "$identity" $mount/*.app
popd

View File

@@ -0,0 +1,108 @@
if (UNIX)
# Suffix for Linux
SET(LIB_SUFFIX
CACHE STRING "Define suffix of directory name (32/64)"
)
SET(EXEC_INSTALL_PREFIX
"${CMAKE_INSTALL_PREFIX}"
CACHE PATH "Base directory for executables and libraries"
)
SET(SHARE_INSTALL_PREFIX
"${CMAKE_INSTALL_PREFIX}/share"
CACHE PATH "Base directory for files which go to share/"
)
SET(DATA_INSTALL_PREFIX
"${SHARE_INSTALL_PREFIX}/${APPLICATION_SHORT_NAME}"
CACHE PATH "The parent directory where applications can install their data")
# The following are directories where stuff will be installed to
SET(BIN_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/bin"
CACHE PATH "The ${APPLICATION_SHORT_NAME} binary install dir (default prefix/bin)"
)
SET(SBIN_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/sbin"
CACHE PATH "The ${APPLICATION_SHORT_NAME} sbin install dir (default prefix/sbin)"
)
SET(LIB_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}"
CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is prefix/lib)"
)
SET(LIBEXEC_INSTALL_DIR
"${EXEC_INSTALL_PREFIX}/libexec"
CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is prefix/libexec)"
)
SET(PLUGIN_INSTALL_DIR
"${LIB_INSTALL_DIR}/${APPLICATION_SHORT_NAME}"
CACHE PATH "The subdirectory relative to the install prefix where plugins will be installed (default is prefix/lib/${APPLICATION_SHORT_NAME})"
)
SET(INCLUDE_INSTALL_DIR
"${CMAKE_INSTALL_PREFIX}/include"
CACHE PATH "The subdirectory to the header prefix (default prefix/include)"
)
SET(DATA_INSTALL_DIR
"${DATA_INSTALL_PREFIX}"
CACHE PATH "The parent directory where applications can install their data (default prefix/share/${APPLICATION_SHORT_NAME})"
)
SET(HTML_INSTALL_DIR
"${DATA_INSTALL_PREFIX}/doc/HTML"
CACHE PATH "The HTML install dir for documentation (default data/doc/html)"
)
SET(ICON_INSTALL_DIR
"${DATA_INSTALL_PREFIX}/icons"
CACHE PATH "The icon install dir (default data/icons/)"
)
SET(SOUND_INSTALL_DIR
"${DATA_INSTALL_PREFIX}/sounds"
CACHE PATH "The install dir for sound files (default data/sounds)"
)
SET(LOCALE_INSTALL_DIR
"${SHARE_INSTALL_PREFIX}/locale"
CACHE PATH "The install dir for translations (default prefix/share/locale)"
)
SET(XDG_APPS_DIR
"${SHARE_INSTALL_PREFIX}/applications/"
CACHE PATH "The XDG apps dir"
)
SET(XDG_DIRECTORY_DIR
"${SHARE_INSTALL_PREFIX}/desktop-directories"
CACHE PATH "The XDG directory"
)
IF(NOT "${EXEC_INSTALL_PREFIX}" STREQUAL "/usr")
SET(SYSCONFDIR_INSTALL_PREFIX "${EXEC_INSTALL_PREFIX}")
endif()
SET(SYSCONF_INSTALL_DIR
"${SYSCONFDIR_INSTALL_PREFIX}/etc"
CACHE PATH "The ${APPLICATION_SHORT_NAME} sysconfig install dir (default prefix/etc)"
)
SET(MAN_INSTALL_DIR
"${SHARE_INSTALL_PREFIX}/man"
CACHE PATH "The ${APPLICATION_SHORT_NAME} man install dir (default prefix/man)"
)
SET(INFO_INSTALL_DIR
"${SHARE_INSTALL_PREFIX}/info"
CACHE PATH "The ${APPLICATION_SHORT_NAME} info install dir (default prefix/info)"
)
endif (UNIX)
if (WIN32)
# Same same
set(SHARE_INSTALL_PREFIX "share" CACHE PATH "-")
set(BIN_INSTALL_DIR "." CACHE PATH "-")
set(SBIN_INSTALL_DIR "." CACHE PATH "-")
set(LIB_INSTALL_DIR "lib" CACHE PATH "-")
set(INCLUDE_INSTALL_DIR "include" CACHE PATH "-")
set(PLUGIN_INSTALL_DIR "plugins" CACHE PATH "-")
set(HTML_INSTALL_DIR "doc/HTML" CACHE PATH "-")
set(ICON_INSTALL_DIR "." CACHE PATH "-")
set(SOUND_INSTALL_DIR "." CACHE PATH "-")
set(LOCALE_INSTALL_DIR "lang" CACHE PATH "-")
set(SYSCONF_INSTALL_DIR "config" CACHE PATH "-")
set(MAN_INSTALL_DIR "man" CACHE PATH "-")
endif (WIN32)

View File

@@ -1,6 +1,6 @@
;ownCloud installer script.
!define APPLICATION_SHORTNAME "@APPLICATION_SHORTNAME@"
!define APPLICATION_SHORTNAME "@APPLICATION_EXECUTABLE@"
!define APPLICATION_NAME "@APPLICATION_NAME@"
!define APPLICATION_VENDOR "@APPLICATION_VENDOR@"
!define APPLICATION_EXECUTABLE "@APPLICATION_EXECUTABLE@.exe"

View File

@@ -8,4 +8,10 @@
#cmakedefine APPLICATION_DOMAIN @APPLICATION_DOMAIN@
#cmakedefine THEME_CLASS @THEME_CLASS@
#cmakedefine THEME_INCLUDE @THEME_INCLUDE@
#cmakedefine APPLICATION_NAME "@APPLICATION_NAME@"
#cmakedefine APPLICATION_SHORTNAME "@APPLICATION_SHORTNAME@"
#cmakedefine SYSCONFDIR "@SYSCONFDIR@"
#cmakedefine DATADIR "@DATADIR@"
#endif

View File

@@ -27,7 +27,7 @@ if(SPHINX_FOUND)
# apt-get install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
add_custom_target(doc-latex ${SPHINX_EXECUTABLE}
-q -c . -b latex
-d ${SPHINX_CACHE_DIR}
-d ${SPHINX_CACHE_DIR}/latex
-D latex_logo=${LATEX_LOGO}
${CMAKE_CURRENT_SOURCE_DIR}
${SPHINX_PDF_DIR} )
@@ -41,7 +41,7 @@ if(SPHINX_FOUND)
if (EXISTS ${QT_QCOLLECTIONGENERATOR_EXECUTABLE})
add_custom_target( doc-qch-sphinx ${SPHINX_EXECUTABLE}
-q -c . -b qthelp
-d ${SPHINX_CACHE_DIR}
-d ${SPHINX_CACHE_DIR}/qthelp
${CMAKE_CURRENT_SOURCE_DIR}
${SPHINX_QCH_DIR} )
add_custom_target( doc-qch ${QT_QCOLLECTIONGENERATOR_EXECUTABLE}
@@ -54,12 +54,12 @@ if(SPHINX_FOUND)
endif()
add_custom_target( doc-html ${SPHINX_EXECUTABLE}
-q -c . -b html
-d ${SPHINX_CACHE_DIR}
-d ${SPHINX_CACHE_DIR}/html
${CMAKE_CURRENT_SOURCE_DIR}
${SPHINX_HTML_DIR} )
add_custom_target( doc-man ${SPHINX_EXECUTABLE}
-q -c . -b man
-d ${SPHINX_CACHE_DIR}
-d ${SPHINX_CACHE_DIR}/man
${CMAKE_CURRENT_SOURCE_DIR}
${SPHINX_MAN_DIR} )
@@ -71,7 +71,7 @@ if(SPHINX_FOUND)
add_custom_target( doc-chm-sphinx ${SPHINX_EXECUTABLE}
-q -c . -b htmlhelp
-D html_theme=basic
-d ${SPHINX_CACHE_DIR}
-d ${SPHINX_CACHE_DIR}/htmlhelp
${CMAKE_CURRENT_SOURCE_DIR}
${SPHINX_HTMLHELP_DIR} )
add_custom_target( doc-chm pushd ${SPHINX_HTMLHELP_DIR}; ${MSHTML_COMPILER} *.hhp; popd

View File

@@ -4,4 +4,5 @@ Type=Application
Exec=@APPLICATION_EXECUTABLE@
Name=@APPLICATION_NAME@ desktop sync client
GenericName=Folder Sync
Icon=@APPLICATION_SHORTNAME@
Icon=@APPLICATION_EXECUTABLE@
Keywords=@APPLICATION_NAME@;syncing;file;sharing

View File

@@ -11,7 +11,7 @@ else()
set(theme_dir ${CMAKE_CURRENT_SOURCE_DIR}/../theme)
endif()
set(synclib_NAME ${APPLICATION_SHORTNAME}sync)
set(synclib_NAME ${APPLICATION_EXECUTABLE}sync)
set(mirall_UI
mirall/folderwizardsourcepage.ui
@@ -22,7 +22,6 @@ mirall/generalsettings.ui
mirall/networksettings.ui
mirall/accountsettings.ui
mirall/ignorelisteditor.ui
mirall/fileitemdialog.ui
mirall/itemprogressdialog.ui
wizard/owncloudsetupnocredspage.ui
wizard/owncloudhttpcredspage.ui
@@ -169,8 +168,8 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
)
if(NOT WIN32)
configure_file(${CMAKE_SOURCE_DIR}/mirall.desktop.in
${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_SHORTNAME}.desktop)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_SHORTNAME}.desktop DESTINATION share/applications )
${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_EXECUTABLE}.desktop)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPLICATION_EXECUTABLE}.desktop DESTINATION share/applications )
endif()
else()
install(TARGETS ${synclib_NAME} DESTINATION ${OWNCLOUD_OSX_BUNDLE}/Contents/MacOS)
@@ -193,7 +192,6 @@ set(mirall_SRCS
mirall/occinfo.cpp
mirall/sslerrordialog.cpp
mirall/logbrowser.cpp
mirall/fileitemdialog.cpp
mirall/settingsdialog.cpp
mirall/generalsettings.cpp
mirall/networksettings.cpp
@@ -218,7 +216,6 @@ set(mirall_HEADERS
mirall/updatedetector.h
mirall/sslerrordialog.h
mirall/logbrowser.h
mirall/fileitemdialog.h
mirall/settingsdialog.h
mirall/generalsettings.h
mirall/networksettings.h
@@ -257,7 +254,7 @@ set( final_src
include( AddAppIconMacro )
set(ownCloud_old ${ownCloud})
kde4_add_app_icon( ownCloud "${theme_dir}/colored/${APPLICATION_SHORTNAME}-icon*.png")
kde4_add_app_icon( ownCloud "${theme_dir}/colored/${APPLICATION_EXECUTABLE}-icon*.png")
list(APPEND final_src ${ownCloud})
set(ownCloud ${ownCloud_old})
@@ -265,16 +262,15 @@ if(NOT BUILD_OWNCLOUD_OSX_BUNDLE)
set(BIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
if(NOT WIN32)
file( GLOB _icons "${theme_dir}/colored/${APPLICATION_SHORTNAME}-icon-*.png" )
file( GLOB _icons "${theme_dir}/colored/${APPLICATION_EXECUTABLE}-icon-*.png" )
foreach( _file ${_icons} )
string( REPLACE "${theme_dir}/colored/${APPLICATION_SHORTNAME}-icon-" "" _res ${_file} )
string( REPLACE "${theme_dir}/colored/${APPLICATION_EXECUTABLE}-icon-" "" _res ${_file} )
string( REPLACE ".png" "" _res ${_res} )
install( FILES ${_file} RENAME ${APPLICATION_SHORTNAME}.png DESTINATION
${CMAKE_INSTALL_DATADIR}/icons/hicolor/${_res}x${_res}/apps )
install( FILES ${_file} RENAME ${APPLICATION_EXECUTABLE}.png DESTINATION ${DATADIR}/icons/hicolor/${_res}x${_res}/apps )
endforeach( _file )
endif(NOT WIN32)
install(FILES ${mirall_I18N} DESTINATION share/${APPLICATION_SHORTNAME}/i18n)
install(FILES ${mirall_I18N} DESTINATION share/${APPLICATION_EXECUTABLE}/i18n)
# we may not add MACOSX_BUNDLE here, if not building one

View File

@@ -23,7 +23,12 @@ int main(int argc, char **argv)
Mirall::Application app(argc, argv);
app.initialize();
if( app.giveHelp() ) {
app.showHelp();
return 0;
}
// if the application is already running, notify it.
if( app.isRunning() ) {
QStringList args = app.arguments();
@@ -34,7 +39,7 @@ int main(int argc, char **argv)
}
return 0;
} else {
if (!QSystemTrayIcon::isSystemTrayAvailable()) {
if (!QSystemTrayIcon::isSystemTrayAvailable() && qgetenv("DESKTOP_SESSION") != "ubuntu") {
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 "
@@ -43,11 +48,6 @@ int main(int argc, char **argv)
.arg(Mirall::Theme::instance()->appNameGUI()));
}
}
// if help requested, show on command line and exit.
if( ! app.giveHelp() ) {
return app.exec();
} else {
app.showHelp();
}
return app.exec();
}

View File

@@ -22,7 +22,6 @@
#include "mirall/folderstatusmodel.h"
#include "mirall/utility.h"
#include "mirall/application.h"
#include "mirall/fileitemdialog.h"
#include "mirall/owncloudsetupwizard.h"
#include "mirall/mirallconfigfile.h"
#include "mirall/ignorelisteditor.h"
@@ -34,9 +33,21 @@
#include <QDesktopServices>
#include <QListWidgetItem>
#include <QMessageBox>
#include <QAction>
#include <QKeySequence>
namespace Mirall {
static const char progressBarStyleC[] =
"QProgressBar {"
"border: 1px solid grey;"
"border-radius: 5px;"
"text-align: center;"
"}"
"QProgressBar::chunk {"
"background-color: %1; width: 1px;"
"}";
AccountSettings::AccountSettings(QWidget *parent) :
QWidget(parent),
ui(new Ui::AccountSettings),
@@ -47,6 +58,7 @@ AccountSettings::AccountSettings(QWidget *parent) :
_model = new FolderStatusModel;
_model->setParent(this);
FolderStatusDelegate *delegate = new FolderStatusDelegate;
delegate->setParent(this);
ui->_folderList->setItemDelegate( delegate );
ui->_folderList->setModel( _model );
@@ -54,13 +66,16 @@ AccountSettings::AccountSettings(QWidget *parent) :
ui->_folderList->setEditTriggers( QAbstractItemView::NoEditTriggers );
ui->_ButtonRemove->setEnabled(false);
ui->_ButtonReset->setEnabled(false);
ui->_ButtonEnable->setEnabled(false);
ui->_ButtonInfo->setEnabled(false);
ui->_ButtonAdd->setEnabled(true);
QAction *resetFolderAction = new QAction(this);
resetFolderAction->setShortcut(QKeySequence(Qt::Key_F5));
connect(resetFolderAction, SIGNAL(triggered()), SLOT(slotResetCurrentFolder()));
addAction(resetFolderAction);
connect(ui->_ButtonRemove, SIGNAL(clicked()), this, SLOT(slotRemoveCurrentFolder()));
connect(ui->_ButtonReset, SIGNAL(clicked()), this, SLOT(slotResetCurrentFolder()));
connect(ui->_ButtonEnable, SIGNAL(clicked()), this, SLOT(slotEnableCurrentFolder()));
connect(ui->_ButtonInfo, SIGNAL(clicked()), this, SLOT(slotInfoAboutCurrentFolder()));
connect(ui->_ButtonAdd, SIGNAL(clicked()), this, SLOT(slotAddFolder()));
@@ -70,6 +85,8 @@ AccountSettings::AccountSettings(QWidget *parent) :
connect(ui->_folderList, SIGNAL(clicked(QModelIndex)), SLOT(slotFolderActivated(QModelIndex)));
connect(ui->_folderList, SIGNAL(doubleClicked(QModelIndex)),SLOT(slotDoubleClicked(QModelIndex)));
QColor color = palette().highlight().color();
ui->quotaProgressBar->setStyleSheet(QString::fromLatin1(progressBarStyleC).arg(color.name()));
ownCloudInfo *ocInfo = ownCloudInfo::instance();
slotUpdateQuota(ocInfo->lastQuotaTotalBytes(), ocInfo->lastQuotaUsedBytes());
connect(ocInfo, SIGNAL(quotaUpdated(qint64,qint64)), SLOT(slotUpdateQuota(qint64,qint64)));
@@ -86,8 +103,6 @@ void AccountSettings::slotFolderActivated( const QModelIndex& indx )
bool state = indx.isValid();
ui->_ButtonRemove->setEnabled( state );
ui->_ButtonReset->setEnabled( state );
ui->_ButtonReset->setEnabled( state );
ui->_ButtonEnable->setEnabled( state );
ui->_ButtonInfo->setEnabled( state );
@@ -140,6 +155,7 @@ void AccountSettings::slotFolderWizardAccepted()
folderMan->slotScheduleAllFolders();
emit folderChanged();
}
buttonsSetEnabled();
}
void AccountSettings::slotFolderWizardRejected()
@@ -185,7 +201,6 @@ void AccountSettings::buttonsSetEnabled()
bool isSelected = selected.isValid();
ui->_ButtonEnable->setEnabled(isSelected);
ui->_ButtonReset->setEnabled(isSelected);
ui->_ButtonRemove->setEnabled(isSelected);
ui->_ButtonInfo->setEnabled(isSelected);
}
@@ -207,7 +222,11 @@ void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f )
SyncResult res = f->syncResult();
SyncResult::Status status = res.status();
QString errors = res.errorStrings().join(QLatin1String("<br/>"));
QStringList errorList = res.errorStrings();
QString errors;
if( ! errorList.isEmpty() ) {
errors = res.errorStrings().join(QLatin1String("<br/>"));
}
Theme *theme = Theme::instance();
item->setData( theme->statusHeaderText( status ), Qt::ToolTipRole );
@@ -219,6 +238,12 @@ void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f )
item->setData( theme->statusHeaderText( status ), FolderStatusDelegate::FolderStatus );
item->setData( errors, FolderStatusDelegate::FolderErrorMsg );
if( errors.isEmpty() && (status == SyncResult::Error ||
status == SyncResult::SetupError ||
status == SyncResult::Unavailable )) {
item->setData( theme->statusHeaderText(status), FolderStatusDelegate::FolderErrorMsg);
}
bool ongoing = false;
item->setData( QVariant(res.warnCount()), FolderStatusDelegate::WarningCount );
if( status == SyncResult::SyncRunning ) {
@@ -260,8 +285,10 @@ void AccountSettings::slotResetCurrentFolder()
QString alias = _model->data( selected, FolderStatusDelegate::FolderAliasRole ).toString();
int ret = QMessageBox::question( 0, tr("Confirm Folder Reset"),
tr("<p>Do you really want to reset folder <i>%1</i> and rebuild your client database?</p>"
"<p><b>Note:</b> While no files will be removed, this can cause significant data "
"traffic and take several minutes to hours, depending on the size of the folder.</p>").arg(alias),
"<p><b>Note:</b> This function is designed for maintenance purposes only. "
"No files will be removed, but this can cause significant data traffic and "
"take several minutes or hours to complete, depending on the size of the folder. "
"Only use this option if advised by your administrator.</p>").arg(alias),
QMessageBox::Yes|QMessageBox::No );
if( ret == QMessageBox::Yes ) {
FolderMan *folderMan = FolderMan::instance();
@@ -307,9 +334,10 @@ void AccountSettings::setFolderList( const Folder::Map &folders )
slotAddFolder( f );
}
QModelIndex idx = _model->index(0, 0);
if (idx.isValid())
QModelIndex idx = _model->index(0, 0);
if (idx.isValid()) {
ui->_folderList->setCurrentIndex(idx);
}
buttonsSetEnabled();
}
@@ -352,7 +380,7 @@ void AccountSettings::slotEnableCurrentFolder()
// this sets the folder status to disabled but does not interrupt it.
Folder *f = folderMan->folder( alias );
if( f && !folderEnabled ) {
if( f && folderEnabled ) {
// check if a sync is still running and if so, ask if we should terminate.
if( f->isBusy() ) { // its still running
int reply = QMessageBox::question( 0, tr("Sync Running"),
@@ -395,11 +423,6 @@ void AccountSettings::slotUpdateFolderState( Folder *folder )
item = _model->item( ++row );
}
#if 0
if( !_fileItemDialog.isNull() && _fileItemDialog->isVisible() ) {
_fileItemDialog->setSyncResult( FolderMan::instance()->syncResult(folder) );
}
#endif
if( item ) {
folderToModelItem( item, folder );
} else {
@@ -425,7 +448,9 @@ void AccountSettings::slotOCInfo( const QString& url, const QString& versionStr,
qDebug() << "#-------# oC found on " << url;
/* enable the open button */
ui->connectLabel->setOpenExternalLinks(true);
ui->connectLabel->setText( tr("Connected to <a href=\"%1\">%1</a>.").arg(url) );
QUrl safeUrl(url);
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()) );
ui->connectLabel->setToolTip( tr("Version: %1 (%2)").arg(versionStr).arg(version));
ui->_ButtonAdd->setEnabled(true);
@@ -534,6 +559,15 @@ void AccountSettings::slotSetProgress(const QString& folder, const Progress::Inf
// stay with the previous kind-string for Context.
if( progress.kind != Progress::Context ) {
_kindContext = Progress::asActionString(progress.kind);
} else {
if( _kindContext.isEmpty() ) {
// empty kind context means that the dialog was opened after the action
// was started.
Progress::Kind kind = ProgressDispatcher::instance()->currentFolderContext(progress.folder);
if( kind != Progress::Invalid ) {
_kindContext = Progress::asActionString(kind);
}
}
}
QString kindString = _kindContext;
@@ -640,10 +674,12 @@ void AccountSettings::slotUpdateQuota(qint64 total, qint64 used)
ui->quotaProgressBar->setEnabled(true);
// workaround the label only accepting ints (which may be only 32 bit wide)
ui->quotaProgressBar->setMaximum(100);
ui->quotaProgressBar->setValue(round(used/(double)total * 100));
int qVal = qRound(used/(double)total * 100);
if( qVal > 100 ) qVal = 100;
ui->quotaProgressBar->setValue(qVal);
QString usedStr = Utility::octetsToString(used);
QString totalStr = Utility::octetsToString(total);
ui->quotaLabel->setText(tr("You are using %1 of your available %2 storage.").arg(usedStr, totalStr));
ui->quotaLabel->setText(tr("%1 of %2 in use.").arg(usedStr, totalStr));
}
void AccountSettings::slotIgnoreFilesEditor()

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>607</width>
<height>385</height>
<height>382</height>
</rect>
</property>
<property name="windowTitle">
@@ -30,16 +30,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeAccountButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remove Account</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="modifyAccountButton">
<property name="text">
@@ -71,7 +61,7 @@
<item>
<widget class="QPushButton" name="_ButtonAdd">
<property name="text">
<string>Add Sync...</string>
<string>Add Folder...</string>
</property>
</widget>
</item>
@@ -82,19 +72,6 @@
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="_ButtonRemove">
<property name="text">
@@ -102,13 +79,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="_ButtonReset">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">

View File

@@ -16,6 +16,8 @@
#include <iostream>
#include "config.h"
#include "mirall/application.h"
#include "mirall/systray.h"
#include "mirall/folder.h"
@@ -81,8 +83,7 @@ static const char optionsC[] =
QString applicationTrPath()
{
#ifdef Q_OS_LINUX
// FIXME - proper path!
return QString::fromLatin1("/usr/share/%1/i18n/").arg(Theme::instance()->appName());
return QString::fromLatin1(DATADIR"/i18n/");
#endif
#ifdef Q_OS_MAC
return QApplication::applicationDirPath()+QLatin1String("/../Resources/Translations"); // path defaults to app dir.
@@ -113,11 +114,12 @@ Application::Application(int &argc, char **argv) :
setWindowIcon( _theme->applicationIcon() );
parseOptions(arguments());
setupTranslations();
setupLogBrowser();
//no need to waste time;
if ( _helpOnly ) return;
setupLogBrowser();
setupTranslations();
connect( this, SIGNAL(messageReceived(QString)), SLOT(slotParseOptions(QString)));
connect( Logger::instance(), SIGNAL(guiLog(QString,QString)),
this, SLOT(slotShowTrayMessage(QString,QString)));
@@ -182,6 +184,11 @@ Application::Application(int &argc, char **argv) :
Application::~Application()
{
if (_settingsDialog) {
delete _settingsDialog.data();
}
delete _logBrowser;
delete _tray; // needed, see ctor
qDebug() << "* Mirall shutdown";
@@ -329,7 +336,7 @@ void Application::setupActions()
QObject::connect(_actionSettings, SIGNAL(triggered(bool)), SLOT(slotSettings()));
_actionHelp = new QAction(tr("Help"), this);
QObject::connect(_actionHelp, SIGNAL(triggered(bool)), SLOT(slotHelp()));
_actionQuit = new QAction(tr("Quit"), this);
_actionQuit = new QAction(tr("Quit %1").arg(_theme->appNameGUI()), this);
QObject::connect(_actionQuit, SIGNAL(triggered(bool)), SLOT(quit()));
}
@@ -362,7 +369,7 @@ void Application::setupContextMenu()
_recentActionsMenu->addAction(_actionRecent);
} else {
_contextMenu = new QMenu();
_recentActionsMenu = _contextMenu->addMenu(tr("Recent Changes..."));
_recentActionsMenu = _contextMenu->addMenu(tr("Recent Changes"));
// this must be called only once after creating the context menu, or
// it will trigger a bug in Ubuntu's SNI bridge patch (11.10, 12.04).
_tray->setContextMenu(_contextMenu);
@@ -379,7 +386,7 @@ void Application::setupContextMenu()
Folder *folder = folderMan->map().value(li.first());
if( folder ) {
// if there is singleFolder mode, a generic open action is displayed.
QAction *action = new QAction( tr("Open local folder '%1'").arg(_theme->appNameGUI()), this);
QAction *action = new QAction( tr("Open %1 folder").arg(_theme->appNameGUI()), this);
connect( action, SIGNAL(triggered()),_folderOpenActionMapper,SLOT(map()));
_folderOpenActionMapper->setMapping( action, folder->alias() );
@@ -407,7 +414,9 @@ void Application::setupContextMenu()
_contextMenu->addMenu(_recentActionsMenu);
_contextMenu->addSeparator();
_contextMenu->addAction(_actionSettings);
_contextMenu->addAction(_actionHelp);
if (!_theme->helpUrl().isEmpty()) {
_contextMenu->addAction(_actionHelp);
}
_contextMenu->addSeparator();
_contextMenu->addAction(_actionQuit);
@@ -418,8 +427,8 @@ void Application::setupLogBrowser()
// might be called from second instance
if (!_logBrowser) {
// init the log browser.
_logBrowser = new LogBrowser;
qInstallMsgHandler( mirallLogCatcher );
_logBrowser = new LogBrowser;
// ## TODO: allow new log name maybe?
if (!_logDirectory.isEmpty()) {
enterNextLogFile();
@@ -510,6 +519,9 @@ void Application::slotSetupProxy()
default:
break;
}
FolderMan::instance()->setDirtyProxy(true);
FolderMan::instance()->slotScheduleAllFolders();
}
void Application::slotRefreshQuotaDisplay( qint64 total, qint64 used )
@@ -522,7 +534,7 @@ void Application::slotRefreshQuotaDisplay( qint64 total, qint64 used )
double percent = used/(double)total*100;
QString percentFormatted = Utility::compactFormatDouble(percent, 1);
QString totalFormatted = Utility::octetsToString(total);
_actionQuota->setText(tr("%1% of %2 used").arg(percentFormatted).arg(totalFormatted));
_actionQuota->setText(tr("%1% of %2 in use").arg(percentFormatted).arg(totalFormatted));
}
void Application::slotUseMonoIconsChanged(bool)
@@ -551,9 +563,9 @@ void Application::rebuildRecentMenus()
_recentActionsMenu->addAction(tr("No items synced recently"));
} else {
QListIterator<Progress::Info> i(progressInfoList);
i.toBack();
while(i.hasPrevious()) {
Progress::Info info = i.previous();
while(i.hasNext()) {
Progress::Info info = i.next();
QString kindStr = Progress::asResultString(info.kind);
QString timeStr = info.timestamp.toString("hh:mm");
@@ -594,7 +606,7 @@ void Application::slotUpdateProgress(const QString &folder, const Progress::Info
void Application::slotDisplayIdle()
{
_actionStatus->setText(tr("In Sync"));
_actionStatus->setText(tr("Up to date"));
}
void Application::slotHelp()

View File

@@ -140,19 +140,19 @@ QString CSyncThread::csyncErrorToString( CSYNC_ERROR_CODE err, const char *errSt
errStr = tr("A HTTP transmission error happened.");
break;
case CSYNC_ERR_PERM:
errStr = tr("CSync failed due to not handled permission deniend.");
errStr = tr("CSync: Permission deniend.");
break;
case CSYNC_ERR_NOT_FOUND:
errStr = tr("CSync failed to find a specific file.");
errStr = tr("CSync: File not found.");
break;
case CSYNC_ERR_EXISTS:
errStr = tr("CSync tried to create a directory that already exists.");
errStr = tr("CSync: Directory already exists.");
break;
case CSYNC_ERR_NOSPC:
errStr = tr("CSync: No space on %1 server available.").arg(Theme::instance()->appNameGUI());
errStr = tr("CSync: No space left on %1 server.").arg(Theme::instance()->appNameGUI());
break;
case CSYNC_ERR_UNSPEC:
errStr = tr("CSync unspecified error.");
errStr = tr("CSync: unspecified error.");
default:
errStr = tr("An internal error number %1 happend.").arg( (int) err );
@@ -257,7 +257,7 @@ int CSyncThread::treewalkFile( TREE_WALK_FILE *file, bool remote )
int CSyncThread::treewalkError(TREE_WALK_FILE* file)
{
SyncFileItem item;
SyncFileItem item; // only used for search.
item._file= QString::fromUtf8(file->path);
int indx = _syncedItems.indexOf(item);
@@ -269,6 +269,7 @@ int CSyncThread::treewalkError(TREE_WALK_FILE* file)
file->instruction == CSYNC_INSTRUCTION_ERROR) ) {
_mutex.lock();
_syncedItems[indx]._instruction = file->instruction;
_syncedItems[indx]._errorString = QString::fromUtf8(file->error_string);
_mutex.unlock();
}
@@ -335,14 +336,14 @@ void CSyncThread::startSync()
int downloadLimit = 0;
if (cfg.useDownloadLimit()) {
downloadLimit = cfg.downloadLimit();
downloadLimit = cfg.downloadLimit() * 1000;
}
csync_set_module_property(_csync_ctx, "bandwidth_limit_download", &downloadLimit);
int uploadLimit = -75; // 75%
int useUpLimit = cfg.useUploadLimit();
if ( useUpLimit >= 1) {
uploadLimit = cfg.uploadLimit();
uploadLimit = cfg.uploadLimit() * 1000;
} else if (useUpLimit == 0) {
uploadLimit = 0;
}
@@ -494,7 +495,7 @@ void CSyncThread::cb_progress( CSYNC_PROGRESS *progress, void *userdata )
pInfo.current_file_no = progress->current_file_no;
pInfo.overall_transmission_size = progress->overall_transmission_size;
pInfo.overall_current_bytes = progress->current_overall_bytes;
pInfo.timestamp = QTime::currentTime();
pInfo.timestamp = QDateTime::currentDateTime();
// Connect to something in folder!
thread->transmissionProgress( pInfo );

View File

@@ -1,309 +0,0 @@
/*
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <QtGui>
#include "mirall/fileitemdialog.h"
#include "mirall/syncresult.h"
#include "mirall/logger.h"
#include "ui_fileitemdialog.h"
#define TYPE_SUCCESS 1
#define TYPE_CONFLICT 2
#define TYPE_NEW 3
#define TYPE_DELETED 4
#define TYPE_ERROR 5
#define TYPE_RENAME 6
#define TYPE_IGNORE 7
#define FILE_TYPE 100
namespace Mirall {
FileItemDialog::FileItemDialog(QWidget *parent) :
QDialog(parent),
_ui(new Ui::FileItemDialog)
{
_ui->setupUi(this);
connect(_ui->_dialogButtonBox->button(QDialogButtonBox::Close), SIGNAL(clicked()),
this, SLOT(accept()));
QStringList header;
header << tr("Files");
QString firstColString = tr("File Count");
header << firstColString;
_ui->_treeWidget->setHeaderLabels( header );
_ui->_treeWidget->setColumnWidth(0, 480);
_timer.setInterval(1000);
connect(&_timer, SIGNAL(timeout()), this, SLOT(slotSetFolderMessage()));
QPushButton *copyBtn = _ui->_dialogButtonBox->addButton(tr("Copy"), QDialogButtonBox::ActionRole);
connect(copyBtn, SIGNAL(clicked()), SLOT(copyToClipboard()));
setWindowTitle(tr("Sync Protocol"));
}
FileItemDialog::~FileItemDialog()
{
delete _ui;
}
void FileItemDialog::setSyncResult( const SyncResult& result )
{
QString folderMessage;
SyncResult::Status syncStatus = result.status();
switch( syncStatus ) {
case SyncResult::Undefined:
folderMessage = tr( "Undefined Folder State" );
break;
case SyncResult::NotYetStarted:
folderMessage = tr( "The folder waits to start syncing." );
break;
case SyncResult::SyncPrepare:
folderMessage = tr( "Determining which files to sync." );
break;
case SyncResult::Unavailable:
folderMessage = tr( "Server is currently not available." );
break;
case SyncResult::SyncRunning:
folderMessage = tr("Sync is running.");
break;
case SyncResult::Success:
folderMessage = tr("Last Sync was successful.");
break;
case SyncResult::Error:
folderMessage = tr( "Syncing Error." );
break;
case SyncResult::SetupError:
folderMessage = tr( "Setup Error." );
break;
default:
folderMessage = tr( "Undefined Error State." );
}
_folderMessage = folderMessage;
_lastSyncTime = result.syncTime();
if( result.errorStrings().count() ) {
_ui->_errorLabel->setVisible(true);
_ui->_errorLabel->setTextFormat(Qt::RichText);
QString errStr;
foreach( QString err, result.errorStrings() ) {
errStr.append(QString("<p>%1</p>").arg(err));
}
_ui->_errorLabel->setText(errStr);
} else {
_ui->_errorLabel->setText(QString::null);
_ui->_errorLabel->setVisible(false);
}
slotSetFolderMessage();
if( syncStatus == SyncResult::SyncRunning ) {
_timer.stop();
} else {
_timer.start();
}
setSyncFileItems( result.syncFileItemVector() );
}
void FileItemDialog::slotSetFolderMessage()
{
QDateTime now = QDateTime::currentDateTime();
int secs = _lastSyncTime.secsTo(now);
if (secs < 60)
_ui->_timelabel->setText(tr("%1 (last finished %n sec. ago)", "", secs).arg(_folderMessage));
else
_ui->_timelabel->setText(tr("%1 (last finished %n min. ago)", "", secs/60).arg(_folderMessage));
}
void FileItemDialog::copyToClipboard()
{
QString text;
QTextStream ts(&text);
int topLevelItems = _ui->_treeWidget->topLevelItemCount();
for (int i = 0; i < topLevelItems; i++) {
QTreeWidgetItem *item = _ui->_treeWidget->topLevelItem(i);
ts << left << qSetFieldWidth(50)
<< item->data(0, Qt::DisplayRole).toString()
<< right << qSetFieldWidth(6)
<< item->data(1, Qt::DisplayRole).toString()
<< endl;
int childItems = item->childCount();
for (int j = 0; j < childItems; j++) {
QTreeWidgetItem *child =item->child(j);
ts << left << qSetFieldWidth(0) << QLatin1String(" ")
<< child->data(0,Qt::DisplayRole).toString()
<< QString::fromLatin1(" (%1)").arg(
child->data(1, Qt::DisplayRole).toString()
)
<< endl;
}
}
QApplication::clipboard()->setText(text);
Logger::instance()->postGuiLog(tr("Copied to clipboard"), tr("The sync protocol has been copied to the clipboard."));
}
void FileItemDialog::accept()
{
_timer.stop();
QDialog::accept();
}
void FileItemDialog::setSyncFileItems( const SyncFileItemVector& list )
{
_ui->_treeWidget->clear();
QStringList strings;
QFont headerFont;
headerFont.setWeight(QFont::Bold);
strings.clear();
strings.append(tr("Synced Files"));
_syncedFileItem = new QTreeWidgetItem( _ui->_treeWidget, strings, TYPE_SUCCESS );
_syncedFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_ui->_treeWidget->addTopLevelItem(_syncedFileItem);
strings.clear();
strings.append(tr("New Files"));
_newFileItem = new QTreeWidgetItem( _ui->_treeWidget, strings, TYPE_NEW );
_newFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_ui->_treeWidget->addTopLevelItem(_newFileItem);
strings.clear();
strings.append(tr("Deleted Files"));
_deletedFileItem = new QTreeWidgetItem( _ui->_treeWidget, strings, TYPE_DELETED );
_deletedFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_ui->_treeWidget->addTopLevelItem(_deletedFileItem);
strings.clear();
strings.append(tr("Renamed Files"));
_renamedFileItem = new QTreeWidgetItem( _ui->_treeWidget, strings, TYPE_RENAME);
_renamedFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_ui->_treeWidget->addTopLevelItem(_renamedFileItem);
strings.clear();
strings.append(tr("Ignored Files"));
_ignoredFileItem = new QTreeWidgetItem( _ui->_treeWidget, strings, TYPE_IGNORE);
_ignoredFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_ui->_treeWidget->addTopLevelItem(_renamedFileItem);
strings.clear();
strings.append(tr("Errors"));
_errorFileItem = new QTreeWidgetItem( _ui->_treeWidget, strings, TYPE_ERROR );
_errorFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_ui->_treeWidget->addTopLevelItem(_errorFileItem);
strings.clear();
strings.append(tr("Conflicts"));
_conflictFileItem = new QTreeWidgetItem( _ui->_treeWidget, strings, TYPE_CONFLICT);
_conflictFileItem->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
_ui->_treeWidget->addTopLevelItem(_conflictFileItem);
QList<QTreeWidgetItem*> syncedItems;
QList<QTreeWidgetItem*> renamedItems;
QList<QTreeWidgetItem*> newItems;
QList<QTreeWidgetItem*> deletedItems;
QList<QTreeWidgetItem*> ignoredItems;
QList<QTreeWidgetItem*> conflictItems;
QList<QTreeWidgetItem*> errorItems;
quint64 overall_files = 0;
foreach( SyncFileItem item, list ) {
overall_files++;
QString dir;
QStringList str( item._file );
if( item._dir == SyncFileItem::Up ) dir = tr("Uploaded");
if( item._dir == SyncFileItem::Down ) dir = tr("Downloaded");
str << dir;
switch( item._instruction ) {
case CSYNC_INSTRUCTION_NONE:
// do nothing.
break;
case CSYNC_INSTRUCTION_EVAL:
// should not happen
break;
case CSYNC_INSTRUCTION_REMOVE:
case CSYNC_INSTRUCTION_DELETED:
deletedItems.append( new QTreeWidgetItem(_deletedFileItem, str, FILE_TYPE) );
break;
case CSYNC_INSTRUCTION_RENAME:
renamedItems.append( new QTreeWidgetItem(_renamedFileItem, str, FILE_TYPE) );
break;
case CSYNC_INSTRUCTION_NEW:
newItems.append( new QTreeWidgetItem(_newFileItem, str, FILE_TYPE) );
break;
case CSYNC_INSTRUCTION_CONFLICT:
conflictItems.append( new QTreeWidgetItem(_conflictFileItem, str, FILE_TYPE) );
break;
case CSYNC_INSTRUCTION_IGNORE:
ignoredItems.append( new QTreeWidgetItem(_ignoredFileItem, str, FILE_TYPE) );
break;
case CSYNC_INSTRUCTION_SYNC:
case CSYNC_INSTRUCTION_UPDATED:
syncedItems.append( new QTreeWidgetItem(_syncedFileItem, str, FILE_TYPE) );
break;
case CSYNC_INSTRUCTION_STAT_ERROR:
case CSYNC_INSTRUCTION_ERROR:
errorItems.append( new QTreeWidgetItem(_errorFileItem, str, FILE_TYPE) );
break;
default:
break;
}
}
formatHeaderItem( _syncedFileItem, syncedItems );
formatHeaderItem( _newFileItem, newItems );
formatHeaderItem( _deletedFileItem, deletedItems );
formatHeaderItem( _renamedFileItem, renamedItems );
formatHeaderItem( _errorFileItem, errorItems );
formatHeaderItem( _conflictFileItem, conflictItems );
formatHeaderItem( _ignoredFileItem, ignoredItems );
}
void FileItemDialog::formatHeaderItem( QTreeWidgetItem *header, const QList<QTreeWidgetItem*>& list )
{
if( !header ) return;
header->addChildren( list );
int count = list.count();
#if LEAVE_THAT_TO_DESIGNERS
QColor col("#adc5d3");
header->setBackgroundColor(0, col);
header->setBackgroundColor(1, col);
#endif
header->setText(1, QString::number( count ));
if( count ) {
QFont font;
font.setWeight( QFont::Bold );
header->setFont(0, font);
header->setFont(1, font);
header->setExpanded(true);
} else {
header->setExpanded(false);
}
}
}

View File

@@ -1,68 +0,0 @@
/*
* Copyright (C) by Klaas Freitag <freitag@owncloud.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef FILEITEMDIALOG_H
#define FILEITEMDIALOG_H
#include <QDialog>
#include <QDateTime>
#include <QTimer>
#include "mirall/syncfileitem.h"
#include "ui_fileitemdialog.h"
namespace Mirall {
class SyncResult;
namespace Ui {
class FileItemDialog;
}
class FileItemDialog : public QDialog
{
Q_OBJECT
public:
explicit FileItemDialog(QWidget *parent = 0);
~FileItemDialog();
void setSyncResult( const SyncResult& );
signals:
public slots:
void accept();
protected slots:
void slotSetFolderMessage();
void copyToClipboard();
private:
void setSyncFileItems( const SyncFileItemVector& list );
void formatHeaderItem( QTreeWidgetItem *, const QList<QTreeWidgetItem*>& );
QTreeWidgetItem *_newFileItem;
QTreeWidgetItem *_syncedFileItem;
QTreeWidgetItem *_deletedFileItem;
QTreeWidgetItem *_renamedFileItem;
QTreeWidgetItem *_errorFileItem;
QTreeWidgetItem *_conflictFileItem;
QTreeWidgetItem *_ignoredFileItem;
QString _folderMessage;
QDateTime _lastSyncTime;
QTimer _timer;
Ui::FileItemDialog *_ui;
};
}
#endif // FILEITEMDIALOG_H

View File

@@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Mirall::FileItemDialog</class>
<widget class="QWidget" name="Mirall::FileItemDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>612</width>
<height>543</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>Detailed Sync Protocol</string>
</property>
</widget>
</item>
<item>
<widget class="QTreeWidget" name="_treeWidget">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="rootIsDecorated">
<bool>true</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
<item>
<widget class="QLabel" name="_timelabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="_errorLabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="_dialogButtonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -22,6 +22,7 @@
#include "mirall/logger.h"
#include "mirall/owncloudinfo.h"
#include "mirall/utility.h"
#include "folderman.h"
#include "creds/abstractcredentials.h"
#include <QDebug>
@@ -69,10 +70,6 @@ Folder::Folder(const QString &alias, const QString &path, const QString& secondP
_syncResult.setStatus( SyncResult::NotYetStarted );
ServerActionNotifier *notifier = new ServerActionNotifier(this);
connect(this, SIGNAL(syncFinished(SyncResult)), this, SLOT(slotSyncFinished(SyncResult)));
connect(this, SIGNAL(syncFinished(SyncResult)), notifier, SLOT(slotSyncFinished(SyncResult)));
// check if the local path exists
checkLocalPath();
@@ -208,7 +205,7 @@ void Folder::setSyncEnabled( bool doit )
_syncResult.clearErrors();
evaluateSync( QStringList() );
} else {
// disable folder. Done through the _enabled-flag set above
_pollTimer.stop();
}
}
@@ -236,28 +233,37 @@ void Folder::evaluateSync(const QStringList &/*pathList*/)
void Folder::slotPollTimerTimeout()
{
qDebug() << "* Polling" << alias() << "for changes. Ignoring all pending events until now (time since next sync:" << (_timeSinceLastSync.elapsed() / 1000) << "s)";
_watcher->clearPendingEvents();
qDebug() << "* Polling" << alias() << "for changes. (time since next sync:" << (_timeSinceLastSync.elapsed() / 1000) << "s)";
if (quint64(_timeSinceLastSync.elapsed()) > MirallConfigFile().forceSyncInterval()) {
qDebug() << "* Force Sync now";
evaluateSync(QStringList());
} else {
RequestEtagJob* job = new RequestEtagJob(secondPath(), this);
// check if the etag is different
QObject::connect(new RequestEtagJob(secondPath(), this), SIGNAL(etagRetreived(QString)),
this, SLOT(etagRetreived(QString)));
QObject::connect(job, SIGNAL(etagRetreived(QString)), this, SLOT(etagRetreived(QString)));
QObject::connect(job, SIGNAL(networkError()), this, SLOT(slotNetworkUnavailable()));
}
}
void Folder::etagRetreived(const QString& etag)
{
qDebug() << "* Compare etag " << etag << " with previous etag " << _lastEtag;
qDebug() << "* Compare etag with previous etag: " << (_lastEtag != etag);
// re-enable sync if it was disabled because network was down
FolderMan::instance()->setSyncEnabled(true);
if (_lastEtag != etag) {
_lastEtag = etag;
evaluateSync(QStringList());
}
}
void Folder::slotNetworkUnavailable()
{
_syncResult.setStatus(SyncResult::Unavailable);
emit syncStateChange();
}
void Folder::slotChanged(const QStringList &pathList)
{
@@ -265,14 +271,95 @@ void Folder::slotChanged(const QStringList &pathList)
evaluateSync(pathList);
}
void Folder::slotSyncFinished(const SyncResult &result)
void Folder::bubbleUpSyncResult()
{
_watcher->setEventsEnabledDelayed(2000);
_pollTimer.start();
_timeSinceLastSync.restart();
// count new, removed and updated items
int newItems = 0;
int removedItems = 0;
int updatedItems = 0;
int ignoredItems = 0;
qDebug() << "OO folder slotSyncFinished: result: " << int(result.status());
emit syncStateChange();
SyncFileItem firstItemNew;
SyncFileItem firstItemDeleted;
SyncFileItem firstItemUpdated;
Logger *logger = Logger::instance();
foreach (const SyncFileItem &item, _syncResult.syncFileItemVector() ) {
if( item._instruction == CSYNC_INSTRUCTION_ERROR ) {
slotCSyncError( tr("File %1: %2").arg(item._file).arg(item._errorString) );
logger->postGuiLog(tr("File %1").arg(item._file), item._errorString);
} else {
if (item._dir == SyncFileItem::Down) {
switch (item._instruction) {
case CSYNC_INSTRUCTION_NEW:
newItems++;
if (firstItemNew.isEmpty())
firstItemNew = item;
if (item._type == SyncFileItem::Directory) {
_watcher->addPath(path() + item._file);
}
break;
case CSYNC_INSTRUCTION_REMOVE:
removedItems++;
if (firstItemDeleted.isEmpty())
firstItemDeleted = item;
if (item._type == SyncFileItem::Directory) {
_watcher->removePath(path() + item._file);
}
break;
case CSYNC_INSTRUCTION_UPDATED:
updatedItems++;
if (firstItemUpdated.isEmpty())
firstItemUpdated = item;
break;
case CSYNC_INSTRUCTION_ERROR:
qDebug() << "Got Instruction ERROR. " << _syncResult.errorString();
break;
default:
// nothing.
break;
}
} else if( item._dir == SyncFileItem::None ) { // ignored files counting.
if( item._instruction == CSYNC_INSTRUCTION_IGNORE ) {
ignoredItems++;
}
}
}
}
_syncResult.setWarnCount(ignoredItems);
qDebug() << "OO folder slotSyncFinished: result: " << int(_syncResult.status());
if (newItems > 0) {
QString file = QDir::toNativeSeparators(firstItemNew._file);
if (newItems == 1)
logger->postGuiLog(tr("New file available"), tr("'%1' has been synced to this machine.").arg(file));
else
logger->postGuiLog(tr("New files available"), tr("'%1' and %n other file(s) have been synced to this machine.",
"", newItems-1).arg(file));
}
if (removedItems > 0) {
QString file = QDir::toNativeSeparators(firstItemDeleted._file);
if (removedItems == 1)
logger->postGuiLog(tr("File removed"), tr("'%1' has been removed.").arg(file));
else
logger->postGuiLog(tr("Files removed"), tr("'%1' and %n other file(s) have been removed.",
"", removedItems-1).arg(file));
}
if (updatedItems > 0) {
QString file = QDir::toNativeSeparators(firstItemUpdated._file);
if (updatedItems == 1)
logger->postGuiLog(tr("File updated"), tr("'%1' has been updated.").arg(file));
else
logger->postGuiLog(tr("Files updated"), tr("'%1' and %n other file(s) have been updated.",
"", updatedItems-1).arg(file));
}
}
void Folder::slotLocalPathChanged( const QString& dir )
@@ -411,6 +498,8 @@ void Folder::setProxy()
csync_set_module_property(_csync_ctx, "proxy_port", &proxyPort );
csync_set_module_property(_csync_ctx, "proxy_user", proxy.user().toUtf8().data() );
csync_set_module_property(_csync_ctx, "proxy_pwd" , proxy.password().toUtf8().data() );
FolderMan::instance()->setDirtyProxy(false);
}
}
@@ -449,6 +538,8 @@ void Folder::startSync(const QStringList &pathList)
QMetaObject::invokeMethod(this, "slotCSyncFinished", Qt::QueuedConnection);
return;
}
} else if (FolderMan::instance()->isDirtyProxy()) {
setProxy();
}
if (_thread && _thread->isRunning()) {
@@ -522,10 +613,14 @@ void Folder::slotCsyncUnavailable()
void Folder::slotCSyncFinished()
{
qDebug() << "-> CSync Finished slot with error " << _csyncError;
_watcher->setEventsEnabledDelayed(2000);
_pollTimer.start();
_timeSinceLastSync.restart();
bubbleUpSyncResult();
if (_csyncError) {
_syncResult.setStatus(SyncResult::Error);
qDebug() << " ** error Strings: " << _errors;
_syncResult.setErrorStrings( _errors );
qDebug() << " * owncloud csync thread finished with error";
@@ -541,6 +636,7 @@ void Folder::slotCSyncFinished()
if( _thread && _thread->isRunning() ) {
_thread->quit();
}
emit syncStateChange();
ownCloudInfo::instance()->getQuotaRequest("/");
emit syncFinished( _syncResult );
}
@@ -573,79 +669,6 @@ void Folder::slotTransmissionProgress(const Progress::Info& progress)
ProgressDispatcher::instance()->setProgressInfo(alias(), newInfo);
}
ServerActionNotifier::ServerActionNotifier(QObject *parent)
: QObject(parent)
{
}
void ServerActionNotifier::slotSyncFinished(const SyncResult &result)
{
SyncFileItemVector items = result.syncFileItemVector();
if (items.count() == 0)
return;
int newItems = 0;
int removedItems = 0;
int updatedItems = 0;
SyncFileItem firstItemNew;
SyncFileItem firstItemDeleted;
SyncFileItem firstItemUpdated;
foreach (const SyncFileItem &item, items) {
if (item._dir == SyncFileItem::Down) {
switch (item._instruction) {
case CSYNC_INSTRUCTION_NEW:
newItems++;
if (firstItemNew.isEmpty())
firstItemNew = item;
break;
case CSYNC_INSTRUCTION_REMOVE:
removedItems++;
if (firstItemDeleted.isEmpty())
firstItemDeleted = item;
break;
case CSYNC_INSTRUCTION_UPDATED:
updatedItems++;
if (firstItemUpdated.isEmpty())
firstItemUpdated = item;
break;
case CSYNC_INSTRUCTION_ERROR:
qDebug() << "Got Instruction ERROR. " << result.errorString();
break;
default:
// nothing.
break;
}
}
}
Logger *logger = Logger::instance();
if (newItems > 0) {
QString file = QDir::toNativeSeparators(firstItemNew._file);
if (newItems == 1)
logger->postGuiLog(tr("New file available"), tr("'%1' has been synced to this machine.").arg(file));
else
logger->postGuiLog(tr("New files available"), tr("'%1' and %n other file(s) have been synced to this machine.",
"", newItems-1).arg(file));
}
if (removedItems > 0) {
QString file = QDir::toNativeSeparators(firstItemDeleted._file);
if (removedItems == 1)
logger->postGuiLog(tr("File removed"), tr("'%1' has been removed.").arg(file));
else
logger->postGuiLog(tr("Files removed"), tr("'%1' and %n other file(s) have been removed.",
"", removedItems-1).arg(file));
}
if (updatedItems > 0) {
QString file = QDir::toNativeSeparators(firstItemUpdated._file);
if (updatedItems == 1)
logger->postGuiLog(tr("File updated"), tr("'%1' has been updated.").arg(file));
else
logger->postGuiLog(tr("Files updated"), tr("'%1' and %n other file(s) have been updated.",
"", updatedItems-1).arg(file));
}
}
void Folder::slotAboutToRemoveAllFiles(SyncFileItem::Direction direction, bool *cancel)
{
QString msg = direction == SyncFileItem::Down ?

View File

@@ -53,17 +53,6 @@ typedef enum SyncFileStatus_s {
STATUS_UPDATED
} SyncFileStatus;
class ServerActionNotifier : public QObject
{
Q_OBJECT
public:
ServerActionNotifier(QObject *parent = 0);
public slots:
void slotSyncFinished(const SyncResult &result);
private:
};
class Folder : public QObject
{
Q_OBJECT
@@ -140,7 +129,6 @@ signals:
void scheduleToSync( const QString& );
public slots:
void slotSyncFinished(const SyncResult &);
/**
*
@@ -172,6 +160,7 @@ private slots:
void slotPollTimerTimeout();
void etagRetreived(const QString &);
void slotNetworkUnavailable();
/**
* Triggered by a file system watcher on the local sync dir
@@ -189,6 +178,8 @@ protected:
void setProxy();
const char* proxyTypeToCStr(QNetworkProxy::ProxyType type);
void bubbleUpSyncResult();
/**
* Starts a sync (calling startSync)
* if the policies allow for it

View File

@@ -37,7 +37,8 @@ FolderMan* FolderMan::_instance = 0;
FolderMan::FolderMan(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
// duplication of folderConfigPath() here
@@ -355,6 +356,10 @@ void FolderMan::slotScheduleSync( const QString& alias )
void FolderMan::setSyncEnabled( bool enabled )
{
if (!_syncEnabled && enabled && !_scheduleQueue.isEmpty()) {
// We have things in our queue that were waiting the the connection to go back on.
QTimer::singleShot(200, this, SLOT(slotScheduleFolderSync()));
}
_syncEnabled = enabled;
}

View File

@@ -109,6 +109,9 @@ public slots:
void slotScheduleAllFolders();
bool isDirtyProxy() { return _dirtyProxy; }
void setDirtyProxy(bool value = true) { _dirtyProxy = value; }
private slots:
// slot to add a folder to the syncing queue
void slotScheduleSync( const QString & );
@@ -136,6 +139,7 @@ private:
QString _currentSyncFolder;
bool _syncEnabled;
QQueue<QString> _scheduleQueue;
bool _dirtyProxy; // If the proxy need to be re-configured
explicit FolderMan(QObject *parent = 0);
static FolderMan *_instance;

View File

@@ -212,6 +212,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
int h = iconRect.bottom();
if( !errorText.isEmpty() ) {
h += aliasMargin;
QRect errorRect = localPathRect;
errorRect.setLeft( iconRect.left());
errorRect.setTop( h );
@@ -222,10 +223,6 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
painter->setPen( QColor(0xaa, 0xaa, 0xaa));
painter->drawRoundedRect( errorRect, 4, 4 );
QIcon warnIcon(":/mirall/resources/warning-16");
QPoint warnPos(errorRect.left()+aliasMargin/2, errorRect.top()+aliasMargin/2);
painter->drawPixmap( warnPos, warnIcon.pixmap(QSize(16,16)));
painter->setPen( Qt::white );
painter->setFont(errorFont);
QRect errorTextRect = errorRect;
@@ -246,7 +243,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
// Sync File Progress Bar: Show it if syncFile is not empty.
if( !overallString.isEmpty()) {
int fileNameTextHeight = subFm.boundingRect(tr("File")).height();
int barHeight = fileNameTextHeight;
int barHeight = qMax(fileNameTextHeight, aliasFm.height()+2); ;
int overallWidth = option.rect.width()-2*aliasMargin;
painter->save();
@@ -263,6 +260,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
pBRect.setWidth( overallWidth - progressTextWidth - margin );
QStyleOptionProgressBarV2 pBarOpt;
pBarOpt.state = option.state | QStyle::State_Horizontal;
pBarOpt.minimum = 0;
pBarOpt.maximum = 100;
@@ -283,6 +281,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
QString elidedText = progressFm.elidedText(overallString, Qt::ElideLeft, overallProgressRect.width());
painter->drawText( overallProgressRect, Qt::AlignRight+Qt::AlignVCenter, elidedText);
// painter->drawRect(overallProgressRect);
// Individual File Progress
QRect fileRect;

View File

@@ -172,5 +172,16 @@ void FolderWatcher::changeDetected(const QString& f)
setProcessTimer();
}
void FolderWatcher::addPath(const QString &path )
{
_d->addPath(path);
}
void FolderWatcher::removePath(const QString &path )
{
_d->removePath(path);
}
} // namespace Mirall

View File

@@ -88,6 +88,15 @@ public:
void setEventInterval(int seconds);
QStringList ignores() const;
/**
* Not all backends are recursive by default.
* Those need to be notified when a directory is added or removed while the watcher is disabled.
* This is a no-op for backend that are recursive
*/
void addPath(const QString&);
void removePath(const QString&);
public slots:
/**
* Enabled or disables folderChanged() events.

View File

@@ -119,9 +119,8 @@ void FolderWatcherPrivate::slotINotifyEvent(int mask, int /*cookie*/, const QStr
}
else if (mask & IN_DELETE) {
//qDebug() << cookie << " DELETE: " << path;
if ( QFileInfo(path).isDir() && _inotify->directories().contains(path) ) {
qDebug() << "(-) Watcher:" << path;
_inotify->removePath(path);
if ( QFileInfo(path).isDir() ) {
removePath(path);
}
}
else if (mask & IN_CLOSE_WRITE) {
@@ -160,4 +159,13 @@ void FolderWatcherPrivate::slotINotifyEvent(int mask, int /*cookie*/, const QStr
_parent->setProcessTimer();
}
void FolderWatcherPrivate::removePath(const QString &path )
{
if (_inotify->directories().contains(path) ) {
qDebug() << "(-) Watcher:" << path;
_inotify->removePath(path);
}
}
} // namespace Mirall

View File

@@ -26,6 +26,8 @@ class FolderWatcherPrivate : public QObject {
Q_OBJECT
public:
FolderWatcherPrivate(FolderWatcher *p);
void addPath(const QString &path) { slotAddFolderRecursive(path); }
void removePath(const QString &);
signals:
void error(const QString& error);
private slots:

View File

@@ -31,6 +31,9 @@ public:
FolderWatcherPrivate(FolderWatcher *p);
~FolderWatcherPrivate();
void addPath(const QString &) {}
void removePath(const QString &) {}
void startWatching();
void doNotifyParent();

View File

@@ -48,6 +48,10 @@ class FolderWatcherPrivate : public QObject {
public:
FolderWatcherPrivate(FolderWatcher *p);
~FolderWatcherPrivate();
void addPath(const QString &) {}
void removePath(const QString &) {}
private:
FolderWatcher *_parent;
WatcherThread *_thread;

View File

@@ -358,10 +358,9 @@ FolderWizard::FolderWizard( QWidget *parent )
setPage(Page_Target, _folderWizardTargetPage );
}
setWindowTitle( tr( "%1 Folder Wizard" ).arg( Theme::instance()->appNameGUI() ) );
#ifdef Q_WS_MAC
setWizardStyle( QWizard::ModernStyle );
#endif
setWindowTitle( tr("Add Folder") );
setOptions(QWizard::CancelButtonOnLeft);
setButtonText(QWizard::FinishButton, tr("Add Folder"));
}
FolderWizard::~FolderWizard()

View File

@@ -7,29 +7,30 @@
<x>0</x>
<y>0</y>
<width>423</width>
<height>226</height>
<height>155</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="text">
<string>Sync Directory</string>
<property name="sizeHint" stdset="0">
<size>
<width>349</width>
<height>0</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="1" column="0">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Pick a local folder on your computer to sync:</string>
<string>Pick a local folder on your computer to sync</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
@@ -66,7 +67,7 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QLabel" name="warnLabel">
<property name="palette">
<palette>
@@ -152,19 +153,6 @@
</property>
</widget>
</item>
<item row="3" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>349</width>
<height>83</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>

View File

@@ -7,102 +7,14 @@
<x>0</x>
<y>0</y>
<width>520</width>
<height>367</height>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Synchronization Target</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_17">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Select a destination folder</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QPushButton" name="addFolderButton">
<property name="text">
<string>Add Folder</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="refreshButton">
<property name="text">
<string>Refresh</string>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="4">
<widget class="QTreeWidget" name="folderTreeWidget">
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Folders</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<item row="3" column="0">
<widget class="QFrame" name="warnFrame">
<property name="palette">
<palette>
@@ -213,7 +125,64 @@
</layout>
</widget>
</item>
<item row="5" column="0">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Select a destination folder</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QPushButton" name="addFolderButton">
<property name="text">
<string>Add Folder</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="refreshButton">
<property name="text">
<string>Refresh</string>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="4">
<widget class="QTreeWidget" name="folderTreeWidget">
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
<column>
<property name="text">
<string>Folders</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -221,7 +190,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>102</height>
<height>0</height>
</size>
</property>
</spacer>

View File

@@ -21,6 +21,7 @@
#include "mirall/mirallconfigfile.h"
#include <QNetworkProxy>
#include <QDir>
namespace Mirall {
@@ -49,6 +50,16 @@ GeneralSettings::GeneralSettings(QWidget *parent) :
// misc
connect(_ui->monoIconsCheckBox, SIGNAL(toggled(bool)), SLOT(saveMiscSettings()));
// OEM themes are not obliged to ship mono icons, so there
// is no point in offering an option
QString themeDir = QString::fromLatin1(":/mirall/theme/1%1/")
.arg(Theme::instance()->systrayIconFlavor(true));
if (QDir(themeDir).exists())
{
_ui->monoIconsCheckBox->setVisible(false);
}
}
GeneralSettings::~GeneralSettings()

View File

@@ -101,7 +101,14 @@ void IgnoreListEditor::slotUpdateLocalIgnoreList()
void IgnoreListEditor::slotAddPattern()
{
QString pattern = QInputDialog::getText(this, tr("Add Ignore Pattern"), tr("Add a new ignore pattern:"));
bool okClicked;
QString pattern = QInputDialog::getText(this, tr("Add Ignore Pattern"),
tr("Add a new ignore pattern:"),
QLineEdit::Normal, QString(), &okClicked);
if (!okClicked || pattern.isEmpty())
return;
QListWidgetItem *item = new QListWidgetItem;
setupItemFlags(item);
if (pattern.startsWith("]")) {

View File

@@ -23,16 +23,6 @@
#include "ui_itemprogressdialog.h"
#define TYPE_SUCCESS 1
#define TYPE_CONFLICT 2
#define TYPE_NEW 3
#define TYPE_DELETED 4
#define TYPE_ERROR 5
#define TYPE_RENAME 6
#define TYPE_IGNORE 7
#define FILE_TYPE 100
namespace Mirall {
ItemProgressDialog::ItemProgressDialog(Application*, QWidget *parent) :
@@ -50,14 +40,16 @@ ItemProgressDialog::ItemProgressDialog(Application*, QWidget *parent) :
this, SLOT(slotProgressErrors(const QString&, const Progress::SyncProblem&)));
QStringList header;
header << tr("Folder/Time");
header << tr("Time");
header << tr("File");
header << tr("Folder");
header << tr("Action");
header << tr("Size");
_ui->_treeWidget->setHeaderLabels( header );
_ui->_treeWidget->setColumnWidth(1, 180);
_ui->_treeWidget->setColumnCount(5);
_ui->_treeWidget->setRootIsDecorated(false);
connect(this, SIGNAL(guiLog(QString,QString)), Logger::instance(), SIGNAL(guiLog(QString,QString)));
@@ -70,51 +62,25 @@ ItemProgressDialog::ItemProgressDialog(Application*, QWidget *parent) :
void ItemProgressDialog::setSyncResultStatus(const SyncResult& result )
{
QString folderMessage;
SyncResult::Status syncStatus = result.status();
switch( syncStatus ) {
case SyncResult::Undefined:
folderMessage = tr( "Undefined Folder State" );
break;
case SyncResult::NotYetStarted:
folderMessage = tr( "The folder waits to start syncing." );
break;
case SyncResult::SyncPrepare:
folderMessage = tr( "Determining which files to sync." );
break;
case SyncResult::Unavailable:
folderMessage = tr( "Server is currently not available." );
break;
case SyncResult::SyncRunning:
folderMessage = tr("Sync is running.");
break;
case SyncResult::Success:
folderMessage = tr("Last Sync was successful.");
break;
case SyncResult::Error:
folderMessage = tr( "Syncing Error." );
break;
case SyncResult::SetupError:
folderMessage = tr( "Setup Error." );
break;
case SyncResult::Problem:
folderMessage = tr( "Sync success, but warnings on individual files.");
break;
default:
folderMessage = tr( "Undefined Error State." );
}
_ui->_timelabel->setText(tr("%1").arg(folderMessage));
if( result.errorStrings().count() ) {
if( result.errorStrings().count() ) {
_ui->_errorLabel->setVisible(true);
_ui->_errorLabel->setTextFormat(Qt::RichText);
QString errStr;
foreach( QString err, result.errorStrings() ) {
errStr.append(QString("<p>%1</p>").arg(err));
QStringList errors = result.errorStrings();
int cnt = errors.size();
bool appendDots = false;
if( cnt > 3 ) {
cnt = 3;
appendDots = true;
}
for( int i = 0; i < cnt; i++) {
errStr.append(QString("%1<br/>").arg(errors.at(i)));
}
if( appendDots ) {
errStr.append(QString("..."));
}
_ui->_errorLabel->setText(errStr);
} else {
_ui->_errorLabel->setText(QString::null);
@@ -127,44 +93,64 @@ void ItemProgressDialog::setSyncResult( const SyncResult& result )
{
setSyncResultStatus(result);
if(result.status() != SyncResult::Success ) {
return;
}
const QString& folder = result.folder();
qDebug() << "Setting sync result for folder " << folder;
QTreeWidgetItem *folderItem = findFolderItem(folder);
if( ! folderItem ) return;
SyncFileItemVector::const_iterator i;
const SyncFileItemVector& items = result.syncFileItemVector();
QDateTime dt = QDateTime::currentDateTime();
for (i = items.begin(); i != items.end(); ++i) {
const SyncFileItem& item = *i;
QString errMsg;
if( item._instruction == CSYNC_INSTRUCTION_IGNORE ) {
QString tooltip;
// handle ignored files here.
if( item._instruction == CSYNC_INSTRUCTION_IGNORE
|| item._instruction == CSYNC_INSTRUCTION_CONFLICT ) {
QStringList columns;
QString timeStr = QTime::currentTime().toString("hh:mm");
QString timeStr = timeString(dt);
QString longTimeStr = timeString(dt, QLocale::LongFormat);
columns << timeStr;
columns << item._file;
if( item._type == SyncFileItem::File ) {
errMsg = tr("File ignored.");
} else if( item._type == SyncFileItem::Directory ){
errMsg = tr("Directory ignored.");
} else if( item._type == SyncFileItem::SoftLink ) {
errMsg = tr("Soft Link ignored.");
columns << folder;
if( item._instruction == CSYNC_INSTRUCTION_IGNORE) {
if( item._type == SyncFileItem::File ) {
errMsg = tr("File ignored.");
tooltip = tr("The file was ignored because it is listed in the clients ignore list\n"
"or the filename contains characters that are not syncable\nin a cross platform "
"environment.");
} else if( item._type == SyncFileItem::Directory ){
errMsg = tr("Directory ignored.");
tooltip = tr("The directory was ignored because it is listed in the clients\nignore list "
"or the directory name contains\ncharacters that are not syncable in a cross "
"platform environment.");
} else if( item._type == SyncFileItem::SoftLink ) {
errMsg = tr("Soft Link ignored.");
tooltip = tr("Softlinks break the semantics of synchronization.\nPlease do not "
"use them in synced directories.");
} else {
errMsg = tr("Ignored.");
}
} else if( item._instruction == CSYNC_INSTRUCTION_CONFLICT ) {
errMsg = tr("Conflict file.");
tooltip = tr("The file was changed on server and local repository and as a result it\n"
"created a so called conflict. The local change is copied to the conflict\n"
"file while the file from the server side is available under the original\n"
"name");
} else {
errMsg = tr("Ignored.");
Q_ASSERT(!"unhandled instruction.");
}
columns << errMsg;
QTreeWidgetItem *twitem = new QTreeWidgetItem(folderItem, columns);
QTreeWidgetItem *twitem = new QTreeWidgetItem(columns);
twitem->setData(0, ErrorIndicatorRole, QVariant(true) );
twitem->setToolTip(0, longTimeStr);
twitem->setToolTip(3, tooltip);
twitem->setIcon(0, Theme::instance()->syncStateIcon(SyncResult::Problem, true));
_ui->_treeWidget->insertTopLevelItem(0, twitem);
Q_UNUSED(twitem);
}
}
}
@@ -178,7 +164,6 @@ void ItemProgressDialog::setupList()
bool haveSyncResult = false;
foreach( Folder *f, map.values() ) {
findFolderItem(f->alias());
if( f->syncResult().syncTime() > dt ) {
dt = f->syncResult().syncTime();
lastResult = f->syncResult();
@@ -204,11 +189,6 @@ void ItemProgressDialog::setupList()
slotProgressErrors(prob.folder, prob);
folderHash[prob.folder] = 1;
}
foreach( const QString& folder, folderHash.keys() ) {
decorateFolderItem(folder);
}
}
ItemProgressDialog::~ItemProgressDialog()
@@ -223,22 +203,22 @@ void ItemProgressDialog::copyToClipboard()
int topLevelItems = _ui->_treeWidget->topLevelItemCount();
for (int i = 0; i < topLevelItems; i++) {
QTreeWidgetItem *item = _ui->_treeWidget->topLevelItem(i);
ts << left << qSetFieldWidth(50)
<< item->data(0, Qt::DisplayRole).toString()
<< right << qSetFieldWidth(6)
<< item->data(1, Qt::DisplayRole).toString()
<< endl;
int childItems = item->childCount();
for (int j = 0; j < childItems; j++) {
QTreeWidgetItem *child =item->child(j);
ts << left << qSetFieldWidth(0) << QLatin1String(" ")
<< child->data(0,Qt::DisplayRole).toString()
<< QString::fromLatin1(" (%1)").arg(
child->data(1, Qt::DisplayRole).toString()
)
<< endl;
}
QTreeWidgetItem *child = _ui->_treeWidget->topLevelItem(i);
// time stamp
ts << left << qSetFieldWidth(10)
<< child->data(0,Qt::DisplayRole).toString()
// file name
<< qSetFieldWidth(64)
<< child->data(1,Qt::DisplayRole).toString()
<< qSetFieldWidth(0) << ' '
// action
<< qSetFieldWidth(15)
<< child->data(3, Qt::DisplayRole).toString()
// size
<< qSetFieldWidth(10)
<< child->data(4, Qt::DisplayRole).toString()
<< qSetFieldWidth(0)
<< endl;
}
QApplication::clipboard()->setText(text);
@@ -250,107 +230,76 @@ void ItemProgressDialog::accept()
QDialog::accept();
}
void ItemProgressDialog::decorateFolderItem( const QString& folder )
void ItemProgressDialog::cleanErrors( const QString& /* folder */ ) // FIXME: Use the folder to detect which errors can be deleted.
{
QTreeWidgetItem *folderItem = findFolderItem(folder);
if( ! folderItem ) return;
int errorCnt = 0;
_problemCounter = 0;
QList<QTreeWidgetItem*> wipeList;
int childCnt = folderItem->childCount();
for( int cnt = 0; cnt < childCnt; cnt++ ) {
bool isErrorItem = folderItem->child(cnt)->data(0, ErrorIndicatorRole).toBool();
if( isErrorItem ) {
errorCnt++;
int itemCnt = _ui->_treeWidget->topLevelItemCount();
for( int cnt = 0; cnt < itemCnt; cnt++ ) {
QTreeWidgetItem *item = _ui->_treeWidget->topLevelItem(cnt);
bool isErrorItem = item->data(0, ErrorIndicatorRole).toBool();
if( isErrorItem ) {
wipeList.append(item);
}
}
}
if( errorCnt == 0 ) {
folderItem->setIcon(0, Theme::instance()->syncStateIcon(SyncResult::Success));
} else {
// FIXME: Set a soft error icon here.
folderItem->setIcon(0, Theme::instance()->syncStateIcon(SyncResult::Problem));
}
qDeleteAll(wipeList.begin(), wipeList.end());
}
QTreeWidgetItem *ItemProgressDialog::createFolderItem(const QString& folder)
QString ItemProgressDialog::timeString(QDateTime dt, QLocale::FormatType format) const
{
QStringList strings;
strings.append(folder);
QTreeWidgetItem *item = new QTreeWidgetItem( _ui->_treeWidget, strings );
item->setFirstColumnSpanned(true);
item->setExpanded(true);
return item;
}
QLocale loc = QLocale::system();
QString timeStr;
QDate today = QDate::currentDate();
QTreeWidgetItem *ItemProgressDialog::findFolderItem( const QString& folder )
{
QTreeWidgetItem *folderItem;
if( folder.isEmpty() ) return NULL;
if( !_folderItems.contains(folder)) {
_folderItems[folder] = createFolderItem(folder);
_ui->_treeWidget->addTopLevelItem(_folderItems[folder]);
}
folderItem = _folderItems[folder];
return folderItem;
}
void ItemProgressDialog::cleanErrors( const QString& folder )
{
_problemCounter = 0;
QList<QTreeWidgetItem*> wipeList;
QTreeWidgetItem *folderItem = findFolderItem(folder);
if( ! folderItem ) return;
int childCnt = folderItem->childCount();
for( int cnt = 0; cnt < childCnt; cnt++ ) {
bool isErrorItem = folderItem->child(cnt)->data(0, ErrorIndicatorRole).toBool();
if( isErrorItem ) {
wipeList.append(folderItem->child(cnt));
if( format == QLocale::NarrowFormat ) {
if( dt.date().day() == today.day() ) {
timeStr = loc.toString(dt.time(), QLocale::NarrowFormat);
} else {
timeStr = loc.toString(dt, QLocale::NarrowFormat);
}
} else {
timeStr = loc.toString(dt, format);
}
}
qDeleteAll(wipeList.begin(), wipeList.end());
return timeStr;
}
void ItemProgressDialog::slotProgressErrors( const QString& folder, const Progress::SyncProblem& problem )
{
QTreeWidgetItem *folderItem;
folderItem = findFolderItem(folder);
if( !folderItem ) return;
QStringList columns;
QString timeStr = problem.timestamp.toString("hh:mm");
QString timeStr = timeString(problem.timestamp);
QString longTimeStr = timeString(problem.timestamp, QLocale::LongFormat);
columns << timeStr;
columns << problem.current_file;
columns << folder;
QString errMsg = tr("Problem: %1").arg(problem.error_message);
#if 0
if( problem.error_code == 507 ) {
errMsg = tr("No more storage space available on server.");
}
#endif
columns << errMsg;
// FIXME: Show the error code if available.
QTreeWidgetItem *item = new QTreeWidgetItem(folderItem, columns);
QTreeWidgetItem *item = new QTreeWidgetItem(columns);
item->setData(0, ErrorIndicatorRole, QVariant(true) );
item->setIcon(0, Theme::instance()->syncStateIcon(SyncResult::Problem, true));
// Maybe we should not set the error icon for all problems but distinguish
// by error_code. A quota problem is considered an error, others might not??
item->setIcon(0, Theme::instance()->syncStateIcon(SyncResult::Error, true));
item->setToolTip(0, longTimeStr);
_ui->_treeWidget->insertTopLevelItem(0, item);
Q_UNUSED(item);
}
void ItemProgressDialog::slotProgressInfo( const QString& folder, const Progress::Info& progress )
{
QTreeWidgetItem *folderItem;
folderItem = findFolderItem(folder);
if( !folderItem ) return;
if( progress.kind == Progress::StartSync ) {
cleanErrors( folder );
folderItem->setIcon(0, Theme::instance()->syncStateIcon(SyncResult::SyncRunning));
}
if( progress.kind == Progress::EndSync ) {
decorateFolderItem( folder );
// decorateFolderItem( folder );
}
// Ingore other events than finishing an individual up- or download.
@@ -359,14 +308,18 @@ void ItemProgressDialog::slotProgressInfo( const QString& folder, const Progress
}
QStringList columns;
QString timeStr = progress.timestamp.toString("hh:mm");
QString timeStr = timeString(progress.timestamp);
QString longTimeStr = timeString(progress.timestamp, QLocale::LongFormat);
columns << timeStr;
columns << progress.current_file;
columns << progress.folder;
columns << Progress::asResultString(progress.kind);
columns << Utility::octetsToString( progress.file_size );
QTreeWidgetItem *item = new QTreeWidgetItem(folderItem, columns);
QTreeWidgetItem *item = new QTreeWidgetItem(columns);
item->setToolTip(0, longTimeStr);
_ui->_treeWidget->insertTopLevelItem(0, item);
Q_UNUSED(item);
}

View File

@@ -16,10 +16,11 @@
#include <QDialog>
#include <QDateTime>
#include <QLocale>
#include "mirall/progressdispatcher.h"
#include "ui_fileitemdialog.h"
#include "ui_itemprogressdialog.h"
namespace Mirall {
class SyncResult;
@@ -54,12 +55,9 @@ signals:
private:
void setSyncResultStatus(const SyncResult& result );
QTreeWidgetItem *createFolderItem(const QString& folder);
QTreeWidgetItem *findFolderItem( const QString& folder );
void cleanErrors( const QString& folder );
void decorateFolderItem( const QString& folder );
QString timeString(QDateTime dt, QLocale::FormatType format = QLocale::NarrowFormat) const;
QHash<QString, QTreeWidgetItem*> _folderItems;
const int ErrorIndicatorRole;
Ui::ItemProgressDialog *_ui;
int _problemCounter;

View File

@@ -39,9 +39,6 @@
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<property name="columnCount">
<number>4</number>
</property>
@@ -67,13 +64,6 @@
</column>
</widget>
</item>
<item>
<widget class="QLabel" name="_timelabel">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="_errorLabel">
<property name="text">

View File

@@ -29,6 +29,7 @@
#include <QCoreApplication>
#include <QDebug>
#include <QSettings>
#include <QAction>
#include "mirall/mirallconfigfile.h"
#include "mirall/logger.h"
@@ -45,11 +46,6 @@ LogWidget::LogWidget(QWidget *parent)
font.setFamily(QLatin1String("Courier New"));
font.setFixedPitch(true);
document()->setDefaultFont( font );
MirallConfigFile cfg;
int lines = cfg.maxLogLines();
// qDebug() << "# ## Have " << lines << " Loglines!";
document()->setMaximumBlockCount( lines );
}
// ==============================================================================
@@ -57,8 +53,7 @@ LogWidget::LogWidget(QWidget *parent)
LogBrowser::LogBrowser(QWidget *parent) :
QDialog(parent),
_logWidget( new LogWidget(parent) ),
_doFileFlush(false),
_logstream(0)
_doFileFlush(false)
{
setObjectName("LogBrowser"); // for save/restoreGeometry()
setWindowTitle(tr("Log Output"));
@@ -118,12 +113,23 @@ LogBrowser::LogBrowser(QWidget *parent) :
// Direct connection for log comming from this thread, and queued for the one in a different thread
connect(Logger::instance(), SIGNAL(newLog(QString)),this,SLOT(slotNewLog(QString)), Qt::AutoConnection);
QAction *showLogWindow = new QAction(this);
showLogWindow->setShortcut(QKeySequence("F12"));
connect(showLogWindow, SIGNAL(triggered()), SLOT(close()));
addAction(showLogWindow);
MirallConfigFile cfg;
cfg.restoreGeometry(this);
int lines = cfg.maxLogLines();
// qDebug() << "# ## Have " << lines << " Loglines!";
_logWidget->document()->setMaximumBlockCount( lines );
}
LogBrowser::~LogBrowser()
{
MirallConfigFile cfg;
cfg.saveGeometry(this);
}
void LogBrowser::slotNewLog( const QString& msg )
@@ -143,9 +149,16 @@ void LogBrowser::setLogFile( const QString & name, bool flush )
if( _logstream ) {
_logFile.close();
}
_logFile.setFileName( name );
if(!_logFile.open(QIODevice::WriteOnly)) {
bool openSucceeded = false;
if (name == QLatin1String("-")) {
openSucceeded = _logFile.open(1, QIODevice::WriteOnly);
} else {
_logFile.setFileName( name );
openSucceeded = _logFile.open(QIODevice::WriteOnly);
}
if(!openSucceeded) {
QMessageBox::warning(
this,
tr("Error"),
@@ -216,11 +229,4 @@ void LogBrowser::slotClearLog()
_logWidget->clear();
}
void LogBrowser::closeEvent(QCloseEvent *event)
{
MirallConfigFile cfg;
cfg.saveGeometry(this);
QWidget::closeEvent(event);
}
} // namespace

View File

@@ -47,9 +47,6 @@ public:
void setLogFile(const QString& , bool );
protected:
void closeEvent(QCloseEvent *event);
protected slots:
void slotNewLog( const QString &msg );
void slotFind();

View File

@@ -94,12 +94,20 @@ MirallConfigFile::MirallConfigFile( const QString& appendix, bool useOldConfig )
void MirallConfigFile::setConfDir(const QString &value)
{
if( value.isEmpty() ) return;
QString dirPath = value;
if( dirPath.isEmpty() ) return;
QFileInfo fi(value);
QFileInfo fi(dirPath);
if ( !fi.exists() && !fi.isAbsolute() ) {
QDir::current().mkdir(dirPath);
QDir dir = QDir::current();
dir.cd(dirPath);
fi.setFile(dir.path());
}
if( fi.exists() && fi.isDir() ) {
qDebug() << "** Using custom config dir " << value;
_confDir=value;
dirPath = fi.absoluteFilePath();
qDebug() << "** Using custom config dir " << dirPath;
_confDir=dirPath;
}
}
@@ -185,7 +193,7 @@ QString MirallConfigFile::excludeFile(Scope scope) const
fi.setFile( QApplication::applicationDirPath(), exclFile );
#endif
#ifdef Q_OS_UNIX
fi.setFile( QString("/etc/%1").arg(Theme::instance()->appName()), exclFile );
fi.setFile( QString( SYSCONFDIR "/%1").arg(Theme::instance()->appName()), exclFile );
#endif
#ifdef Q_OS_MAC
// exec path is inside the bundle
@@ -587,7 +595,7 @@ QString MirallConfigFile::proxyPassword() const
int MirallConfigFile::useUploadLimit() const
{
return getValue(useUploadLimitC, QString::null, -1).toInt();
return getValue(useUploadLimitC, QString::null, 0).toInt();
}
bool MirallConfigFile::useDownloadLimit() const

View File

@@ -102,6 +102,7 @@ public:
bool useDownloadLimit() const;
void setUseUploadLimit(int);
void setUseDownloadLimit(bool);
/** in kbyte/s */
int uploadLimit() const;
int downloadLimit() const;
void setUploadLimit(int kbytes);

View File

@@ -113,7 +113,7 @@ void NetworkSettings::loadBWLimitSettings()
if ( uploadLimit >= 1 ) {
_ui->uploadLimitRadioButton->setChecked(true);
} else if (uploadLimit == 0){
_ui->noDownloadLimitRadioButton->setChecked(true);
_ui->noUploadLimitRadioButton->setChecked(true);
} else {
_ui->autoUploadLimitRadioButton->setChecked(true);
}

View File

@@ -229,7 +229,7 @@
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="noDownloadLimitRadioButton">
<property name="text">
<string>No Limit</string>
<string>No limit</string>
</property>
<property name="checked">
<bool>true</bool>
@@ -254,6 +254,12 @@
</item>
<item row="1" column="1">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Upload Bandwidth</string>
</property>
@@ -261,7 +267,7 @@
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="noUploadLimitRadioButton">
<property name="text">
<string>No Limit</string>
<string>No limit</string>
</property>
</widget>
</item>

View File

@@ -138,7 +138,10 @@ QNetworkReply* ownCloudInfo::mkdirRequest( const QString& dir )
qDebug() << "OCInfo Making dir " << dir;
_authAttempts = 0;
QNetworkRequest req;
req.setUrl( QUrl( webdavUrl(_connection) + dir ) );
QUrl url = QUrl(webdavUrl(_connection));
url.setEncodedPath(url.encodedPath()+QUrl::toPercentEncoding(dir, "/"));
req.setUrl( url );
QNetworkReply *reply = davRequest("MKCOL", req, 0);
// remember the confighandle used for this request
@@ -296,7 +299,7 @@ void ownCloudInfo::slotGetDirectoryListingFinished()
currentItem = reader.readElementText();
} else if (name == QLatin1String("collection") &&
!currentItem.isEmpty()) {
folders.append(currentItem);
folders.append(QUrl::fromEncoded(currentItem.toLatin1()).path());
currentItem.clear();
}
}
@@ -585,6 +588,8 @@ RequestEtagJob::RequestEtagJob(const QString& dir, QObject* parent)
connect( _reply, SIGNAL( finished()), SLOT(slotFinished()) );
connect( _reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(slotError()));
connect( _reply, SIGNAL(error(QNetworkReply::NetworkError)),
ownCloudInfo::instance(), SLOT(slotError(QNetworkReply::NetworkError)));
}
void RequestEtagJob::slotFinished()
@@ -615,6 +620,7 @@ void RequestEtagJob::slotError()
qDebug() << "RequestEtagJob Error: " << _reply->errorString();
_reply->deleteLater();
deleteLater();
emit networkError();
}
} // ns Mirall

View File

@@ -178,6 +178,7 @@ private slots:
signals:
void etagRetreived(const QString &etag);
void networkError();
};
} // ns Mirall

View File

@@ -47,8 +47,11 @@ OwncloudSetupWizard::OwncloudSetupWizard(QObject* parent) :
this, SLOT(slotConnectToOCUrl( const QString& )));
connect( _ocWizard, SIGNAL(createLocalAndRemoteFolders(QString, QString)),
this, SLOT(slotCreateLocalAndRemoteFolders(QString, QString)));
connect( _ocWizard, SIGNAL(finished(int)),this,SLOT(slotAssistantFinished(int)));
/* basicSetupFinished might be called from a reply from the network.
slotAssistantFinished might destroy the temporary QNetworkAccessManager.
Therefore Qt::QueuedConnection is required */
connect( _ocWizard, SIGNAL(basicSetupFinished(int)),
this, SLOT(slotAssistantFinished(int)), Qt::QueuedConnection);
connect( _ocWizard, SIGNAL(clearPendingRequests()),
this, SLOT(slotClearPendingRequests()));
}
@@ -241,15 +244,10 @@ void OwncloudSetupWizard::testOwnCloudConnect()
// write a temporary config.
QDateTime now = QDateTime::currentDateTime();
// remove a possibly existing custom config.
if( ! _configHandle.isEmpty() ) {
// remove the old config file.
MirallConfigFile oldConfig( _configHandle );
oldConfig.cleanupCustomConfig();
if( _configHandle.isEmpty() ) {
_configHandle = now.toString(QLatin1String("MMddyyhhmmss"));
}
_configHandle = now.toString(QLatin1String("MMddyyhhmmss"));
MirallConfigFile cfgFile( _configHandle, true );
QString url = _ocWizard->field(QLatin1String("OCUrl")).toString();
if( url.isEmpty() ) return;
@@ -484,8 +482,6 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
// first terminate sync jobs.
folderMan->terminateSyncProcess();
folderMan->unloadAllFolders();
bool startFromScratch = _ocWizard->field( "OCSyncFromScratch" ).toBool();
if( startFromScratch ) {
// first try to rename (backup) the current local dir.
@@ -505,10 +501,6 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
}
}
}
// save the user credentials and afterwards clear the cred store.
if( acceptCfg ) {
cfg.acceptCustomConfig();
}
// Now write the resulting folder definition if folder names are set.
if( acceptCfg && urlHasChanged ) {
@@ -524,6 +516,11 @@ void OwncloudSetupWizard::slotAssistantFinished( int result )
qDebug() << "User interrupted change of configuration.";
}
}
// save the user credentials and afterwards clear the cred store.
if( acceptCfg ) {
cfg.acceptCustomConfig();
}
}
// clear the custom config handle

View File

@@ -33,15 +33,6 @@ ownCloudTheme::ownCloudTheme()
// qDebug() << " ** running ownCloud theme!";
}
QString ownCloudTheme::appName() const
{
/* If this is changed, existing configs are not found any more
* because the value is used by QDesktopServices to find the config
* file. Be aware.
*/
return QLatin1String("ownCloud");
}
QString ownCloudTheme::configFileName() const
{
return QLatin1String("owncloud.cfg");
@@ -65,7 +56,7 @@ QString ownCloudTheme::about() const
return QCoreApplication::translate("ownCloudTheme::about()",
"<p>Version %2. "
"For more information visit <a href=\"%3\">%4</a></p>"
"<p><small>By Klaas Freitag, Daniel Molkentin, Jan-Christoph Borchardt, ownCloud Inc. "
"<p><small>By Klaas Freitag, Daniel Molkentin, Jan-Christoph Borchardt, ownCloud Inc.<br>"
"Based on Mirall by Duncan Mac-Vicar P.</small></p>"
"%7"
)

View File

@@ -25,7 +25,6 @@ class ownCloudTheme : public Theme
public:
ownCloudTheme();
virtual QString appName() const;
QString configFileName() const;
QString about() const;
QPixmap splashScreen() const;

View File

@@ -16,7 +16,7 @@
#include <QObject>
#include <QMetaType>
#include <QDebug>
#include <QCoreApplication>
namespace Mirall {
@@ -28,35 +28,35 @@ QString Progress::asResultString( Kind kind )
switch(kind) {
case Download:
case EndDownload:
re = QObject::tr("Download");
re = QCoreApplication::translate( "progress", "Download");
break;
case Upload:
re = QObject::tr("Upload");
re = QCoreApplication::translate( "progress", "Upload");
break;
case Context:
re = QObject::tr("Context");
re = QCoreApplication::translate( "progress", "Context" );
break;
case Inactive:
re = QObject::tr("Inactive");
re = QCoreApplication::translate( "progress", "Inactive");
break;
case StartDownload:
re = QObject::tr("Download");
re = QCoreApplication::translate( "progress", "Download");
break;
case StartUpload:
case EndUpload:
re = QObject::tr("Upload");
re = QCoreApplication::translate( "progress", "Upload");
break;
case StartSync:
re = QObject::tr("Start");
re = QCoreApplication::translate( "progress", "Start");
break;
case EndSync:
re = QObject::tr("Finished");
re = QCoreApplication::translate( "progress", "Finished");
break;
case StartDelete:
re = QObject::tr("For deletion");
re = QCoreApplication::translate( "progress", "For deletion");
break;
case EndDelete:
re = QObject::tr("deleted");
re = QCoreApplication::translate( "progress", "deleted");
break;
default:
Q_ASSERT(false);
@@ -71,40 +71,40 @@ QString Progress::asActionString( Kind kind )
switch(kind) {
case Download:
re = QObject::tr("downloading");
re = QCoreApplication::translate( "progress", "downloading");
break;
case Upload:
re = QObject::tr("uploading");
re = QCoreApplication::translate( "progress", "uploading");
break;
case Context:
re = QObject::tr("Context");
re = QCoreApplication::translate( "progress", "Context");
break;
case Inactive:
re = QObject::tr("inactive");
re = QCoreApplication::translate( "progress", "inactive");
break;
case StartDownload:
re = QObject::tr("downloading");
re = QCoreApplication::translate( "progress", "downloading");
break;
case StartUpload:
re = QObject::tr("uploading");
re = QCoreApplication::translate( "progress", "uploading");
break;
case EndDownload:
re = QObject::tr("downloading");
re = QCoreApplication::translate( "progress", "downloading");
break;
case EndUpload:
re = QObject::tr("uploading");
re = QCoreApplication::translate( "progress", "uploading");
break;
case StartSync:
re = QObject::tr("starting");
re = QCoreApplication::translate( "progress", "starting");
break;
case EndSync:
re = QObject::tr("finished");
re = QCoreApplication::translate( "progress", "finished");
break;
case StartDelete:
re = QObject::tr("delete");
re = QCoreApplication::translate( "progress", "delete");
break;
case EndDelete:
re = QObject::tr("deleted");
re = QCoreApplication::translate( "progress", "deleted");
break;
default:
Q_ASSERT(false);
@@ -121,7 +121,7 @@ ProgressDispatcher* ProgressDispatcher::instance() {
ProgressDispatcher::ProgressDispatcher(QObject *parent) :
QObject(parent),
_problemQueueSize(50)
_QueueSize(50)
{
}
@@ -158,13 +158,14 @@ void ProgressDispatcher::setProgressInfo(const QString& folder, const Progress::
Progress::SyncProblem err;
err.folder = folder;
err.current_file = newProgress.current_file;
// its really
err.error_message = QString::fromLocal8Bit( (const char*)newProgress.file_size );
err.error_code = newProgress.file_size;
err.timestamp = QTime::currentTime();
err.error_code = newProgress.current_file_bytes;
err.timestamp = QDateTime::currentDateTime();
_recentProblems.enqueue( err );
if( _recentProblems.size() > _problemQueueSize ) {
_recentProblems.dequeue();
_recentProblems.prepend( err );
if( _recentProblems.size() > _QueueSize ) {
_recentProblems.removeLast();
}
emit progressSyncProblem( folder, err );
} else {
@@ -174,13 +175,32 @@ void ProgressDispatcher::setProgressInfo(const QString& folder, const Progress::
if( newProgress.kind == Progress::EndSync ) {
newProgress.overall_current_bytes = newProgress.overall_transmission_size;
newProgress.current_file_no = newProgress.overall_file_count;
_currentAction.remove(newProgress.folder);
}
if( newProgress.kind == Progress::EndDownload || newProgress.kind == Progress::EndUpload ||
if( newProgress.kind == Progress::EndDownload ||
newProgress.kind == Progress::EndUpload ||
newProgress.kind == Progress::EndDelete ) {
_recentChanges.enqueue(newProgress);
_recentChanges.prepend(newProgress);
if( _recentChanges.size() > _QueueSize ) {
_recentChanges.removeLast();
}
}
// store the last real action to help clients that start during
// the Context-phase of an upload or download.
if( newProgress.kind != Progress::Context ) {
_currentAction[folder] = newProgress.kind;
}
emit progressInfo( folder, newProgress );
}
}
Progress::Kind ProgressDispatcher::currentFolderContext( const QString& folder )
{
if( _currentAction.contains(folder)) {
return _currentAction[folder];
}
return Progress::Invalid;
}
}

View File

@@ -25,9 +25,8 @@ namespace Mirall {
/**
* @brief The FolderScheduler class schedules folders for sync
*/
class Progress
namespace Progress
{
public:
typedef enum {
Invalid,
StartSync,
@@ -57,7 +56,7 @@ public:
qint64 overall_transmission_size;
qint64 overall_current_bytes;
QTime timestamp;
QDateTime timestamp;
} Info;
@@ -66,12 +65,12 @@ public:
QString current_file;
QString error_message;
int error_code;
QTime timestamp;
QDateTime timestamp;
} SyncProblem;
static QString asActionString( Kind );
static QString asResultString( Kind );
};
QString asActionString( Kind );
QString asResultString( Kind );
}
/**
* @file progressdispatcher.h
@@ -93,6 +92,8 @@ public:
QList<Progress::Info> recentChangedItems(int count);
QList<Progress::SyncProblem> recentProblems(int count);
Progress::Kind currentFolderContext( const QString& folder );
signals:
/**
@brief Signals the progress of data transmission.
@@ -110,10 +111,11 @@ protected:
private:
ProgressDispatcher(QObject* parent = 0);
const int _problemQueueSize;
QQueue<Progress::Info> _recentChanges;
QQueue<Progress::SyncProblem> _recentProblems;
const int _QueueSize;
QList<Progress::Info> _recentChanges;
QList<Progress::SyncProblem> _recentProblems;
QHash<QString, Progress::Kind> _currentAction;
static ProgressDispatcher* _instance;
};

View File

@@ -46,7 +46,11 @@ SettingsDialog::SettingsDialog(Application *app, QWidget *parent) :
_ui->setupUi(this);
setObjectName("Settings"); // required as group for saveGeometry call
setWindowTitle(tr("%1 Settings").arg(Theme::instance()->appNameGUI()));
setWindowTitle(tr("%1").arg(Theme::instance()->appNameGUI()));
_accountSettings = new AccountSettings(this);
addAccount(tr("Account"), _accountSettings);
slotUpdateAccountState();
QIcon generalIcon(QLatin1String(":/mirall/resources/settings.png"));
QListWidgetItem *general = new QListWidgetItem(generalIcon, tr("General"), _ui->labelWidget);
@@ -62,18 +66,12 @@ SettingsDialog::SettingsDialog(Application *app, QWidget *parent) :
NetworkSettings *networkSettings = new NetworkSettings;
_ui->stack->addWidget(networkSettings);
connect(networkSettings, SIGNAL(proxySettingsChanged()), app, SLOT(slotSetupProxy()));
connect(networkSettings, SIGNAL(proxySettingsChanged()), FolderMan::instance(), SLOT(slotScheduleAllFolders()));
//connect(generalSettings, SIGNAL(resizeToSizeHint()), SLOT(resizeToSizeHint()));
_accountSettings = new AccountSettings(this);
addAccount(tr("Account"), _accountSettings);
slotUpdateAccountState();
connect( app, SIGNAL(folderStateChanged(Folder*)), _accountSettings, SLOT(slotUpdateFolderState(Folder*)));
connect( app, SIGNAL(folderStateChanged(Folder*)), SLOT(slotUpdateAccountState()));
connect( _accountSettings, SIGNAL(addASync()), app, SLOT(slotFolderAdded()) );
connect( _accountSettings, SIGNAL(folderChanged()), app, SLOT(slotFoldersChanged()));
connect( _accountSettings, SIGNAL(openFolderAlias(const QString&)),
app, SLOT(slotFolderOpenAction(QString)));
@@ -84,7 +82,7 @@ SettingsDialog::SettingsDialog(Application *app, QWidget *parent) :
connect( ProgressDispatcher::instance(), SIGNAL(progressSyncProblem(QString,Progress::SyncProblem)),
_accountSettings, SLOT(slotProgressProblem(QString,Progress::SyncProblem)) );
_ui->labelWidget->setCurrentRow(_ui->labelWidget->row(general));
_ui->labelWidget->setCurrentRow(_ui->labelWidget->row(_accountItem));
connect(_ui->labelWidget, SIGNAL(currentRowChanged(int)),
_ui->stack, SLOT(setCurrentIndex(int)));
@@ -92,12 +90,20 @@ SettingsDialog::SettingsDialog(Application *app, QWidget *parent) :
QPushButton *closeButton = _ui->buttonBox->button(QDialogButtonBox::Close);
connect(closeButton, SIGNAL(pressed()), SLOT(accept()));
QAction *showLogWindow = new QAction(this);
showLogWindow->setShortcut(QKeySequence("F12"));
connect(showLogWindow, SIGNAL(triggered()), app, SLOT(slotOpenLogBrowser()));
addAction(showLogWindow);
MirallConfigFile cfg;
cfg.restoreGeometry(this);
}
SettingsDialog::~SettingsDialog()
{
MirallConfigFile cfg;
cfg.saveGeometry(this);
delete _ui;
}
@@ -110,13 +116,6 @@ void SettingsDialog::addAccount(const QString &title, QWidget *widget)
}
void SettingsDialog::closeEvent(QCloseEvent *event)
{
MirallConfigFile cfg;
cfg.saveGeometry(this);
QWidget::closeEvent(event);
}
void SettingsDialog::slotUpdateAccountState()
{
FolderMan *folderMan = FolderMan::instance();

View File

@@ -41,9 +41,6 @@ public:
void addAccount(const QString &title, QWidget *widget);
protected:
void closeEvent(QCloseEvent *event);
protected slots:
void slotUpdateAccountState();

View File

@@ -6,15 +6,24 @@
<rect>
<x>0</x>
<y>0</y>
<width>704</width>
<height>299</height>
<width>693</width>
<height>457</height>
</rect>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">

View File

@@ -35,6 +35,7 @@ public:
// variables
QString _file;
QString _renameTarget;
QString _errorString;
csync_instructions_e _instruction;
Direction _dir;
Type _type;

View File

@@ -45,35 +45,45 @@ QString Theme::statusHeaderText( SyncResult::Status status ) const
switch( status ) {
case SyncResult::Undefined:
resultStr = QObject::tr("Status undefined");
resultStr = QCoreApplication::translate("theme", "Status undefined");
break;
case SyncResult::NotYetStarted:
resultStr = QObject::tr("Waiting to start sync");
resultStr = QCoreApplication::translate("theme", "Waiting to start sync");
break;
case SyncResult::SyncRunning:
resultStr = QObject::tr("Sync is running");
resultStr = QCoreApplication::translate("theme", "Sync is running");
break;
case SyncResult::Success:
resultStr = QObject::tr("Sync Success");
resultStr = QCoreApplication::translate("theme", "Sync Success");
break;
case SyncResult::Problem:
resultStr = QObject::tr("Sync Success, problems with individual files.");
resultStr = QCoreApplication::translate("theme", "Sync Success, problems with individual files.");
break;
case SyncResult::Error:
resultStr = QObject::tr("Sync Error - Click info button for details.");
resultStr = QCoreApplication::translate("theme", "Sync Error - Click info button for details.");
break;
case SyncResult::SetupError:
resultStr = QObject::tr( "Setup Error" );
resultStr = QCoreApplication::translate("theme", "Setup Error" );
break;
default:
resultStr = QObject::tr("Status undefined");
case SyncResult::Unavailable:
resultStr = QCoreApplication::translate("theme", "The server is currently unavailable" );
break;
case SyncResult::SyncPrepare:
resultStr = QCoreApplication::translate("theme", "Preparing to sync" );
break;
}
return resultStr;
}
QString Theme::appNameGUI() const
{
return appName();
return QLatin1String(APPLICATION_NAME);
}
QString Theme::appName() const
{
return QLatin1String(APPLICATION_SHORTNAME);
}
QString Theme::version() const
@@ -94,12 +104,8 @@ QIcon Theme::trayFolderIcon( const QString& backend ) const
QIcon Theme::themeIcon( const QString& name, bool sysTray ) const
{
QString flavor;
if (sysTray && _mono) {
#ifdef Q_OS_MAC
flavor = QLatin1String("black");
#else
flavor = QLatin1String("white");
#endif
if (sysTray) {
flavor = systrayIconFlavor(_mono);
} else {
flavor = QLatin1String("colored");
}
@@ -158,6 +164,21 @@ QString Theme::defaultClientFolder() const
return appName();
}
QString Theme::systrayIconFlavor(bool mono) const
{
QString flavor;
if (mono) {
#ifdef Q_OS_MAC
flavor = QLatin1String("black");
#else
flavor = QLatin1String("white");
#endif
} else {
flavor = QLatin1String("colored");
}
return flavor;
}
void Theme::setSystrayUseMonoIcons(bool mono)
{
_mono = mono;

View File

@@ -48,7 +48,8 @@ public:
* Use and redefine this if the human readable name contains spaces,
* special chars and such.
*
* By default, appName() is returned.
* By default, the name is derived from the APPLICATION_NAME
* cmake variable.
*
* @return QString with human readable app name.
*/
@@ -61,9 +62,16 @@ public:
* it is used for config files etc. If you need a more sophisticated
* name in the GUI, redefine appNameGUI.
*
* By default, the name is derived from the APPLICATION_SHORTNAME
* cmake variable, and should be the same. This method is only
* reimplementable for legacy reasons.
*
* Warning: Do not modify this value, as many things, e.g. settings
* depend on it! You most likely want to modify \ref appNameGUI().
*
* @return QString with app name.
*/
virtual QString appName() const = 0;
virtual QString appName() const;
/**
* @brief configFileName
@@ -119,6 +127,8 @@ public:
*/
virtual QString enforcedLocale() const { return QString::null; }
/** colored, white or black */
QString systrayIconFlavor(bool mono) const;
/**
* Override to use a string or a custom image name.

View File

@@ -17,6 +17,7 @@
#include <QCoreApplication>
#include <QSettings>
#include <QTextStream>
#include <QDir>
#include <QFile>
#include <QUrl>
@@ -124,6 +125,8 @@ QString Utility::octetsToString( qint64 octets )
return QString::number(qRound64(qreal(octets)/qreal(mb))) + QLatin1String(" MB");
} else if (octets >= kb) {
return QString::number(qRound64(qreal(octets)/qreal(kb))) + QLatin1String(" KB");
} else if (octets == 1){
return QLatin1String("1 byte");
} else {
return QString::number(octets) + QLatin1String(" bytes");
}
@@ -284,16 +287,24 @@ void Utility::setLaunchOnStartup(const QString &appName, const QString& guiName,
qDebug() << "Could not create autostart directory";
return;
}
QSettings desktopFile(desktopFileLocation, QSettings::IniFormat);
desktopFile.beginGroup("Desktop Entry");
desktopFile.setValue(QLatin1String("Name"), guiName);
desktopFile.setValue(QLatin1String("GenericName"), QLatin1String("File Synchronizer"));
desktopFile.setValue(QLatin1String("Exec"), QCoreApplication::applicationFilePath());
desktopFile.setValue(QLatin1String("Terminal"), false);
desktopFile.setValue(QLatin1String("Icon"), appName);
desktopFile.setValue(QLatin1String("Categories"), QLatin1String("Network"));
desktopFile.setValue(QLatin1String("StartupNotify"), false);
desktopFile.endGroup();
QFile iniFile(desktopFileLocation);
if (!iniFile.open(QIODevice::WriteOnly)) {
qDebug() << "Could not write auto start entry" << desktopFileLocation;
return;
}
QTextStream ts(&iniFile);
ts.setCodec("UTF-8");
ts << QLatin1String("[Desktop Entry]") << endl
<< QLatin1String("Name=") << guiName << endl
<< QLatin1String("GenericName=") << QLatin1String("File Synchronizer") << endl
<< QLatin1String("Exec=") << QCoreApplication::applicationFilePath() << endl
<< QLatin1String("Terminal=") << "false" << endl
<< QLatin1String("Icon=") << appName << endl
<< QLatin1String("Categories=") << QLatin1String("Network") << endl
<< QLatin1String("Type=") << QLatin1String("Application") << endl
<< QLatin1String("StartupNotify=") << "false" << endl
<< QLatin1String("X-GNOME-Autostart-enabled=") << "true" << endl
;
} else {
if (!QFile::remove(desktopFileLocation)) {
qDebug() << "Could not remove autostart desktop file";

View File

@@ -54,6 +54,7 @@ OwncloudAdvancedSetupPage::OwncloudAdvancedSetupPage()
setupCustomization();
connect( _ui.pbSelectLocalFolder, SIGNAL(clicked()), SLOT(slotSelectFolder()));
setButtonText(QWizard::NextButton, tr("Connect..."));
}
void OwncloudAdvancedSetupPage::setupCustomization()

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>821</width>
<height>647</height>
<width>484</width>
<height>342</height>
</rect>
</property>
<property name="sizePolicy">

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>478</width>
<height>461</height>
<width>525</width>
<height>193</height>
</rect>
</property>
<property name="sizePolicy">
@@ -34,11 +34,30 @@
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Server &amp;Address</string>
@@ -48,7 +67,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item>
<widget class="Utils::FancyLineEdit" name="leUrl">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -64,6 +83,22 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>

View File

@@ -46,11 +46,13 @@ OwncloudWizard::OwncloudWizard(QWidget *parent)
_setupLog(),
_configExists(false)
{
setPage(WizardCommon::Page_ServerSetup, _setupPage );
setPage(WizardCommon::Page_ServerSetup, _setupPage);
setPage(WizardCommon::Page_HttpCreds, _httpCredsPage);
setPage(WizardCommon::Page_ShibbolethCreds, _shibbolethCredsPage);
setPage(WizardCommon::Page_AdvancedSetup, _advancedSetupPage);
setPage(WizardCommon::Page_Result, _resultPage );
setPage(WizardCommon::Page_Result, _resultPage);
connect(this, SIGNAL(finished(int)), SIGNAL(basicSetupFinished(int)));
// note: start Id is set by the calling class depending on if the
// welcome text is to be shown or not.
@@ -145,12 +147,13 @@ void OwncloudWizard::slotCurrentPageChanged( int id )
qDebug() << "Current Wizard page changed to " << id;
if( id == WizardCommon::Page_ServerSetup ) {
setButtonText( QWizard::NextButton, tr("Connect...") );
emit clearPendingRequests();
_setupPage->initializePage();
}
if( id == WizardCommon::Page_Result ) {
disconnect(this, SIGNAL(finished(int)), this, SIGNAL(basicSetupFinished(int)));
emit basicSetupFinished(QDialog::Accepted);
appendToConfigurationLog( QString::null );
}
}

View File

@@ -69,6 +69,8 @@ signals:
void determineAuthType(const QString&);
void connectToOCUrl( const QString& );
void createLocalAndRemoteFolders(const QString&, const QString&);
// make sure to connect to this, rather than finished(int)!!
void basicSetupFinished( int );
private:
OwncloudSetupPage* _setupPage;

View File

@@ -1,6 +1,5 @@
*.filepart
*~
*.bak
*.part
*.crdownload
@@ -17,12 +16,9 @@ csync_journal.db.ctmp
desktop.ini
*.kate-swp
*.aux
*.nav
*.out
*.toc
*_conflict-*
]*.~*
].TemporaryItems
].Trashes

View File

@@ -1,4 +1,4 @@
include_directories(${CMAKE_CURRENT_LIST_DIR}/../src)
include(owncloud_add_test.cmake)
owncloud_add_test(First)
owncloud_add_test(Utility)

View File

@@ -10,10 +10,10 @@ macro(owncloud_add_test test_class)
add_executable(${OWNCLOUD_TEST_CLASS}Test test${OWNCLOUD_TEST_CLASS_LOWERCASE}.cpp ${${OWNCLOUD_TEST_CLASS}_MOCS})
target_link_libraries(${OWNCLOUD_TEST_CLASS}Test
${APPLICATION_EXECUTABLE}sync
${QT_QTTEST_LIBRARY}
${QT_QTCORE_LIBRARY}
)
add_test(NAME ${OWNCLOUD_TEST_CLASS}Test COMMAND ${OWNCLOUD_TEST_CLASS}Test)
endmacro()
endmacro()

View File

@@ -1,24 +0,0 @@
/*
This software is in the public domain, furnished "as is", without technical
support, and with no warranty, express or implied, as to its usefulness for
any purpose.
*/
#ifndef MIRALL_TESTFIRST_H
#define MIRALL_TESTFIRST_H
#include <QtTest>
class TestFirst : public QObject
{
Q_OBJECT
private slots:
void testTheFirstThing()
{
QVERIFY( true );
}
};
#endif

58
test/testutility.h Normal file
View File

@@ -0,0 +1,58 @@
/*
This software is in the public domain, furnished "as is", without technical
support, and with no warranty, express or implied, as to its usefulness for
any purpose.
*/
#ifndef MIRALL_TESTUTILITY_H
#define MIRALL_TESTUTILITY_H
#include <QtTest>
#include "mirall/utility.h"
using namespace Mirall::Utility;
class TestUtility : public QObject
{
Q_OBJECT
private slots:
void testFormatFingerprint()
{
QVERIFY2(formatFingerprint("68ac906495480a3404beee4874ed853a037a7a8f")
== "68:ac:90:64:95:48:0a:34:04:be:ee:48:74:ed:85:3a:03:7a:7a:8f",
"Utility::formatFingerprint() is broken");
}
void testOctetsToString()
{
QVERIFY(octetsToString(1) == "1 byte");
QVERIFY(octetsToString(2) == "2 bytes");
QVERIFY(octetsToString(1024) == "1 KB");
QVERIFY(octetsToString(1024*1024) == "1 MB");
QVERIFY(octetsToString(1024LL*1024*1024) == "1 GB");
QVERIFY(octetsToString(1024LL*1024*1024*1024) == "1 TB");
}
void testLaunchOnStartup()
{
const QString appName = "testLaunchOnStartup";
const QString guiName = "LaunchOnStartup GUI Name";
QVERIFY(hasLaunchOnStartup(appName) == false);
setLaunchOnStartup(appName, guiName, true);
QVERIFY(hasLaunchOnStartup(appName) == true);
setLaunchOnStartup(appName, guiName, false);
QVERIFY(hasLaunchOnStartup(appName) == false);
}
void testToCSyncScheme()
{
QVERIFY(toCSyncScheme("http://example.com/owncloud/") ==
"owncloud://example.com/owncloud/");
QVERIFY(toCSyncScheme("https://example.com/owncloud/") ==
"ownclouds://example.com/owncloud/");
}
};
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff