Added support for native KDE notifier icon.
This commit is contained in:
		
							
								
								
									
										10
									
								
								qcma.pro
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								qcma.pro
									
									
									
									
									
								
							@@ -122,6 +122,16 @@ unix {
 | 
			
		||||
 | 
			
		||||
unix:!macx:DEFINES += _FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE
 | 
			
		||||
 | 
			
		||||
unix:!macx:ENABLE_KDE {
 | 
			
		||||
    greaterThan(QT_MAJOR_VERSION, 4) {
 | 
			
		||||
        error("ENABLE_KDE can only be used with Qt4")
 | 
			
		||||
    }
 | 
			
		||||
    LIBS += -lkdeui
 | 
			
		||||
    DEFINES += "ENABLE_KDE_NOTIFIER=1"
 | 
			
		||||
    SOURCES += src/kdenotifier.cpp
 | 
			
		||||
    HEADERS += src/kdenotifier.h
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
win32:RC_FILE = qcma.rc
 | 
			
		||||
win32:QMAKE_CXXFLAGS += -mno-ms-bitfields
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<!DOCTYPE TS>
 | 
			
		||||
<TS version="2.1" language="es_ES">
 | 
			
		||||
<TS version="2.0" language="es_ES">
 | 
			
		||||
<context>
 | 
			
		||||
    <name>BackupItem</name>
 | 
			
		||||
    <message>
 | 
			
		||||
@@ -134,7 +134,7 @@
 | 
			
		||||
    <name>CmaClient</name>
 | 
			
		||||
    <message>
 | 
			
		||||
        <source>Connected to </source>
 | 
			
		||||
        <translation type="vanished">Conectado a </translation>
 | 
			
		||||
        <translation type="obsolete">Conectado a </translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/cmaclient.cpp" line="127"/>
 | 
			
		||||
@@ -316,8 +316,8 @@
 | 
			
		||||
<context>
 | 
			
		||||
    <name>FilterLineEdit</name>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/filterlineedit.cpp" line="40"/>
 | 
			
		||||
        <location filename="../../src/filterlineedit.cpp" line="61"/>
 | 
			
		||||
        <location filename="../../src/filterlineedit.cpp" line="50"/>
 | 
			
		||||
        <location filename="../../src/filterlineedit.cpp" line="71"/>
 | 
			
		||||
        <source>Filter</source>
 | 
			
		||||
        <translation>Filtro</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
@@ -325,37 +325,38 @@
 | 
			
		||||
<context>
 | 
			
		||||
    <name>MainWidget</name>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="75"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="79"/>
 | 
			
		||||
        <source>Shutting down...</source>
 | 
			
		||||
        <translation>Cerrando...</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="76"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="80"/>
 | 
			
		||||
        <source>Stopping QCMA...</source>
 | 
			
		||||
        <translation>Deteniendo QCMA...</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="88"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="96"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="227"/>
 | 
			
		||||
        <source>Disconnected</source>
 | 
			
		||||
        <translation>Desconectado</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="89"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="97"/>
 | 
			
		||||
        <source>The device has been disconnected</source>
 | 
			
		||||
        <translation>El dispositivo se ha desconectado</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="138"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="154"/>
 | 
			
		||||
        <source>About QCMA</source>
 | 
			
		||||
        <translation>Acerca de QCMA</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="140"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="156"/>
 | 
			
		||||
        <source>Copyright (C) 2013  Codestation</source>
 | 
			
		||||
        <translation>Copyright (C) 2013  Codestation</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="142"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="158"/>
 | 
			
		||||
        <source>Copyright (C) 2013  Codestation
 | 
			
		||||
 | 
			
		||||
build hash: %1
 | 
			
		||||
@@ -366,17 +367,22 @@ Hash de compilación: %1
 | 
			
		||||
Rama de compilación: %2</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="167"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="183"/>
 | 
			
		||||
        <source>&About QCMA</source>
 | 
			
		||||
        <translation>&Acerca de QCMA</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="246"/>
 | 
			
		||||
        <source>Qcma - Information</source>
 | 
			
		||||
        <translation>Qcma - Información</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <source>Copyright (C) 2013  Codestation
 | 
			
		||||
</source>
 | 
			
		||||
        <translation type="obsolete">Copyright (C) 2013  Codestation\n</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="166"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="182"/>
 | 
			
		||||
        <source>&Backup Manager</source>
 | 
			
		||||
        <translation>&Gestor de Respaldos</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
@@ -385,7 +391,7 @@ Rama de compilación: %2</translation>
 | 
			
		||||
        <translation type="obsolete">&Acerca de</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="168"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="184"/>
 | 
			
		||||
        <source>Abou&t Qt</source>
 | 
			
		||||
        <translation>A&cerca de Qt</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
@@ -394,12 +400,12 @@ Rama de compilación: %2</translation>
 | 
			
		||||
        <translation type="obsolete">PIN recibido: %1</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="164"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="180"/>
 | 
			
		||||
        <source>&Settings</source>
 | 
			
		||||
        <translation>&Ajustes</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="165"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="181"/>
 | 
			
		||||
        <source>&Refresh database</source>
 | 
			
		||||
        <translation>&Refrescar base de datos</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
@@ -408,12 +414,17 @@ Rama de compilación: %2</translation>
 | 
			
		||||
        <translation type="obsolete">Gestor de Respaldos</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="169"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="185"/>
 | 
			
		||||
        <source>&Quit</source>
 | 
			
		||||
        <translation>&Salir</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="210"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="225"/>
 | 
			
		||||
        <source>Qcma status</source>
 | 
			
		||||
        <translation>Estado de Qcma</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="243"/>
 | 
			
		||||
        <source>Information</source>
 | 
			
		||||
        <translation>Información</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<?xml version="1.0" encoding="utf-8"?>
 | 
			
		||||
<!DOCTYPE TS>
 | 
			
		||||
<TS version="2.1" language="ja_JP">
 | 
			
		||||
<TS version="2.0" language="ja_JP">
 | 
			
		||||
<context>
 | 
			
		||||
    <name>BackupItem</name>
 | 
			
		||||
    <message>
 | 
			
		||||
@@ -134,7 +134,7 @@
 | 
			
		||||
    <name>CmaClient</name>
 | 
			
		||||
    <message>
 | 
			
		||||
        <source>Connected to </source>
 | 
			
		||||
        <translation type="vanished">次のデバイスに接続しました </translation>
 | 
			
		||||
        <translation type="obsolete">次のデバイスに接続しました </translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/cmaclient.cpp" line="127"/>
 | 
			
		||||
@@ -317,8 +317,8 @@
 | 
			
		||||
<context>
 | 
			
		||||
    <name>FilterLineEdit</name>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/filterlineedit.cpp" line="40"/>
 | 
			
		||||
        <location filename="../../src/filterlineedit.cpp" line="61"/>
 | 
			
		||||
        <location filename="../../src/filterlineedit.cpp" line="50"/>
 | 
			
		||||
        <location filename="../../src/filterlineedit.cpp" line="71"/>
 | 
			
		||||
        <source>Filter</source>
 | 
			
		||||
        <translation type="unfinished"></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
@@ -326,37 +326,38 @@
 | 
			
		||||
<context>
 | 
			
		||||
    <name>MainWidget</name>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="75"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="79"/>
 | 
			
		||||
        <source>Shutting down...</source>
 | 
			
		||||
        <translation>終了しています...</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="76"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="80"/>
 | 
			
		||||
        <source>Stopping QCMA...</source>
 | 
			
		||||
        <translation>QCMAを停止しています...</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="88"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="96"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="227"/>
 | 
			
		||||
        <source>Disconnected</source>
 | 
			
		||||
        <translation>切断されました</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="89"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="97"/>
 | 
			
		||||
        <source>The device has been disconnected</source>
 | 
			
		||||
        <translation>デバイスが切断されました</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="138"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="154"/>
 | 
			
		||||
        <source>About QCMA</source>
 | 
			
		||||
        <translation type="unfinished"></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="140"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="156"/>
 | 
			
		||||
        <source>Copyright (C) 2013  Codestation</source>
 | 
			
		||||
        <translation type="unfinished"></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="142"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="158"/>
 | 
			
		||||
        <source>Copyright (C) 2013  Codestation
 | 
			
		||||
 | 
			
		||||
build hash: %1
 | 
			
		||||
@@ -364,31 +365,36 @@ build branch: %2</source>
 | 
			
		||||
        <translation type="unfinished"></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="166"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="182"/>
 | 
			
		||||
        <source>&Backup Manager</source>
 | 
			
		||||
        <translation type="unfinished"></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="167"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="183"/>
 | 
			
		||||
        <source>&About QCMA</source>
 | 
			
		||||
        <translation type="unfinished"></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="168"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="184"/>
 | 
			
		||||
        <source>Abou&t Qt</source>
 | 
			
		||||
        <translation type="unfinished"></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="246"/>
 | 
			
		||||
        <source>Qcma - Information</source>
 | 
			
		||||
        <translation type="unfinished"></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <source>Received PIN: %1</source>
 | 
			
		||||
        <translation type="obsolete">受信したPIN: %1</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="164"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="180"/>
 | 
			
		||||
        <source>&Settings</source>
 | 
			
		||||
        <translation>&設定</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="165"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="181"/>
 | 
			
		||||
        <source>&Refresh database</source>
 | 
			
		||||
        <translation>&データベースを更新する</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
@@ -397,12 +403,17 @@ build branch: %2</source>
 | 
			
		||||
        <translation type="obsolete">バックアップマネージャー</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="169"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="185"/>
 | 
			
		||||
        <source>&Quit</source>
 | 
			
		||||
        <translation>&終了</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="210"/>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="225"/>
 | 
			
		||||
        <source>Qcma status</source>
 | 
			
		||||
        <translation type="unfinished"></translation>
 | 
			
		||||
    </message>
 | 
			
		||||
    <message>
 | 
			
		||||
        <location filename="../../src/mainwidget.cpp" line="243"/>
 | 
			
		||||
        <source>Information</source>
 | 
			
		||||
        <translation>情報</translation>
 | 
			
		||||
    </message>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										25
									
								
								src/kdenotifier.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/kdenotifier.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  QCMA: Cross-platform content manager assistant for the PS Vita
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (C) 2014  Codestation
 | 
			
		||||
 *
 | 
			
		||||
 *  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, either version 3 of the License, or
 | 
			
		||||
 *  (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 *  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.
 | 
			
		||||
 *
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include "kdenotifier.h"
 | 
			
		||||
 | 
			
		||||
KDENotifier::KDENotifier(const QString &id, QObject *parent) :
 | 
			
		||||
    KStatusNotifierItem(id, parent)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										41
									
								
								src/kdenotifier.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								src/kdenotifier.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  QCMA: Cross-platform content manager assistant for the PS Vita
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (C) 2014  Codestation
 | 
			
		||||
 *
 | 
			
		||||
 *  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, either version 3 of the License, or
 | 
			
		||||
 *  (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 *  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.
 | 
			
		||||
 *
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef KDENOTIFIER_H
 | 
			
		||||
#define KDENOTIFIER_H
 | 
			
		||||
 | 
			
		||||
#include <kstatusnotifieritem.h>
 | 
			
		||||
#include <kmenu.h>
 | 
			
		||||
 | 
			
		||||
class KDENotifier : public KStatusNotifierItem
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    explicit KDENotifier(const QString &id, QObject *parent = 0);
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
    // block left click because it shows the default widget
 | 
			
		||||
    virtual void activate (const QPoint &pos=QPoint()) {
 | 
			
		||||
        Q_UNUSED(pos);
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // KDENOTIFIER_H
 | 
			
		||||
@@ -34,6 +34,10 @@
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
#include <QSpacerItem>
 | 
			
		||||
 | 
			
		||||
#ifdef ENABLE_KDE_NOTIFIER
 | 
			
		||||
#include <kmenu.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
const QStringList MainWidget::path_list = QStringList() << "photoPath" << "musicPath" << "videoPath" << "appsPath" << "urlPath";
 | 
			
		||||
 | 
			
		||||
bool sleptOnce = false;
 | 
			
		||||
@@ -79,10 +83,14 @@ void MainWidget::stopServer()
 | 
			
		||||
 | 
			
		||||
void MainWidget::deviceDisconnect()
 | 
			
		||||
{
 | 
			
		||||
#ifndef ENABLE_KDE_NOTIFIER
 | 
			
		||||
#ifndef Q_OS_WIN32
 | 
			
		||||
    trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_dc.png"));
 | 
			
		||||
#else
 | 
			
		||||
    trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_16_dc.png"));
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
    notifierItem->setIconByPixmap(QIcon(":/main/resources/images/psv_icon_dc.png"));
 | 
			
		||||
#endif
 | 
			
		||||
    qDebug("Icon changed - disconnected");
 | 
			
		||||
    setTrayTooltip(tr("Disconnected"));
 | 
			
		||||
@@ -91,10 +99,14 @@ void MainWidget::deviceDisconnect()
 | 
			
		||||
 | 
			
		||||
void MainWidget::deviceConnected(QString message)
 | 
			
		||||
{
 | 
			
		||||
#ifndef ENABLE_KDE_NOTIFIER
 | 
			
		||||
#ifndef Q_OS_WIN32
 | 
			
		||||
    trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon.png"));
 | 
			
		||||
#else
 | 
			
		||||
    trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_16.png"));
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
    notifierItem->setIconByPixmap(QIcon(":/main/resources/images/psv_icon.png"));
 | 
			
		||||
#endif
 | 
			
		||||
    qDebug("Icon changed - connected");
 | 
			
		||||
    setTrayTooltip(message);
 | 
			
		||||
@@ -121,7 +133,11 @@ void MainWidget::connectSignals()
 | 
			
		||||
 | 
			
		||||
void MainWidget::setTrayTooltip(QString message)
 | 
			
		||||
{
 | 
			
		||||
#ifndef ENABLE_KDE_NOTIFIER
 | 
			
		||||
    trayIcon->setToolTip(message);
 | 
			
		||||
#else
 | 
			
		||||
    notifierItem->setToolTipSubTitle(message);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWidget::openManager()
 | 
			
		||||
@@ -175,7 +191,12 @@ void MainWidget::createTrayIcon()
 | 
			
		||||
    connect(about_qt, SIGNAL(triggered()), this, SLOT(showAboutQt()));
 | 
			
		||||
    connect(quit, SIGNAL(triggered()), this, SLOT(stopServer()));
 | 
			
		||||
 | 
			
		||||
#ifndef ENABLE_KDE_NOTIFIER
 | 
			
		||||
    QMenu *trayIconMenu = new QMenu(this);
 | 
			
		||||
#else
 | 
			
		||||
    KMenu *trayIconMenu = new KMenu(this);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    trayIconMenu->addAction(options);
 | 
			
		||||
    trayIconMenu->addAction(reload);
 | 
			
		||||
    trayIconMenu->addAction(backup);
 | 
			
		||||
@@ -185,6 +206,7 @@ void MainWidget::createTrayIcon()
 | 
			
		||||
    trayIconMenu->addSeparator();
 | 
			
		||||
    trayIconMenu->addAction(quit);
 | 
			
		||||
 | 
			
		||||
#ifndef ENABLE_KDE_NOTIFIER
 | 
			
		||||
    trayIcon = new QSystemTrayIcon(this);
 | 
			
		||||
    trayIcon->setContextMenu(trayIconMenu);
 | 
			
		||||
#ifndef Q_OS_WIN32
 | 
			
		||||
@@ -193,8 +215,18 @@ void MainWidget::createTrayIcon()
 | 
			
		||||
    trayIcon->setIcon(QIcon(":/main/resources/images/psv_icon_16_dc.png"));
 | 
			
		||||
#endif
 | 
			
		||||
    trayIcon->show();
 | 
			
		||||
    // try to avoid the iconTray Qt bug
 | 
			
		||||
    //Sleeper::sleep(1);
 | 
			
		||||
#else
 | 
			
		||||
    notifierItem = new KDENotifier("QcmaNotifier", this);
 | 
			
		||||
    notifierItem->setContextMenu(trayIconMenu);
 | 
			
		||||
    notifierItem->setTitle("Qcma");
 | 
			
		||||
    notifierItem->setCategory(KStatusNotifierItem::ApplicationStatus);
 | 
			
		||||
    notifierItem->setIconByPixmap(QIcon(":/main/resources/images/psv_icon_dc.png"));
 | 
			
		||||
    notifierItem->setStatus(KStatusNotifierItem::Active);
 | 
			
		||||
    notifierItem->setToolTipTitle(tr("Qcma status"));
 | 
			
		||||
    notifierItem->setToolTipIconByPixmap(QIcon(":/main/resources/images/qcma.png"));
 | 
			
		||||
    notifierItem->setToolTipSubTitle(tr("Disconnected"));
 | 
			
		||||
    notifierItem->setStandardActionsEnabled(false);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainWidget::receiveMessage(QString message)
 | 
			
		||||
@@ -206,12 +238,19 @@ void MainWidget::receiveMessage(QString message)
 | 
			
		||||
        sleptOnce = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#ifndef ENABLE_KDE_NOTIFIER
 | 
			
		||||
    if(trayIcon->isVisible()) {
 | 
			
		||||
        trayIcon->showMessage(tr("Information"), message);
 | 
			
		||||
    }
 | 
			
		||||
#else
 | 
			
		||||
    notifierItem->showMessage(tr("Qcma - Information"), message, "dialog-information", 3000);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
MainWidget::~MainWidget()
 | 
			
		||||
{
 | 
			
		||||
#ifndef ENABLE_KDE_NOTIFIER
 | 
			
		||||
    trayIcon->hide();
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,11 @@
 | 
			
		||||
 | 
			
		||||
#include <QAction>
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
 | 
			
		||||
#include <QSystemTrayIcon>
 | 
			
		||||
#ifdef ENABLE_KDE_NOTIFIER
 | 
			
		||||
#include "kdenotifier.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <vitamtp.h>
 | 
			
		||||
 | 
			
		||||
@@ -60,7 +64,12 @@ private:
 | 
			
		||||
    QAction *backup;
 | 
			
		||||
    QAction *about;
 | 
			
		||||
    QAction *about_qt;
 | 
			
		||||
 | 
			
		||||
#ifndef ENABLE_KDE_NOTIFIER
 | 
			
		||||
    QSystemTrayIcon *trayIcon;
 | 
			
		||||
#else
 | 
			
		||||
    KDENotifier *notifierItem;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    const static QStringList path_list;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user