Merge pull request #175 from ayonix/ssl-fix
authorManuel Nickschas <sputnick@quassel-irc.org>
Mon, 8 Feb 2016 20:33:53 +0000 (21:33 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 8 Feb 2016 20:33:53 +0000 (21:33 +0100)
Fix the SSL check on systems that don't use OpenSSL

14 files changed:
CMakeLists.txt
appveyor.yml
scripts/build/NullsoftInstaller.nsi
src/client/networkmodel.cpp
src/client/selectionmodelsynchronizer.cpp
src/common/peer.cpp
src/qtui/CMakeLists.txt
src/qtui/snorenotificationbackend.cpp
src/qtui/ui/snorentificationconfigwidget.ui
src/uisupport/action.cpp
src/uisupport/bufferview.cpp
src/uisupport/bufferview.h
src/uisupport/bufferviewfilter.cpp
src/uisupport/bufferviewfilter.h

index 03aabee..046b66d 100644 (file)
@@ -217,12 +217,21 @@ if (USE_QT5)
             PURPOSE     "Required for audio notifications"
         )
 
-        find_package(LibsnoreQt5 0.5.70 QUIET)
+        find_package(LibsnoreQt5 0.7.0 QUIET)
         set_package_properties(LibsnoreQt5 PROPERTIES TYPE OPTIONAL
             URL "https://projects.kde.org/projects/playground/libs/snorenotify"
             DESCRIPTION "a cross-platform notification framework"
             PURPOSE     "Enable support for the snorenotify framework"
         )
+        if(LibsnoreQt5_FOUND)
+            find_package(LibsnoreSettingsQt5)
+            set_package_properties(LibsnoreSettingsQt5 PROPERTIES TYPE REQUIRED
+                URL "https://projects.kde.org/projects/playground/libs/snorenotify"
+                DESCRIPTION "a cross-platform notification framework"
+                PURPOSE     "Enable support for the snorenotify framework"
+            )
+        endif()
+        
 
         if (WITH_WEBKIT)
             find_package(Qt5WebKit QUIET)
index bb7cfc1..a97c2e2 100644 (file)
@@ -10,9 +10,9 @@ build_script:
 
     Import-Module $env:APPVEYOR_BUILD_FOLDER\work\appveyorHelp.psm1
 
-    Init @("ninja", "png2ico", "nsis") ([ordered]@{"git://anongit.kde.org/extra-cmake-modules.git" = @{"branch" = "master"};
+    Init @("ninja", "png2ico", "nsis", "7zip.commandline") ([ordered]@{"git://anongit.kde.org/extra-cmake-modules.git" = @{"branch" = "master"};
                                  "https://github.com/Snorenotify/SnoreGrowl.git" = @{"branch" = "v0.4.0"; "buildType" = "Release"};
-                                 "git://anongit.kde.org/snorenotify.git" = @{"branch" = "v0.6.0"; "buildType" = "Release"}})
+                                 "git://anongit.kde.org/snorenotify.git" = @{"branch" = "v0.7.0"; "buildType" = "Release"}})
 
 
     mkdir -Force $env:APPVEYOR_BUILD_FOLDER\work\build\$env:APPVEYOR_PROJECT_NAME
@@ -34,18 +34,15 @@ build_script:
                             #snore
                             "bin\\.*snore.*\.dll",
                             "lib\\plugins\\libsnore.*\\libsnore_backend.*\.dll",
-                            "lib\\plugins\\libsnore.*\\libsnore_secondary_backend.*\.dll",
-                            #snorenotify 0.5
-                            "lib\\libsnore.*\\libsnore_backend.*\.dll",
-                            #
-                            "bin\\SnoreToast\.exe",
+                            "lib\\plugins\\libsnore.*\\libsnore_settings_backend.*\.dll",
+                            "lib\\plugins\\libsnore.*\\libsnore_secondarybackend.*\.dll", "lib\\plugins\\libsnore.*\\libsnore_settings_secondarybackend.*\.dll", "bin\\SnoreToast\.exe",
                             #
                             #Growl
                             "bin\\.*snoregrowl.*\.dll",
                             #
                             #ssl
-                            "bin\\libeay32\.dll",
-                            "bin\\ssleay32\.dll",
+                            ".*\\libeay32\.dll",
+                            ".*\\ssleay32\.dll",
                             #
                             #icu
                             "bin\\icuin\d+\.dll",
