mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
support copy file path in context menu
This commit is contained in:
parent
b139e77173
commit
72bb72477e
@ -44,6 +44,10 @@ void VFileInfoDialog::setupUI(const QString &p_title, const QString &p_info)
|
|||||||
// Select without suffix.
|
// Select without suffix.
|
||||||
m_nameEdit->setSelection(baseStart, baseLength);
|
m_nameEdit->setSelection(baseStart, baseLength);
|
||||||
|
|
||||||
|
// File path.
|
||||||
|
QLineEdit *filePathEdit = new QLineEdit(m_file->fetchPath());
|
||||||
|
filePathEdit->setReadOnly(true);
|
||||||
|
|
||||||
// Attachment folder.
|
// Attachment folder.
|
||||||
VLineEdit *attachmentFolderEdit = new VLineEdit(m_file->getAttachmentFolder());
|
VLineEdit *attachmentFolderEdit = new VLineEdit(m_file->getAttachmentFolder());
|
||||||
attachmentFolderEdit->setPlaceholderText(tr("Will be assigned when adding attachments"));
|
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"));
|
modifiedTimeLabel->setToolTip(tr("Last modified time within VNote"));
|
||||||
|
|
||||||
// Tags.
|
// Tags.
|
||||||
QLineEdit *tagEdit = new QLineEdit();
|
QLineEdit *tagEdit = new QLineEdit(m_file->getTags().join(", "));
|
||||||
tagEdit->setToolTip(tr("Tags of this note separated by ,"));
|
tagEdit->setToolTip(tr("Tags of this note separated by ,"));
|
||||||
tagEdit->setReadOnly(true);
|
tagEdit->setReadOnly(true);
|
||||||
tagEdit->setText(m_file->getTags().join(", "));
|
|
||||||
|
|
||||||
QFormLayout *topLayout = new QFormLayout();
|
QFormLayout *topLayout = new QFormLayout();
|
||||||
topLayout->addRow(tr("Note &name:"), m_nameEdit);
|
topLayout->addRow(tr("Note &name:"), m_nameEdit);
|
||||||
|
topLayout->addRow(tr("File path:"), filePathEdit);
|
||||||
topLayout->addRow(tr("Attachment folder:"), attachmentFolderEdit);
|
topLayout->addRow(tr("Attachment folder:"), attachmentFolderEdit);
|
||||||
topLayout->addRow(tr("Created time:"), createdTimeLabel);
|
topLayout->addRow(tr("Created time:"), createdTimeLabel);
|
||||||
topLayout->addRow(tr("Modified time:"), modifiedTimeLabel);
|
topLayout->addRow(tr("Modified time:"), modifiedTimeLabel);
|
||||||
|
@ -24,6 +24,8 @@ void VOrphanFileInfoDialog::setupUI()
|
|||||||
QFormLayout *topLayout = new QFormLayout();
|
QFormLayout *topLayout = new QFormLayout();
|
||||||
|
|
||||||
QLabel *fileLabel = new QLabel(m_file->fetchPath());
|
QLabel *fileLabel = new QLabel(m_file->fetchPath());
|
||||||
|
fileLabel->setTextInteractionFlags(fileLabel->textInteractionFlags() | Qt::TextSelectableByMouse);
|
||||||
|
fileLabel->setWordWrap(true);
|
||||||
topLayout->addRow(tr("File:"), fileLabel);
|
topLayout->addRow(tr("File:"), fileLabel);
|
||||||
|
|
||||||
m_imageFolderEdit = new VLineEdit(m_file->getImageFolder());
|
m_imageFolderEdit = new VLineEdit(m_file->getImageFolder());
|
||||||
|
@ -633,6 +633,19 @@ void VFileList::contextMenuRequested(QPoint pos)
|
|||||||
connect(openLocationAct, &QAction::triggered,
|
connect(openLocationAct, &QAction::triggered,
|
||||||
this, &VFileList::openFileLocation);
|
this, &VFileList::openFileLocation);
|
||||||
menu.addAction(openLocationAct);
|
menu.addAction(openLocationAct);
|
||||||
|
|
||||||
|
QAction *copyPathAct = new QAction(tr("Copy File Path"), &menu);
|
||||||
|
connect(copyPathAct, &QAction::triggered,
|
||||||
|
this, [this]() {
|
||||||
|
QList<QListWidgetItem *> 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"),
|
QAction *addToCartAct = new QAction(VIconUtils::menuIcon(":/resources/icons/cart.svg"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user