aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--include/MainWindow.h48
-rw-r--r--include/ui/widgets/FilePage.h30
-rw-r--r--include/ui/widgets/TextEdit.h9
-rw-r--r--resource/ts/gpg_frontend_fr.ts153
-rw-r--r--resource/ts/gpg_frontend_ru.ts153
-rw-r--r--resource/ts/gpgfrontend_en_us.ts153
-rw-r--r--resource/ts/gpgfrontend_zh_chs.ts153
-rw-r--r--resource/ts/gpgfrontend_zh_cht.ts153
-rw-r--r--src/MainWindow.cpp4
-rw-r--r--src/ui/main_window/MainWindowSlotFunction.cpp17
-rw-r--r--src/ui/main_window/MainWindowSlotUI.cpp4
-rw-r--r--src/ui/main_window/MainWindowUI.cpp4
-rw-r--r--src/ui/widgets/EditorPage.cpp12
-rw-r--r--src/ui/widgets/FilePage.cpp122
-rw-r--r--src/ui/widgets/TextEdit.cpp123
16 files changed, 899 insertions, 241 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 75029131..811c4710 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16)
-project(GpgFrontend VERSION 1.0.6 LANGUAGES CXX)
+project(GpgFrontend VERSION 1.1.0 LANGUAGES CXX)
message(STATUS "GPGFrontend Build Configuration Started CMAKE Version ${CMAKE_VERSION}")
diff --git a/include/MainWindow.h b/include/MainWindow.h
index efe56919..af6b1560 100644
--- a/include/MainWindow.h
+++ b/include/MainWindow.h
@@ -69,6 +69,34 @@ protected:
*/
void closeEvent(QCloseEvent *event) override;
+public slots:
+
+ /**
+ * @details Open a new tab for path
+ */
+ void slotOpenFile(QString &path);
+
+ /**
+ * @details Open dialog for encrypting file.
+ */
+ void slotFileEncrypt();
+
+ /**
+ * @details Open dialog for decrypting file.
+ */
+ void slotFileDecrypt();
+
+ /**
+ * @details Open dialog for signing file.
+ */
+ void slotFileSign();
+
+ /**
+ * @details Open dialog for verifying file.
+ */
+ void slotFileVerify();
+
+
private slots:
/**
@@ -158,26 +186,6 @@ private slots:
void slotAbout();
/**
- * @details Open dialog for encrypting file.
- */
- void slotFileEncrypt();
-
- /**
- * @details Open dialog for decrypting file.
- */
- void slotFileDecrypt();
-
- /**
- * @details Open dialog for signing file.
- */
- void slotFileSign();
-
- /**
- * @details Open dialog for verifying file.
- */
- void slotFileVerify();
-
- /**
* @details Open File Opera Tab
*/
void slotOpenFileTab();
diff --git a/include/ui/widgets/FilePage.h b/include/ui/widgets/FilePage.h
index c343571d..d7ce51d7 100644
--- a/include/ui/widgets/FilePage.h
+++ b/include/ui/widgets/FilePage.h
@@ -25,7 +25,7 @@
#ifndef GPGFRONTEND_FILEPAGE_H
#define GPGFRONTEND_FILEPAGE_H
-#include <GpgFrontend.h>
+#include "GpgFrontend.h"
class FilePage : public QWidget {
Q_OBJECT
@@ -33,7 +33,13 @@ public:
explicit FilePage(QWidget* parent = nullptr);
- QString getSelected() const;
+ [[nodiscard]] QString getSelected() const;
+
+ void createPopupMenu();
+
+signals:
+
+ void pathChanged(QString path);
private slots:
@@ -44,7 +50,18 @@ private slots:
void slotUpLevel();
void slotGoPath();
+ void slotOpenItem();
+ void slotDeleteItem();
+ void slotEncryptItem();
+ void slotDecryptItem();
+ void slotSignItem();
+ void slotVerifyItem();
+
+ void onCustomContextMenu(const QPoint &point);
+
+
private:
+
QFileSystemModel *dirModel;
QTreeView *dirTreeView;
QLineEdit *pathEdit;
@@ -53,6 +70,15 @@ private:
QPushButton *upLevelButton;
QPushButton *goPathButton;
+ QMenu *popUpMenu{};
+ QAction *encryptItemAct{};
+ QAction *decryptItemAct{};
+ QAction *signItemAct{};
+ QAction *verifyItemAct{};
+
+ QWidget *firstParent;
+
+
};
diff --git a/include/ui/widgets/TextEdit.h b/include/ui/widgets/TextEdit.h
index 99b8bcc7..8e1df675 100644
--- a/include/ui/widgets/TextEdit.h
+++ b/include/ui/widgets/TextEdit.h
@@ -40,7 +40,7 @@ public:
/**
* @brief
*/
- TextEdit();
+ TextEdit(QWidget *parent);
/**
* @details Load the content of file into the current textpage
@@ -136,6 +136,11 @@ public slots:
void slotNewTab();
/**
+ * @details Adds a new tab with opening file by path
+ */
+ void slotOpenFile(QString &path);
+
+ /**
* @details Adds a new tab with the given title and opens given html file.
* Increase Tab-Count by one
* @param title title for the tab
@@ -195,6 +200,8 @@ private:
private slots:
+ void slotFilePagePathChanged(const QString& path);
+
/**
* @details Remove the tab with given index
*
diff --git a/resource/ts/gpg_frontend_fr.ts b/resource/ts/gpg_frontend_fr.ts
index 78ca3d4f..33f8b53d 100644
--- a/resource/ts/gpg_frontend_fr.ts
+++ b/resource/ts/gpg_frontend_fr.ts
@@ -284,6 +284,59 @@
</message>
</context>
<context>
+ <name>FilePage</name>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="126"/>
+ <source>Open</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="128"/>
+ <source>Delete</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="130"/>
+ <source>Encrypt File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="132"/>
+ <source>Decrypt File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="134"/>
+ <source>Sign File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="136"/>
+ <source>Verify File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="188"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="189"/>
+ <source>Are you sure you want to delete it?</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="199"/>
+ <source>Error</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="200"/>
+ <source>Unable to delete the file or folder.</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>FindWidget</name>
<message>
<location filename="../../src/ui/FindWidget.cpp" line="38"/>
@@ -1875,38 +1928,74 @@ This is NOT your Public Key, so DON&apos;T give it away.&lt;br /&gt;Do you REALL
<context>
<name>MainWindow</name>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="36"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="83"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="281"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="37"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="87"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="280"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="331"/>
<source>No Key Selected</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="43"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="90"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="288"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="44"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="94"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="287"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="338"/>
<source>Invalid Operation</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="44"/>
- <source>The selected key contains a key that does not actually have a encrypt function.&lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="45"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="288"/>
+ <source>The selected key contains a key that does not actually have a encrypt usage.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="45"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="92"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="290"/>
- <source>&lt;br/&gt;For example the Following Key: &lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="95"/>
+ <source>The selected key contains a key that does not actually have a signature usage.&lt;br/&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="258"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="262"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="296"/>
+ <source>Error</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="262"/>
+ <source>No permission to read this file.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="267"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="268"/>
+ <source>The target file already exists, do you need to overwrite it?</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="91"/>
- <source>The selected key contains a key that does not actually have a signature function.&lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="296"/>
+ <source>An error occurred during operation.</source>
<translation type="unfinished"></translation>
</message>
<message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="46"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="96"/>
<location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="289"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="340"/>
+ <source>&lt;br/&gt;For example the Following Key: &lt;br/&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="258"/>
+ <source>Select a file before doing it.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="339"/>
<source>The selected key cannot be used for signing and encryption at the same time.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
@@ -2722,51 +2811,57 @@ This is NOT your Public Key, so DON&apos;T give it away.&lt;br /&gt;Do you REALL
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="76"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="100"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="132"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="107"/>
<source>Open file</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="101"/>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="379"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="204"/>
+ <source>Save file</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="416"/>
<source>Application</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="102"/>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="380"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="101"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="133"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="417"/>
<source>Cannot read file %1:
%2.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="151"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="182"/>
<source>File</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="152"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="183"/>
<source>Cannot write file %1:
%2.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="173"/>
- <source>Save file </source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="237"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="268"/>
<source>Unsaved document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="238"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="269"/>
<source>&lt;h3&gt;The document &quot;%1&quot; has been modified.&lt;br/&gt;Do you want to save your changes?&lt;/h3&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="240"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="271"/>
<source>&lt;b&gt;Note:&lt;/b&gt; If you don&apos;t save these files, all changes are lost.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
diff --git a/resource/ts/gpg_frontend_ru.ts b/resource/ts/gpg_frontend_ru.ts
index 370d406c..392479ea 100644
--- a/resource/ts/gpg_frontend_ru.ts
+++ b/resource/ts/gpg_frontend_ru.ts
@@ -284,6 +284,59 @@
</message>
</context>
<context>
+ <name>FilePage</name>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="126"/>
+ <source>Open</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="128"/>
+ <source>Delete</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="130"/>
+ <source>Encrypt File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="132"/>
+ <source>Decrypt File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="134"/>
+ <source>Sign File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="136"/>
+ <source>Verify File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="188"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="189"/>
+ <source>Are you sure you want to delete it?</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="199"/>
+ <source>Error</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="200"/>
+ <source>Unable to delete the file or folder.</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>FindWidget</name>
<message>
<location filename="../../src/ui/FindWidget.cpp" line="38"/>
@@ -1875,38 +1928,74 @@ This is NOT your Public Key, so DON&apos;T give it away.&lt;br /&gt;Do you REALL
<context>
<name>MainWindow</name>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="36"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="83"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="281"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="37"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="87"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="280"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="331"/>
<source>No Key Selected</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="43"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="90"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="288"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="44"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="94"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="287"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="338"/>
<source>Invalid Operation</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="44"/>
- <source>The selected key contains a key that does not actually have a encrypt function.&lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="45"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="288"/>
+ <source>The selected key contains a key that does not actually have a encrypt usage.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="45"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="92"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="290"/>
- <source>&lt;br/&gt;For example the Following Key: &lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="95"/>
+ <source>The selected key contains a key that does not actually have a signature usage.&lt;br/&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="258"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="262"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="296"/>
+ <source>Error</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="262"/>
+ <source>No permission to read this file.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="267"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="268"/>
+ <source>The target file already exists, do you need to overwrite it?</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="91"/>
- <source>The selected key contains a key that does not actually have a signature function.&lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="296"/>
+ <source>An error occurred during operation.</source>
<translation type="unfinished"></translation>
</message>
<message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="46"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="96"/>
<location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="289"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="340"/>
+ <source>&lt;br/&gt;For example the Following Key: &lt;br/&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="258"/>
+ <source>Select a file before doing it.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="339"/>
<source>The selected key cannot be used for signing and encryption at the same time.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
@@ -2722,51 +2811,57 @@ This is NOT your Public Key, so DON&apos;T give it away.&lt;br /&gt;Do you REALL
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="76"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="100"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="132"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="107"/>
<source>Open file</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="101"/>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="379"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="204"/>
+ <source>Save file</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="416"/>
<source>Application</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="102"/>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="380"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="101"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="133"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="417"/>
<source>Cannot read file %1:
%2.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="151"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="182"/>
<source>File</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="152"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="183"/>
<source>Cannot write file %1:
%2.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="173"/>
- <source>Save file </source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="237"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="268"/>
<source>Unsaved document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="238"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="269"/>
<source>&lt;h3&gt;The document &quot;%1&quot; has been modified.&lt;br/&gt;Do you want to save your changes?&lt;/h3&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="240"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="271"/>
<source>&lt;b&gt;Note:&lt;/b&gt; If you don&apos;t save these files, all changes are lost.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
diff --git a/resource/ts/gpgfrontend_en_us.ts b/resource/ts/gpgfrontend_en_us.ts
index 09ec9879..58c7e8ff 100644
--- a/resource/ts/gpgfrontend_en_us.ts
+++ b/resource/ts/gpgfrontend_en_us.ts
@@ -284,6 +284,59 @@
</message>
</context>
<context>
+ <name>FilePage</name>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="126"/>
+ <source>Open</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="128"/>
+ <source>Delete</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="130"/>
+ <source>Encrypt File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="132"/>
+ <source>Decrypt File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="134"/>
+ <source>Sign File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="136"/>
+ <source>Verify File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="188"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="189"/>
+ <source>Are you sure you want to delete it?</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="199"/>
+ <source>Error</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="200"/>
+ <source>Unable to delete the file or folder.</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>FindWidget</name>
<message>
<location filename="../../src/ui/FindWidget.cpp" line="38"/>
@@ -1875,38 +1928,74 @@ This is NOT your Public Key, so DON&apos;T give it away.&lt;br /&gt;Do you REALL
<context>
<name>MainWindow</name>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="36"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="83"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="281"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="37"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="87"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="280"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="331"/>
<source>No Key Selected</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="43"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="90"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="288"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="44"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="94"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="287"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="338"/>
<source>Invalid Operation</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="44"/>
- <source>The selected key contains a key that does not actually have a encrypt function.&lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="45"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="288"/>
+ <source>The selected key contains a key that does not actually have a encrypt usage.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="45"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="92"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="290"/>
- <source>&lt;br/&gt;For example the Following Key: &lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="95"/>
+ <source>The selected key contains a key that does not actually have a signature usage.&lt;br/&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="258"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="262"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="296"/>
+ <source>Error</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="262"/>
+ <source>No permission to read this file.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="267"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="268"/>
+ <source>The target file already exists, do you need to overwrite it?</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="91"/>
- <source>The selected key contains a key that does not actually have a signature function.&lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="296"/>
+ <source>An error occurred during operation.</source>
<translation type="unfinished"></translation>
</message>
<message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="46"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="96"/>
<location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="289"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="340"/>
+ <source>&lt;br/&gt;For example the Following Key: &lt;br/&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="258"/>
+ <source>Select a file before doing it.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="339"/>
<source>The selected key cannot be used for signing and encryption at the same time.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
@@ -2722,51 +2811,57 @@ This is NOT your Public Key, so DON&apos;T give it away.&lt;br /&gt;Do you REALL
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="76"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="100"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="132"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="107"/>
<source>Open file</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="101"/>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="379"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="204"/>
+ <source>Save file</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="416"/>
<source>Application</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="102"/>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="380"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="101"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="133"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="417"/>
<source>Cannot read file %1:
%2.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="151"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="182"/>
<source>File</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="152"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="183"/>
<source>Cannot write file %1:
%2.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="173"/>
- <source>Save file </source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="237"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="268"/>
<source>Unsaved document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="238"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="269"/>
<source>&lt;h3&gt;The document &quot;%1&quot; has been modified.&lt;br/&gt;Do you want to save your changes?&lt;/h3&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="240"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="271"/>
<source>&lt;b&gt;Note:&lt;/b&gt; If you don&apos;t save these files, all changes are lost.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
diff --git a/resource/ts/gpgfrontend_zh_chs.ts b/resource/ts/gpgfrontend_zh_chs.ts
index c6722829..9464f39c 100644
--- a/resource/ts/gpgfrontend_zh_chs.ts
+++ b/resource/ts/gpgfrontend_zh_chs.ts
@@ -284,6 +284,59 @@
</message>
</context>
<context>
+ <name>FilePage</name>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="126"/>
+ <source>Open</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="128"/>
+ <source>Delete</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="130"/>
+ <source>Encrypt File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="132"/>
+ <source>Decrypt File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="134"/>
+ <source>Sign File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="136"/>
+ <source>Verify File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="188"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="189"/>
+ <source>Are you sure you want to delete it?</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="199"/>
+ <source>Error</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="200"/>
+ <source>Unable to delete the file or folder.</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>FindWidget</name>
<message>
<location filename="../../src/ui/FindWidget.cpp" line="38"/>
@@ -1875,38 +1928,74 @@ This is NOT your Public Key, so DON&apos;T give it away.&lt;br /&gt;Do you REALL
<context>
<name>MainWindow</name>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="36"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="83"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="281"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="37"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="87"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="280"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="331"/>
<source>No Key Selected</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="43"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="90"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="288"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="44"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="94"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="287"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="338"/>
<source>Invalid Operation</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="44"/>
- <source>The selected key contains a key that does not actually have a encrypt function.&lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="45"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="288"/>
+ <source>The selected key contains a key that does not actually have a encrypt usage.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="45"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="92"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="290"/>
- <source>&lt;br/&gt;For example the Following Key: &lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="95"/>
+ <source>The selected key contains a key that does not actually have a signature usage.&lt;br/&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="258"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="262"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="296"/>
+ <source>Error</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="262"/>
+ <source>No permission to read this file.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="267"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="268"/>
+ <source>The target file already exists, do you need to overwrite it?</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="91"/>
- <source>The selected key contains a key that does not actually have a signature function.&lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="296"/>
+ <source>An error occurred during operation.</source>
<translation type="unfinished"></translation>
</message>
<message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="46"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="96"/>
<location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="289"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="340"/>
+ <source>&lt;br/&gt;For example the Following Key: &lt;br/&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="258"/>
+ <source>Select a file before doing it.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="339"/>
<source>The selected key cannot be used for signing and encryption at the same time.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
@@ -2722,51 +2811,57 @@ This is NOT your Public Key, so DON&apos;T give it away.&lt;br /&gt;Do you REALL
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="76"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="100"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="132"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="107"/>
<source>Open file</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="101"/>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="379"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="204"/>
+ <source>Save file</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="416"/>
<source>Application</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="102"/>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="380"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="101"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="133"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="417"/>
<source>Cannot read file %1:
%2.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="151"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="182"/>
<source>File</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="152"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="183"/>
<source>Cannot write file %1:
%2.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="173"/>
- <source>Save file </source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="237"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="268"/>
<source>Unsaved document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="238"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="269"/>
<source>&lt;h3&gt;The document &quot;%1&quot; has been modified.&lt;br/&gt;Do you want to save your changes?&lt;/h3&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="240"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="271"/>
<source>&lt;b&gt;Note:&lt;/b&gt; If you don&apos;t save these files, all changes are lost.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
diff --git a/resource/ts/gpgfrontend_zh_cht.ts b/resource/ts/gpgfrontend_zh_cht.ts
index c6722829..9464f39c 100644
--- a/resource/ts/gpgfrontend_zh_cht.ts
+++ b/resource/ts/gpgfrontend_zh_cht.ts
@@ -284,6 +284,59 @@
</message>
</context>
<context>
+ <name>FilePage</name>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="126"/>
+ <source>Open</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="128"/>
+ <source>Delete</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="130"/>
+ <source>Encrypt File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="132"/>
+ <source>Decrypt File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="134"/>
+ <source>Sign File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="136"/>
+ <source>Verify File</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="188"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="189"/>
+ <source>Are you sure you want to delete it?</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="199"/>
+ <source>Error</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/FilePage.cpp" line="200"/>
+ <source>Unable to delete the file or folder.</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
<name>FindWidget</name>
<message>
<location filename="../../src/ui/FindWidget.cpp" line="38"/>
@@ -1875,38 +1928,74 @@ This is NOT your Public Key, so DON&apos;T give it away.&lt;br /&gt;Do you REALL
<context>
<name>MainWindow</name>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="36"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="83"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="281"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="37"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="87"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="280"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="331"/>
<source>No Key Selected</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="43"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="90"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="288"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="44"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="94"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="287"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="338"/>
<source>Invalid Operation</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="44"/>
- <source>The selected key contains a key that does not actually have a encrypt function.&lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="45"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="288"/>
+ <source>The selected key contains a key that does not actually have a encrypt usage.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="45"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="92"/>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="290"/>
- <source>&lt;br/&gt;For example the Following Key: &lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="95"/>
+ <source>The selected key contains a key that does not actually have a signature usage.&lt;br/&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="258"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="262"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="296"/>
+ <source>Error</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="262"/>
+ <source>No permission to read this file.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="267"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="268"/>
+ <source>The target file already exists, do you need to overwrite it?</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="91"/>
- <source>The selected key contains a key that does not actually have a signature function.&lt;br/&gt;</source>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="296"/>
+ <source>An error occurred during operation.</source>
<translation type="unfinished"></translation>
</message>
<message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="46"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="96"/>
<location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="289"/>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="340"/>
+ <source>&lt;br/&gt;For example the Following Key: &lt;br/&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="258"/>
+ <source>Select a file before doing it.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/main_window/MainWindowSlotFunction.cpp" line="339"/>
<source>The selected key cannot be used for signing and encryption at the same time.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
@@ -2722,51 +2811,57 @@ This is NOT your Public Key, so DON&apos;T give it away.&lt;br /&gt;Do you REALL
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="76"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="100"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="132"/>
+ <source>Warning</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="107"/>
<source>Open file</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="101"/>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="379"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="204"/>
+ <source>Save file</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="416"/>
<source>Application</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="102"/>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="380"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="101"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="133"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="417"/>
<source>Cannot read file %1:
%2.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="151"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="182"/>
<source>File</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="152"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="183"/>
<source>Cannot write file %1:
%2.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="173"/>
- <source>Save file </source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="237"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="268"/>
<source>Unsaved document</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="238"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="269"/>
<source>&lt;h3&gt;The document &quot;%1&quot; has been modified.&lt;br/&gt;Do you want to save your changes?&lt;/h3&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../../src/ui/widgets/TextEdit.cpp" line="240"/>
+ <location filename="../../src/ui/widgets/TextEdit.cpp" line="271"/>
<source>&lt;b&gt;Note:&lt;/b&gt; If you don&apos;t save these files, all changes are lost.&lt;br/&gt;</source>
<translation type="unfinished"></translation>
</message>
diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
index 67274a65..0d8521e7 100644
--- a/src/MainWindow.cpp
+++ b/src/MainWindow.cpp
@@ -34,7 +34,9 @@ MainWindow::MainWindow()
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
- edit = new TextEdit();
+ qDebug() << "Main Window" << this;
+
+ edit = new TextEdit(this);
setCentralWidget(edit);
/* the list of Keys available*/
diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp
index dcfac10b..023b3d73 100644
--- a/src/ui/main_window/MainWindowSlotFunction.cpp
+++ b/src/ui/main_window/MainWindowSlotFunction.cpp
@@ -84,13 +84,13 @@ void MainWindow::slotSign() {
mKeyList->getPrivateCheckedKeys(keys);
if (keys.isEmpty()) {
- QMessageBox::critical(nullptr, tr("No Key Selected"), tr("No Key Selected"));
+ QMessageBox::critical(this, tr("No Key Selected"), tr("No Key Selected"));
return;
}
for (const auto &key : keys) {
if (!GpgME::GpgContext::checkIfKeyCanSign(key)) {
- QMessageBox::information(nullptr,
+ QMessageBox::information(this,
tr("Invalid Operation"),
tr("The selected key contains a key that does not actually have a signature usage.<br/>")
+ tr("<br/>For example the Following Key: <br/>") + key.uids.first().uid);
@@ -255,7 +255,7 @@ void MainWindow::slotFileEncrypt() {
QFileInfo fileInfo(path);
if(!fileInfo.isFile()) {
- QMessageBox::critical(this, tr("Error"), tr("Can only encrypt a file."));
+ QMessageBox::critical(this, tr("Error"), tr("Select a file before doing it."));
return;
}
if(!fileInfo.isReadable()) {
@@ -276,9 +276,14 @@ void MainWindow::slotFileEncrypt() {
mKeyList->getCheckedKeys(keys);
+ if(keys.empty()) {
+ QMessageBox::critical(this, tr("No Key Selected"), tr("No Key Selected"));
+ return;
+ }
+
for (const auto &key : keys) {
if (!GpgME::GpgContext::checkIfKeyCanEncr(key)) {
- QMessageBox::information(nullptr,
+ QMessageBox::information(this,
tr("Invalid Operation"),
tr("The selected key contains a key that does not actually have a encrypt usage.<br/>")
+ tr("<br/>For example the Following Key: <br/>") + key.uids.first().uid);
@@ -403,3 +408,7 @@ void MainWindow::slotDecryptVerify() {
delete resultAnalyseDecrypt;
delete resultAnalyseVerify;
}
+
+void MainWindow::slotOpenFile(QString &path) {
+ edit->slotOpenFile(path);
+}
diff --git a/src/ui/main_window/MainWindowSlotUI.cpp b/src/ui/main_window/MainWindowSlotUI.cpp
index cad8669a..219d09b6 100644
--- a/src/ui/main_window/MainWindowSlotUI.cpp
+++ b/src/ui/main_window/MainWindowSlotUI.cpp
@@ -63,10 +63,8 @@ void MainWindow::slotCheckAttachmentFolder() {
}
void MainWindow::slotImportKeyFromEdit() {
- if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == 0) {
+ if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr)
return;
- }
-
keyMgmt->slotImportKeys(edit->curTextPage()->toPlainText().toUtf8());
}
diff --git a/src/ui/main_window/MainWindowUI.cpp b/src/ui/main_window/MainWindowUI.cpp
index 5afdc263..fba2fe62 100644
--- a/src/ui/main_window/MainWindowUI.cpp
+++ b/src/ui/main_window/MainWindowUI.cpp
@@ -386,8 +386,8 @@ void MainWindow::createToolBars() {
// Add dropdown menu for file encryption/decryption to crypttoolbar
fileEncButton = new QToolButton();
- fileEncButton->setMenu(fileEncMenu);
- // connect(fileEncButton, SIGNAL(clicked(bool)), this, SLOT(slotOpenFileTab()));
+ // fileEncButton->setMenu(fileEncMenu);
+ connect(fileEncButton, SIGNAL(clicked(bool)), this, SLOT(slotOpenFileTab()));
fileEncButton->setPopupMode(QToolButton::InstantPopup);
fileEncButton->setIcon(QIcon(":fileencryption.png"));
fileEncButton->setToolTip(tr("Opera File"));
diff --git a/src/ui/widgets/EditorPage.cpp b/src/ui/widgets/EditorPage.cpp
index cb4ca5ef..8a51b721 100644
--- a/src/ui/widgets/EditorPage.cpp
+++ b/src/ui/widgets/EditorPage.cpp
@@ -27,7 +27,7 @@
#include <utility>
EditorPage::EditorPage(QString filePath, QWidget *parent) : QWidget(parent),
- fullFilePath(std::move(filePath)) {
+ fullFilePath(std::move(filePath)) {
// Set the Textedit properties
textPage = new QTextEdit();
textPage->setAcceptRichText(false);
@@ -42,7 +42,7 @@ EditorPage::EditorPage(QString filePath, QWidget *parent) : QWidget(parent),
setAttribute(Qt::WA_DeleteOnClose);
textPage->setFocus();
- //connect(textPage, SIGNAL(textChanged()), this, SLOT(formatGpgHeader()));
+ connect(textPage, SIGNAL(textChanged()), this, SLOT(formatGpgHeader()));
}
const QString &EditorPage::getFilePath() const {
@@ -64,11 +64,11 @@ void EditorPage::showNotificationWidget(QWidget *widget, const char *className)
void EditorPage::closeNoteByClass(const char *className) {
QList<QWidget *> widgets = findChildren<QWidget *>();
- foreach(QWidget *widget, widgets) {
- if (widget->property(className) == true) {
- widget->close();
- }
+ for (QWidget *widget: widgets) {
+ if (widget->property(className) == true) {
+ widget->close();
}
+ }
}
void EditorPage::slotFormatGpgHeader() {
diff --git a/src/ui/widgets/FilePage.cpp b/src/ui/widgets/FilePage.cpp
index d1e04879..e4226bcf 100644
--- a/src/ui/widgets/FilePage.cpp
+++ b/src/ui/widgets/FilePage.cpp
@@ -24,7 +24,13 @@
#include "ui/widgets/FilePage.h"
+#include "MainWindow.h"
+
FilePage::FilePage(QWidget *parent) : QWidget(parent) {
+
+ qDebug() << "First Parent" << parent;
+ firstParent = parent;
+
qDebug() << "New File Page";
dirModel = new QFileSystemModel();
@@ -35,6 +41,10 @@ FilePage::FilePage(QWidget *parent) : QWidget(parent) {
dirTreeView->setAnimated(true);
dirTreeView->setIndentation(20);
dirTreeView->setRootIndex(dirModel->index(QDir::currentPath()));
+ dirTreeView->setContextMenuPolicy(Qt::CustomContextMenu);
+ mPath = dirModel->rootPath();
+
+ createPopupMenu();
upLevelButton = new QPushButton("UP Level");
connect(upLevelButton, SIGNAL(clicked(bool)), this, SLOT(slotUpLevel()));
@@ -43,7 +53,7 @@ FilePage::FilePage(QWidget *parent) : QWidget(parent) {
connect(goPathButton, SIGNAL(clicked(bool)), this, SLOT(slotGoPath()));
pathEdit = new QLineEdit();
- pathEdit->setFixedWidth(520);
+ pathEdit->setFixedWidth(500);
pathEdit->setText(dirModel->rootPath());
auto *menuLayout = new QHBoxLayout();
@@ -60,6 +70,9 @@ FilePage::FilePage(QWidget *parent) : QWidget(parent) {
connect(dirTreeView, SIGNAL(clicked(const QModelIndex &)), this, SLOT(fileTreeViewItemClicked(const QModelIndex &)));
connect(dirTreeView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(fileTreeViewItemDoubleClicked(const QModelIndex &)));
+ connect(dirTreeView, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onCustomContextMenu(const QPoint &)));
+
+ emit pathChanged(mPath);
}
@@ -77,6 +90,7 @@ void FilePage::slotUpLevel() {
pathEdit->setText(mPath);
}
qDebug() << "Current Root mPath" << mPath;
+ emit pathChanged(mPath);
}
void FilePage::fileTreeViewItemDoubleClicked(const QModelIndex &index) {
@@ -87,13 +101,11 @@ void FilePage::fileTreeViewItemDoubleClicked(const QModelIndex &index) {
pathEdit->setText(mPath);
}
qDebug() << "Index mPath" << mPath;
+ emit pathChanged(mPath);
}
QString FilePage::getSelected() const {
- QModelIndex index = dirTreeView->currentIndex();
- QVariant data = dirTreeView->model()->data(index);
- qDebug() << "Target Path" << mPath;
- return data.toString();
+ return mPath;
}
void FilePage::slotGoPath() {
@@ -105,4 +117,104 @@ void FilePage::slotGoPath() {
} else {
QMessageBox::critical(this, "Error", "The path is unprivileged or unreachable.");
}
+ emit pathChanged(mPath);
+}
+
+void FilePage::createPopupMenu() {
+ popUpMenu = new QMenu();
+
+ auto openItemAct = new QAction(tr("Open"), this);
+ connect(openItemAct, SIGNAL(triggered()), this, SLOT(slotOpenItem()));
+ auto deleteItemAct = new QAction(tr("Delete"), this);
+ connect(deleteItemAct, SIGNAL(triggered()), this, SLOT(slotDeleteItem()));
+ encryptItemAct = new QAction(tr("Encrypt File"), this);
+ connect(encryptItemAct, SIGNAL(triggered()), this, SLOT(slotEncryptItem()));
+ decryptItemAct = new QAction(tr("Decrypt File"), this);
+ connect(decryptItemAct, SIGNAL(triggered()), this, SLOT(slotDecryptItem()));
+ signItemAct = new QAction(tr("Sign File"), this);
+ connect(signItemAct, SIGNAL(triggered()), this, SLOT(slotSignItem()));
+ verifyItemAct = new QAction(tr("Verify File"), this);
+ connect(verifyItemAct, SIGNAL(triggered()), this, SLOT(slotVerifyItem()));
+
+ popUpMenu->addAction(openItemAct);
+ popUpMenu->addAction(deleteItemAct);
+ popUpMenu->addSeparator();
+ popUpMenu->addAction(encryptItemAct);
+ popUpMenu->addAction(decryptItemAct);
+ popUpMenu->addAction(signItemAct);
+ popUpMenu->addAction(verifyItemAct);
+
+}
+
+void FilePage::onCustomContextMenu(const QPoint &point) {
+ QModelIndex index = dirTreeView->indexAt(point);
+ mPath = dirModel->fileInfo(index).absoluteFilePath();
+ qDebug() << "Right Click" << mPath;
+ if (index.isValid()) {
+ QFileInfo info(mPath);
+ encryptItemAct->setEnabled(info.isFile());
+ decryptItemAct->setEnabled(info.isFile());
+ signItemAct->setEnabled(info.isFile());
+ verifyItemAct->setEnabled(info.isFile());
+
+ popUpMenu->exec(dirTreeView->viewport()->mapToGlobal(point));
+ }
+}
+
+void FilePage::slotOpenItem() {
+ QFileInfo info(mPath);
+ if(info.isDir()) {
+ qDebug() << "getSelected" << pathEdit->text();
+ if(info.isReadable() && info.isExecutable()) {
+ qDebug() << "Set Path" << info.filePath();
+ dirTreeView->setRootIndex(dirModel->index(info.filePath()));
+ } else {
+ QMessageBox::critical(this, "Error", "The path is unprivileged or unreachable.");
+ }
+ } else {
+ auto mainWindow = qobject_cast<MainWindow *>(firstParent);
+ qDebug() << "Open Item" << mPath;
+ if (mainWindow != nullptr)
+ mainWindow->slotOpenFile(mPath);
+ }
+ emit pathChanged(mPath);
+}
+
+void FilePage::slotDeleteItem() {
+ QModelIndex index = dirTreeView->currentIndex();
+ QVariant data = dirTreeView->model()->data(index);
+
+ auto ret = QMessageBox::warning(this,
+ tr("Warning"),
+ tr("Are you sure you want to delete it?"),
+ QMessageBox::Ok | QMessageBox::Cancel);
+
+ if(ret == QMessageBox::Cancel)
+ return;
+
+ qDebug() << "Delete Item" << data.toString();
+
+ if(!dirModel->remove(index)){
+ QMessageBox::critical(this,
+ tr("Error"),
+ tr("Unable to delete the file or folder."));
+ }
+}
+
+void FilePage::slotEncryptItem() {
+ auto mainWindow = qobject_cast<MainWindow *>(firstParent);
+ if(mainWindow != nullptr)
+ mainWindow->slotFileEncrypt();
+}
+
+void FilePage::slotDecryptItem() {
+
+}
+
+void FilePage::slotSignItem() {
+
+}
+
+void FilePage::slotVerifyItem() {
+
}
diff --git a/src/ui/widgets/TextEdit.cpp b/src/ui/widgets/TextEdit.cpp
index 00abe16f..2394b694 100644
--- a/src/ui/widgets/TextEdit.cpp
+++ b/src/ui/widgets/TextEdit.cpp
@@ -24,7 +24,7 @@
#include "ui/widgets/TextEdit.h"
-TextEdit::TextEdit() {
+TextEdit::TextEdit(QWidget *parent) : QWidget(parent) {
countPage = 0;
tabWidget = new QTabWidget(this);
tabWidget->setMovable(true);
@@ -66,45 +66,75 @@ void TextEdit::slotNewHelpTab(const QString &title, const QString &path) const {
void TextEdit::slotNewFileTab() const {
- auto *page = new FilePage();
+ auto *page = new FilePage(qobject_cast<QWidget *>(parent()));
tabWidget->addTab(page, "File");
tabWidget->setCurrentIndex(tabWidget->count() - 1);
+ connect(page, SIGNAL(pathChanged(QString)), this, SLOT(slotFilePagePathChanged(QString)));
}
+void TextEdit::slotOpenFile(QString &path) {
+
+ QFile file(path);
+
+ if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ auto *page = new EditorPage(path);
+
+ QTextStream in(&file);
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ page->getTextPage()->setPlainText(in.readAll());
+ page->setFilePath(path);
+ QTextDocument *document = page->getTextPage()->document();
+ document->setModified(false);
+
+ tabWidget->addTab(page, strippedName(path));
+ tabWidget->setCurrentIndex(tabWidget->count() - 1);
+ QApplication::restoreOverrideCursor();
+ page->getTextPage()->setFocus();
+ connect(page->getTextPage()->document(), SIGNAL(modificationChanged(bool)), this,
+ SLOT(slotShowModified()));
+ //enableAction(true)
+ file.close();
+ } else {
+ QMessageBox::warning(this, tr("Warning"),
+ tr("Cannot read file %1:\n%2.")
+ .arg(path).arg(file.errorString()));
+ }
+}
+
void TextEdit::slotOpen() {
QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Open file"),
QDir::currentPath());
- foreach (QString fileName, fileNames) {
- if (!fileName.isEmpty()) {
- QFile file(fileName);
-
- if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- auto *page = new EditorPage(fileName);
-
- QTextStream in(&file);
- QApplication::setOverrideCursor(Qt::WaitCursor);
- page->getTextPage()->setPlainText(in.readAll());
- page->setFilePath(fileName);
- QTextDocument *document = page->getTextPage()->document();
- document->setModified(false);
-
- tabWidget->addTab(page, strippedName(fileName));
- tabWidget->setCurrentIndex(tabWidget->count() - 1);
- QApplication::restoreOverrideCursor();
- page->getTextPage()->setFocus();
- connect(page->getTextPage()->document(), SIGNAL(modificationChanged(bool)), this,
- SLOT(slotShowModified()));
- //enableAction(true)
- file.close();
- } else {
- QMessageBox::warning(this, tr("Application"),
- tr("Cannot read file %1:\n%2.")
- .arg(fileName)
- .arg(file.errorString()));
- }
+ for (const auto &fileName : fileNames) {
+ if (!fileName.isEmpty()) {
+ QFile file(fileName);
+
+ if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ auto *page = new EditorPage(fileName);
+
+ QTextStream in(&file);
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ page->getTextPage()->setPlainText(in.readAll());
+ page->setFilePath(fileName);
+ QTextDocument *document = page->getTextPage()->document();
+ document->setModified(false);
+
+ tabWidget->addTab(page, strippedName(fileName));
+ tabWidget->setCurrentIndex(tabWidget->count() - 1);
+ QApplication::restoreOverrideCursor();
+ page->getTextPage()->setFocus();
+ connect(page->getTextPage()->document(), SIGNAL(modificationChanged(bool)), this,
+ SLOT(slotShowModified()));
+ //enableAction(true)
+ file.close();
+ } else {
+ QMessageBox::warning(this, tr("Warning"),
+ tr("Cannot read file %1:\n%2.")
+ .arg(fileName)
+ .arg(file.errorString()));
}
}
+ }
}
void TextEdit::slotSave() {
@@ -170,7 +200,7 @@ bool TextEdit::slotSaveAs() {
path = tabWidget->tabText(tabWidget->currentIndex()).remove(0, 2);
}
- QString fileName = QFileDialog::getSaveFileName(this, tr("Save file "),
+ QString fileName = QFileDialog::getSaveFileName(this, tr("Save file"),
path);
return saveFile(fileName);
}
@@ -299,7 +329,8 @@ bool TextEdit::maybeSaveAnyTab() {
bool allsaved = true;
QList<int> tabIdsToSave = dialog->getTabIdsToSave();
- foreach (int tabId, tabIdsToSave) {
+ foreach(int
+ tabId, tabIdsToSave) {
tabWidget->setCurrentIndex(tabId);
if (!maybeSaveCurrentTab(false)) {
allsaved = false;
@@ -544,26 +575,16 @@ void TextEdit::slotSelectAll() const {
if (tabWidget->count() == 0 || curTextPage() == nullptr) {
return;
}
-
curTextPage()->selectAll();
}
-/*void TextEdit::dragEnterEvent(QDragEnterEvent *event)
-{
- if (event->mimeData()->hasFormat("text/plain"))
- qDebug() << "enter textedit drag action";
- event->acceptProposedAction();
-}
-
-void TextEdit::dropEvent(QDropEvent* event)
-{
- curTextPage()->setPlainText(event->mimeData()->text());
-
- foreach (QUrl tmp, event->mimeData()->urls())
- {
- qDebug() << tmp;
+void TextEdit::slotFilePagePathChanged(const QString& path) {
+ int index = tabWidget->currentIndex();
+ QString mPath;
+ if(path.size() > 8) {
+ mPath = path.mid(path.size()-8,8).prepend("...");
+ } else {
+ mPath = path;
}
-
- //event->acceptProposedAction();
-}
-*/
+ tabWidget->setTabText(index, mPath);
+} \ No newline at end of file