tweaked PathLineEdit
This commit is contained in:
parent
1759bfd0bd
commit
a38ea5629f
|
@ -52,7 +52,7 @@ void PathLineEdit::contextMenuEvent(QContextMenuEvent *event)
|
|||
{
|
||||
unique_ptr<QMenu> menu(createStandardContextMenu());
|
||||
menu->addSeparator();
|
||||
connect(menu->addAction(tr("Browse")), &QAction::triggered, [this] {
|
||||
connect(menu->addAction(QIcon::fromTheme(QStringLiteral("document-open")), tr("Select directory ...")), &QAction::triggered, [this] {
|
||||
const QString path = QFileDialog::getExistingDirectory(this);
|
||||
if(!path.isEmpty()) {
|
||||
editText(path);
|
||||
|
@ -61,9 +61,9 @@ void PathLineEdit::contextMenuEvent(QContextMenuEvent *event)
|
|||
QFileInfo fileInfo(text());
|
||||
if(fileInfo.exists()) {
|
||||
if(fileInfo.isFile()) {
|
||||
connect(menu->addAction(tr("Open")), &QAction::triggered, bind(&DesktopUtils::openLocalFileOrDir, text()));
|
||||
connect(menu->addAction(QIcon::fromTheme(QStringLiteral("system-run")), tr("Open")), &QAction::triggered, bind(&DesktopUtils::openLocalFileOrDir, text()));
|
||||
} else if(fileInfo.isDir()) {
|
||||
connect(menu->addAction(tr("Explore")), &QAction::triggered, bind(&DesktopUtils::openLocalFileOrDir, text()));
|
||||
connect(menu->addAction(QIcon::fromTheme(QStringLiteral("system-file-manager")), tr("Explore")), &QAction::triggered, bind(&DesktopUtils::openLocalFileOrDir, text()));
|
||||
}
|
||||
}
|
||||
menu->exec(event->globalPos());
|
||||
|
|
Loading…
Reference in New Issue