diff options
author | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2010-10-05 19:54:33 +0000 |
---|---|---|
committer | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2010-10-05 19:54:33 +0000 |
commit | a3871904220dcac97f2e84f121eab3e58ab30af0 (patch) | |
tree | 0e02aa97305fce6828b900a53180f8a1dab03d4a | |
parent | now checked keys in the mainwindow's keylist are also checked in the fileencr... (diff) | |
download | gpg4usb-a3871904220dcac97f2e84f121eab3e58ab30af0.tar.gz gpg4usb-a3871904220dcac97f2e84f121eab3e58ab30af0.zip |
check attachmentfolder for files all 5 sec
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@381 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | attachments.cpp | 1 | ||||
-rw-r--r-- | gpgwin.cpp | 42 | ||||
-rw-r--r-- | gpgwin.h | 1 |
3 files changed, 37 insertions, 7 deletions
diff --git a/attachments.cpp b/attachments.cpp index 7480429..6018608 100644 --- a/attachments.cpp +++ b/attachments.cpp @@ -135,6 +135,7 @@ void Attachments::saveByteArrayToFile(QByteArray outBuffer, QString filename) */ void Attachments::openFile() { + // TODO: make attachmentdir constant or configurable QString attachmentDir = qApp->applicationDirPath() + "/attachments/"; //QDir p = QDir(qApp->applicationDirPath() + "/attachments/"); if(!QDir(attachmentDir).exists()) { @@ -45,6 +45,11 @@ GpgWin::GpgWin() /* List of binary Attachments */ mAttachments = new Attachments(iconPath); + + /* test attachmentdir for files alll 15s */ + QTimer *timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(checkAttachmentFolder())); + timer->start(5000); createActions(); createMenus(); @@ -327,18 +332,18 @@ void GpgWin::createStatusBar() QWidget *statusBarBox = new QWidget(); QHBoxLayout *statusBarBoxLayout = new QHBoxLayout(); - statusBar()->showMessage(tr("Ready"),2000); QPixmap *pixmap; - pixmap = new QPixmap(iconPath + "statusbar_icon.png"); + // icon which should be shown if there are files in attachments-folder + pixmap = new QPixmap(iconPath + "statusbar_icon.png"); statusBarIcon = new QLabel(statusBar()); statusBarIcon->setPixmap(*pixmap); + statusBar()->insertPermanentWidget(0,statusBarIcon,0); + statusBarIcon->hide(); + + statusBar()->showMessage(tr("Ready"),2000); statusBarBox->setLayout(statusBarBoxLayout); - - statusBarIcon->setStatusTip(tr("Files have been saved to attachment subdirectory")); - statusBar()->insertPermanentWidget(0,statusBarIcon,0); - statusBarIcon->hide(); } void GpgWin::createDockWindows() @@ -609,10 +614,33 @@ void GpgWin::parseMime(QByteArray *message) *message = pText.toUtf8(); if (showmadock) { aDock->show(); - statusBarIcon->show(); } } +void GpgWin::checkAttachmentFolder() { + // TODO: always check? + if(!settings.value("mime/parseMime").toBool()) { + return; + } + + QString attachmentDir = qApp->applicationDirPath() + "/attachments/"; + // filenum minus . and .. + uint filenum = QDir(attachmentDir).count() - 2 ; + if(filenum > 0) { + QString statusText; + if(filenum == 1) { + statusText = tr("There is one unencrypted file in attachment folder"); + } else { + statusText = tr("There are ") + QString::number(filenum) + tr(" unencrypted files in attachment folder"); + } + statusBarIcon->setStatusTip(statusText); + statusBarIcon->show(); + } else { + statusBarIcon->hide(); + } + +} + /** * if there is no '\n' before the PGP-Begin-Block, but for example a whitespace, * GPGME doesn't recognise the Message as encrypted. This function adds '\n' @@ -80,6 +80,7 @@ public slots: void fileEncryption(); void openSettingsDialog(); void openTutorial(); + void checkAttachmentFolder(); // void dropEvent(QDropEvent *event); private: |