tweaked PathLineEdit

This commit is contained in:
Martchus 2016-04-09 02:38:36 +02:00
parent 1759bfd0bd
commit a38ea5629f
1 changed files with 3 additions and 3 deletions

View File

@ -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());