Переглянути джерело

- added icon defaults for systems without icon theming bnc#730834
- fixed some bugs with ownCloud status check fails
- bumped version to 0.1.2

Klaas Freitag 14 роки тому
батько
коміт
bf40e0aafc

+ 9 - 1
mirall.qrc

@@ -1,5 +1,5 @@
 <RCC>
-    <qresource prefix="/new/mirall">
+    <qresource prefix="/mirall">
         <file>resources/mirall-32.png</file>
         <file>resources/mirall-64.png</file>
         <file>resources/mirall-128.png</file>
@@ -11,5 +11,13 @@
         <file>resources/mirall-48.png</file>
         <file>resources/folder-grey-48.png</file>
         <file>resources/folder-remote-48.png</file>
+        <file>resources/dialog-close.png</file>
+        <file>resources/dialog-ok.png</file>
+        <file>resources/dialog-cancel.png</file>
+        <file>resources/view-refresh.png</file>
+        <file>resources/folder-favorites.png</file>
+        <file>resources/folder-sync.png</file>
+        <file>resources/folder-important.png</file>
+        <file>resources/folder-grey.png</file>
     </qresource>
 </RCC>

BIN
resources/dialog-cancel.png


BIN
resources/dialog-close.png


BIN
resources/dialog-ok.png


BIN
resources/folder-favorites.png


BIN
resources/folder-grey.png


BIN
resources/folder-important.png


BIN
resources/folder-sync.png


BIN
resources/view-refresh.png


+ 5 - 5
src/mirall/application.cpp

@@ -118,7 +118,7 @@ void Application::setupActions()
 void Application::setupSystemTray()
 {
     _tray = new QSystemTrayIcon(this);
-    _tray->setIcon(QIcon::fromTheme(FOLDER_ICON_EMPTY));
+    _tray->setIcon(QIcon::fromTheme(FOLDER_ICON_EMPTY, QIcon( QString( ":/mirall/resources/%1").arg(FOLDER_ICON_EMPTY))));
 
     connect(_tray,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
             SLOT(slotTrayClicked(QSystemTrayIcon::ActivationReason)));
@@ -306,7 +306,7 @@ void Application::setupKnownFolders()
   foreach (QString file, list) {
     setupFolderFromConfigFile(file);
   }
-  if( list.size() ) _tray->setIcon(QIcon::fromTheme(FOLDER_ICON));
+  if( list.size() ) _tray->setIcon(QIcon::fromTheme(FOLDER_ICON, QIcon( QString( ":/mirall/resources/%1").arg(FOLDER_ICON))));
 }
 
 // filename is the name of the file only, it does not include
@@ -385,7 +385,7 @@ void Application::slotFolderSyncStarted()
     _folderSyncCount++;
 
     if (_folderSyncCount > 0) {
-        _tray->setIcon(QIcon::fromTheme(FOLDER_SYNC_ICON));
+        _tray->setIcon(QIcon::fromTheme(FOLDER_SYNC_ICON, QIcon( QString( ":/mirall/resources/%1").arg(FOLDER_SYNC_ICON))));
     }
 }
 
