diff --git a/src/dialog/vfileinfodialog.cpp b/src/dialog/vfileinfodialog.cpp index ba9270cb..e9a520a4 100644 --- a/src/dialog/vfileinfodialog.cpp +++ b/src/dialog/vfileinfodialog.cpp @@ -44,6 +44,10 @@ void VFileInfoDialog::setupUI(const QString &p_title, const QString &p_info) // Select without suffix. m_nameEdit->setSelection(baseStart, baseLength); + // File path. + QLineEdit *filePathEdit = new QLineEdit(m_file->fetchPath()); + filePathEdit->setReadOnly(true); + // Attachment folder. VLineEdit *attachmentFolderEdit = new VLineEdit(m_file->getAttachmentFolder()); attachmentFolderEdit->setPlaceholderText(tr("Will be assigned when adding attachments")); @@ -60,13 +64,13 @@ void VFileInfoDialog::setupUI(const QString &p_title, const QString &p_info) modifiedTimeLabel->setToolTip(tr("Last modified time within VNote")); // Tags. - QLineEdit *tagEdit = new QLineEdit(); + QLineEdit *tagEdit = new QLineEdit(m_file->getTags().join(", ")); tagEdit->setToolTip(tr("Tags of this note separated by ,")); tagEdit->setReadOnly(true); - tagEdit->setText(m_file->getTags().join(", ")); QFormLayout *topLayout = new QFormLayout(); topLayout->addRow(tr("Note &name:"), m_nameEdit); + topLayout->addRow(tr("File path:"), filePathEdit); topLayout->addRow(tr("Attachment folder:"), attachmentFolderEdit); topLayout->addRow(tr("Created time:"), createdTimeLabel); topLayout->addRow(tr("Modified time:"), modifiedTimeLabel); diff --git a/src/dialog/vorphanfileinfodialog.cpp b/src/dialog/vorphanfileinfodialog.cpp index 88a41492..435b0291 100644 --- a/src/dialog/vorphanfileinfodialog.cpp +++ b/src/dialog/vorphanfileinfodialog.cpp @@ -24,6 +24,8 @@ void VOrphanFileInfoDialog::setupUI() QFormLayout *topLayout = new QFormLayout(); QLabel *fileLabel = new QLabel(m_file->fetchPath()); + fileLabel->setTextInteractionFlags(fileLabel->textInteractionFlags() | Qt::TextSelectableByMouse); + fileLabel->setWordWrap(true); topLayout->addRow(tr("File:"), fileLabel); m_imageFolderEdit = new VLineEdit(m_file->getImageFolder()); diff --git a/src/vfilelist.cpp b/src/vfilelist.cpp index 7680dd61..a5d0644f 100644 --- a/src/vfilelist.cpp +++ b/src/vfilelist.cpp @@ -633,6 +633,19 @@ void VFileList::contextMenuRequested(QPoint pos) connect(openLocationAct, &QAction::triggered, this, &VFileList::openFileLocation); menu.addAction(openLocationAct); + + QAction *copyPathAct = new QAction(tr("Copy File Path"), &menu); + connect(copyPathAct, &QAction::triggered, + this, [this]() { + QList items = fileList->selectedItems(); + if (items.size() == 1) { + QString filePath = getVFile(items[0])->fetchPath(); + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setText(filePath); + g_mainWin->showStatusMessage(tr("File path copied %1").arg(filePath)); + } + }); + menu.addAction(copyPathAct); } QAction *addToCartAct = new QAction(VIconUtils::menuIcon(":/resources/icons/cart.svg"),