@@ -93,25 +90,22 @@ build_script:
                             "plugins\\phonon_backend\\.*",
                             "plugins\\phonon4qt5_backend\\.*") @(
                             #blacklist
+                            "include",
                             ".*\.h",
-                            "lib\\plugins\\libsnore.*\\libsnore_backend_freedesktop\.dll"
+                            "lib\\plugins\\libsnore.*\\libsnore_backend_freedesktop\.dll",
+                            ".*\.pdb",
+                            ".*plugind\.dll"
                             )
 
     mv "$imageDir\bin\*" "$imageDir\"
     #mv "$imageDir\lib\qca-qt5\crypto" "$imageDir\crypto"
+    mv "$imageDir\qml\*" "$imageDir"
     mv "$imageDir\plugins\*" "$imageDir"
     if(Test-Path "$imageDir\lib\plugins")
     {
         mv "$imageDir\lib\plugins\*" "$imageDir"
     }
-    #snorenotify 0.5 plugins
-    if(Test-Path "$imageDir\lib\libsnore-qt5")
-    {
-        mv "$imageDir\lib\libsnore-qt5\*" "$imageDir"
-    }
-    rm -Recurse "$imageDir\plugins\*"
-    rm -Recurse "$imageDir\lib"
-    rm -Recurse "$imageDir\bin"
+    DeleteEmptyFodlers $imageDir
     7ZipDeployImage
     NsisDeployImage $env:APPVEYOR_BUILD_FOLDER\scripts\build\NullsoftInstaller.nsi
 
@@ -119,11 +113,11 @@ environment:
     QT_VER: 5.5
 
     matrix:
-    #mingw
-    - COMPILER: mingw492_32
     #msvc
-    - COMPILER: msvc2013
     - COMPILER: msvc2013_64
+    - COMPILER: msvc2013
+    #mingw
+    - COMPILER: mingw492_32
 
 test: off
 
index 028067e..81d9cf8 100644 (file)
@@ -86,7 +86,7 @@ SetDatablockOptimize on
 CRCCheck on
 SilentInstall normal
 
-InstallDir "$PROGRAMFILES\${productname}"
+InstallDir "${defaultinstdir}\${productname}"
 InstallDirRegKey HKLM "${regkey}" ""
 
 
index 4d49efb..ddc71dd 100644 (file)
@@ -463,6 +463,12 @@ bool QueryBufferItem::setData(int column, const QVariant &value, int role)
     case Qt::EditRole:
     {
         QString newName = value.toString();
+
+        // Sanity check - buffer names must not contain newlines!
+        int nlpos = newName.indexOf('\n');
+        if (nlpos >= 0)
+            newName = newName.left(nlpos);
+
         if (!newName.isEmpty()) {
             Client::renameBuffer(bufferId(), newName);
             return true;
index 0dcf7f8..14c57c0 100644 (file)
@@ -255,6 +255,13 @@ void SelectionModelSynchronizer::currentChanged(const QModelIndex &current, cons
         ++iter;
     }
     _changeCurrentEnabled = true;
+
+    // Trigger a dataChanged() signal from the base model to update all proxy models (e.g. filters).
+    // Since signals are protected, we have to use invokeMethod for faking signal emission.
+    if (previous.isValid()) {
+        QMetaObject::invokeMethod(model(), "dataChanged", Qt::DirectConnection,
+                                  Q_ARG(QModelIndex, previous), Q_ARG(QModelIndex, previous));
+    }
 }
 
 
index 3785326..c076806 100644 (file)
@@ -34,20 +34,23 @@ AuthHandler *Peer::authHandler() const
 }
 
 
-// Note that we need to use a fixed-size integer instead of uintptr_t, in order
-// to avoid issues with different architectures for client and core.
-// In practice, we'll never really have to restore the real value of a PeerPtr from
-// a QVariant.
+// PeerPtr is used in RPC signatures for enabling receivers to send replies
+// to a particular peer rather than broadcast to all connected ones.
+// To enable this, the SignalProxy transparently replaces the bogus value
+// received over the network with the actual address of the local Peer
+// instance. Because the actual value isn't needed on the wire, it is
+// serialized as null.
 QDataStream &operator<<(QDataStream &out, PeerPtr ptr)
 {
-    out << reinterpret_cast<quint64>(ptr);
+    Q_UNUSED(ptr);
+    out << static_cast<quint64>(0);  // 64 bit for historic reasons
     return out;
 }
 
 QDataStream &operator>>(QDataStream &in, PeerPtr &ptr)
 {
+    ptr = nullptr;
     quint64 value;
     in >> value;
-    ptr = reinterpret_cast<PeerPtr>(value);
     return in;
 }
