mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-22 06:09:09 -04:00
updated to upstream/master
This commit is contained in:
commit
e28886fe79
79 changed files with 1898 additions and 856 deletions
|
@ -1078,17 +1078,38 @@ void ChatLobbyWidget::readChatLobbyInvites()
|
|||
RsGxsId default_id ;
|
||||
rsMsgs->getDefaultIdentityForChatLobby(default_id) ;
|
||||
|
||||
std::list<ChatLobbyId> subscribed_lobbies ;
|
||||
rsMsgs->getChatLobbyList(subscribed_lobbies) ;
|
||||
|
||||
for(std::list<ChatLobbyInvite>::const_iterator it(invites.begin());it!=invites.end();++it)
|
||||
{
|
||||
// first check if the lobby is already subscribed. If so, just ignore the request.
|
||||
|
||||
bool found = false ;
|
||||
for(auto it2(subscribed_lobbies.begin());it2!=subscribed_lobbies.end() && !found;++it2)
|
||||
found = found || (*it2 == (*it).lobby_id) ;
|
||||
|
||||
if(found)
|
||||
continue ;
|
||||
|
||||
QMessageBox mb(QObject::tr("Join chat room"),
|
||||
tr("%1 invites you to chat room named %2").arg(QString::fromUtf8(rsPeers->getPeerName((*it).peer_id).c_str())).arg(RsHtml::plainText(it->lobby_name)),
|
||||
QMessageBox::Question, QMessageBox::Yes,QMessageBox::No, 0);
|
||||
|
||||
|
||||
QLabel *label = new QLabel(tr("Choose an identity for this chat room:"));
|
||||
QLabel *label ;
|
||||
GxsIdChooser *idchooser = new GxsIdChooser ;
|
||||
idchooser->loadIds(IDCHOOSER_ID_REQUIRED,default_id) ;
|
||||
|
||||
if( (*it).lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED )
|
||||
{
|
||||
idchooser->loadIds(IDCHOOSER_ID_REQUIRED | IDCHOOSER_NON_ANONYMOUS,default_id) ;
|
||||
label = new QLabel(tr("Choose a non anonymous identity for this chat room:"));
|
||||
}
|
||||
else
|
||||
{
|
||||
idchooser->loadIds(IDCHOOSER_ID_REQUIRED,default_id) ;
|
||||
label = new QLabel(tr("Choose an identity for this chat room:"));
|
||||
}
|
||||
|
||||
QGridLayout* layout = qobject_cast<QGridLayout*>(mb.layout());
|
||||
if (layout) {
|
||||
|
|
|
@ -445,10 +445,10 @@ void SearchDialog::collCreate()
|
|||
details.type = DIR_TYPE_FILE;
|
||||
|
||||
dirVec.push_back(details);
|
||||
}//if (!item->text(SR_HASH_COL).isEmpty())
|
||||
}//for (int i = 0; i < numdls; ++i)
|
||||
}
|
||||
}
|
||||
|
||||
RsCollection(dirVec).openNewColl(this);
|
||||
RsCollection(dirVec,RS_FILE_HINTS_LOCAL).openNewColl(this);
|
||||
}
|
||||
|
||||
void SearchDialog::collModif()
|
||||
|
@ -795,8 +795,7 @@ void SearchDialog::advancedSearch(RsRegularExpression::Expression* expression)
|
|||
TurtleRequestId req_id = rsTurtle->turtleSearch(e) ;
|
||||
|
||||
// This will act before turtle results come to the interface, thanks to the signals scheduling policy.
|
||||
// The text "bool exp" should be replaced by an appropriate text describing the actual search.
|
||||
initSearchResult("bool exp",req_id, ui.FileTypeComboBox->currentIndex(), true) ;
|
||||
initSearchResult(QString::fromStdString(e.GetStrings()),req_id, ui.FileTypeComboBox->currentIndex(), true) ;
|
||||
|
||||
rsFiles -> SearchBoolExp(expression, results, RS_FILE_HINTS_REMOTE);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE);
|
||||
|
||||
|
|
|
@ -509,9 +509,20 @@ void RemoteSharedFilesDialog::spawnCustomPopupMenu( QPoint point )
|
|||
collectionMenu.addAction(collCreateAct);
|
||||
collectionMenu.addAction(collOpenAct);
|
||||
|
||||
QAction *downloadAct = new QAction(QIcon(IMAGE_DOWNLOAD), tr( "Download" ), &contextMnu ) ;
|
||||
connect( downloadAct , SIGNAL( triggered() ), this, SLOT( downloadRemoteSelected() ) ) ;
|
||||
contextMnu.addAction( downloadAct) ;
|
||||
QModelIndexList list = ui.dirTreeView->selectionModel()->selectedRows() ;
|
||||
|
||||
if(type == DIR_TYPE_DIR || list.size() > 1)
|
||||
{
|
||||
QAction *downloadActI = new QAction(QIcon(IMAGE_DOWNLOAD), tr( "Download..." ), &contextMnu ) ;
|
||||
connect( downloadActI , SIGNAL( triggered() ), this, SLOT( downloadRemoteSelectedInteractive() ) ) ;
|
||||
contextMnu.addAction( downloadActI) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
QAction *downloadAct = new QAction(QIcon(IMAGE_DOWNLOAD), tr( "Download" ), &contextMnu ) ;
|
||||
connect( downloadAct , SIGNAL( triggered() ), this, SLOT( downloadRemoteSelected() ) ) ;
|
||||
contextMnu.addAction( downloadAct) ;
|
||||
}
|
||||
|
||||
contextMnu.addSeparator() ;//------------------------------------
|
||||
contextMnu.addAction( copylinkAct) ;
|
||||
|
@ -545,7 +556,16 @@ void RemoteSharedFilesDialog::expanded(const QModelIndex& indx)
|
|||
|
||||
model->updateRef(proxyModel->mapToSource(indx)) ;
|
||||
}
|
||||
void RemoteSharedFilesDialog::downloadRemoteSelectedInteractive()
|
||||
{
|
||||
/* call back to the model (which does all the interfacing? */
|
||||
|
||||
std::cerr << "Downloading Files" ;
|
||||
std::cerr << std::endl ;
|
||||
|
||||
QModelIndexList lst = getSelected() ;
|
||||
model -> downloadSelected(lst,true) ;
|
||||
}
|
||||
void RemoteSharedFilesDialog::downloadRemoteSelected()
|
||||
{
|
||||
/* call back to the model (which does all the interfacing? */
|
||||
|
@ -554,7 +574,7 @@ void RemoteSharedFilesDialog::downloadRemoteSelected()
|
|||
std::cerr << std::endl ;
|
||||
|
||||
QModelIndexList lst = getSelected() ;
|
||||
model -> downloadSelected(lst) ;
|
||||
model -> downloadSelected(lst,false) ;
|
||||
}
|
||||
|
||||
void SharedFilesDialog::copyLinks(const QModelIndexList& lst, bool remote,QList<RetroShareLink>& urls,bool& has_unhashed_files)
|
||||
|
|
|
@ -187,6 +187,7 @@ class RemoteSharedFilesDialog : public SharedFilesDialog
|
|||
|
||||
private slots:
|
||||
void downloadRemoteSelected();
|
||||
void downloadRemoteSelectedInteractive();
|
||||
void expanded(const QModelIndex& indx);
|
||||
};
|
||||
|
||||
|
|
|
@ -2133,7 +2133,8 @@ void TransfersDialog::collCreate()
|
|||
std::set<RsFileHash>::iterator it ;
|
||||
getDLSelectedItems(&items, NULL);
|
||||
|
||||
for (it = items.begin(); it != items.end(); ++it) {
|
||||
for (it = items.begin(); it != items.end(); ++it)
|
||||
{
|
||||
FileInfo info;
|
||||
if (!rsFiles->FileDetails(*it, RS_FILE_HINTS_DOWNLOAD, info)) continue;
|
||||
|
||||
|
@ -2144,9 +2145,9 @@ void TransfersDialog::collCreate()
|
|||
details.type = DIR_TYPE_FILE;
|
||||
|
||||
dirVec.push_back(details);
|
||||
}//for (it = items.begin();
|
||||
}
|
||||
|
||||
RsCollection(dirVec).openNewColl(this);
|
||||
RsCollection(dirVec,RS_FILE_HINTS_LOCAL).openNewColl(this);
|
||||
}
|
||||
|
||||
void TransfersDialog::collModif()
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QMessageBox>
|
||||
#include <QMenu>
|
||||
#include <QWidgetAction>
|
||||
|
@ -32,21 +33,23 @@
|
|||
#include "IdDialog.h"
|
||||
#include "ui_IdDialog.h"
|
||||
#include "IdEditDialog.h"
|
||||
#include "retroshare-gui/RsAutoUpdatePage.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include "gui/chat/ChatDialog.h"
|
||||
#include "gui/Circles/CreateCircleDialog.h"
|
||||
#include "gui/common/UIStateHelper.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "gui/gxs/RsGxsUpdateBroadcastBase.h"
|
||||
#include "gui/common/UIStateHelper.h"
|
||||
#include "gui/chat/ChatDialog.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "gui/msgs/MessageComposer.h"
|
||||
#include "gui/Circles/CreateCircleDialog.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
#include "retroshare-gui/RsAutoUpdatePage.h"
|
||||
#include "util/misc.h"
|
||||
#include "util/QtVersion.h"
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include "retroshare/rsgxsflags.h"
|
||||
#include "retroshare/rsmsgs.h"
|
||||
#include "retroshare/rspeers.h"
|
||||
#include "retroshare/rsservicecontrol.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -175,32 +178,40 @@ IdDialog::IdDialog(QWidget *parent) :
|
|||
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_Nickname);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_KeyId);
|
||||
// mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_GpgHash);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_Type);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_GpgId);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_GpgName);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_Type);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->lineEdit_LastUsed);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->ownOpinion_CB);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->overallOpinion_TF);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->autoBanIdentities_CB);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->neighborNodesOpinion_TF);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->overallOpinion_TF);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->usageStatistics_TB);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->inviteButton);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->label_positive);
|
||||
mStateHelper->addWidget(IDDIALOG_IDDETAILS, ui->label_negative);
|
||||
|
||||
mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_Nickname);
|
||||
mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_GpgName);
|
||||
mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_KeyId);
|
||||
// mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_GpgHash);
|
||||
mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_GpgId);
|
||||
mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_Type);
|
||||
mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_GpgId);
|
||||
mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_GpgName);
|
||||
mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->lineEdit_LastUsed);
|
||||
//mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->line_RatingOverall);
|
||||
mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->neighborNodesOpinion_TF);
|
||||
mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->overallOpinion_TF);
|
||||
mStateHelper->addLoadPlaceholder(IDDIALOG_IDDETAILS, ui->usageStatistics_TB);
|
||||
|
||||
mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_Nickname);
|
||||
mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_KeyId);
|
||||
// mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_GpgHash);
|
||||
mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_GpgId);
|
||||
mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_Type);
|
||||
mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_GpgId);
|
||||
mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_GpgName);
|
||||
mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->lineEdit_LastUsed);
|
||||
mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->neighborNodesOpinion_TF);
|
||||
mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->overallOpinion_TF);
|
||||
mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->usageStatistics_TB);
|
||||
mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->label_positive);
|
||||
mStateHelper->addClear(IDDIALOG_IDDETAILS, ui->label_negative);
|
||||
|
||||
//mStateHelper->addWidget(IDDIALOG_REPLIST, ui->treeWidget_RepList);
|
||||
//mStateHelper->addLoadPlaceholder(IDDIALOG_REPLIST, ui->treeWidget_RepList);
|
||||
|
@ -221,22 +232,15 @@ IdDialog::IdDialog(QWidget *parent) :
|
|||
connect(ui->inviteButton, SIGNAL(clicked()), this, SLOT(sendInvite()));
|
||||
|
||||
|
||||
ui->avLabel_Person->setPixmap(QPixmap(":/icons/png/people.png"));
|
||||
ui->avlabel_Circles->setPixmap(QPixmap(":/icons/png/circles.png"));
|
||||
|
||||
ui->headerTextLabel_Person->setText(tr("People"));
|
||||
ui->headerTextLabel_Circles->setText(tr("Circles"));
|
||||
|
||||
/* Initialize splitter */
|
||||
ui->mainSplitter->setStretchFactor(0, 0);
|
||||
ui->mainSplitter->setStretchFactor(1, 1);
|
||||
|
||||
ui->inviteFrame->hide();
|
||||
|
||||
/*remove
|
||||
QList<int> sizes;
|
||||
sizes << width() << 500; // Qt calculates the right sizes
|
||||
ui->splitter->setSizes(sizes);*/
|
||||
clearPerson();
|
||||
|
||||
/* Add filter types */
|
||||
QMenu *idTWHMenu = new QMenu(tr("Show Items"), this);
|
||||
|
@ -385,7 +389,22 @@ IdDialog::IdDialog(QWidget *parent) :
|
|||
connect(tmer,SIGNAL(timeout()),this,SLOT(updateCirclesDisplay())) ;
|
||||
|
||||
tmer->start(10000) ; // update every 10 secs.
|
||||
}
|
||||
}
|
||||
|
||||
void IdDialog::clearPerson()
|
||||
{
|
||||
QFontMetricsF f(ui->avLabel_Person->font()) ;
|
||||
|
||||
ui->avLabel_Person->setPixmap(QPixmap(":/icons/png/people.png").scaled(f.height()*4,f.height()*4,Qt::IgnoreAspectRatio,Qt::SmoothTransformation));
|
||||
ui->headerTextLabel_Person->setText(tr("People"));
|
||||
|
||||
ui->inviteFrame->hide();
|
||||
ui->avatarLabel->clear();
|
||||
|
||||
whileBlocking(ui->ownOpinion_CB)->setCurrentIndex(1);
|
||||
whileBlocking(ui->autoBanIdentities_CB)->setChecked(false);
|
||||
|
||||
}
|
||||
|
||||
void IdDialog::toggleAutoBanIdentities(bool b)
|
||||
{
|
||||
|
@ -1582,9 +1601,9 @@ void IdDialog::insertIdList(uint32_t token)
|
|||
|
||||
int accept = filter;
|
||||
|
||||
RsGxsIdGroup data;
|
||||
//RsGxsIdGroup data;
|
||||
std::vector<RsGxsIdGroup> datavector;
|
||||
std::vector<RsGxsIdGroup>::iterator vit;
|
||||
//std::vector<RsGxsIdGroup>::iterator vit;
|
||||
|
||||
if (!rsIdentity->getGroupData(token, datavector))
|
||||
{
|
||||
|
@ -1595,6 +1614,7 @@ void IdDialog::insertIdList(uint32_t token)
|
|||
|
||||
mStateHelper->setActive(IDDIALOG_IDLIST, false);
|
||||
mStateHelper->clear(IDDIALOG_IDLIST);
|
||||
clearPerson();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1645,8 +1665,8 @@ void IdDialog::insertIdList(uint32_t token)
|
|||
|
||||
/* Insert new items */
|
||||
for (std::map<RsGxsGroupId,RsGxsIdGroup>::const_iterator vit = ids_set.begin(); vit != ids_set.end(); ++vit)
|
||||
{
|
||||
data = vit->second ;
|
||||
{
|
||||
RsGxsIdGroup data = vit->second ;
|
||||
|
||||
item = NULL;
|
||||
|
||||
|
@ -1661,16 +1681,16 @@ void IdDialog::insertIdList(uint32_t token)
|
|||
|
||||
Settings->endGroup();
|
||||
|
||||
if (fillIdListItem(vit->second, item, ownPgpId, accept))
|
||||
{
|
||||
if(vit->second.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
|
||||
ownItem->addChild(item);
|
||||
else if(vit->second.mIsAContact)
|
||||
contactsItem->addChild(item);
|
||||
else
|
||||
allItem->addChild(item);
|
||||
}
|
||||
}
|
||||
if (fillIdListItem(data, item, ownPgpId, accept))
|
||||
{
|
||||
if(data.mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN)
|
||||
ownItem->addChild(item);
|
||||
else if(data.mIsAContact)
|
||||
contactsItem->addChild(item);
|
||||
else
|
||||
allItem->addChild(item);
|
||||
}
|
||||
}
|
||||
|
||||
/* count items */
|
||||
int itemCount = contactsItem->childCount() + allItem->childCount() + ownItem->childCount();
|
||||
|
@ -1690,6 +1710,7 @@ void IdDialog::requestIdDetails()
|
|||
mStateHelper->setActive(IDDIALOG_IDDETAILS, false);
|
||||
mStateHelper->setLoading(IDDIALOG_IDDETAILS, false);
|
||||
mStateHelper->clear(IDDIALOG_IDDETAILS);
|
||||
clearPerson();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1717,6 +1738,7 @@ void IdDialog::insertIdDetails(uint32_t token)
|
|||
{
|
||||
mStateHelper->setActive(IDDIALOG_IDDETAILS, false);
|
||||
mStateHelper->clear(IDDIALOG_REPLIST);
|
||||
clearPerson();
|
||||
|
||||
ui->lineEdit_KeyId->setText("ERROR GETTING KEY!");
|
||||
|
||||
|
@ -1731,6 +1753,7 @@ void IdDialog::insertIdDetails(uint32_t token)
|
|||
|
||||
mStateHelper->setActive(IDDIALOG_IDDETAILS, false);
|
||||
mStateHelper->clear(IDDIALOG_IDDETAILS);
|
||||
clearPerson();
|
||||
|
||||
ui->lineEdit_KeyId->setText("INVALID DV SIZE");
|
||||
|
||||
|
@ -1768,8 +1791,14 @@ void IdDialog::insertIdDetails(uint32_t token)
|
|||
std::cerr << "Setting header frame image : " << pixmap.width() << " x " << pixmap.height() << std::endl;
|
||||
#endif
|
||||
|
||||
ui->avLabel_Person->setPixmap(pixmap);
|
||||
ui->avatarLabel->setPixmap(pixmap);
|
||||
//ui->avLabel_Person->setPixmap(pixmap);
|
||||
//ui->avatarLabel->setPixmap(pixmap);
|
||||
QFontMetricsF f(ui->avLabel_Person->font()) ;
|
||||
ui->avLabel_Person->setPixmap(pixmap.scaled(f.height()*4,f.height()*4,Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||
|
||||
QFontMetricsF g(ui->inviteButton->font()) ;
|
||||
ui->avatarLabel->setPixmap(pixmap.scaled(ui->inviteButton->width(),ui->inviteButton->width(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation));
|
||||
ui->avatarLabel->setScaledContents(true);
|
||||
|
||||
if (data.mPgpKnown)
|
||||
{
|
||||
|
@ -1814,7 +1843,10 @@ void IdDialog::insertIdDetails(uint32_t token)
|
|||
if (isLinkedToOwnPgpId)
|
||||
ui->lineEdit_Type->setText(tr("Identity owned by you, linked to your Retroshare node")) ;
|
||||
else
|
||||
ui->lineEdit_Type->setText(tr("Anonymous identity, owned by you")) ;
|
||||
if (data.mMeta.mGroupFlags & (GXS_SERV::FLAG_PRIVACY_PRIVATE | RSGXSID_GROUPFLAG_REALID))
|
||||
ui->lineEdit_Type->setText(tr("Identity owned by you, linked to your Retroshare node but not yet validated")) ;
|
||||
else
|
||||
ui->lineEdit_Type->setText(tr("Anonymous identity, owned by you")) ;
|
||||
else if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID_kept_for_compatibility)
|
||||
{
|
||||
if (data.mPgpKnown)
|
||||
|
|
|
@ -138,6 +138,8 @@ private:
|
|||
void requestIdEdit(std::string &id);
|
||||
void showIdEdit(uint32_t token);
|
||||
|
||||
void clearPerson();
|
||||
|
||||
private:
|
||||
TokenQueue *mIdQueue;
|
||||
TokenQueue *mCircleQueue;
|
||||
|
|
|
@ -290,6 +290,12 @@
|
|||
<layout class="QVBoxLayout" name="scrollAreaWidgetContentsVLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="headerFramePerson">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
|
@ -477,6 +483,12 @@ border-image: url(:/images/closepressed.png)
|
|||
</item>
|
||||
<item row="0" column="0" rowspan="2">
|
||||
<widget class="QLabel" name="avLabel_Person">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
|
@ -485,8 +497,8 @@ border-image: url(:/images/closepressed.png)
|
|||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
<width>1000</width>
|
||||
<height>1000</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
|
|
|
@ -227,6 +227,7 @@ void IdEditDialog::enforceNoAnonIds()
|
|||
{
|
||||
ui->radioButton_GpgId->setChecked(true);
|
||||
ui->radioButton_GpgId->setEnabled(false);
|
||||
ui->radioButton_Pseudo->setEnabled(false);
|
||||
}
|
||||
|
||||
void IdEditDialog::loadExistingId(uint32_t token)
|
||||
|
|
|
@ -1027,12 +1027,12 @@ void MainWindow::addFriend()
|
|||
}
|
||||
|
||||
/** New RSCollection ShortCut */
|
||||
void MainWindow::newRsCollection()
|
||||
{
|
||||
std::vector <DirDetails> dirVec;
|
||||
|
||||
RsCollection(dirVec).openNewColl(this);
|
||||
}
|
||||
// void MainWindow::newRsCollection()
|
||||
// {
|
||||
// std::vector <DirDetails> dirVec;
|
||||
//
|
||||
// RsCollection(dirVec).openNewColl(this);
|
||||
// }
|
||||
|
||||
/** Shows Share Manager */
|
||||
void MainWindow::openShareManager()
|
||||
|
|
|
@ -223,7 +223,7 @@ private slots:
|
|||
|
||||
/** Toolbar fns. */
|
||||
void addFriend();
|
||||
void newRsCollection();
|
||||
//void newRsCollection();
|
||||
void showMessengerWindow();
|
||||
void showStatisticsWindow();
|
||||
#ifdef ENABLE_WEBUI
|
||||
|
|
|
@ -231,7 +231,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
|
|||
QMenu *printmenu = new QMenu();
|
||||
printmenu->addAction(ui.actionPrint);
|
||||
printmenu->addAction(ui.actionPrintPreview);
|
||||
ui.printbutton->setMenu(printmenu);
|
||||
ui.printButton->setMenu(printmenu);
|
||||
|
||||
QMenu *viewmenu = new QMenu();
|
||||
viewmenu->addAction(ui.actionTextBesideIcon);
|
||||
|
@ -346,9 +346,8 @@ void MessagesDialog::processSettings(bool load)
|
|||
}
|
||||
|
||||
// state of splitter
|
||||
ui.msgSplitter->restoreState(Settings->value("Splitter").toByteArray());
|
||||
ui.msgSplitter_2->restoreState(Settings->value("Splitter2").toByteArray());
|
||||
ui.listSplitter->restoreState(Settings->value("Splitter3").toByteArray());
|
||||
ui.msgSplitter->restoreState(Settings->value("SplitterMsg").toByteArray());
|
||||
ui.listSplitter->restoreState(Settings->value("SplitterList").toByteArray());
|
||||
|
||||
/* toolbar button style */
|
||||
Qt::ToolButtonStyle style = (Qt::ToolButtonStyle) Settings->value("ToolButon_Style", Qt::ToolButtonIconOnly).toInt();
|
||||
|
@ -361,9 +360,8 @@ void MessagesDialog::processSettings(bool load)
|
|||
Settings->setValue("MessageTreeVersion", messageTreeVersion);
|
||||
|
||||
// state of splitter
|
||||
Settings->setValue("Splitter", ui.msgSplitter->saveState());
|
||||
Settings->setValue("Splitter2", ui.msgSplitter_2->saveState());
|
||||
Settings->setValue("Splitter3", ui.listSplitter->saveState());
|
||||
Settings->setValue("SplitterMsg", ui.msgSplitter->saveState());
|
||||
Settings->setValue("SplitterList", ui.listSplitter->saveState());
|
||||
|
||||
/* toolbar button style */
|
||||
Settings->setValue("ToolButon_Style", ui.newmessageButton->toolButtonStyle());
|
||||
|
@ -1527,8 +1525,8 @@ void MessagesDialog::insertMsgTxtAndFiles(QTreeWidgetItem *item, bool bSetToRead
|
|||
}
|
||||
}
|
||||
|
||||
msgWidget->fill(mCurrMsgId);
|
||||
updateInterface();
|
||||
msgWidget->fill(mCurrMsgId);
|
||||
}
|
||||
|
||||
bool MessagesDialog::getCurrentMsg(std::string &cid, std::string &mid)
|
||||
|
@ -1607,7 +1605,7 @@ void MessagesDialog::setToolbarButtonStyle(Qt::ToolButtonStyle style)
|
|||
ui.replyallmessageButton->setToolButtonStyle(style);
|
||||
ui.forwardmessageButton->setToolButtonStyle(style);
|
||||
ui.tagButton->setToolButtonStyle(style);
|
||||
ui.printbutton->setToolButtonStyle(style);
|
||||
ui.printButton->setToolButtonStyle(style);
|
||||
ui.viewtoolButton->setToolButtonStyle(style);
|
||||
}
|
||||
|
||||
|
@ -1710,23 +1708,23 @@ void MessagesDialog::updateMessageSummaryList()
|
|||
{
|
||||
case ROW_INBOX:
|
||||
textTotal = tr("Total:") + " " + QString::number(inboxCount);
|
||||
ui.total_label->setText(textTotal);
|
||||
ui.totalLabel->setText(textTotal);
|
||||
break;
|
||||
case ROW_OUTBOX:
|
||||
textTotal = tr("Total:") + " " + QString::number(newOutboxCount);
|
||||
ui.total_label->setText(textTotal);
|
||||
ui.totalLabel->setText(textTotal);
|
||||
break;
|
||||
case ROW_DRAFTBOX:
|
||||
textTotal = tr("Total:") + " " + QString::number(newDraftCount);
|
||||
ui.total_label->setText(textTotal);
|
||||
ui.totalLabel->setText(textTotal);
|
||||
break;
|
||||
case ROW_SENTBOX:
|
||||
textTotal = tr("Total:") + " " + QString::number(newSentboxCount);
|
||||
ui.total_label->setText(textTotal);
|
||||
ui.totalLabel->setText(textTotal);
|
||||
break;
|
||||
case ROW_TRASHBOX:
|
||||
textTotal = tr("Total:") + " " + QString::number(trashboxCount);
|
||||
ui.total_label->setText(textTotal);
|
||||
ui.totalLabel->setText(textTotal);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1967,7 +1965,7 @@ void MessagesDialog::connectActions()
|
|||
ui.replymessageButton->disconnect();
|
||||
ui.replyallmessageButton->disconnect();
|
||||
ui.forwardmessageButton->disconnect();
|
||||
ui.printbutton->disconnect();
|
||||
ui.printButton->disconnect();
|
||||
ui.actionPrint->disconnect();
|
||||
ui.actionPrintPreview->disconnect();
|
||||
ui.actionSaveAs->disconnect();
|
||||
|
@ -1994,7 +1992,7 @@ void MessagesDialog::connectActions()
|
|||
msg->connectAction(MessageWidget::ACTION_REPLY, ui.replymessageButton);
|
||||
msg->connectAction(MessageWidget::ACTION_REPLY_ALL, ui.replyallmessageButton);
|
||||
msg->connectAction(MessageWidget::ACTION_FORWARD, ui.forwardmessageButton);
|
||||
msg->connectAction(MessageWidget::ACTION_PRINT, ui.printbutton);
|
||||
msg->connectAction(MessageWidget::ACTION_PRINT, ui.printButton);
|
||||
msg->connectAction(MessageWidget::ACTION_PRINT, ui.actionPrint);
|
||||
msg->connectAction(MessageWidget::ACTION_PRINT_PREVIEW, ui.actionPrintPreview);
|
||||
msg->connectAction(MessageWidget::ACTION_SAVE_AS, ui.actionSaveAs);
|
||||
|
@ -2019,7 +2017,7 @@ void MessagesDialog::updateInterface()
|
|||
ui.replymessageButton->setEnabled(count == 1);
|
||||
ui.replyallmessageButton->setEnabled(count == 1);
|
||||
ui.forwardmessageButton->setEnabled(count == 1);
|
||||
ui.printbutton->setEnabled(count == 1);
|
||||
ui.printButton->setEnabled(count == 1);
|
||||
ui.actionPrint->setEnabled(count == 1);
|
||||
ui.actionPrintPreview->setEnabled(count == 1);
|
||||
ui.actionSaveAs->setEnabled(count == 1);
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<layout class="QGridLayout" name="toolBarFrameGLayout">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
|
@ -66,7 +66,7 @@
|
|||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="9">
|
||||
<widget class="Line" name="line_2">
|
||||
<widget class="Line" name="toolBarFrameLineR">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -219,7 +219,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="12">
|
||||
<widget class="QToolButton" name="printbutton">
|
||||
<widget class="QToolButton" name="printButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -454,7 +454,7 @@
|
|||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="images.qrc">
|
||||
<iconset resource="icons.qrc">
|
||||
<normaloff>:/icons/help_64.png</normaloff>:/icons/help_64.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
|
@ -466,7 +466,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="14">
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="toolBarFrameSpacerR">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -479,7 +479,7 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<spacer name="toolBarFrameSpacerL">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -495,7 +495,7 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="Line" name="line">
|
||||
<widget class="Line" name="toolBarFrameLineL">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -513,7 +513,7 @@
|
|||
<attribute name="title">
|
||||
<string notr="true">Main Tab</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<layout class="QGridLayout" name="tabGLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -535,7 +535,7 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QFrame" name="sideBarFrame">
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<layout class="QGridLayout" name="sideBarFrameGLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -629,7 +629,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="total_label">
|
||||
<widget class="QLabel" name="totalLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
|
@ -646,7 +646,7 @@
|
|||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QHBoxLayout" name="folderFrameHLayout">
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
|
@ -687,7 +687,7 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<layout class="QHBoxLayout" name="quickViewFrameHLayout">
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
|
@ -726,38 +726,33 @@
|
|||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QSplitter" name="msgSplitter_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<widget class="RSTreeWidget" name="messageTreeWidget">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<widget class="RSTreeWidget" name="messageTreeWidget">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="expandsOnDoubleClick">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="expandsOnDoubleClick">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QGridLayout" name="msgLayout"/>
|
||||
</widget>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<layout class="QGridLayout" name="msgLayout"/>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -838,6 +833,11 @@
|
|||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>StyledLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/StyledLabel.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>LineEditClear</class>
|
||||
<extends>QLineEdit</extends>
|
||||
|
@ -854,19 +854,14 @@
|
|||
<header>gui/common/RSTabWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>StyledLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/common/StyledLabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>replymessageButton</tabstop>
|
||||
<tabstop>listWidget</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="images.qrc"/>
|
||||
<include location="icons.qrc"/>
|
||||
<include location="images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -58,108 +58,90 @@
|
|||
#define IMAGE_MESSAGE ":/images/mail_new.png"
|
||||
|
||||
/* Images for Status icons */
|
||||
#define IMAGE_AUTHED ":/images/accepted16.png"
|
||||
|
||||
//following defined in model
|
||||
/*#define IMAGE_AUTHED ":/images/accepted16.png"
|
||||
#define IMAGE_DENIED ":/images/denied16.png"
|
||||
#define IMAGE_TRUSTED ":/images/rs-2.png"
|
||||
#define IMAGE_TRUSTED ":/images/rs-2.png" */
|
||||
|
||||
// Defines for key list columns
|
||||
#define COLUMN_CHECK 0
|
||||
|
||||
//following defined in model
|
||||
/*#define COLUMN_CHECK 0
|
||||
#define COLUMN_PEERNAME 1
|
||||
#define COLUMN_I_AUTH_PEER 2
|
||||
#define COLUMN_PEER_AUTH_ME 3
|
||||
#define COLUMN_PEERID 4
|
||||
#define COLUMN_LAST_USED 5
|
||||
#define COLUMN_COUNT 6
|
||||
#define COLUMN_COUNT 6 */
|
||||
|
||||
RsPeerId getNeighRsCertId(QTreeWidgetItem *i);
|
||||
//RsPeerId getNeighRsCertId(QTreeWidgetItem *i);
|
||||
|
||||
/******
|
||||
* #define NET_DEBUG 1
|
||||
*****/
|
||||
|
||||
static const unsigned int ROLE_SORT = Qt::UserRole + 1 ;
|
||||
//static const unsigned int ROLE_SORT = Qt::UserRole + 1 ;
|
||||
|
||||
/** Constructor */
|
||||
NetworkDialog::NetworkDialog(QWidget *parent)
|
||||
: RsAutoUpdatePage(10000,parent) // updates every 10 sec.
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
Q_UNUSED(parent);
|
||||
ui.setupUi(this);
|
||||
|
||||
connect( ui.connectTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connectTreeWidgetCostumPopupMenu( QPoint ) ) );
|
||||
connect( ui.connectTreeWidget, SIGNAL( itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT( peerdetails () ) );
|
||||
|
||||
connect( ui.filterLineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(filterItems(QString)));
|
||||
connect( ui.filterLineEdit, SIGNAL(filterChanged(int)), this, SLOT(filterColumnChanged(int)));
|
||||
|
||||
connect( ui.onlyTrustedKeys, SIGNAL(clicked()), this, SLOT(securedUpdateDisplay()));
|
||||
|
||||
/* hide the Tree +/- */
|
||||
ui.connectTreeWidget -> setRootIsDecorated( false );
|
||||
ui.connectTreeWidget -> setColumnCount(6);
|
||||
//list data model
|
||||
float f = QFontMetricsF(font()).height()/14.0 ;
|
||||
|
||||
compareNetworkRole = new RSTreeWidgetItemCompareRole;
|
||||
compareNetworkRole->setRole(COLUMN_LAST_USED, ROLE_SORT);
|
||||
PGPIdItemModel = new pgpid_item_model(neighs, f, this);
|
||||
PGPIdItemProxy = new pgpid_item_proxy(this);
|
||||
connect(ui.onlyTrustedKeys, SIGNAL(toggled(bool)), PGPIdItemProxy, SLOT(use_only_trusted_keys(bool)));
|
||||
PGPIdItemProxy->setSourceModel(PGPIdItemModel);
|
||||
PGPIdItemProxy->setFilterKeyColumn(COLUMN_PEERNAME);
|
||||
PGPIdItemProxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
PGPIdItemProxy->setSortRole(Qt::EditRole); //use edit role to get raw data since we do not have edit for this model.
|
||||
ui.connectTreeWidget->setModel(PGPIdItemProxy);
|
||||
ui.connectTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
ui.connectTreeWidget->verticalHeader()->hide();
|
||||
ui.connectTreeWidget->setShowGrid(false);
|
||||
ui.connectTreeWidget->setUpdatesEnabled(true);
|
||||
ui.connectTreeWidget->setSortingEnabled(true);
|
||||
ui.connectTreeWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
ui.connectTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
connect(ui.connectTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( connectTreeWidgetCostumPopupMenu( QPoint ) ) );
|
||||
connect(ui.connectTreeWidget, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(peerdetails()));
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * _header = ui.connectTreeWidget->header () ;
|
||||
/* QHeaderView * _header = ui.connectTreeWidget->header () ;
|
||||
QHeaderView_setSectionResizeModeColumn(_header, COLUMN_CHECK, QHeaderView::Custom);
|
||||
QHeaderView_setSectionResizeModeColumn(_header, COLUMN_PEERNAME, QHeaderView::Interactive);
|
||||
QHeaderView_setSectionResizeModeColumn(_header, COLUMN_I_AUTH_PEER, QHeaderView::Interactive);
|
||||
QHeaderView_setSectionResizeModeColumn(_header, COLUMN_PEER_AUTH_ME, QHeaderView::Interactive);
|
||||
QHeaderView_setSectionResizeModeColumn(_header, COLUMN_PEERID, QHeaderView::Interactive);
|
||||
QHeaderView_setSectionResizeModeColumn(_header, COLUMN_LAST_USED, QHeaderView::Interactive);
|
||||
QHeaderView_setSectionResizeModeColumn(_header, COLUMN_LAST_USED, QHeaderView::Interactive); */
|
||||
|
||||
_header->model()->setHeaderData(COLUMN_CHECK, Qt::Horizontal, tr(""));
|
||||
_header->model()->setHeaderData(COLUMN_PEERNAME, Qt::Horizontal, tr("Profile"));
|
||||
_header->model()->setHeaderData(COLUMN_I_AUTH_PEER, Qt::Horizontal, tr("Trust level"));
|
||||
_header->model()->setHeaderData(COLUMN_PEER_AUTH_ME, Qt::Horizontal, tr("Has signed your key?"));
|
||||
_header->model()->setHeaderData(COLUMN_PEERID, Qt::Horizontal, tr("Id"));
|
||||
_header->model()->setHeaderData(COLUMN_LAST_USED, Qt::Horizontal, tr("Last used"));
|
||||
|
||||
_header->model()->setHeaderData(COLUMN_CHECK, Qt::Horizontal, tr(" Do you accept connections signed by this profile?"),Qt::ToolTipRole);
|
||||
_header->model()->setHeaderData(COLUMN_PEERNAME, Qt::Horizontal, tr("Name of the profile"),Qt::ToolTipRole);
|
||||
_header->model()->setHeaderData(COLUMN_I_AUTH_PEER, Qt::Horizontal, tr("This column indicates trust level and whether you signed the profile PGP key"),Qt::ToolTipRole);
|
||||
_header->model()->setHeaderData(COLUMN_PEER_AUTH_ME, Qt::Horizontal, tr("Did that peer sign your own profile PGP key"),Qt::ToolTipRole);
|
||||
_header->model()->setHeaderData(COLUMN_PEERID, Qt::Horizontal, tr("PGP Key Id of that profile"),Qt::ToolTipRole);
|
||||
_header->model()->setHeaderData(COLUMN_LAST_USED, Qt::Horizontal, tr("Last time this key was used (received time, or to check connection)"),Qt::ToolTipRole);
|
||||
|
||||
float f = QFontMetricsF(font()).height()/14.0 ;
|
||||
|
||||
_header->resizeSection ( COLUMN_CHECK, 25*f );
|
||||
_header->resizeSection ( COLUMN_PEERNAME, 200*f );
|
||||
_header->resizeSection ( COLUMN_I_AUTH_PEER, 200*f );
|
||||
_header->resizeSection ( COLUMN_PEER_AUTH_ME, 200*f );
|
||||
_header->resizeSection ( COLUMN_LAST_USED, 75*f );
|
||||
|
||||
// set header text aligment
|
||||
QTreeWidgetItem * headerItem = ui.connectTreeWidget->headerItem();
|
||||
headerItem->setTextAlignment(COLUMN_CHECK, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
headerItem->setTextAlignment(COLUMN_PEERNAME, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
headerItem->setTextAlignment(COLUMN_I_AUTH_PEER, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
headerItem->setTextAlignment(COLUMN_PEER_AUTH_ME, Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
headerItem->setTextAlignment(COLUMN_PEERID, Qt::AlignVCenter);
|
||||
headerItem->setTextAlignment(COLUMN_LAST_USED, Qt::AlignVCenter);
|
||||
|
||||
headerItem->setText(0,QString()) ;
|
||||
|
||||
ui.connectTreeWidget->sortItems( COLUMN_PEERNAME, Qt::AscendingOrder );
|
||||
|
||||
ui.onlyTrustedKeys->setMinimumWidth(20*f);
|
||||
|
||||
QMenu *menu = new QMenu();
|
||||
/* QMenu *menu = new QMenu();
|
||||
menu->addAction(ui.actionTabsright);
|
||||
menu->addAction(ui.actionTabswest);
|
||||
menu->addAction(ui.actionTabssouth);
|
||||
menu->addAction(ui.actionTabsnorth);
|
||||
menu->addSeparator();
|
||||
menu->addAction(ui.actionTabsTriangular);
|
||||
menu->addAction(ui.actionTabsRounded);
|
||||
menu->addAction(ui.actionTabsRounded); */
|
||||
|
||||
/* add filter actions */
|
||||
ui.filterLineEdit->addFilter(QIcon(), tr("Name"), COLUMN_PEERNAME, tr("Search name"));
|
||||
ui.filterLineEdit->addFilter(QIcon(), tr("Peer ID"), COLUMN_PEERID, tr("Search peer ID"));
|
||||
ui.filterLineEdit->setCurrentFilter(COLUMN_PEERNAME);
|
||||
connect(ui.filterLineEdit, SIGNAL(textChanged(QString)), PGPIdItemProxy, SLOT(setFilterWildcard(QString)));
|
||||
|
||||
}
|
||||
|
||||
void NetworkDialog::changeEvent(QEvent *e)
|
||||
|
@ -177,14 +159,16 @@ void NetworkDialog::changeEvent(QEvent *e)
|
|||
|
||||
void NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint /*point*/ )
|
||||
{
|
||||
//std::cerr << "NetworkDialog::connectTreeWidgetCostumPopupMenu( QPoint point ) called" << std::endl;
|
||||
QTreeWidgetItem *wi = getCurrentNeighbour();
|
||||
if (!wi)
|
||||
return;
|
||||
|
||||
QModelIndexList l = ui.connectTreeWidget->selectionModel()->selection().indexes();
|
||||
if(l.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QMenu *contextMnu = new QMenu;
|
||||
|
||||
RsPgpId peer_id(wi->text(COLUMN_PEERID).toStdString()) ;
|
||||
RsPgpId peer_id(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l.begin()->row(), COLUMN_PEERID)).toString().toStdString()) ;
|
||||
|
||||
// That's what context menus are made for
|
||||
RsPeerDetails detail;
|
||||
|
@ -271,13 +255,17 @@ void NetworkDialog::removeUnusedKeys()
|
|||
}
|
||||
QMessageBox::warning(NULL,tr("Keyring info"),tr("Key removal has failed. Your keyring remains intact.\n\nReported error:")+" "+error_string ) ;
|
||||
}
|
||||
insertConnect() ;
|
||||
updateDisplay();
|
||||
// insertConnect() ;
|
||||
}
|
||||
|
||||
void NetworkDialog::denyFriend()
|
||||
{
|
||||
QTreeWidgetItem *wi = getCurrentNeighbour();
|
||||
RsPgpId peer_id( wi->text(COLUMN_PEERID).toStdString() );
|
||||
QModelIndexList l = ui.connectTreeWidget->selectionModel()->selection().indexes();
|
||||
if(l.empty())
|
||||
return;
|
||||
|
||||
RsPgpId peer_id(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l.begin()->row(), COLUMN_PEERID)).toString().toStdString());
|
||||
rsPeers->removeFriend(peer_id) ;
|
||||
|
||||
securedUpdateDisplay();
|
||||
|
@ -300,27 +288,32 @@ void NetworkDialog::denyFriend()
|
|||
|
||||
void NetworkDialog::makeFriend()
|
||||
{
|
||||
PGPKeyDialog::showIt(RsPgpId(getCurrentNeighbour()->text(COLUMN_PEERID).toStdString()), PGPKeyDialog::PageDetails);
|
||||
|
||||
QModelIndexList l = ui.connectTreeWidget->selectionModel()->selection().indexes();
|
||||
if(l.empty())
|
||||
return;
|
||||
|
||||
PGPKeyDialog::showIt(RsPgpId(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l.begin()->row(), COLUMN_PEERID)).toString().toStdString()), PGPKeyDialog::PageDetails);
|
||||
}
|
||||
|
||||
/** Shows Peer Information/Auth Dialog */
|
||||
void NetworkDialog::peerdetails()
|
||||
{
|
||||
QTreeWidgetItem* item = getCurrentNeighbour();
|
||||
if (item == NULL) {
|
||||
return;
|
||||
}
|
||||
PGPKeyDialog::showIt(RsPgpId(item->text(COLUMN_PEERID).toStdString()), PGPKeyDialog::PageDetails);
|
||||
QModelIndexList l = ui.connectTreeWidget->selectionModel()->selection().indexes();
|
||||
if(l.empty())
|
||||
return;
|
||||
|
||||
PGPKeyDialog::showIt(RsPgpId(ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l.begin()->row(), COLUMN_PEERID)).toString().toStdString()), PGPKeyDialog::PageDetails);
|
||||
}
|
||||
|
||||
void NetworkDialog::copyLink()
|
||||
{
|
||||
QTreeWidgetItem *wi = getCurrentNeighbour();
|
||||
if (wi == NULL) {
|
||||
return;
|
||||
}
|
||||
QModelIndexList l = ui.connectTreeWidget->selectionModel()->selection().indexes();
|
||||
if(l.empty())
|
||||
return;
|
||||
|
||||
RsPgpId peer_id ( wi->text(COLUMN_PEERID).toStdString() ) ;
|
||||
|
||||
RsPgpId peer_id (ui.connectTreeWidget->model()->data(ui.connectTreeWidget->model()->index(l.begin()->row(), COLUMN_PEERID)).toString().toStdString()) ;
|
||||
|
||||
QList<RetroShareLink> urls;
|
||||
RetroShareLink link = RetroShareLink::createPerson(peer_id);
|
||||
|
@ -356,225 +349,14 @@ void NetworkDialog::copyLink()
|
|||
// /* window will destroy itself! */
|
||||
//}
|
||||
|
||||
void NetworkDialog::updateDisplay()
|
||||
{
|
||||
insertConnect() ;
|
||||
}
|
||||
|
||||
/* get the list of Neighbours from the RsIface. */
|
||||
void NetworkDialog::insertConnect()
|
||||
{
|
||||
// static time_t last_time = 0 ;
|
||||
|
||||
if (!rsPeers)
|
||||
return;
|
||||
|
||||
// // Because this is called from a qt signal, there's no limitation between calls.
|
||||
time_t now = time(NULL);
|
||||
|
||||
std::list<RsPgpId> neighs; //these are GPG ids
|
||||
std::list<RsPgpId>::iterator it;
|
||||
rsPeers->getGPGAllList(neighs);
|
||||
|
||||
/* get a link to the table */
|
||||
QTreeWidget *connectWidget = ui.connectTreeWidget;
|
||||
/* disable sorting while editing the table */
|
||||
connectWidget->setSortingEnabled(false);
|
||||
|
||||
//remove items
|
||||
int index = 0;
|
||||
while (index < connectWidget->topLevelItemCount())
|
||||
{
|
||||
RsPgpId gpg_widget_id( (connectWidget->topLevelItem(index))->text(COLUMN_PEERID).toStdString() );
|
||||
RsPeerDetails detail;
|
||||
if ( (!rsPeers->getGPGDetails(gpg_widget_id, detail)) || (ui.onlyTrustedKeys->isChecked() && (detail.validLvl < RS_TRUST_LVL_MARGINAL && !detail.accept_connection)))
|
||||
delete (connectWidget->takeTopLevelItem(index));
|
||||
else
|
||||
++index;
|
||||
}
|
||||
|
||||
for(it = neighs.begin(); it != neighs.end(); ++it)
|
||||
{
|
||||
#ifdef NET_DEBUG
|
||||
std::cerr << "NetworkDialog::insertConnect() inserting gpg key : " << *it << std::endl;
|
||||
#endif
|
||||
if (*it == rsPeers->getGPGOwnId()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getGPGDetails(*it, detail))
|
||||
{
|
||||
continue; /* BAD */
|
||||
}
|
||||
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *item;
|
||||
QList<QTreeWidgetItem *> list = connectWidget->findItems(QString::fromStdString( (*it).toStdString() ), Qt::MatchExactly, COLUMN_PEERID);
|
||||
if (list.size() == 1) {
|
||||
item = list.front();
|
||||
} else {
|
||||
//create new item
|
||||
#ifdef NET_DEBUG
|
||||
std::cerr << "NetworkDialog::insertConnect() creating new tree widget item : " << *it << std::endl;
|
||||
#endif
|
||||
item = new RSTreeWidgetItem(compareNetworkRole, 0);
|
||||
item -> setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
|
||||
|
||||
int S = QFontMetricsF(font()).height() ;
|
||||
item -> setSizeHint(COLUMN_CHECK, QSize( S,S ) );
|
||||
|
||||
/* (1) Person */
|
||||
item -> setText(COLUMN_PEERNAME, QString::fromUtf8(detail.name.c_str()));
|
||||
|
||||
/* (4) key id */
|
||||
item -> setText(COLUMN_PEERID, QString::fromStdString(detail.gpg_id.toStdString()));
|
||||
}
|
||||
|
||||
//QString TrustLevelString ;
|
||||
|
||||
/* (2) Key validity */
|
||||
if (detail.ownsign)
|
||||
{
|
||||
item -> setText(COLUMN_I_AUTH_PEER, tr("Personal signature"));
|
||||
item -> setToolTip(COLUMN_I_AUTH_PEER, tr("PGP key signed by you"));
|
||||
}
|
||||
else
|
||||
switch(detail.trustLvl)
|
||||
{
|
||||
case RS_TRUST_LVL_MARGINAL: item->setText(COLUMN_I_AUTH_PEER,tr("Marginally trusted peer")) ; break;
|
||||
case RS_TRUST_LVL_FULL:
|
||||
case RS_TRUST_LVL_ULTIMATE: item->setText(COLUMN_I_AUTH_PEER,tr("Fully trusted peer")) ; break ;
|
||||
case RS_TRUST_LVL_UNKNOWN:
|
||||
case RS_TRUST_LVL_UNDEFINED:
|
||||
case RS_TRUST_LVL_NEVER:
|
||||
default: item->setText(2,tr("Untrusted peer")) ; break ;
|
||||
}
|
||||
|
||||
/* (3) has me auth */
|
||||
QString PeerAuthenticationString ;
|
||||
|
||||
if (detail.hasSignedMe)
|
||||
PeerAuthenticationString = tr("Yes");
|
||||
else
|
||||
PeerAuthenticationString = tr("No");
|
||||
|
||||
item->setText(COLUMN_PEER_AUTH_ME,PeerAuthenticationString) ;
|
||||
|
||||
uint64_t last_time_used = now - detail.lastUsed ;
|
||||
QString lst_used_str ;
|
||||
|
||||
if(last_time_used < 3600)
|
||||
lst_used_str = tr("Last hour") ;
|
||||
else if(last_time_used < 86400)
|
||||
lst_used_str = tr("Today") ;
|
||||
else if(last_time_used > 86400 * 15000)
|
||||
lst_used_str = tr("Never");
|
||||
else
|
||||
lst_used_str = tr("%1 days ago").arg((int)( last_time_used / 86400 )) ;
|
||||
|
||||
QString lst_used_sort_str = QString::number(detail.lastUsed,'f',10);
|
||||
|
||||
item->setText(COLUMN_LAST_USED,lst_used_str) ;
|
||||
item->setData(COLUMN_LAST_USED,ROLE_SORT,lst_used_sort_str) ;
|
||||
|
||||
/**
|
||||
* Determinated the Background Color
|
||||
*/
|
||||
QColor backgrndcolor;
|
||||
|
||||
if (detail.accept_connection)
|
||||
{
|
||||
item -> setText(COLUMN_CHECK, "0");
|
||||
item -> setIcon(COLUMN_CHECK,(QIcon(IMAGE_AUTHED)));
|
||||
if (detail.ownsign)
|
||||
{
|
||||
backgrndcolor = backgroundColorOwnSign();
|
||||
}
|
||||
else
|
||||
{
|
||||
backgrndcolor = backgroundColorAcceptConnection();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item -> setText(COLUMN_CHECK, "1");
|
||||
|
||||
if (detail.hasSignedMe)
|
||||
{
|
||||
backgrndcolor = backgroundColorHasSignedMe();
|
||||
item -> setIcon(COLUMN_CHECK,(QIcon(IMAGE_DENIED)));
|
||||
for(int k=0;k<COLUMN_COUNT;++k)
|
||||
item -> setToolTip(k, QString::fromUtf8(detail.name.c_str()) + tr(" has authenticated you. \nRight-click and select 'make friend' to be able to connect."));
|
||||
}
|
||||
else
|
||||
{
|
||||
backgrndcolor = backgroundColorDenied();
|
||||
item -> setIcon(COLUMN_CHECK,(QIcon(IMAGE_DENIED)));
|
||||
}
|
||||
}
|
||||
|
||||
// Color each Background column in the Network Tab except the first one => 1-9
|
||||
// whith the determinated color
|
||||
for(int i = 0; i <COLUMN_COUNT; ++i)
|
||||
item -> setBackground(i,QBrush(backgrndcolor));
|
||||
|
||||
if( (detail.accept_connection || detail.validLvl >= RS_TRUST_LVL_MARGINAL) || !ui.onlyTrustedKeys->isChecked())
|
||||
connectWidget->addTopLevelItem(item);
|
||||
}
|
||||
|
||||
// add self to network.
|
||||
RsPeerDetails ownGPGDetails;
|
||||
rsPeers->getGPGDetails(rsPeers->getGPGOwnId(), ownGPGDetails);
|
||||
/* make a widget per friend */
|
||||
QTreeWidgetItem *self_item;
|
||||
QList<QTreeWidgetItem *> list = connectWidget->findItems(QString::fromStdString(ownGPGDetails.gpg_id.toStdString()), Qt::MatchExactly, COLUMN_PEERID);
|
||||
if (list.size() == 1) {
|
||||
self_item = list.front();
|
||||
} else {
|
||||
self_item = new RSTreeWidgetItem(compareNetworkRole, 0);
|
||||
self_item->setChildIndicatorPolicy(QTreeWidgetItem::DontShowIndicatorWhenChildless);
|
||||
}
|
||||
self_item -> setText(COLUMN_CHECK, "0");
|
||||
self_item->setIcon(COLUMN_CHECK,(QIcon(IMAGE_AUTHED)));
|
||||
self_item->setText(COLUMN_PEERNAME, QString::fromUtf8(ownGPGDetails.name.c_str()) + " (" + tr("yourself") + ")");
|
||||
self_item->setText(COLUMN_I_AUTH_PEER,"N/A");
|
||||
self_item->setText(COLUMN_PEERID, QString::fromStdString(ownGPGDetails.gpg_id.toStdString()));
|
||||
|
||||
// Color each Background column in the Network Tab except the first one => 1-9
|
||||
for(int i=0;i<COLUMN_COUNT;++i)
|
||||
{
|
||||
self_item->setBackground(i,backgroundColorSelf()) ;
|
||||
}
|
||||
connectWidget->addTopLevelItem(self_item);
|
||||
|
||||
/* enable sorting */
|
||||
connectWidget->setSortingEnabled(true);
|
||||
/* update display */
|
||||
connectWidget->update();
|
||||
|
||||
if (ui.filterLineEdit->text().isEmpty() == false) {
|
||||
filterItems(ui.filterLineEdit->text());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QTreeWidgetItem *NetworkDialog::getCurrentNeighbour()
|
||||
{
|
||||
if (ui.connectTreeWidget->selectedItems().size() != 0)
|
||||
{
|
||||
return ui.connectTreeWidget -> currentItem();
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Utility Fns */
|
||||
RsPeerId getNeighRsCertId(QTreeWidgetItem *i)
|
||||
/*RsPeerId getNeighRsCertId(QTreeWidgetItem *i)
|
||||
{
|
||||
RsPeerId id ( (i -> text(COLUMN_PEERID)).toStdString() );
|
||||
return id;
|
||||
}
|
||||
} */
|
||||
void NetworkDialog::on_actionAddFriend_activated()
|
||||
{
|
||||
// /* Create a new input dialog, which allows users to create files, too */
|
||||
|
@ -700,44 +482,23 @@ void NetworkDialog::on_actionCreate_New_Profile_activated()
|
|||
// Settings->endGroup();
|
||||
// }
|
||||
|
||||
void NetworkDialog::filterColumnChanged(int)
|
||||
void NetworkDialog::filterColumnChanged(int col)
|
||||
{
|
||||
filterItems(ui.filterLineEdit->text());
|
||||
if(PGPIdItemProxy)
|
||||
PGPIdItemProxy->setFilterKeyColumn(col);
|
||||
//filterItems(ui.filterLineEdit->text());
|
||||
}
|
||||
|
||||
void NetworkDialog::filterItems(const QString &text)
|
||||
{
|
||||
int filterColumn = ui.filterLineEdit->currentFilter();
|
||||
|
||||
int count = ui.connectTreeWidget->topLevelItemCount ();
|
||||
for (int index = 0; index < count; ++index) {
|
||||
filterItem(ui.connectTreeWidget->topLevelItem(index), text, filterColumn);
|
||||
}
|
||||
|
||||
void NetworkDialog::updateDisplay()
|
||||
{
|
||||
if (!rsPeers)
|
||||
return;
|
||||
//update ids list
|
||||
std::list<RsPgpId> new_neighs;
|
||||
rsPeers->getGPGAllList(new_neighs);
|
||||
//refresh model
|
||||
PGPIdItemModel->data_updated(new_neighs);
|
||||
}
|
||||
|
||||
bool NetworkDialog::filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn)
|
||||
{
|
||||
bool visible = true;
|
||||
|
||||
if (text.isEmpty() == false) {
|
||||
if (item->text(filterColumn).contains(text, Qt::CaseInsensitive) == false) {
|
||||
visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
int visibleChildCount = 0;
|
||||
int count = item->childCount();
|
||||
for (int index = 0; index < count; ++index) {
|
||||
if (filterItem(item->child(index), text, filterColumn)) {
|
||||
++visibleChildCount;
|
||||
}
|
||||
}
|
||||
|
||||
if (visible || visibleChildCount) {
|
||||
item->setHidden(false);
|
||||
} else {
|
||||
item->setHidden(true);
|
||||
}
|
||||
|
||||
return (visible || visibleChildCount);
|
||||
}
|
||||
|
|
|
@ -25,9 +25,15 @@
|
|||
|
||||
#include "ui_NetworkDialog.h"
|
||||
#include "RsAutoUpdatePage.h"
|
||||
#include "gui/NetworkDialog/pgpid_item_model.h"
|
||||
#include "gui/NetworkDialog/pgpid_item_proxy.h"
|
||||
|
||||
//tmp
|
||||
class QTreeWidgetItem;
|
||||
|
||||
class RSTreeWidgetItemCompareRole ;
|
||||
|
||||
|
||||
class NetworkDialog : public RsAutoUpdatePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -42,23 +48,22 @@ public:
|
|||
/** Default Constructor */
|
||||
NetworkDialog(QWidget *parent = 0);
|
||||
|
||||
//void load();
|
||||
virtual void updateDisplay() ; // overloaded from RsAutoUpdatePage
|
||||
|
||||
|
||||
QColor backgroundColorSelf() const { return mBackgroundColorSelf; }
|
||||
QColor backgroundColorOwnSign() const { return mBackgroundColorOwnSign; }
|
||||
QColor backgroundColorAcceptConnection() const { return mBackgroundColorAcceptConnection; }
|
||||
QColor backgroundColorHasSignedMe() const { return mBackgroundColorHasSignedMe; }
|
||||
QColor backgroundColorDenied() const { return mBackgroundColorDenied; }
|
||||
|
||||
void setBackgroundColorSelf(QColor color) { mBackgroundColorSelf = color; }
|
||||
void setBackgroundColorOwnSign(QColor color) { mBackgroundColorOwnSign = color; }
|
||||
void setBackgroundColorAcceptConnection(QColor color) { mBackgroundColorAcceptConnection = color; }
|
||||
void setBackgroundColorHasSignedMe(QColor color) { mBackgroundColorHasSignedMe = color; }
|
||||
void setBackgroundColorDenied(QColor color) { mBackgroundColorDenied = color; }
|
||||
void setBackgroundColorSelf(QColor color) { PGPIdItemModel->setBackgroundColorSelf(color); mBackgroundColorSelf = color; }
|
||||
void setBackgroundColorOwnSign(QColor color) { PGPIdItemModel->setBackgroundColorOwnSign(color); mBackgroundColorOwnSign = color; }
|
||||
void setBackgroundColorAcceptConnection(QColor color) { PGPIdItemModel->setBackgroundColorAcceptConnection(color); mBackgroundColorAcceptConnection = color; }
|
||||
void setBackgroundColorHasSignedMe(QColor color) { PGPIdItemModel->setBackgroundColorHasSignedMe(color); mBackgroundColorHasSignedMe = color; }
|
||||
void setBackgroundColorDenied(QColor color) { PGPIdItemModel->setBackgroundColorDenied(color); mBackgroundColorDenied = color; }
|
||||
|
||||
private:
|
||||
void insertConnect();
|
||||
// void insertConnect();
|
||||
// std::string loadneighbour();
|
||||
/* void loadneighbour(); */
|
||||
//void updateNewDiscoveryInfo() ;
|
||||
|
@ -68,7 +73,7 @@ protected:
|
|||
|
||||
private slots:
|
||||
|
||||
void removeUnusedKeys() ;
|
||||
void removeUnusedKeys() ;
|
||||
void makeFriend() ;
|
||||
void denyFriend() ;
|
||||
// void deleteCert() ;
|
||||
|
@ -104,14 +109,15 @@ private slots:
|
|||
// void on_actionTabsTriangular_activated();
|
||||
|
||||
void filterColumnChanged(int);
|
||||
void filterItems(const QString &text);
|
||||
// void filterItems(const QString &text);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
QTreeWidgetItem *getCurrentNeighbour();
|
||||
|
||||
// class NetworkView *networkview;
|
||||
|
||||
bool filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn);
|
||||
// bool filterItem(QTreeWidgetItem *item, const QString &text, int filterColumn);
|
||||
|
||||
/* Color definitions (for standard see qss.default) */
|
||||
QColor mBackgroundColorSelf;
|
||||
|
@ -122,6 +128,12 @@ private:
|
|||
|
||||
RSTreeWidgetItemCompareRole *compareNetworkRole ;
|
||||
|
||||
//iinternal long lived data
|
||||
std::list<RsPgpId> neighs;
|
||||
|
||||
pgpid_item_model *PGPIdItemModel;
|
||||
pgpid_item_proxy *PGPIdItemProxy;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::NetworkDialog ui;
|
||||
};
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QTreeWidget" name="connectTreeWidget">
|
||||
<widget class="QTableView" name="connectTreeWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
|
@ -66,63 +66,6 @@
|
|||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="uniformRowHeights">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="animated">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="headerCascadingSectionResizes">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="headerDefaultSectionSize">
|
||||
<number>200</number>
|
||||
</attribute>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Profile</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Did I authenticated peer</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Did I sign his PGP key</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Has signed my key</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Cert Id</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Last used</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
348
retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp
Normal file
348
retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.cpp
Normal file
|
@ -0,0 +1,348 @@
|
|||
#include "pgpid_item_model.h"
|
||||
#include <time.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <QIcon>
|
||||
#include <QBrush>
|
||||
|
||||
|
||||
/*TODO:
|
||||
* using list here for internal data storage is not best option
|
||||
*/
|
||||
pgpid_item_model::pgpid_item_model(std::list<RsPgpId> &neighs_, float &_font_height, QObject *parent)
|
||||
: QAbstractTableModel(parent), neighs(neighs_), font_height(_font_height)
|
||||
{
|
||||
}
|
||||
|
||||
QVariant pgpid_item_model::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if(orientation == Qt::Horizontal)
|
||||
{
|
||||
if(role == Qt::ToolTipRole)
|
||||
{
|
||||
switch(section)
|
||||
{
|
||||
case COLUMN_CHECK:
|
||||
return QString(tr(" Do you accept connections signed by this profile?"));
|
||||
break;
|
||||
case COLUMN_PEERNAME:
|
||||
return QString(tr("Name of the profile"));
|
||||
break;
|
||||
case COLUMN_I_AUTH_PEER:
|
||||
return QString(tr("This column indicates trust level and whether you signed the profile PGP key"));
|
||||
break;
|
||||
case COLUMN_PEER_AUTH_ME:
|
||||
return QString(tr("Did that peer sign your own profile PGP key"));
|
||||
break;
|
||||
case COLUMN_PEERID:
|
||||
return QString(tr("PGP Key Id of that profile"));
|
||||
break;
|
||||
case COLUMN_LAST_USED:
|
||||
return QString(tr("Last time this key was used (received time, or to check connection)"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(role == Qt::DisplayRole)
|
||||
{
|
||||
switch(section)
|
||||
{
|
||||
case COLUMN_CHECK:
|
||||
return QString(tr("Connections"));
|
||||
break;
|
||||
case COLUMN_PEERNAME:
|
||||
return QString(tr("Profile"));
|
||||
break;
|
||||
case COLUMN_I_AUTH_PEER:
|
||||
return QString(tr("Trust level"));
|
||||
break;
|
||||
case COLUMN_PEER_AUTH_ME:
|
||||
return QString(tr("Has signed your key?"));
|
||||
break;
|
||||
case COLUMN_PEERID:
|
||||
return QString(tr("Id"));
|
||||
break;
|
||||
case COLUMN_LAST_USED:
|
||||
return QString(tr("Last used"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (role == Qt::TextAlignmentRole)
|
||||
{
|
||||
switch(section)
|
||||
{
|
||||
default:
|
||||
return (uint32_t)(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(role == Qt::SizeHintRole)
|
||||
{
|
||||
switch(section)
|
||||
{
|
||||
case COLUMN_CHECK:
|
||||
return 25*font_height;
|
||||
break;
|
||||
case COLUMN_PEERNAME: case COLUMN_I_AUTH_PEER: case COLUMN_PEER_AUTH_ME:
|
||||
return 200*font_height;
|
||||
break;
|
||||
case COLUMN_LAST_USED:
|
||||
return 75*font_height;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
int pgpid_item_model::rowCount(const QModelIndex &/*parent*/) const
|
||||
{
|
||||
return neighs.size();
|
||||
}
|
||||
|
||||
int pgpid_item_model::columnCount(const QModelIndex &/*parent*/) const
|
||||
{
|
||||
return COLUMN_COUNT;
|
||||
}
|
||||
|
||||
|
||||
QVariant pgpid_item_model::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if((unsigned)index.row() >= neighs.size())
|
||||
return QVariant();
|
||||
|
||||
|
||||
//shit code (please rewrite it)
|
||||
|
||||
std::list<RsPgpId>::iterator it = neighs.begin();
|
||||
for(int i = 0; i < index.row(); i++)
|
||||
it++;
|
||||
RsPeerDetails detail;
|
||||
if (!rsPeers->getGPGDetails(*it, detail))
|
||||
return QVariant();
|
||||
//shit code end
|
||||
if(role == Qt::EditRole) //some columns return raw data for editrole, used for proper filtering
|
||||
{
|
||||
switch(index.column())
|
||||
{
|
||||
case COLUMN_LAST_USED:
|
||||
return detail.lastUsed;
|
||||
break;
|
||||
case COLUMN_I_AUTH_PEER:
|
||||
{
|
||||
if (detail.ownsign)
|
||||
return RS_TRUST_LVL_ULTIMATE;
|
||||
return detail.trustLvl;
|
||||
}
|
||||
break;
|
||||
case COLUMN_PEER_AUTH_ME:
|
||||
return detail.hasSignedMe;
|
||||
break;
|
||||
case COLUMN_CHECK:
|
||||
return detail.accept_connection;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
//we using editrole only where it is useful, for other data we use display, so no "else if" here
|
||||
if(role == Qt::DisplayRole || role == Qt::EditRole)
|
||||
{
|
||||
switch(index.column())
|
||||
{
|
||||
case COLUMN_PEERNAME:
|
||||
return QString::fromUtf8(detail.name.c_str());
|
||||
break;
|
||||
case COLUMN_PEERID:
|
||||
return QString::fromStdString(detail.gpg_id.toStdString());
|
||||
break;
|
||||
case COLUMN_I_AUTH_PEER:
|
||||
{
|
||||
if (detail.ownsign)
|
||||
return tr("Personal signature");
|
||||
else
|
||||
{
|
||||
switch(detail.trustLvl)
|
||||
{
|
||||
case RS_TRUST_LVL_MARGINAL: return tr("Marginally trusted peer") ; break;
|
||||
case RS_TRUST_LVL_FULL:
|
||||
case RS_TRUST_LVL_ULTIMATE: return tr("Fully trusted peer") ; break ;
|
||||
case RS_TRUST_LVL_UNKNOWN:
|
||||
case RS_TRUST_LVL_UNDEFINED:
|
||||
case RS_TRUST_LVL_NEVER:
|
||||
default: return tr("Untrusted peer") ; break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case COLUMN_PEER_AUTH_ME:
|
||||
{
|
||||
if (detail.hasSignedMe)
|
||||
return tr("Yes");
|
||||
else
|
||||
return tr("No");
|
||||
}
|
||||
break;
|
||||
case COLUMN_LAST_USED:
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
uint64_t last_time_used = now - detail.lastUsed ;
|
||||
QString lst_used_str ;
|
||||
|
||||
if(last_time_used < 3600)
|
||||
lst_used_str = tr("Last hour") ;
|
||||
else if(last_time_used < 86400)
|
||||
lst_used_str = tr("Today") ;
|
||||
else if(last_time_used > 86400 * 15000)
|
||||
lst_used_str = tr("Never");
|
||||
else
|
||||
lst_used_str = tr("%1 days ago").arg((int)( last_time_used / 86400 )) ;
|
||||
|
||||
|
||||
return lst_used_str;
|
||||
}
|
||||
break;
|
||||
case COLUMN_CHECK:
|
||||
{
|
||||
if (detail.accept_connection)
|
||||
{
|
||||
return tr("Accepted");
|
||||
}
|
||||
else
|
||||
{
|
||||
return tr(" - ");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else if(role == Qt::ToolTipRole)
|
||||
{
|
||||
switch(index.column())
|
||||
{
|
||||
case COLUMN_I_AUTH_PEER:
|
||||
{
|
||||
if (detail.ownsign)
|
||||
return tr("PGP key signed by you");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
if (!detail.accept_connection && detail.hasSignedMe)
|
||||
{
|
||||
return QString::fromUtf8(detail.name.c_str()) + tr(" has authenticated you. \nRight-click and select 'make friend' to be able to connect.");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
else if(role == Qt::DecorationRole)
|
||||
{
|
||||
switch(index.column())
|
||||
{
|
||||
case COLUMN_CHECK:
|
||||
{
|
||||
if (detail.accept_connection)
|
||||
return QIcon(IMAGE_AUTHED);
|
||||
else
|
||||
return QIcon(IMAGE_DENIED);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(role == Qt::BackgroundRole)
|
||||
{
|
||||
if (detail.accept_connection)
|
||||
{
|
||||
if (detail.ownsign)
|
||||
{
|
||||
return QBrush(mBackgroundColorOwnSign);
|
||||
}
|
||||
else
|
||||
{
|
||||
return QBrush(mBackgroundColorAcceptConnection);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (detail.hasSignedMe)
|
||||
{
|
||||
return QBrush(mBackgroundColorHasSignedMe);
|
||||
}
|
||||
else
|
||||
{
|
||||
return QBrush(mBackgroundColorDenied);
|
||||
}
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
||||
//following code is just a poc, it's still suboptimal, unefficient, but much better then existing rs code
|
||||
|
||||
void pgpid_item_model::data_updated(std::list<RsPgpId> &new_neighs)
|
||||
{
|
||||
|
||||
//shit code follow (rewrite this please)
|
||||
size_t old_size = neighs.size(), new_size = 0;
|
||||
std::list<RsPgpId> old_neighs = neighs;
|
||||
|
||||
new_size = new_neighs.size();
|
||||
//set model data to new cleaned up data
|
||||
neighs = new_neighs;
|
||||
neighs.sort();
|
||||
neighs.unique(); //remove possible dups
|
||||
|
||||
//reflect actual row count in model
|
||||
if(old_size < new_size)
|
||||
{
|
||||
beginInsertRows(QModelIndex(), old_size, new_size);
|
||||
insertRows(old_size, new_size - old_size);
|
||||
endInsertRows();
|
||||
}
|
||||
else if(new_size < old_size)
|
||||
{
|
||||
beginRemoveRows(QModelIndex(), new_size, old_size);
|
||||
removeRows(old_size, old_size - new_size);
|
||||
endRemoveRows();
|
||||
}
|
||||
//update data in ui, to avoid unnecessary redraw and ui updates, updating only changed elements
|
||||
//TODO: libretroshare should implement a way to obtain only changed elements via some signalling non-blocking api.
|
||||
{
|
||||
size_t ii1 = 0;
|
||||
for(auto i1 = neighs.begin(), end1 = neighs.end(), i2 = old_neighs.begin(), end2 = old_neighs.end(); i1 != end1; ++i1, ++i2, ii1++)
|
||||
{
|
||||
if(i2 == end2)
|
||||
break;
|
||||
if(*i1 != *i2)
|
||||
{
|
||||
QModelIndex topLeft = createIndex(ii1,0), bottomRight = createIndex(ii1, COLUMN_COUNT-1);
|
||||
emit dataChanged(topLeft, bottomRight);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(new_size > old_size)
|
||||
{
|
||||
QModelIndex topLeft = createIndex(old_size ? old_size -1 : 0 ,0), bottomRight = createIndex(new_size -1, COLUMN_COUNT-1);
|
||||
emit dataChanged(topLeft, bottomRight);
|
||||
}
|
||||
//dirty solution for initial data fetch
|
||||
//TODO: do it properly!
|
||||
if(!old_size)
|
||||
{
|
||||
beginResetModel();
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
//shit code end
|
||||
}
|
||||
|
58
retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.h
Normal file
58
retroshare-gui/src/gui/NetworkDialog/pgpid_item_model.h
Normal file
|
@ -0,0 +1,58 @@
|
|||
#ifndef KEY_ITEM_MODEL_H
|
||||
#define KEY_ITEM_MODEL_H
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <QColor>
|
||||
|
||||
#define IMAGE_AUTHED ":/images/accepted16.png"
|
||||
#define IMAGE_DENIED ":/images/denied16.png"
|
||||
#define IMAGE_TRUSTED ":/images/rs-2.png"
|
||||
|
||||
|
||||
#define COLUMN_CHECK 0
|
||||
#define COLUMN_PEERNAME 1
|
||||
#define COLUMN_I_AUTH_PEER 2
|
||||
#define COLUMN_PEER_AUTH_ME 3
|
||||
#define COLUMN_PEERID 4
|
||||
#define COLUMN_LAST_USED 5
|
||||
#define COLUMN_COUNT 6
|
||||
|
||||
|
||||
class pgpid_item_model : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit pgpid_item_model(std::list<RsPgpId> &neighs, float &font_height, QObject *parent = nullptr);
|
||||
|
||||
// Header:
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const ;
|
||||
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const ;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const ;
|
||||
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const ;
|
||||
|
||||
void setBackgroundColorSelf(QColor color) { mBackgroundColorSelf = color; }
|
||||
void setBackgroundColorOwnSign(QColor color) { mBackgroundColorOwnSign = color; }
|
||||
void setBackgroundColorAcceptConnection(QColor color) { mBackgroundColorAcceptConnection = color; }
|
||||
void setBackgroundColorHasSignedMe(QColor color) { mBackgroundColorHasSignedMe = color; }
|
||||
void setBackgroundColorDenied(QColor color) { mBackgroundColorDenied = color; }
|
||||
|
||||
|
||||
public slots:
|
||||
void data_updated(std::list<RsPgpId> &new_neighs);
|
||||
|
||||
private:
|
||||
std::list<RsPgpId> &neighs;
|
||||
float font_height;
|
||||
QColor mBackgroundColorSelf;
|
||||
QColor mBackgroundColorOwnSign;
|
||||
QColor mBackgroundColorAcceptConnection;
|
||||
QColor mBackgroundColorHasSignedMe;
|
||||
QColor mBackgroundColorDenied;
|
||||
};
|
||||
|
||||
#endif // KEY_ITEM_MODEL_H
|
48
retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.cpp
Normal file
48
retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.cpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
#include "pgpid_item_proxy.h"
|
||||
|
||||
//TODO: include only required headers here
|
||||
#include <retroshare/rsiface.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rsdisc.h>
|
||||
#include <retroshare/rsmsgs.h>
|
||||
|
||||
|
||||
//TODO: set this defines in one place
|
||||
// Defines for key list columns
|
||||
#define COLUMN_CHECK 0
|
||||
#define COLUMN_PEERNAME 1
|
||||
#define COLUMN_I_AUTH_PEER 2
|
||||
#define COLUMN_PEER_AUTH_ME 3
|
||||
#define COLUMN_PEERID 4
|
||||
#define COLUMN_LAST_USED 5
|
||||
#define COLUMN_COUNT 6
|
||||
|
||||
|
||||
|
||||
pgpid_item_proxy::pgpid_item_proxy(QObject *parent) :
|
||||
QSortFilterProxyModel(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void pgpid_item_proxy::use_only_trusted_keys(bool val)
|
||||
{
|
||||
only_trusted_keys = val;
|
||||
filterChanged();
|
||||
}
|
||||
|
||||
bool pgpid_item_proxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
|
||||
{
|
||||
if(only_trusted_keys)
|
||||
{
|
||||
if(!rsPeers)
|
||||
return false;
|
||||
RsPgpId peer_id (sourceModel()->data(sourceModel()->index(sourceRow, COLUMN_PEERID, sourceParent)).toString().toStdString());
|
||||
RsPeerDetails details;
|
||||
if(!rsPeers->getGPGDetails(peer_id, details))
|
||||
return false;
|
||||
if(details.validLvl < RS_TRUST_LVL_MARGINAL)
|
||||
return false;
|
||||
}
|
||||
return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent);
|
||||
}
|
21
retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.h
Normal file
21
retroshare-gui/src/gui/NetworkDialog/pgpid_item_proxy.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
#ifndef PGPID_ITEM_PROXY_H
|
||||
#define PGPID_ITEM_PROXY_H
|
||||
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
class pgpid_item_proxy :
|
||||
public QSortFilterProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
pgpid_item_proxy(QObject *parent = nullptr);
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
public slots:
|
||||
void use_only_trusted_keys(bool val);
|
||||
|
||||
private:
|
||||
bool only_trusted_keys = false;
|
||||
};
|
||||
|
||||
#endif // PGPID_ITEM_PROXY_H
|
|
@ -1065,10 +1065,21 @@ void RetroshareDirModel::createCollectionFile(QWidget *parent, const QModelIndex
|
|||
std::vector <DirDetails> dirVec;
|
||||
getDirDetailsFromSelect(list, dirVec);
|
||||
|
||||
RsCollection(dirVec).openNewColl(parent);
|
||||
FileSearchFlags f = RemoteMode?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ;
|
||||
|
||||
QString dir_name;
|
||||
if(!RemoteMode)
|
||||
{
|
||||
if(dirVec.size())
|
||||
{
|
||||
const DirDetails& details = dirVec[0];
|
||||
dir_name = QDir(QString::fromUtf8(details.name.c_str())).dirName();
|
||||
}
|
||||
}
|
||||
RsCollection(dirVec,f).openNewColl(parent,dir_name);
|
||||
}
|
||||
|
||||
void RetroshareDirModel::downloadSelected(const QModelIndexList &list)
|
||||
void RetroshareDirModel::downloadSelected(const QModelIndexList &list,bool interactive)
|
||||
{
|
||||
if (!RemoteMode)
|
||||
{
|
||||
|
@ -1085,35 +1096,38 @@ void RetroshareDirModel::downloadSelected(const QModelIndexList &list)
|
|||
std::vector <DirDetails> dirVec;
|
||||
|
||||
getDirDetailsFromSelect(list, dirVec);
|
||||
FileSearchFlags f = RemoteMode?RS_FILE_HINTS_REMOTE:RS_FILE_HINTS_LOCAL ;
|
||||
|
||||
/* Fire off requests */
|
||||
for (int i = 0, n = dirVec.size(); i < n; ++i)
|
||||
{
|
||||
if (!RemoteMode)
|
||||
{
|
||||
continue; /* don't try to download local stuff */
|
||||
}
|
||||
if(interactive)
|
||||
RsCollection(dirVec,f).downloadFiles() ;
|
||||
else /* Fire off requests */
|
||||
for (int i = 0, n = dirVec.size(); i < n; ++i)
|
||||
{
|
||||
if (!RemoteMode)
|
||||
{
|
||||
continue; /* don't try to download local stuff */
|
||||
}
|
||||
|
||||
const DirDetails& details = dirVec[i];
|
||||
const DirDetails& details = dirVec[i];
|
||||
|
||||
/* if it is a file */
|
||||
if (details.type == DIR_TYPE_FILE)
|
||||
{
|
||||
std::cerr << "RetroshareDirModel::downloadSelected() Calling File Request";
|
||||
std::cerr << std::endl;
|
||||
std::list<RsPeerId> srcIds;
|
||||
srcIds.push_back(details.id);
|
||||
rsFiles -> FileRequest(details.name, details.hash,
|
||||
details.count, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
|
||||
}
|
||||
/* if it is a dir, copy all files included*/
|
||||
else if (details.type == DIR_TYPE_DIR)
|
||||
{
|
||||
int prefixLen = details.path.rfind(details.name);
|
||||
if (prefixLen < 0) continue;
|
||||
downloadDirectory(details, prefixLen);
|
||||
}
|
||||
}
|
||||
/* if it is a file */
|
||||
if (details.type == DIR_TYPE_FILE)
|
||||
{
|
||||
std::cerr << "RetroshareDirModel::downloadSelected() Calling File Request";
|
||||
std::cerr << std::endl;
|
||||
std::list<RsPeerId> srcIds;
|
||||
srcIds.push_back(details.id);
|
||||
rsFiles -> FileRequest(details.name, details.hash,
|
||||
details.count, "", RS_FILE_REQ_ANONYMOUS_ROUTING, srcIds);
|
||||
}
|
||||
/* if it is a dir, copy all files included*/
|
||||
else if (details.type == DIR_TYPE_DIR)
|
||||
{
|
||||
int prefixLen = details.path.rfind(details.name);
|
||||
if (prefixLen < 0) continue;
|
||||
downloadDirectory(details, prefixLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* recursively download a directory */
|
||||
|
|
|
@ -63,7 +63,7 @@ class RetroshareDirModel : public QAbstractItemModel
|
|||
bool visible() { return _visible ;}
|
||||
|
||||
/* Callback from GUI */
|
||||
void downloadSelected(const QModelIndexList &list);
|
||||
void downloadSelected(const QModelIndexList &list, bool interactive);
|
||||
void createCollectionFile(QWidget *parent, const QModelIndexList &list);
|
||||
|
||||
void getDirDetailsFromSelect (const QModelIndexList &list, std::vector <DirDetails>& dirVec);
|
||||
|
|
|
@ -1220,6 +1220,11 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
errorList << &fileExist << &personExist << &personFailed << &personNotFound << &forumUnknown << &forumMsgUnknown << &channelUnknown << &channelMsgUnknown << &postedUnknown << &postedMsgUnknown << &messageReceipientNotAccepted << &messageReceipientUnknown;
|
||||
// not needed: forumFound, channelFound, messageStarted
|
||||
|
||||
// we want to merge all single file links into one collection
|
||||
// if a collection tree link is found it is processed independen for the other file links
|
||||
RsCollection col;
|
||||
bool fileLinkFound = false;
|
||||
|
||||
for (linkIt = links.begin(); linkIt != links.end(); ++linkIt) {
|
||||
const RetroShareLink &link = *linkIt;
|
||||
|
||||
|
@ -1364,12 +1369,9 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
}
|
||||
break;
|
||||
|
||||
case TYPE_FILE:
|
||||
{
|
||||
RsCollection col ;
|
||||
col.merge_in(link.name(),link.size(),RsFileHash(link.hash().toStdString())) ;
|
||||
col.downloadFiles();
|
||||
}
|
||||
case TYPE_FILE:
|
||||
col.merge_in(link.name(),link.size(),RsFileHash(link.hash().toStdString())) ;
|
||||
fileLinkFound = true;
|
||||
break;
|
||||
|
||||
|
||||
|
@ -1557,6 +1559,10 @@ static void processList(const QStringList &list, const QString &textSingular, co
|
|||
}
|
||||
}
|
||||
|
||||
// were single file links found?
|
||||
if (fileLinkFound)
|
||||
col.downloadFiles();
|
||||
|
||||
int countProcessed = 0;
|
||||
int countError = 0;
|
||||
|
||||
|
|
|
@ -63,7 +63,9 @@ const static uint32_t timeToInactivity = 60 * 10; // in seconds
|
|||
|
||||
/** Default constructor */
|
||||
ChatLobbyDialog::ChatLobbyDialog(const ChatLobbyId& lid, QWidget *parent, Qt::WindowFlags flags)
|
||||
: ChatDialog(parent, flags), lobbyId(lid)
|
||||
: ChatDialog(parent, flags), lobbyId(lid),
|
||||
bullet_red_128(":/icons/bullet_red_128.png"), bullet_grey_128(":/icons/bullet_grey_128.png"),
|
||||
bullet_green_128(":/icons/bullet_green_128.png"), bullet_yellow_128(":/icons/bullet_yellow_128.png")
|
||||
{
|
||||
/* Invoke Qt Designer generated QObject setup routine */
|
||||
ui.setupUi(this);
|
||||
|
@ -556,16 +558,16 @@ void ChatLobbyDialog::updateParticipantsList()
|
|||
|
||||
|
||||
if(isParticipantMuted(it2->first))
|
||||
widgetitem->setIcon(COLUMN_ICON, QIcon(":/icons/bullet_red_128.png"));
|
||||
widgetitem->setIcon(COLUMN_ICON, bullet_red_128);
|
||||
else if (tLastAct + timeToInactivity < now)
|
||||
widgetitem->setIcon(COLUMN_ICON, QIcon(":/icons/bullet_grey_128.png"));
|
||||
widgetitem->setIcon(COLUMN_ICON, bullet_grey_128);
|
||||
else
|
||||
widgetitem->setIcon(COLUMN_ICON, QIcon(":/icons/bullet_green_128.png"));
|
||||
widgetitem->setIcon(COLUMN_ICON, bullet_green_128);
|
||||
|
||||
RsGxsId gxs_id;
|
||||
rsMsgs->getIdentityForChatLobby(lobbyId, gxs_id);
|
||||
|
||||
if (RsGxsId(participant.toStdString()) == gxs_id) widgetitem->setIcon(COLUMN_ICON, QIcon(":/icons/bullet_yellow_128.png"));
|
||||
if (RsGxsId(participant.toStdString()) == gxs_id) widgetitem->setIcon(COLUMN_ICON, bullet_yellow_128);
|
||||
|
||||
widgetitem->updateBannedState();
|
||||
|
||||
|
|
|
@ -120,6 +120,8 @@ private:
|
|||
QAction *showinpeopleAct;
|
||||
|
||||
GxsIdChooser *ownIdChooser ;
|
||||
//icons cache
|
||||
QIcon bullet_red_128, bullet_grey_128, bullet_green_128, bullet_yellow_128;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1589,10 +1589,9 @@ void ChatWidget::fileHashingFinished(QList<HashedFile> hashedFiles)
|
|||
|
||||
RetroShareLink link;
|
||||
|
||||
if(mDefaultExtraFileFlags & RS_FILE_REQ_ANONYMOUS_ROUTING)
|
||||
link = RetroShareLink::createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()));
|
||||
else
|
||||
link = RetroShareLink::createExtraFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()),QString::fromStdString(rsPeers->getOwnId().toStdString()));
|
||||
// We dont use extra links anymore, since files in the extra list can always be accessed using anonymous+encrypted FT.
|
||||
|
||||
link = RetroShareLink::createFile(hashedFile.filename, hashedFile.size, QString::fromStdString(hashedFile.hash.toStdString()));
|
||||
|
||||
if (hashedFile.flag & HashedFile::Picture) {
|
||||
message += QString("<img src=\"file:///%1\" width=\"100\" height=\"100\">").arg(hashedFile.filepath);
|
||||
|
|
|
@ -56,14 +56,20 @@ RsCollection::RsCollection(const FileTree& fr)
|
|||
recursAddElements(_xml_doc,fr,0,_root) ;
|
||||
}
|
||||
|
||||
RsCollection::RsCollection(const std::vector<DirDetails>& file_infos, QObject *parent)
|
||||
RsCollection::RsCollection(const std::vector<DirDetails>& file_infos,FileSearchFlags flags, QObject *parent)
|
||||
: QObject(parent), _xml_doc("RsCollection")
|
||||
{
|
||||
_root = _xml_doc.createElement("RsCollection");
|
||||
_xml_doc.appendChild(_root);
|
||||
|
||||
if(! ( (flags & RS_FILE_HINTS_LOCAL) || (flags & RS_FILE_HINTS_REMOTE)))
|
||||
{
|
||||
std::cerr << "(EE) Wrong flags passed to RsCollection constructor. Please fix the code!" << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
for(uint32_t i = 0;i<file_infos.size();++i)
|
||||
recursAddElements(_xml_doc,file_infos[i],_root) ;
|
||||
recursAddElements(_xml_doc,file_infos[i],_root,flags) ;
|
||||
}
|
||||
|
||||
RsCollection::~RsCollection()
|
||||
|
@ -170,7 +176,7 @@ void RsCollection::recursCollectColFileInfos(const QDomElement& e,std::vector<Co
|
|||
}
|
||||
|
||||
|
||||
void RsCollection::recursAddElements(QDomDocument& doc,const DirDetails& details,QDomElement& e) const
|
||||
void RsCollection::recursAddElements(QDomDocument& doc,const DirDetails& details,QDomElement& e,FileSearchFlags flags) const
|
||||
{
|
||||
if (details.type == DIR_TYPE_FILE)
|
||||
{
|
||||
|
@ -194,12 +200,11 @@ void RsCollection::recursAddElements(QDomDocument& doc,const DirDetails& details
|
|||
continue;
|
||||
|
||||
DirDetails subDirDetails;
|
||||
FileSearchFlags flags = RS_FILE_HINTS_LOCAL;
|
||||
|
||||
if (!rsFiles->RequestDirDetails(details.children[i].ref, subDirDetails, flags))
|
||||
continue;
|
||||
|
||||
recursAddElements(doc,subDirDetails,d) ;
|
||||
recursAddElements(doc,subDirDetails,d,flags) ;
|
||||
}
|
||||
|
||||
e.appendChild(d) ;
|
||||
|
@ -408,9 +413,8 @@ bool RsCollection::save(QWidget *parent) const
|
|||
}
|
||||
|
||||
|
||||
bool RsCollection::openNewColl(QWidget *parent)
|
||||
bool RsCollection::openNewColl(QWidget *parent, QString fileName)
|
||||
{
|
||||
QString fileName;
|
||||
if(!misc::getSaveFileName(parent, RshareSettings::LASTDIR_EXTRAFILE
|
||||
, QApplication::translate("RsCollectionFile", "Create collection file")
|
||||
, QApplication::translate("RsCollectionFile", "Collection files") + " (*." + RsCollection::ExtensionString + ")"
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
|
||||
RsCollection(QObject *parent = 0) ;
|
||||
// create from list of files and directories
|
||||
RsCollection(const std::vector<DirDetails>& file_entries, QObject *parent = 0) ;
|
||||
RsCollection(const std::vector<DirDetails>& file_entries, FileSearchFlags flags, QObject *parent = 0) ;
|
||||
RsCollection(const FileTree& fr);
|
||||
virtual ~RsCollection() ;
|
||||
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
bool save(const QString& fileName) const ;
|
||||
|
||||
// Open new collection
|
||||
bool openNewColl(QWidget *parent);
|
||||
bool openNewColl(QWidget *parent, QString fileName = "");
|
||||
// Open existing collection
|
||||
bool openColl(const QString& fileName, bool readOnly = false, bool showError = true);
|
||||
|
||||
|
@ -98,7 +98,7 @@ private slots:
|
|||
|
||||
private:
|
||||
|
||||
void recursAddElements(QDomDocument&,const DirDetails&,QDomElement&) const ;
|
||||
void recursAddElements(QDomDocument&, const DirDetails&, QDomElement&, FileSearchFlags flags) const ;
|
||||
void recursAddElements(QDomDocument&,const ColFileInfo&,QDomElement&) const;
|
||||
void recursAddElements(QDomDocument& doc,const FileTree& ft,uint32_t index,QDomElement& e) const;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
"emojione/people.png"|":neutral_face:":"emojione/1F610.png";
|
||||
"emojione/people.png"|":expressionless:|-_-":"emojione/1F611.png";
|
||||
"emojione/people.png"|":hushed:":"emojione/1F62F.png";
|
||||
"emojione/people.png"|":frowning:":"emojione/1f626.png";
|
||||
"emojione/people.png"|":frowning:":"emojione/1F626.png";
|
||||
"emojione/people.png"|":anguished:":"emojione/1F627.png";
|
||||
"emojione/people.png"|":open_mouth:|:-O|:O":"emojione/1F62E.png";
|
||||
"emojione/people.png"|":astonished:":"emojione/1F632.png";
|
||||
|
@ -82,7 +82,7 @@
|
|||
"emojione/people.png"|":alien:":"emojione/1F47D.png";
|
||||
"emojione/people.png"|":space_invader:":"emojione/1F47E.png";
|
||||
"emojione/people.png"|":robot_face:":"emojione/1f916.png";
|
||||
"emojione/people.png"|":jack_o_lantern:":"emojione/1f383.png";
|
||||
"emojione/people.png"|":jack_o_lantern:":"emojione/1F383.png";
|
||||
"emojione/people.png"|":poop:|:shit:|:hankey:|:poo:":"emojione/1F4A9.png";
|
||||
"emojione/people.png"|":smile_cat:|(@)":"emojione/1F638.png";
|
||||
"emojione/people.png"|":joy_cat:":"emojione/1F639.png";
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QVBoxLayout" name="GxsCommentDialogVLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="postFrame">
|
||||
<property name="sizePolicy">
|
||||
|
@ -22,7 +22,7 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="postFrameVLayout">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
|
@ -36,7 +36,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<layout class="QHBoxLayout" name="toolBarHLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="hotSortButton">
|
||||
<property name="text">
|
||||
|
@ -80,7 +80,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="toolBarHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
@ -93,7 +93,7 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="idLabel">
|
||||
<property name="text">
|
||||
<string>Voter ID:</string>
|
||||
</property>
|
||||
|
|
|
@ -21,13 +21,14 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <QMimeData>
|
||||
#include <QTextDocument>
|
||||
#include <QAbstractTextDocumentLayout>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QDateTime>
|
||||
#include <QMenu>
|
||||
#include <QMimeData>
|
||||
#include <QPainter>
|
||||
#include <QTextDocument>
|
||||
|
||||
#include "gui/common/RSElidedItemDelegate.h"
|
||||
#include "gui/gxs/GxsCommentTreeWidget.h"
|
||||
|
@ -54,7 +55,8 @@
|
|||
#define POST_COLOR_ROLE (Qt::UserRole+2)
|
||||
|
||||
/* Images for context menu icons */
|
||||
#define IMAGE_MESSAGE ":/images/folder-draft.png"
|
||||
#define IMAGE_MESSAGE ":/images/folder-draft.png"
|
||||
#define IMAGE_COPY ":/images/copy.png"
|
||||
#define IMAGE_VOTEUP ":/images/vote_up.png"
|
||||
#define IMAGE_VOTEDOWN ":/images/vote_down.png"
|
||||
|
||||
|
@ -170,6 +172,7 @@ void GxsCommentTreeWidget::setCurrentCommentMsgId(QTreeWidgetItem *current, QTre
|
|||
if(current)
|
||||
{
|
||||
mCurrentCommentMsgId = RsGxsMessageId(current->text(PCITEM_COLUMN_MSGID).toStdString());
|
||||
mCurrentCommentText = current->text(PCITEM_COLUMN_COMMENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -180,6 +183,8 @@ void GxsCommentTreeWidget::customPopUpMenu(const QPoint& /*point*/)
|
|||
action->setDisabled(mCurrentCommentMsgId.isNull());
|
||||
action = contextMnu.addAction(QIcon(IMAGE_MESSAGE), tr("Submit Comment"), this, SLOT(makeComment()));
|
||||
action->setDisabled(mMsgVersions.empty());
|
||||
action = contextMnu.addAction(QIcon(IMAGE_COPY), tr("Copy Comment"), this, SLOT(copyComment()));
|
||||
action->setDisabled(mCurrentCommentMsgId.isNull());
|
||||
|
||||
contextMnu.addSeparator();
|
||||
|
||||
|
@ -308,6 +313,14 @@ void GxsCommentTreeWidget::replyToComment()
|
|||
pcc.exec();
|
||||
}
|
||||
|
||||
void GxsCommentTreeWidget::copyComment()
|
||||
{
|
||||
QMimeData *mimeData = new QMimeData();
|
||||
mimeData->setHtml("<html>"+mCurrentCommentText+"</html>");
|
||||
QClipboard *clipboard = QApplication::clipboard();
|
||||
clipboard->setMimeData(mimeData, QClipboard::Clipboard);
|
||||
}
|
||||
|
||||
void GxsCommentTreeWidget::setup(RsTokenService *token_service, RsGxsCommentService *comment_service)
|
||||
{
|
||||
mRsTokenService = token_service;
|
||||
|
|
|
@ -71,6 +71,8 @@ public slots:
|
|||
void makeComment();
|
||||
void replyToComment();
|
||||
|
||||
void copyComment();
|
||||
|
||||
void voteUp();
|
||||
void voteDown();
|
||||
|
||||
|
@ -89,6 +91,7 @@ protected:
|
|||
std::set<RsGxsMessageId> mMsgVersions;
|
||||
RsGxsMessageId mLatestMsgId;
|
||||
RsGxsMessageId mCurrentCommentMsgId;
|
||||
QString mCurrentCommentText;
|
||||
RsGxsId mVoterId;
|
||||
|
||||
std::map<RsGxsMessageId, QTreeWidgetItem *> mLoadingMap;
|
||||
|
|
|
@ -630,7 +630,7 @@ void CreateGxsChannelMsg::sendMsg()
|
|||
std::string subject = std::string(misc::removeNewLine(subjectEdit->text()).toUtf8());
|
||||
QString text;
|
||||
RsHtml::optimizeHtml(msgEdit, text);
|
||||
std::string msg = text.toStdString();
|
||||
std::string msg = std::string(text.toUtf8());
|
||||
|
||||
std::list<RsGxsFile> files;
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ MessageWidget *MessageWidget::openMsg(const std::string &msgId, bool window)
|
|||
|
||||
/** Constructor */
|
||||
MessageWidget::MessageWidget(bool controlled, QWidget *parent, Qt::WindowFlags flags)
|
||||
: QWidget(parent, flags)
|
||||
: QWidget(parent, flags), toolButtonReply(NULL)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
ui.setupUi(this);
|
||||
|
@ -196,6 +196,7 @@ void MessageWidget::connectAction(enumActionType actionType, QToolButton* button
|
|||
break;
|
||||
case ACTION_REPLY:
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(reply()));
|
||||
toolButtonReply = button;
|
||||
break;
|
||||
case ACTION_REPLY_ALL:
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(replyAll()));
|
||||
|
@ -600,9 +601,11 @@ void MessageWidget::fill(const std::string &msgId)
|
|||
|
||||
if ((msgInfo.msgflags & RS_MSG_SYSTEM) && msgInfo.rspeerid_srcId == ownId) {
|
||||
ui.fromText->setText("RetroShare");
|
||||
if (toolButtonReply) toolButtonReply->setEnabled(false);
|
||||
} else {
|
||||
ui.fromText->setText(link.toHtml());
|
||||
ui.fromText->setToolTip(tooltip_string) ;
|
||||
if (toolButtonReply) toolButtonReply->setEnabled(true);
|
||||
}
|
||||
|
||||
ui.subjectText->setText(QString::fromUtf8(msgInfo.title.c_str()));
|
||||
|
|
|
@ -95,6 +95,8 @@ private:
|
|||
|
||||
QList<QLabel*> tagLabels;
|
||||
|
||||
QToolButton* toolButtonReply;
|
||||
|
||||
/** Qt Designer generated object */
|
||||
Ui::MessageWidget ui;
|
||||
};
|
||||
|
|
|
@ -209,6 +209,12 @@
|
|||
</item>
|
||||
<item row="3" column="2" colspan="2">
|
||||
<widget class="RSTextBrowser" name="ccText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
|
@ -238,6 +244,12 @@
|
|||
</item>
|
||||
<item row="4" column="2" colspan="2">
|
||||
<widget class="RSTextBrowser" name="bccText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
|
|
|
@ -68,7 +68,7 @@ MessageWindow::MessageWindow(QWidget *parent, Qt::WindowFlags flags)
|
|||
QMenu *printmenu = new QMenu();
|
||||
printmenu->addAction(ui.actionPrint);
|
||||
printmenu->addAction(ui.actionPrint_Preview);
|
||||
ui.printbutton->setMenu(printmenu);
|
||||
ui.printButton->setMenu(printmenu);
|
||||
|
||||
// create view menu
|
||||
QMenu *viewmenu = new QMenu();
|
||||
|
@ -120,7 +120,7 @@ void MessageWindow::addWidget(MessageWidget *widget)
|
|||
msgWidget->connectAction(MessageWidget::ACTION_REPLY, ui.replymessageButton);
|
||||
msgWidget->connectAction(MessageWidget::ACTION_REPLY_ALL, ui.replyallmessageButton);
|
||||
msgWidget->connectAction(MessageWidget::ACTION_FORWARD, ui.forwardmessageButton);
|
||||
msgWidget->connectAction(MessageWidget::ACTION_PRINT, ui.printbutton);
|
||||
msgWidget->connectAction(MessageWidget::ACTION_PRINT, ui.printButton);
|
||||
msgWidget->connectAction(MessageWidget::ACTION_PRINT, ui.actionPrint);
|
||||
msgWidget->connectAction(MessageWidget::ACTION_PRINT, actionPrint);
|
||||
msgWidget->connectAction(MessageWidget::ACTION_PRINT_PREVIEW, ui.actionPrint_Preview);
|
||||
|
@ -216,7 +216,7 @@ void MessageWindow::setToolbarButtonStyle(Qt::ToolButtonStyle style)
|
|||
ui.replyallmessageButton->setToolButtonStyle(style);
|
||||
ui.forwardmessageButton->setToolButtonStyle(style);
|
||||
ui.tagButton->setToolButtonStyle(style);
|
||||
ui.printbutton->setToolButtonStyle(style);
|
||||
ui.printButton->setToolButtonStyle(style);
|
||||
ui.viewtoolButton->setToolButtonStyle(style);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,11 +11,20 @@
|
|||
</rect>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="verticalSpacing">
|
||||
<layout class="QGridLayout" name="centralwidgetGLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
|
@ -44,8 +53,17 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<property name="margin">
|
||||
<layout class="QGridLayout" name="toolBarFrameGLayout">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
|
@ -81,7 +99,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="Line" name="line">
|
||||
<widget class="Line" name="toolBarFrameLineL">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -187,7 +205,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="Line" name="line_2">
|
||||
<widget class="Line" name="toolBarFrameLineR">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
@ -223,7 +241,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QToolButton" name="printbutton">
|
||||
<widget class="QToolButton" name="printButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
|
@ -281,7 +299,7 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="10">
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="toolBarFrameHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
|
|
|
@ -191,10 +191,11 @@ ServerPage::ServerPage(QWidget * parent, Qt::WindowFlags flags)
|
|||
connect(ui.extAddress, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
|
||||
connect(ui.dynDNS, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
|
||||
|
||||
connect(ui.hiddenpage_proxyAddress_tor, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
|
||||
connect(ui.hiddenpage_proxyPort_tor, SIGNAL(valueChanged(int)),this,SLOT(saveAddresses()));
|
||||
connect(ui.hiddenpage_proxyAddress_i2p, SIGNAL(textChanged(QString)),this,SLOT(saveAddresses()));
|
||||
connect(ui.hiddenpage_proxyPort_i2p, SIGNAL(valueChanged(int)),this,SLOT(saveAddresses()));
|
||||
connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
|
||||
connect(ui.hiddenpage_proxyAddress_tor, SIGNAL(editingFinished()),this,SLOT(saveAddresses()));
|
||||
connect(ui.hiddenpage_proxyPort_tor, SIGNAL(editingFinished()),this,SLOT(saveAddresses()));
|
||||
connect(ui.hiddenpage_proxyAddress_i2p, SIGNAL(editingFinished()),this,SLOT(saveAddresses()));
|
||||
connect(ui.hiddenpage_proxyPort_i2p, SIGNAL(editingFinished()),this,SLOT(saveAddresses()));
|
||||
|
||||
connect(ui.totalDownloadRate,SIGNAL(valueChanged(int)),this,SLOT(saveRates()));
|
||||
connect(ui.totalUploadRate, SIGNAL(valueChanged(int)),this,SLOT(saveRates()));
|
||||
|
@ -422,7 +423,6 @@ void ServerPage::load()
|
|||
whileBlocking(ui.hiddenpage_proxyAddress_i2p) -> setText(QString::fromStdString(proxyaddr));
|
||||
whileBlocking(ui.hiddenpage_proxyPort_i2p) -> setValue(proxyport);
|
||||
|
||||
updateOutProxyIndicator();
|
||||
}
|
||||
|
||||
//Relay Tab
|
||||
|
@ -873,8 +873,6 @@ void ServerPage::updateStatus()
|
|||
else
|
||||
ui.iconlabel_ext->setPixmap(QPixmap(":/images/ledoff1.png"));
|
||||
|
||||
// check for Tor
|
||||
updateOutProxyIndicator();
|
||||
}
|
||||
|
||||
void ServerPage::toggleUPnP()
|
||||
|
@ -910,6 +908,9 @@ void ServerPage::saveAddresses()
|
|||
|
||||
saveCommon();
|
||||
|
||||
if(ui.tabWidget->currentIndex() == 2) // hidden services tab
|
||||
updateOutProxyIndicator();
|
||||
|
||||
if (mIsHiddenNode) {
|
||||
saveAddressesHiddenNode();
|
||||
return;
|
||||
|
@ -991,6 +992,12 @@ void ServerPage::saveRates()
|
|||
rsConfig->SetMaxDataRates( ui.totalDownloadRate->value(), ui.totalUploadRate->value() );
|
||||
}
|
||||
|
||||
void ServerPage::tabChanged(int page)
|
||||
{
|
||||
if(page == 2)
|
||||
updateOutProxyIndicator();
|
||||
}
|
||||
|
||||
/***********************************************************************************/
|
||||
/***********************************************************************************/
|
||||
/******* ALTERNATIVE VERSION IF HIDDEN NODE ***************************************/
|
||||
|
@ -1131,8 +1138,6 @@ void ServerPage::loadHiddenNode()
|
|||
whileBlocking(ui.hiddenpage_proxyAddress_i2p) -> setText(QString::fromStdString(proxyaddr));
|
||||
whileBlocking(ui.hiddenpage_proxyPort_i2p) -> setValue(proxyport);
|
||||
|
||||
updateOutProxyIndicator();
|
||||
|
||||
QString expected = "";
|
||||
switch (mHiddenType) {
|
||||
case RS_HIDDEN_TYPE_I2P:
|
||||
|
@ -1220,8 +1225,6 @@ void ServerPage::updateStatusHiddenNode()
|
|||
ui.iconlabel_ext->setPixmap(QPixmap(":/images/ledoff1.png"));
|
||||
|
||||
#endif
|
||||
|
||||
updateOutProxyIndicator();
|
||||
}
|
||||
|
||||
void ServerPage::saveAddressesHiddenNode()
|
||||
|
@ -1554,8 +1557,6 @@ void ServerPage::loadCommon()
|
|||
whileBlocking(ui.hiddenpage_proxyPort_i2p) -> setValue(proxyport);
|
||||
whileBlocking(ui.hiddenpage_proxyPort_i2p_2)->setValue(proxyport); // this one is for bob tab
|
||||
|
||||
updateOutProxyIndicator();
|
||||
|
||||
// don't use whileBlocking here
|
||||
ui.cb_enableBob->setChecked(mBobSettings.enableBob);
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ private slots:
|
|||
void ipWhiteListContextMenu(const QPoint &point);
|
||||
void removeBannedIp();
|
||||
|
||||
void tabChanged(int page);
|
||||
// server
|
||||
void saveAddresses();
|
||||
void saveRates();
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "TurtleRouterDialog.h"
|
||||
#include <QPainter>
|
||||
#include <QStylePainter>
|
||||
#include <algorithm> // for sort
|
||||
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
|
||||
|
@ -70,6 +71,10 @@ void TurtleRouterDialog::processSettings(bool bLoad)
|
|||
|
||||
}
|
||||
|
||||
bool sr_Compare( TurtleRequestDisplayInfo m1, TurtleRequestDisplayInfo m2)
|
||||
{
|
||||
return m1.age < m2.age;
|
||||
}
|
||||
|
||||
void TurtleRouterDialog::updateDisplay()
|
||||
{
|
||||
|
@ -79,7 +84,9 @@ void TurtleRouterDialog::updateDisplay()
|
|||
std::vector<TurtleRequestDisplayInfo > tunnel_reqs_info ;
|
||||
|
||||
rsTurtle->getInfo(hashes_info,tunnels_info,search_reqs_info,tunnel_reqs_info) ;
|
||||
|
||||
|
||||
std::sort(search_reqs_info.begin(),search_reqs_info.end(),sr_Compare) ;
|
||||
|
||||
updateTunnelRequests(hashes_info,tunnels_info,search_reqs_info,tunnel_reqs_info) ;
|
||||
|
||||
}
|
||||
|
@ -162,8 +169,8 @@ void TurtleRouterDialog::updateTunnelRequests( const std::vector<std::vector<std
|
|||
|
||||
for(uint i=0;i<search_reqs_info.size();++i)
|
||||
{
|
||||
QString str = tr("Request id: %1\t from [%2]\t %3 secs ago").arg(search_reqs_info[i].request_id,0,16).arg(getPeerName(search_reqs_info[i].source_peer_id)).arg(search_reqs_info[i].age);
|
||||
|
||||
QString str = tr("Request id: %1\t %3 secs ago\t from %2\t %4").arg(search_reqs_info[i].request_id,0,16).arg(getPeerName(search_reqs_info[i].source_peer_id), -25).arg(search_reqs_info[i].age).arg(QString::fromUtf8(search_reqs_info[i].keywords.c_str(),search_reqs_info[i].keywords.length()));
|
||||
|
||||
stl.clear() ;
|
||||
stl.push_back(str) ;
|
||||
|
||||
|
|
|
@ -491,7 +491,7 @@ feenableexcept(FE_INVALID | FE_DIVBYZERO);
|
|||
QObject::connect(notify,SIGNAL(chatStatusChanged(const QString&,const QString&,bool)),w->friendsDialog,SLOT(updatePeerStatusString(const QString&,const QString&,bool)));
|
||||
QObject::connect(notify,SIGNAL(ownStatusMessageChanged()),w->friendsDialog,SLOT(loadmypersonalstatus()));
|
||||
|
||||
QObject::connect(notify,SIGNAL(logInfoChanged(const QString&)) ,w->friendsDialog->networkDialog,SLOT(setLogInfo(QString))) ;
|
||||
// QObject::connect(notify,SIGNAL(logInfoChanged(const QString&)) ,w->friendsDialog->networkDialog,SLOT(setLogInfo(QString))) ;
|
||||
QObject::connect(notify,SIGNAL(discInfoChanged()) ,w->friendsDialog->networkView,SLOT(update()),Qt::QueuedConnection) ;
|
||||
QObject::connect(notify,SIGNAL(errorOccurred(int,int,const QString&)),w,SLOT(displayErrorMessage(int,int,const QString&))) ;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ QFrame#titleBarFrame, QFrame#toolBarFrame
|
|||
QToolTip
|
||||
{
|
||||
border: 1px solid #3A3939;
|
||||
background-color: rgb(90, 102, 117);;
|
||||
background-color: rgb(90, 102, 117);
|
||||
color: white;
|
||||
padding: 1px;
|
||||
opacity: 200;
|
||||
|
@ -76,11 +76,11 @@ QWidget:item:selected
|
|||
|
||||
ForumsDialog, GxsForumThreadWidget
|
||||
{
|
||||
qproperty-textColorRead: gray;
|
||||
qproperty-textColorRead: darkgray;
|
||||
qproperty-textColorUnread: white;
|
||||
qproperty-textColorUnreadChildren: gray;
|
||||
qproperty-textColorUnreadChildren: red;
|
||||
qproperty-textColorNotSubscribed: white;
|
||||
qproperty-textColorMissing: red;
|
||||
qproperty-textColorMissing: darkred;
|
||||
}
|
||||
|
||||
QMenuBar
|
||||
|
@ -330,7 +330,7 @@ QTextEdit
|
|||
|
||||
QPlainTextEdit
|
||||
{
|
||||
background-color: #201F1F;;
|
||||
background-color: #201F1F;
|
||||
color: silver;
|
||||
border-radius: 3px;
|
||||
border: 1px solid #3A3939;
|
||||
|
@ -830,6 +830,14 @@ QTreeView, QListView
|
|||
background-color: #201F1F;
|
||||
}
|
||||
|
||||
QTreeView::item {
|
||||
background-color: #201F1F;
|
||||
}
|
||||
|
||||
QTreeView::item:!selected {
|
||||
color: #C0C0C0;
|
||||
}
|
||||
|
||||
QTreeView:branch:selected, QTreeView:branch:hover
|
||||
{
|
||||
background: url(qdarkstyle/transparent.png);
|
||||
|
@ -867,14 +875,14 @@ QTreeView::branch:open:has-children:has-siblings:hover {
|
|||
image: url(qdarkstyle/branch_open-on.png);
|
||||
}
|
||||
|
||||
QListView::item:!selected:hover, QListView::item:!selected:hover, QTreeView::item:!selected:hover {
|
||||
QListView::item:!selected:hover, QTableView::item:!selected:hover, QTreeView::item:!selected:hover {
|
||||
background: rgba(0, 0, 0, 0);
|
||||
outline: 0;
|
||||
color: #FFFFFF
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
QListView::item:selected:hover, QListView::item:selected:hover, QTreeView::item:selected:hover {
|
||||
background: #78879b;;
|
||||
QListView::item:selected:hover, QTableView::item:selected:hover, QTreeView::item:selected:hover {
|
||||
background: #78879b;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
|
|
|
@ -614,8 +614,9 @@ HEADERS += rshare.h \
|
|||
gui/statistics/BWGraph.h \
|
||||
util/RsSyntaxHighlighter.h \
|
||||
util/imageutil.h \
|
||||
gui/NetworkDialog/pgpid_item_model.h \
|
||||
gui/NetworkDialog/pgpid_item_proxy.h \
|
||||
gui/common/RsCollection.h
|
||||
|
||||
# gui/ForumsDialog.h \
|
||||
# gui/forums/ForumDetails.h \
|
||||
# gui/forums/EditForumDetails.h \
|
||||
|
@ -974,8 +975,9 @@ SOURCES += main.cpp \
|
|||
gui/statistics/BWGraph.cpp \
|
||||
util/RsSyntaxHighlighter.cpp \
|
||||
util/imageutil.cpp \
|
||||
gui/NetworkDialog/pgpid_item_model.cpp \
|
||||
gui/NetworkDialog/pgpid_item_proxy.cpp \
|
||||
gui/common/RsCollection.cpp
|
||||
|
||||
# gui/ForumsDialog.cpp \
|
||||
# gui/forums/ForumDetails.cpp \
|
||||
# gui/forums/EditForumDetails.cpp \
|
||||
|
|
|
@ -363,7 +363,7 @@ bool misc::getSaveFileName(QWidget *parent, RshareSettings::enumLastDir type
|
|||
, QString &file, QString *selectedFilter
|
||||
, QFileDialog::Options options)
|
||||
{
|
||||
QString lastDir = Settings->getLastDir(type);
|
||||
QString lastDir = Settings->getLastDir(type) + "/" + file;
|
||||
|
||||
file = QFileDialog::getSaveFileName(parent, caption, lastDir, filter, selectedFilter, QFileDialog::DontUseNativeDialog | options);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue