SHARE
TWEET

Untitled

a guest Aug 15th, 2017 8 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/psi-plus-snapshots-1.2.32/src/mainwin.cpp b/psi-plus-snapshots-1.2.32/src/mainwin.cpp
  2. index ecd20cc..4d71e98 100644
  3. --- a/psi-plus-snapshots-1.2.32/src/mainwin.cpp
  4. +++ b/psi-plus-snapshots-1.2.32/src/mainwin.cpp
  5. @@ -1627,12 +1627,13 @@ void MainWin::trayClicked(const QPoint &, int button)
  6.  void MainWin::trayDoubleClicked()
  7.  {
  8.     //Double click works like second single click now if "double-click" style is disabled
  9. -
  10.     if(PsiOptions::instance()->getOption("options.ui.systemtray.use-double-click").toBool()) {
  11.         if(d->nextAmount > 0) {
  12.             doRecvNextEvent();
  13.             return;
  14.         }
  15. +   } else {
  16. +       return;
  17.     }
  18.  
  19.     toggleVisible(true);
  20. diff --git a/psi-plus-snapshots-1.2.32/src/psitrayicon.cpp b/psi-plus-snapshots-1.2.32/src/psitrayicon.cpp
  21. index c6b0dc6..cb42e35 100644
  22. --- a/psi-plus-snapshots-1.2.32/src/psitrayicon.cpp
  23. +++ b/psi-plus-snapshots-1.2.32/src/psitrayicon.cpp
  24. @@ -1,9 +1,12 @@
  25.  #include <QPixmap>
  26.  #include <QPixmapCache>
  27.  #include <QApplication> // old
  28. +#include <QTimer>
  29. +#include <QDebug>
  30.  #include <QSystemTrayIcon>
  31.  #include <QHelpEvent>
  32.  
  33. +#include "psioptions.h"
  34.  #include "psitrayicon.h"
  35.  #include "iconset.h"
  36.  #include "alerticon.h"
  37. @@ -17,11 +20,14 @@ PsiTrayIcon::PsiTrayIcon(const QString &tip, QMenu *popup, QObject *parent)
  38.     , icon_(NULL)
  39.     , trayicon_(new QSystemTrayIcon())
  40.     , realIcon_(0)
  41. +   , timer_(new QTimer())
  42.  { 
  43.     trayicon_->setContextMenu(popup);
  44.     setToolTip(tip);
  45.     connect(trayicon_,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),SLOT(trayicon_activated(QSystemTrayIcon::ActivationReason)));
  46.     trayicon_->installEventFilter(this);
  47. +   timer_->setSingleShot(true);
  48. +   timer_->setInterval(qApp->doubleClickInterval());
  49.  }
  50.  
  51.  PsiTrayIcon::~PsiTrayIcon()
  52. @@ -32,6 +38,7 @@ PsiTrayIcon::~PsiTrayIcon()
  53.         icon_->stop();
  54.         delete icon_;
  55.     }
  56. +   delete timer_;
  57.  }
  58.  
  59.  void PsiTrayIcon::setContextMenu(QMenu* menu)
  60. @@ -176,8 +183,20 @@ void PsiTrayIcon::trayicon_activated(QSystemTrayIcon::ActivationReason reason)
  61.  #ifdef Q_OS_MAC
  62.     Q_UNUSED(reason)
  63.  #else
  64. -   if (reason == QSystemTrayIcon::Trigger)
  65. -       emit clicked(QPoint(),Qt::LeftButton);
  66. +   if (reason == QSystemTrayIcon::Trigger) {
  67. +       if(PsiOptions::instance()->getOption("options.ui.systemtray.use-double-click").toBool()) {
  68. +           if (timer_->remainingTime() <= 0)
  69. +           { //timer is not active or finished (first click)
  70. +               timer_->start();
  71. +           } else
  72. +           { //timer is active (second click)
  73. +               timer_->stop();
  74. +               emit doubleClicked(QPoint());
  75. +           }
  76. +       } else {
  77. +           emit clicked(QPoint(), Qt::LeftButton);
  78. +       }
  79. +   }
  80.     else if (reason == QSystemTrayIcon::MiddleClick || (isKde() && reason == QSystemTrayIcon::Context))
  81.         emit clicked(QPoint(),Qt::MidButton);
  82.     else if (reason == QSystemTrayIcon::DoubleClick)
  83. diff --git a/psi-plus-snapshots-1.2.32/src/psitrayicon.h b/psi-plus-snapshots-1.2.32/src/psitrayicon.h
  84. index bb67fc1..8f0cf66 100644
  85. --- a/psi-plus-snapshots-1.2.32/src/psitrayicon.h
  86. +++ b/psi-plus-snapshots-1.2.32/src/psitrayicon.h
  87. @@ -48,6 +48,7 @@ private:
  88.     PsiIcon* icon_;
  89.     QSystemTrayIcon* trayicon_;
  90.     quintptr realIcon_;
  91. +   QTimer* timer_;
  92.  };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top