index 6987ec6..8510a71 100644 (file)
@@ -99,7 +99,7 @@ if (LibsnoreQt5_FOUND)
     add_definitions(-DHAVE_LIBSNORE)
     list(APPEND SOURCES snorenotificationbackend.cpp)
     list(APPEND FORMS   snorentificationconfigwidget.ui)
-    list(APPEND LIBS    Snore::Libsnore)
+    list(APPEND LIBS    Snore::Libsnore Snore::LibsnoreSettings)
 endif()
 
 if (PHONON_FOUND OR Phonon4Qt5_FOUND)
index 72873c1..69ce0e0 100644 (file)
@@ -43,9 +43,9 @@ SnoreNotificationBackend::SnoreNotificationBackend (QObject *parent)
 
     Snore::SnoreCore::instance().loadPlugins(
 #ifndef HAVE_KDE
-                Snore::SnorePlugin::BACKEND |
+                Snore::SnorePlugin::Backend |
 #endif
-                Snore::SnorePlugin::SECONDARY_BACKEND);
+                Snore::SnorePlugin::SecondaryBackend | Snore::SnorePlugin::Settings);
     m_application = Snore::Application("Quassel", m_icon);
     m_application.hints().setValue("windows-app-id","QuasselProject.QuasselIRC");
     m_application.hints().setValue("pushover-token", "arNtsi983QSZUqU3KAZrFLKHGFPkdL");
@@ -91,7 +91,7 @@ void SnoreNotificationBackend::close(uint notificationId)
     }
 #endif
     Snore::Notification n = Snore::SnoreCore::instance().getActiveNotificationByID(m_notificationIds.take(notificationId));
-    Snore::SnoreCore::instance().requestCloseNotification(n, Snore::Notification::CLOSED);
+    Snore::SnoreCore::instance().requestCloseNotification(n, Snore::Notification::Closed);
 }
 
 void SnoreNotificationBackend::actionInvoked(Snore::Notification n)
index 991e37b..117fc98 100644 (file)
@@ -55,7 +55,7 @@
   <customwidget>
    <class>Snore::SettingsDialog</class>
    <extends>QWidget</extends>
-   <header location="global">libsnore/settingsdialog.h</header>
+   <header location="global">libsnore/settings/settingsdialog.h</header>
    <container>1</container>
   </customwidget>
  </customwidgets>
index c222dc1..2758e77 100644 (file)
@@ -98,11 +98,16 @@ void Action::setShortcutConfigurable(bool b)
 QKeySequence Action::shortcut(ShortcutTypes type) const
 {
     Q_ASSERT(type);
-    if (type == DefaultShortcut)
+    if (type == DefaultShortcut) {
+#if QT_VERSION < 0x050000
         return property("defaultShortcut").value<QKeySequence>();
+#else
+        auto sequence = property("defaultShortcuts").value<QList<QKeySequence>>();
+        return sequence.isEmpty() ? QKeySequence() : sequence.first();
+#endif
+    }
 
-    if (shortcuts().count()) return shortcuts().value(0);
-    return QKeySequence();
+    return shortcuts().isEmpty() ? QKeySequence() : shortcuts().first();
 }
 
 
@@ -116,9 +121,13 @@ void Action::setShortcut(const QKeySequence &key, ShortcutTypes type)
 {
     Q_ASSERT(type);
 
-    if (type & DefaultShortcut)
+    if (type & DefaultShortcut) {
+#if QT_VERSION < 0x050000
         setProperty("defaultShortcut", key);
-
+#else
+        setProperty("defaultShortcuts", QVariant::fromValue(QList<QKeySequence>() << key));
+#endif
+    }
     if (type & ActiveShortcut)
         QAction::setShortcut(key);
 }
index d092146..c27e3a3 100644 (file)
@@ -158,21 +158,6 @@ void BufferView::setFilteredModel(QAbstractItemModel *model_, BufferViewConfig *
 }
 
 