@@ -397,13 +397,13 @@ void Application::slotFolderSyncFinished(const SyncResult &result)
 
     if (_folderSyncCount < 1) {
         if (result.result() == SyncResult::Success) {
-            _tray->setIcon(QIcon::fromTheme(FOLDER_ICON));
+            _tray->setIcon(QIcon::fromTheme(FOLDER_ICON, QIcon( QString( ":/mirall/resources/%1").arg(FOLDER_ICON))));
             //_tray->showMessage(tr("Folder %1").arg(folder->alias()),
             //                   tr("Synchronization successfull"),
             //                   QSystemTrayIcon::Information);
         }
         else {
-            _tray->setIcon(QIcon::fromTheme(FOLDER_SYNC_ERROR));
+            _tray->setIcon(QIcon::fromTheme(FOLDER_SYNC_ERROR, QIcon( QString( ":/mirall/resources/%1").arg(FOLDER_SYNC_ERROR))));
             _tray->showMessage(tr("Folder %1").arg(folder->alias()),
                                result.errorString(),
                                /* tr("Synchronization did not finish successfully"), */

+ 1 - 1
src/mirall/createanowncloudpage.ui

@@ -22,7 +22,7 @@
         <string/>
        </property>
        <property name="pixmap">
-        <pixmap resource="../../mirall.qrc">:/new/mirall/resources/mirall-32.png</pixmap>
+        <pixmap resource="../../mirall.qrc">:/mirall/resources/mirall-32.png</pixmap>
        </property>
       </widget>
      </item>

+ 4 - 5
src/mirall/folder.cpp

@@ -40,9 +40,9 @@ Folder::Folder(const QString &alias, const QString &path, QObject *parent)
       _online(false),
       _enabled(true)
 {
-    _openAction = new QAction(QIcon::fromTheme(FOLDER_ICON), path, this);
+    _openAction = new QAction(QIcon::fromTheme(FOLDER_ICON, QIcon( QString( ":/mirall/resources/%1").arg(FOLDER_ICON))), path, this);
     _openAction->setIconVisibleInMenu(true);
-    _openAction->setIcon(QIcon::fromTheme(FOLDER_ICON));
+    _openAction->setIcon(QIcon::fromTheme(FOLDER_ICON, QIcon( QString( ":/mirall/resources/%1").arg(FOLDER_ICON))));
 
     QObject::connect(_openAction, SIGNAL(triggered(bool)), SLOT(slotOpenFolder()));
 
@@ -198,13 +198,12 @@ void Folder::slotSyncStarted()
 {
     // disable events until syncing is done
     _watcher->setEventsEnabled(false);
-    _openAction->setIcon(QIcon::fromTheme(FOLDER_SYNC_ICON));
+    _openAction->setIcon(QIcon::fromTheme(FOLDER_SYNC_ICON, QIcon( QString( ":/mirall/resources/%1").arg(FOLDER_SYNC_ICON))));
 }
 
 void Folder::slotSyncFinished(const SyncResult &result)
 {
   _lastSyncResult = result;
-  qDebug() << "XX got a sync result: " << _lastSyncResult.result()<< " for folder " << this ;
 
   bool enabled = ( result.result() == SyncResult::Success );
   setSyncEnabled( enabled );
@@ -236,7 +235,7 @@ QIcon Folder::icon( int size ) const
   if( _backend == "unison" ) name = QString( "folder-%1.png" ).arg(size);
   if( _backend == "csync" ) name = QString("folder-remote-%1.png").arg(size);
 
-  return QIcon( QString( ":/new/mirall/resources/%1").arg(name) );
+  return QIcon( QString( ":/mirall/resources/%1").arg(name) );
 }
 
 QString Folder::backend() const

+ 9 - 4
src/mirall/folderwizard.cpp

@@ -217,6 +217,7 @@ void FolderWizardTargetPage::slotCreateRemoteFolder()
 
   OwncloudSetup ocSetup;
   QString url = ocSetup.ownCloudUrl();
+  if( ! url.endsWith('/')) url.append('/');
   url.append( "files/webdav.php/");
   url.append( folder );
   qDebug() << "creating folder on ownCloud: " << url;
@@ -299,15 +300,19 @@ void FolderWizardTargetPage::initializePage()
 
 void FolderWizardTargetPage::slotOwnCloudFound( const QString& url, const QString& infoStr )
 {
-
-  _ui.OCLabel->setText( tr("to your <a href=\"%1\">ownCloud</a> (version %2)").arg(url).arg(infoStr));
-
-  qDebug() << "ownCloud found on " << url << " with version: " << infoStr;
+  if( infoStr.isEmpty() ) {
+  } else {
+    _ui.OCLabel->setText( tr("to your <a href=\"%1\">ownCloud</a> (version %2)").arg(url).arg(infoStr));
+    _ui.OCFolderLineEdit->setEnabled( true );
+    _ui.OCRadioBtn->setEnabled( true );
+    qDebug() << "ownCloud found on " << url << " with version: " << infoStr;
+  }
 }
 
 void FolderWizardTargetPage::slotNoOwnCloudFound()
 {
   qDebug() << "No ownCloud configured!";
+  _ui.OCLabel->setText( tr("no configured ownCloud found!") );
   _ui.OCRadioBtn->setEnabled( false );
   _ui.OCFolderLineEdit->setEnabled( false );
 }

+ 3 - 3
src/mirall/folderwizardtargetpage.ui

@@ -105,7 +105,7 @@
             <string/>
            </property>
            <property name="pixmap">
-            <pixmap resource="../../mirall.qrc">:/new/mirall/resources/mirall-48.png</pixmap>
+            <pixmap resource="../../mirall.qrc">:/mirall/resources/mirall-48.png</pixmap>
            </property>
           </widget>
          </item>
@@ -133,7 +133,7 @@
             <string/>
            </property>
            <property name="pixmap">
-            <pixmap resource="../../mirall.qrc">:/new/mirall/resources/folder-grey-32.png</pixmap>
+            <pixmap resource="../../mirall.qrc">:/mirall/resources/folder-grey-32.png</pixmap>
            </property>
            <property name="alignment">
             <set>Qt::AlignCenter</set>
@@ -207,7 +207,7 @@
             <string/>
            </property>
            <property name="pixmap">
-            <pixmap resource="../../mirall.qrc">:/new/mirall/resources/folder-remote-32.png</pixmap>
+            <pixmap resource="../../mirall.qrc">:/mirall/resources/folder-remote-32.png</pixmap>
            </property>
            <property name="alignment">
             <set>Qt::AlignCenter</set>

+ 20 - 18
src/mirall/owncloudinfo.cpp

@@ -88,33 +88,35 @@ void ownCloudInfo::slotAuthentication( QNetworkReply*, QAuthenticator *auth )
   }
 }
 
-
 void ownCloudInfo::slotReplyFinished( QNetworkReply *reply )
 {
   const QString version( _readBuffer );
   const QString url = reply->url().toString();
 
-  emit ownCloudInfoReply( url, reply->error() );
-
   QString info( version );
 
-  info.remove(0,1); // remove first char which is a "{"
-  info.remove(-1,1); // remove the last char which is a "}"
-  QStringList li = info.split( QChar(',') );
-
-  QString infoString;
-  QString versionStr;
-  foreach ( infoString, li ) {
-    if( infoString.contains( "versionstring") ) {
-      // get the version string out.
-      versionStr = infoString.mid(17);
-      versionStr.remove(-1, 1);
+  if( info.contains("installed") && info.contains("version") && info.contains("versionstring") ) {
+    info.remove(0,1); // remove first char which is a "{"
+    info.remove(-1,1); // remove the last char which is a "}"
+    QStringList li = info.split( QChar(',') );
+
+    QString infoString;
+    QString versionStr;
+    foreach ( infoString, li ) {
+      if( infoString.contains( "versionstring") ) {
+        // get the version string out.
+        versionStr = infoString.mid(17);
+        versionStr.remove(-1, 1);
+      }
     }
-  }
-  QString urlStr( url );
-  urlStr.remove("/status.php"); // get the plain url.
+    QString urlStr( url );
+    urlStr.remove("/status.php"); // get the plain url.
 
-  emit ownCloudInfoFound( urlStr, versionStr );
+    emit ownCloudInfoFound( urlStr, versionStr );
+  } else {
+    qDebug() << "No proper answer on status.php!";
+    emit noOwncloudFound();
+  }
 }
 
 void ownCloudInfo::slotReadyRead()

+ 0 - 2
src/mirall/owncloudinfo.h

@@ -40,8 +40,6 @@ signals:
   void ownCloudInfoFound( const QString&,  const QString& );
   void noOwncloudFound();
 
-  void ownCloudInfoReply( const QString&, QNetworkReply::NetworkError );
-
 public slots:
 
 protected slots:

+ 0 - 1
src/mirall/owncloudwizard.cpp

@@ -302,7 +302,6 @@ void OwncloudWizard::slotCurrentPageChanged( int id )
       // call in installation mode and install to ftp site.
       emit installOCServer();
     } else {
-      qDebug() << "XX: " << field("connectMyOC").toBool();
     }
   }
 }

