From e9cc85028c198cbf7b4cf803d9678a7f7f022aea Mon Sep 17 00:00:00 2001 From: Gianluca Montecchi Date: Wed, 2 Sep 2015 23:40:01 +0200 Subject: [PATCH 1/3] Initial import of tomb-qt-tray --- extras/qt-tray/i18n/tomb-qt-tray_it.qm | Bin 0 -> 1129 bytes extras/qt-tray/i18n/tomb-qt-tray_it.ts | 75 ++++++++++++ extras/qt-tray/main.cpp | 22 ++++ extras/qt-tray/pixmaps/tomb_icon.png | Bin 0 -> 8882 bytes extras/qt-tray/qt-tray.pro | 28 +++++ extras/qt-tray/tomb.cpp | 152 +++++++++++++++++++++++++ extras/qt-tray/tomb.h | 53 +++++++++ 7 files changed, 330 insertions(+) create mode 100644 extras/qt-tray/i18n/tomb-qt-tray_it.qm create mode 100644 extras/qt-tray/i18n/tomb-qt-tray_it.ts create mode 100644 extras/qt-tray/main.cpp create mode 100644 extras/qt-tray/pixmaps/tomb_icon.png create mode 100644 extras/qt-tray/qt-tray.pro create mode 100644 extras/qt-tray/tomb.cpp create mode 100644 extras/qt-tray/tomb.h diff --git a/extras/qt-tray/i18n/tomb-qt-tray_it.qm b/extras/qt-tray/i18n/tomb-qt-tray_it.qm new file mode 100644 index 0000000000000000000000000000000000000000..c414c1ca0789ba27f649ffca5abe2dbf321093ff GIT binary patch literal 1129 zcmaJ=v2GJV5FIBDHkOr?q@dWO2}1Y^iYNsIA~+IhK#C(l$L75Dt$cTT*Ru|dS;!xB2SEa$7NC8Gr3{aRFNY_G{f_0x!{^}Nrx{u(wi>3dG z6NmN~_YC1rWQ`mX^fZ(^$-#Nfq7vNG*gH_v!=ow2QaJa)586<-#%{7NaApy&a6_S| zVK`^fqLPZookWSknpim}dQzvVE4&fTOY0-i);>{I;3afEG6NhUwr^!7v=fgnq_nl5SRnzWF0%^U4WZB+>dd>Iv8l6N|v^!EQQWvD_x?xjgB32 zLw1;p4Uf?jF;D6SIuugGXxF53lekN_k(5Vm)HhzLFufUgcp;j$xY z&^~VQ4UAw}+LZ@jK37xO3Ki?#82R~M5j&7GYP65EhfK39M@Y{-4g%cyj4{K1nZz>P zrNX2G?OFcZz~q>e6hkwMzFM-~qC + + + + Dialog + + Explore + Esplora + + + Close + Chiudi + + + + Tomb + + + Explore + Esplora + + + + Close + Chiudi + + + + Slam + Slam + + + + + + + tomb-qt-tray + tomb-qt-tray + + + + You need to specify a Tomb File. +Exiting + Devi specificare un file Tomb. +Uscita + + + + Tomb encrypted undertaker + + + + + We started digging out bones + + + + + polkit is not installed + polkit non è installato + + + + The program crashed +Try to run 'tomb close' in a console + Il programma è crashato +Prova ad eseguire "tomb close" in una console + + + + The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program. + Il programma non è stato avviato. O il programma chiamato non è installato o non hai sufficienti diritti per eseguirlo. + + + diff --git a/extras/qt-tray/main.cpp b/extras/qt-tray/main.cpp new file mode 100644 index 0000000..70f6386 --- /dev/null +++ b/extras/qt-tray/main.cpp @@ -0,0 +1,22 @@ +#include +#include +#include + +#include "tomb.h" + + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + QTranslator translator(0); + + + translator.load( QString("./i18n/tomb-qt-tray_") + QLocale::system().name() ); + + a.installTranslator( &translator ); + //w.show(); + Tomb w; + + + return a.exec(); +} diff --git a/extras/qt-tray/pixmaps/tomb_icon.png b/extras/qt-tray/pixmaps/tomb_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..bedc5b9d71bf10b379c62844d95d26bb3c4c6335 GIT binary patch literal 8882 zcmYLPbyQSew7xS#4BaJ23DT{E(%mgcICOV642^^|h%|!a0Mgwhh;(-&h_p1k`K`C! zdS~6a^WQ#u-}~)v@BN+oQC(FI2lE*w001}&^3s~ffB1htC>rwKD{3+V0JMODw1l>I z*3kzaecieXT z_S}DMFCb?xU@steq$&3Quj|oZn?uYx(7g!X9BaKb(|!qxu{qUh*AKxr#Bac$KFPTC zczGZ()Ac;i>v9HC*|8bTMnwPOMeEyaRoNm<#+biEp%9>T1x7_c(EVCK;OX{!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,0 +1,28 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2015-07-30T22:53:13 +# +#------------------------------------------------- + +QT += core gui quick + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = tomb-qt-tray +TEMPLATE = app + + +SOURCES += main.cpp\ + tomb.cpp + +HEADERS += tomb.h + +TRANSLATIONS = i18n/tomb-qt-tray_it.ts + +CONFIG += c++11 + +FORMS += + +DISTFILES += + + diff --git a/extras/qt-tray/tomb.cpp b/extras/qt-tray/tomb.cpp new file mode 100644 index 0000000..43dff85 --- /dev/null +++ b/extras/qt-tray/tomb.cpp @@ -0,0 +1,152 @@ + +#include "tomb.h" +#include +#include +#include +#include + +#include + +Tomb::Tomb(QWidget *parent) + : QDialog(parent) +{ + struct mntent *ent; + FILE *aFile; + + + if (QApplication::arguments().length() > 1) { + this->info = QFileInfo(QApplication::arguments().takeAt(1)); + this->tombName = QString(info.baseName()); + this->tombPath = info.path(); + } else { + QMessageBox::critical(this, tr("tomb-qt-tray"), tr("You need to specify a Tomb File.\nExiting"), QMessageBox::Ok); + exit(EXIT_FAILURE); + } + + + // Build the menù + this->icon = QIcon( QCoreApplication::applicationDirPath() + QDir::separator()+QString("pixmaps/tomb_icon.png")); + this->trayIcon = new QSystemTrayIcon(this->icon); + this->trayIconMenu = new QMenu(); + + this->tombBuildMenu(); + + this->trayIcon->setContextMenu(this->trayIconMenu); + + this->trayIcon->setToolTip(QString(info.baseName())); + this->trayIcon->show(); + this->trayIcon->showMessage(tr("Tomb encrypted undertaker"),tr("We started digging out bones"), QSystemTrayIcon::Information); + if (QT_VERSION >= 0x050400) { + for (auto volume : QStorageInfo::mountedVolumes()) { + if (QString(volume.device()).contains(this->tombName) == true) { + this->tombMountPoint = QString(volume.rootPath()); + break; + } + } + } else { + aFile = setmntent("/proc/mounts", "r"); + if (aFile == NULL) { + perror("setmntent"); + exit(1); + } + while (NULL != (ent = getmntent(aFile))) { + if (QString( ent->mnt_fsname).contains(this->tombName) == true) { + this->tombMountPoint = QString(ent->mnt_dir); + break; + } + } + endmntent(aFile); + } +} + +void Tomb::closeEvent(QCloseEvent *event) { + event->accept(); +} + +void Tomb::tombBuildMenu() { + + // Create the menu items +// this->tombOpen = new QAction(tr("Open"), this); + //this->trayIconMenu->addAction(tombOpen); + + this->menu_tombExplore = new QAction(tr("Explore"), this); + this->trayIconMenu->addAction(menu_tombExplore); + + this->trayIconMenu->addSeparator(); + + this->menu_tombClose = new QAction(tr("Close"), this); + this->trayIconMenu->addAction(menu_tombClose); + + this->menu_tombSlam = new QAction(tr("Slam"), this); + this->trayIconMenu->addAction(menu_tombSlam); + + connect(this->menu_tombExplore, SIGNAL(triggered()), this, SLOT(tombExplore())); + connect(this->menu_tombClose, SIGNAL(triggered()), this, SLOT(tombClose())); + connect(this->menu_tombSlam, SIGNAL(triggered()), this, SLOT(tombSlam())); + +} + +void Tomb::tombExplore() { + + QDesktopServices::openUrl(QUrl(QUrl::fromLocalFile(this->tombMountPoint))); + +} + +void Tomb::tombClose() { + + QProcess *tomb; + tomb = new QProcess(this); + tomb->start("pkexec", QStringList() << "tomb" << "close"); + connect(tomb, SIGNAL(finished(int , QProcess::ExitStatus )), this, SLOT(tombCheckCmdRet(int , QProcess::ExitStatus ))); + connect(tomb, SIGNAL(error(QProcess::ProcessError)), this, SLOT(tombStartError(QProcess::ProcessError))); + tomb->waitForFinished(30000); + +} + +void Tomb::tombSlam() { + + QProcess *tomb; + tomb = new QProcess(this); + tomb->start("pkexec", QStringList() << "tomb" << "slam"); + connect(tomb, SIGNAL(finished(int , QProcess::ExitStatus )), this, SLOT(tombCheckCmdRet(int , QProcess::ExitStatus ))); + connect(tomb, SIGNAL(error(QProcess::ProcessError)), this, SLOT(tombStartError(QProcess::ProcessError))); + tomb->waitForFinished(30000); + +} + +void Tomb::tombCheckCmdRet(int exitCode, QProcess::ExitStatus exitStatus) { + + if (exitStatus == QProcess::CrashExit) { + QMessageBox::critical(this, tr("tomb-qt-tray"), tr("polkit is not installed"),QMessageBox::Ok); + } else { + if (exitCode != QProcess::NormalExit) { + QMessageBox::critical(this, tr("tomb-qt-tray"), tr("The program crashed\nTry to run 'tomb close' in a console"),QMessageBox::Ok); + } + } + +} + +void Tomb::tombStartError(QProcess::ProcessError err) { + + QString msg = QString(); + + switch (err) { + case QProcess::FailedToStart : + msg = tr("The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program."); + break; + case QProcess::Crashed: + case QProcess::Timedout: + case QProcess::ReadError: + case QProcess::WriteError: + case QProcess::UnknownError: + break; + } + QMessageBox::critical(this, tr("tomb-qt-tray"), msg, QMessageBox::Ok); + +} + + +Tomb::~Tomb() { + +} + diff --git a/extras/qt-tray/tomb.h b/extras/qt-tray/tomb.h new file mode 100644 index 0000000..9429b89 --- /dev/null +++ b/extras/qt-tray/tomb.h @@ -0,0 +1,53 @@ +#ifndef DIALOG_H +#define DIALOG_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class Tomb : public QDialog +{ + Q_OBJECT + + public: + Tomb(QWidget *parent = 0); + ~Tomb(); + + + QIcon icon; + QSystemTrayIcon *trayIcon; + QMenu *trayIconMenu; + QAction *menu_tombExplore; + QAction *menu_tombClose; + QAction *menu_tombSlam; + + private: + void tombBuildMenu(); + + QString tombPath; + QString tombName; + QFileInfo info; + QString tombMountPoint; + + private slots: + virtual void closeEvent(QCloseEvent *event); + + public slots: + void tombExplore(); + void tombClose(); + void tombSlam(); + void tombCheckCmdRet(int exitCode, QProcess::ExitStatus); + void tombStartError(QProcess::ProcessError err); +}; + +#endif // DIALOG_H From 492174d3c6bac5b01759e19263444858516d941f Mon Sep 17 00:00:00 2001 From: Gianluca Montecchi Date: Thu, 3 Sep 2015 21:36:12 +0200 Subject: [PATCH 2/3] Added copyright notice --- extras/qt-tray/main.cpp | 19 +++++++++++++++++++ extras/qt-tray/qt-tray.pro | 19 +++++++++++++++++++ extras/qt-tray/tomb.cpp | 19 +++++++++++++++++++ extras/qt-tray/tomb.h | 19 +++++++++++++++++++ 4 files changed, 76 insertions(+) diff --git a/extras/qt-tray/main.cpp b/extras/qt-tray/main.cpp index 70f6386..019d5b3 100644 --- a/extras/qt-tray/main.cpp +++ b/extras/qt-tray/main.cpp @@ -1,3 +1,22 @@ +/* Tomb - encrypted storage undertaker + * + * (c) Copyright 2015 Gianluca Montecchi + * + * This source code is free software; you can redistribute it and/or + * modify it under the terms of the GNU Public License as published + * by the Free Software Foundation; either version 3 of the License, + * or (at your option) any later version. + * + * This source code 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. + * Please refer to the GNU Public License for more details. + * + * You should have received a copy of the GNU Public License along with + * this source code; if not, write to: + * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + #include #include #include diff --git a/extras/qt-tray/qt-tray.pro b/extras/qt-tray/qt-tray.pro index 2060ae9..caeca12 100644 --- a/extras/qt-tray/qt-tray.pro +++ b/extras/qt-tray/qt-tray.pro @@ -1,3 +1,22 @@ +# Tomb - encrypted storage undertaker +# +# (c) Copyright 2015 Gianluca Montecchi +# +# This source code is free software; you can redistribute it and/or +# modify it under the terms of the GNU Public License as published +# by the Free Software Foundation; either version 3 of the License, +# or (at your option) any later version. +# +# This source code 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. +# Please refer to the GNU Public License for more details. +# +# You should have received a copy of the GNU Public License along with +# this source code; if not, write to: +# Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +#/ + #------------------------------------------------- # # Project created by QtCreator 2015-07-30T22:53:13 diff --git a/extras/qt-tray/tomb.cpp b/extras/qt-tray/tomb.cpp index 43dff85..3af337c 100644 --- a/extras/qt-tray/tomb.cpp +++ b/extras/qt-tray/tomb.cpp @@ -1,3 +1,22 @@ +/* Tomb - encrypted storage undertaker + * + * (c) Copyright 2015 Gianluca Montecchi + * + * This source code is free software; you can redistribute it and/or + * modify it under the terms of the GNU Public License as published + * by the Free Software Foundation; either version 3 of the License, + * or (at your option) any later version. + * + * This source code 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. + * Please refer to the GNU Public License for more details. + * + * You should have received a copy of the GNU Public License along with + * this source code; if not, write to: + * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + #include "tomb.h" #include diff --git a/extras/qt-tray/tomb.h b/extras/qt-tray/tomb.h index 9429b89..979ef16 100644 --- a/extras/qt-tray/tomb.h +++ b/extras/qt-tray/tomb.h @@ -1,3 +1,22 @@ +/* Tomb - encrypted storage undertaker + * + * (c) Copyright 2015 Gianluca Montecchi + * + * This source code is free software; you can redistribute it and/or + * modify it under the terms of the GNU Public License as published + * by the Free Software Foundation; either version 3 of the License, + * or (at your option) any later version. + * + * This source code 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. + * Please refer to the GNU Public License for more details. + * + * You should have received a copy of the GNU Public License along with + * this source code; if not, write to: + * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + #ifndef DIALOG_H #define DIALOG_H From 6d83bbb1bdf4b5eee9bf46578ac09157f6f87485 Mon Sep 17 00:00:00 2001 From: Gianluca Montecchi Date: Fri, 4 Sep 2015 19:56:43 +0200 Subject: [PATCH 3/3] Updated Italian translation --- extras/qt-tray/i18n/tomb-qt-tray_it.qm | Bin 1129 -> 1392 bytes extras/qt-tray/i18n/tomb-qt-tray_it.ts | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/qt-tray/i18n/tomb-qt-tray_it.qm b/extras/qt-tray/i18n/tomb-qt-tray_it.qm index c414c1ca0789ba27f649ffca5abe2dbf321093ff..e97a90c761b3db110f3f18451f28e5be42e0744a 100644 GIT binary patch delta 328 zcmY*Tu}T9$6r9|h=CDbjjbO0`ENoL~El7k^76HXVxXZ5VlH6|C+Y?eq8e2gNf51Nw z{~(>8U~8e+WLIGvE1g<6&#>6l>470M0Quc;ZB|+t)z)o_sAfIs5tH zUGH(f+sS0-E7$_b`M*g%Sb^79)7fFh$@d$u;C8u_set98n%U)>+#_ zSCvB9k)KV2lA^Iv`B03NZ&S^p+DeHoam4>63_nzK6Lg8526j#u>9C>;N`bp4<7p*u z#Q=`j5Nk|Uv*yh;)d?#^?Jv;InG$s!Ml)28IX*FSDsYnt@5tEq$V;5 Tomb encrypted undertaker - + Tomb encrypted undertaker We started digging out bones - + Abbiamo cominciato a tirare fuori gli scheletri