diff --git a/PKGBUILD b/PKGBUILD index e596256..b77682a 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -8,7 +8,7 @@ depends=('qt6-base' 'botan') makedepends=('cmake') source=("${url}/archive/refs/tags/${pkgver}.tar.gz") sha256sums=('SKIP') -DEBUGPKG=() +options=('!debug') build() { cd "${pkgname}-${pkgver}" diff --git a/README.md b/README.md index 6309e48..376d6e2 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ sudo pacman -S base-devel makepkg -si ``` -### Windows / MSYS2 +### Windows (MSYS2) ``` pacman -S --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja mingw-w64-x86_64-qt6-base mingw-w64-x86_64-qt6-tools mingw-w64-x86_64-libbotan diff --git a/src/mainwindow.cc b/src/mainwindow.cc index e889330..756cf3f 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -1,3 +1,4 @@ +// TODO: actual fs #include "mainwindow.h" #include #include @@ -38,6 +39,9 @@ MainWindow::MainWindow(QWidget *parent) return; } + ui->statusbar->showMessage("Creating the vault..."); + QCoreApplication::processEvents(); + static Botan::AutoSeeded_RNG rng; auto salt_sv = rng.random_vec(16); std::vector salt(salt_sv.begin(), salt_sv.end()); @@ -51,6 +55,8 @@ MainWindow::MainWindow(QWidget *parent) m_vault = std::make_unique(path.toStdString(), password.toStdString()); reload_fs_tree(); + + ui->statusbar->clearMessage(); }); connect(ui->actionOpen, &QAction::triggered, this, [this]() { @@ -63,12 +69,20 @@ MainWindow::MainWindow(QWidget *parent) QString password = QInputDialog::getText( this, "Unlock the vault", "Enter vault password", QLineEdit::Password); + if (password.isEmpty()) { + return; + } // TODO: check if password valid + ui->statusbar->showMessage("Opening the vault..."); + QCoreApplication::processEvents(); + m_vault = std::make_unique(path.toStdString(), password.toStdString()); reload_fs_tree(); + + ui->statusbar->clearMessage(); }); connect( @@ -95,16 +109,20 @@ MainWindow::MainWindow(QWidget *parent) } reload_fs_tree(); + ui->statusbar->showMessage("Added " + QString::number(paths.size()) + + " files"); }); } void MainWindow::reload_fs_tree() { + setWindowTitle(QString::fromStdString(m_vault->path()) + " - dull"); ui->menuFiles->setEnabled(true); ui->fsTreeWidget->clear(); auto headers = m_vault->read_file_headers(); for (const auto &header : headers) { auto *item = new QTreeWidgetItem(ui->fsTreeWidget); + item->setIcon(0, style()->standardIcon(QStyle::SP_FileIcon)); item->setText(0, QString::fromStdString(header.name)); item->setText(1, QString::number(header.content_ciphertext_size)); } @@ -136,6 +154,8 @@ void MainWindow::extract_file(const std::string &filename) { std::ofstream file(path.toStdString(), std::ios::binary); file.write(content->data(), static_cast(content->size())); + + ui->statusbar->showMessage("Extracted to " + path); } else { qWarning() << "File to extract not found"; } @@ -166,6 +186,7 @@ void MainWindow::edit_file(const std::string &filename) { m_vault->update_file(filename, new_content); reload_fs_tree(); + ui->statusbar->showMessage("File updated"); // QTemporaryDir gets deleted when it goes out of scope } else { qWarning() << "File to edit not found"; @@ -240,6 +261,8 @@ void MainWindow::dropEvent(QDropEvent *event) { m_vault->create_file(path_to_filename(u.toLocalFile().toStdString()), content); } + ui->statusbar->showMessage( + "Added " + QString::number(event->mimeData()->urls().size()) + " files"); reload_fs_tree(); event->acceptProposedAction(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 321e29c..ff2dfcb 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -40,6 +40,7 @@ + @@ -69,16 +70,25 @@ + + + New + + + Open + + + Add diff --git a/src/vault.h b/src/vault.h index 6262a5e..89fee85 100644 --- a/src/vault.h +++ b/src/vault.h @@ -28,6 +28,8 @@ public: void delete_file(const std::string &name); void update_file(const std::string &name, const std::string &content); + const std::string &path() const { return m_path; } + private: std::string m_path; std::fstream m_file;