+ 1 - 1
src/mirall/statusdialog.cpp

@@ -166,7 +166,7 @@ void StatusDialog::setFolderList( Folder::Map folders )
       resultStr = tr( "Setup Error" );
       statusIcon = "dialog-cancel";
     }
-    item->setData( QIcon::fromTheme( statusIcon ), FolderViewDelegate::FolderStatusIcon );
+    item->setData( QIcon::fromTheme( statusIcon, QIcon( QString( ":/mirall/resources/%1").arg(statusIcon))), FolderViewDelegate::FolderStatusIcon );
     item->setData( resultStr, FolderViewDelegate::FolderStatus );
     item->setData( res.errorString(), FolderViewDelegate::FolderErrorMsg );
 

+ 1 - 1
src/mirall/statusdialog.ui

@@ -71,7 +71,7 @@
          </property>
          <property name="icon">
           <iconset resource="../../mirall.qrc">
-           <normaloff>:/new/mirall/resources/mirall-128.png</normaloff>:/new/mirall/resources/mirall-128.png</iconset>
+           <normaloff>:/mirall/resources/mirall-128.png</normaloff>:/mirall/resources/mirall-128.png</iconset>
          </property>
          <property name="iconSize">
           <size>

+ 4 - 2
src/mirall/version.h

@@ -10,9 +10,11 @@
  * 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 VERSION_H
+ */
+
+#ifndef VERSION_H
 #define VERSION_H
 
-#define VERSION_STRING "0.1.1"
+#define VERSION_STRING "0.1.2"
 
 #endif // VERSION_H