extract all
This commit is contained in:
15
PKGBUILD
15
PKGBUILD
@@ -1,22 +1,27 @@
|
||||
pkgname=dull
|
||||
pkgname=dull-git
|
||||
pkgver=0.1
|
||||
pkgrel=1
|
||||
pkgdesc="Desktop app for securely storing sensitive files"
|
||||
arch=('x86_64')
|
||||
url="https://github.com/antpiasecki/dull"
|
||||
depends=('qt6-base' 'botan')
|
||||
makedepends=('cmake')
|
||||
source=("${url}/archive/refs/tags/${pkgver}.tar.gz")
|
||||
makedepends=('cmake' 'git')
|
||||
source=("git+${url}.git")
|
||||
sha256sums=('SKIP')
|
||||
options=('!debug')
|
||||
|
||||
pkgver() {
|
||||
cd "${pkgname%-git}"
|
||||
git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
|
||||
}
|
||||
|
||||
build() {
|
||||
cd "${pkgname}-${pkgver}"
|
||||
cd "${pkgname%-git}"
|
||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
|
||||
cmake --build build -j$(nproc)
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${pkgname}-${pkgver}/build"
|
||||
cd "${pkgname%-git}/build"
|
||||
make DESTDIR="${pkgdir}" install
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include <botan/aead.h>
|
||||
#include <botan/hex.h>
|
||||
#include <botan/pwdhash.h>
|
||||
|
||||
namespace Crypto {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
QApplication app(argc, argv);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// TODO: actual fs
|
||||
#include "mainwindow.h"
|
||||
#include <QDesktopServices>
|
||||
#include <QDragEnterEvent>
|
||||
#include <QDropEvent>
|
||||
#include <QFileDialog>
|
||||
#include <QInputDialog>
|
||||
@@ -9,7 +8,6 @@
|
||||
#include <QMimeData>
|
||||
#include <QTemporaryDir>
|
||||
#include <botan/auto_rng.h>
|
||||
#include <botan/hex.h>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent), ui(std::make_unique<Ui::MainWindow>()) {
|
||||
@@ -22,12 +20,12 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(ui->actionNew, &QAction::triggered, this, [this]() {
|
||||
QString path = QFileDialog::getSaveFileName(this, "Choose vault location",
|
||||
QDir::currentPath(),
|
||||
"Dull Vaults (*.dull)");
|
||||
"Dull vaults (*.dull)");
|
||||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!path.contains(".dull")) {
|
||||
if (!path.endsWith(".dull")) {
|
||||
path += ".dull";
|
||||
}
|
||||
|
||||
@@ -112,6 +110,29 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->statusbar->showMessage("Added " + QString::number(paths.size()) +
|
||||
" files");
|
||||
});
|
||||
|
||||
connect(ui->actionExtract_All, &QAction::triggered, this, [this]() {
|
||||
if (!m_vault) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString path =
|
||||
QFileDialog::getExistingDirectory(this, "Choose location to extract");
|
||||
if (path.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto headers = m_vault->read_file_headers();
|
||||
for (const auto &header : headers) {
|
||||
auto content = m_vault->read_file(header.name);
|
||||
if (content) {
|
||||
std::ofstream file(path.toStdString() + "/" + header.name,
|
||||
std::ios::binary);
|
||||
file.write(content->data(), static_cast<i64>(content->size()));
|
||||
}
|
||||
}
|
||||
ui->statusbar->showMessage("Extracted all files to " + path);
|
||||
});
|
||||
}
|
||||
|
||||
void MainWindow::reload_fs_tree() {
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include "ui_mainwindow.h"
|
||||
#include "vault.h"
|
||||
#include <QMainWindow>
|
||||
#include <memory>
|
||||
|
||||
class MainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>32</height>
|
||||
<width>900</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuVault">
|
||||
@@ -65,6 +65,7 @@
|
||||
<string>Files</string>
|
||||
</property>
|
||||
<addaction name="actionAddFiles"/>
|
||||
<addaction name="actionExtract_All"/>
|
||||
</widget>
|
||||
<addaction name="menuVault"/>
|
||||
<addaction name="menuFiles"/>
|
||||
@@ -93,6 +94,14 @@
|
||||
<string>Add</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExtract_All">
|
||||
<property name="icon">
|
||||
<iconset theme="document-save-as"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Extract All</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "vault.h"
|
||||
#include "common.h"
|
||||
#include "crypto.h"
|
||||
#include <array>
|
||||
#include <botan/auto_rng.h>
|
||||
#include <filesystem>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user