From f551c5b1958e15fc81ce44a7d2e3165854a2ddef Mon Sep 17 00:00:00 2001 From: Saturneric Date: Sun, 4 Jul 2021 03:49:16 +0800 Subject: Improve UI; Improve File Opera; --- src/ui/widgets/FilePage.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/ui/widgets/FilePage.cpp') diff --git a/src/ui/widgets/FilePage.cpp b/src/ui/widgets/FilePage.cpp index 9f6970db..42cedfd9 100644 --- a/src/ui/widgets/FilePage.cpp +++ b/src/ui/widgets/FilePage.cpp @@ -56,20 +56,23 @@ FilePage::FilePage(QWidget *parent) : QWidget(parent) { connect(goPathButton, SIGNAL(clicked(bool)), this, SLOT(slotGoPath())); pathEdit = new QLineEdit(); - pathEdit->setFixedWidth(480); pathEdit->setText(dirModel->rootPath()); auto *menuLayout = new QHBoxLayout(); menuLayout->addWidget(upLevelButton); + menuLayout->setStretchFactor(upLevelButton, 1); menuLayout->addWidget(pathEdit); + menuLayout->setStretchFactor(pathEdit, 8); menuLayout->addWidget(goPathButton); - menuLayout->addWidget(goPathButton); + menuLayout->setStretchFactor(goPathButton, 1); menuLayout->addWidget(refreshButton); - menuLayout->addStretch(0); + menuLayout->setStretchFactor(refreshButton, 1); auto *layout = new QVBoxLayout(); layout->addLayout(menuLayout); + layout->setStretchFactor(menuLayout, 1); layout->addWidget(dirTreeView); + layout->setStretchFactor(dirTreeView, 8); this->setLayout(layout); @@ -158,10 +161,10 @@ void FilePage::onCustomContextMenu(const QPoint &point) { 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()); + encryptItemAct->setEnabled(info.isFile() && (info.suffix() != "gpg" && info.suffix() != "sig")); + decryptItemAct->setEnabled(info.isFile() && info.suffix() == "gpg"); + signItemAct->setEnabled(info.isFile() && (info.suffix() != "gpg" && info.suffix() != "sig")); + verifyItemAct->setEnabled(info.isFile() && (info.suffix() == "sig" || info.suffix() == "gpg")); popUpMenu->exec(dirTreeView->viewport()->mapToGlobal(point)); } -- cgit v1.2.3