mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
set default title as file name for a link
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1548 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6145efd378
commit
c5e66682c8
@ -22,6 +22,7 @@
|
||||
#include "common/vmessagebox.h"
|
||||
|
||||
#include "AddLinksDialog.h"
|
||||
#include "RetroShareLinkAnalyzer.h"
|
||||
#include "rsiface/rsrank.h"
|
||||
|
||||
/* Images for context menu icons */
|
||||
@ -33,7 +34,7 @@
|
||||
#define IMAGE_BADLINK ":/images/filerating1.png"
|
||||
|
||||
/** Constructor */
|
||||
AddLinksDialog::AddLinksDialog(QWidget *parent)
|
||||
AddLinksDialog::AddLinksDialog(QString url, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
@ -44,6 +45,20 @@ AddLinksDialog::AddLinksDialog(QWidget *parent)
|
||||
connect(ui.closepushButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||
|
||||
ui.linkLineEdit->setReadOnly(true);
|
||||
ui.linkLineEdit->setText(url);
|
||||
|
||||
RetroShareLinkAnalyzer analyzer(url);
|
||||
QVector<RetroShareLinkData> linkList;
|
||||
analyzer.getFileInformation(linkList);
|
||||
if (!linkList.isEmpty())
|
||||
{ /* set title as first name from list */
|
||||
RetroShareLinkData item = linkList.first();
|
||||
ui.titleLineEdit->setText(item.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.titleLineEdit->setText("New File");
|
||||
}
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
@ -91,13 +106,3 @@ void AddLinksDialog::addLinkComment()
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
void AddLinksDialog::insertTitleText(std::string title)
|
||||
{
|
||||
ui.titleLineEdit->setText(QString::fromStdString(title));
|
||||
}
|
||||
|
||||
void AddLinksDialog::insertLinkText(std::string link)
|
||||
{
|
||||
ui.linkLineEdit->setText(QString::fromStdString(link));
|
||||
}
|
||||
|
@ -30,12 +30,9 @@ class AddLinksDialog : public QDialog
|
||||
|
||||
public:
|
||||
/** Default Constructor */
|
||||
AddLinksDialog(QWidget *parent = 0);
|
||||
AddLinksDialog(QString url, QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
void insertTitleText(std::string title);
|
||||
void insertLinkText(std::string link);
|
||||
|
||||
static int IndexToScore(int index);
|
||||
|
||||
public slots:
|
||||
|
@ -341,10 +341,7 @@ void SharedFilesDialog::sendLinkToCloud()
|
||||
{
|
||||
copyLinkLocal ();
|
||||
|
||||
AddLinksDialog *nAddLinksDialog = new AddLinksDialog();
|
||||
|
||||
nAddLinksDialog->insertTitleText("New File");
|
||||
nAddLinksDialog->insertLinkText(QApplication::clipboard()->text().toStdString());
|
||||
AddLinksDialog *nAddLinksDialog = new AddLinksDialog(QApplication::clipboard()->text());
|
||||
|
||||
nAddLinksDialog->addLinkComment();
|
||||
nAddLinksDialog->close();
|
||||
@ -354,10 +351,7 @@ void SharedFilesDialog::addLinkToCloud()
|
||||
{
|
||||
copyLinkLocal ();
|
||||
|
||||
AddLinksDialog *nAddLinksDialog = new AddLinksDialog(this);
|
||||
|
||||
nAddLinksDialog->insertTitleText("New File");
|
||||
nAddLinksDialog->insertLinkText(QApplication::clipboard()->text().toStdString());
|
||||
AddLinksDialog *nAddLinksDialog = new AddLinksDialog(QApplication::clipboard()->text());
|
||||
|
||||
nAddLinksDialog->show();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user