-void BufferView::setSelectionModel(QItemSelectionModel *selectionModel)
-{
-    if (QTreeView::selectionModel())
-        disconnect(selectionModel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
-            model(), SIGNAL(checkPreviousCurrentForRemoval(QModelIndex, QModelIndex)));
-
-    QTreeView::setSelectionModel(selectionModel);
-    BufferViewFilter *filter = qobject_cast<BufferViewFilter *>(model());
-    if (filter) {
-        connect(selectionModel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
-            filter, SLOT(checkPreviousCurrentForRemoval(QModelIndex, QModelIndex)));
-    }
-}
-
-
 void BufferView::setConfig(BufferViewConfig *config)
 {
     if (_config == config)
index a49ce15..2962e5e 100644 (file)
@@ -52,7 +52,6 @@ public:
 
     void setModel(QAbstractItemModel *model);
     void setFilteredModel(QAbstractItemModel *model, BufferViewConfig *config);
-    virtual void setSelectionModel(QItemSelectionModel *selectionModel);
 
     void setConfig(BufferViewConfig *config);
     inline BufferViewConfig *config() { return _config; }
index c829267..4c5d4a9 100644 (file)
 #include "networkmodel.h"
 #include "uistyle.h"
 
-class CheckRemovalEvent : public QEvent
-{
-public:
-    CheckRemovalEvent(const QModelIndex &source_index) : QEvent(QEvent::User), index(source_index) {};
-    QPersistentModelIndex index;
-};
-
 
 /*****************************************
 * The Filter for the Tree View
@@ -57,9 +50,6 @@ BufferViewFilter::BufferViewFilter(QAbstractItemModel *model, BufferViewConfig *
 
     setDynamicSortFilter(true);
 
-    connect(this, SIGNAL(_dataChanged(const QModelIndex &, const QModelIndex &)),
-        this, SLOT(_q_sourceDataChanged(QModelIndex, QModelIndex)));
-
     _enableEditMode.setCheckable(true);
     _enableEditMode.setChecked(_editMode);
     connect(&_enableEditMode, SIGNAL(toggled(bool)), this, SLOT(enableEditMode(bool)));
@@ -542,34 +532,6 @@ bool BufferViewFilter::setCheckedState(const QModelIndex &index, Qt::CheckState
 }
 
 
-void BufferViewFilter::checkPreviousCurrentForRemoval(const QModelIndex &current, const QModelIndex &previous)
-{
-    Q_UNUSED(current);
-    if (previous.isValid())
-        QCoreApplication::postEvent(this, new CheckRemovalEvent(previous));
-}
-
-
-void BufferViewFilter::customEvent(QEvent *event)
-{
-    if (event->type() != QEvent::User)
-        return;
-
-    CheckRemovalEvent *removalEvent = static_cast<CheckRemovalEvent *>(event);
-    checkItemForRemoval(removalEvent->index);
-
-    event->accept();
-}
-
-
-void BufferViewFilter::checkItemsForRemoval(const QModelIndex &topLeft, const QModelIndex &bottomRight)
-{
-    QModelIndex source_topLeft = mapToSource(topLeft);
-    QModelIndex source_bottomRight = mapToSource(bottomRight);
-    emit _dataChanged(source_topLeft, source_bottomRight);
-}
-
-
 bool BufferViewFilter::bufferIdLessThan(const BufferId &left, const BufferId &right)
 {
     Q_CHECK_PTR(Client::networkModel());
index 1a4d781..5cf0cce 100644 (file)
@@ -69,20 +69,13 @@ public:
 
     QList<QAction *> actions(const QModelIndex &index);
 
-public slots:
-    void checkPreviousCurrentForRemoval(const QModelIndex &current, const QModelIndex &previous);
-    void checkItemForRemoval(const QModelIndex &index) { checkItemsForRemoval(index, index); }
-    void checkItemsForRemoval(const QModelIndex &topLeft, const QModelIndex &bottomRight);
-
 protected:
     bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const;
     bool lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const;
     bool bufferLessThan(const QModelIndex &source_left, const QModelIndex &source_right) const;
     bool networkLessThan(const QModelIndex &source_left, const QModelIndex &source_right) const;
-    virtual void customEvent(QEvent *event);
 
 signals:
-    void _dataChanged(const QModelIndex &source_topLeft, const QModelIndex &source_bottomRight);
     void configChanged();
 
 private slots: