cleaned the RS link code, factorized the parsing into a single class. Still missing: copy/paste of multiple links

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2514 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-03-10 21:38:26 +00:00
parent a208efdaf9
commit a657def956
13 changed files with 316 additions and 170 deletions

View file

@ -34,9 +34,7 @@
#include "AddLinksDialog.h"
#include "SendLinkDialog.h"
#ifndef RETROSHARE_LINK_ANALYZER
#include "RetroShareLinkAnalyzer.h"
#endif
#include "RetroShareLink.h"
#include <iostream>
#include <sstream>
@ -253,12 +251,14 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
else
localModel->getDirDetailsFromSelect(lst, dirVec);
RetroShareLinkAnalyzer analyzer;
for (int i = 0, n = dirVec.size(); i < n; ++i)
{
const DirDetails& details = dirVec[i];
RetroShareLink link(details.name.c_str(), details.count, details.hash.c_str());
QApplication::clipboard()->setText(link.toString());
#ifdef TO_DO_LATER
if (details.type == DIR_TYPE_DIR)
{
for (std::list<DirStub>::const_iterator cit = details.children.begin();
@ -286,10 +286,8 @@ void SharedFilesDialog::copyLink (const QModelIndexList& lst, bool remote)
}
else
analyzer.setRetroShareLink (details.name.c_str(), QString::number(details.count), details.hash.c_str());
#endif
}
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(analyzer.getRetroShareLink ());
}
void SharedFilesDialog::copyLinkRemote()