merged uptream/master

This commit is contained in:
csoler 2018-02-18 17:56:51 +01:00
commit 7cda064ef4
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
7 changed files with 104 additions and 54 deletions

View File

@ -1403,13 +1403,14 @@ bool DistributedChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id,const
return false; return false;
} }
std::map<ChatLobbyId,VisibleChatLobbyRecord>::const_iterator vid = _visible_lobbies.find(lobby_id) ; //std::map<ChatLobbyId,VisibleChatLobbyRecord>::const_iterator vid = _visible_lobbies.find(lobby_id) ;
if(_visible_lobbies.end() == vid) //When invited to new Lobby, it is not visible.
{ //if(_visible_lobbies.end() == vid)
std::cerr << " (EE) Cannot subscribe a non visible chat lobby!!" << std::endl; //{
return false ; // std::cerr << " (EE) Cannot subscribe a non visible chat lobby!!" << std::endl;
} // return false ;
//}
RsIdentityDetails det ; RsIdentityDetails det ;
if( (!rsIdentity->getIdDetails(identity,det)) || !(det.mFlags & RS_IDENTITY_FLAGS_IS_OWN_ID)) if( (!rsIdentity->getIdDetails(identity,det)) || !(det.mFlags & RS_IDENTITY_FLAGS_IS_OWN_ID))
@ -1418,7 +1419,7 @@ bool DistributedChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id,const
return false ; return false ;
} }
if( (vid->second.lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED ) && !(det.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED)) if( (it->second.lobby_flags & RS_CHAT_LOBBY_FLAGS_PGP_SIGNED ) && !(det.mFlags & RS_IDENTITY_FLAGS_PGP_LINKED))
{ {
std::cerr << " (EE) Cannot subscribe with identity " << identity << " because it is unsigned and the lobby requires signed ids only." << std::endl; std::cerr << " (EE) Cannot subscribe with identity " << identity << " because it is unsigned and the lobby requires signed ids only." << std::endl;
return false ; return false ;
@ -1437,8 +1438,8 @@ bool DistributedChatService::acceptLobbyInvite(const ChatLobbyId& lobby_id,const
ChatLobbyEntry entry ; ChatLobbyEntry entry ;
entry.participating_friends.insert(it->second.peer_id) ; entry.participating_friends.insert(it->second.peer_id) ;
entry.lobby_flags = it->second.lobby_flags ; entry.lobby_flags = it->second.lobby_flags ;
entry.gxs_id = identity ; entry.gxs_id = identity ;
entry.lobby_id = lobby_id ; entry.lobby_id = lobby_id ;
entry.lobby_name = it->second.lobby_name ; entry.lobby_name = it->second.lobby_name ;
entry.lobby_topic = it->second.lobby_topic ; entry.lobby_topic = it->second.lobby_topic ;

View File

@ -966,6 +966,9 @@ void SharedFilesDialog::recursRestoreExpandedItems(const QModelIndex& index, con
bool invisible = vis.find(local_path) != vis.end(); bool invisible = vis.find(local_path) != vis.end();
ui.dirTreeView->setRowHidden(index.row(),index.parent(),invisible ) ; ui.dirTreeView->setRowHidden(index.row(),index.parent(),invisible ) ;
if(invisible)
mHiddenIndexes.push_back(proxyModel->mapToSource(index));
if(!invisible && exp.find(local_path) != exp.end()) if(!invisible && exp.find(local_path) != exp.end())
{ {
#ifdef DEBUG_SHARED_FILES_DIALOG #ifdef DEBUG_SHARED_FILES_DIALOG
@ -1330,26 +1333,9 @@ void SharedFilesDialog::startFilter()
#define EXPAND_WHILE_SEARCHING 1 #define EXPAND_WHILE_SEARCHING 1
static void recursMakeAllVisible(QTreeView *tree,const QModelIndex& indx)
{
tree->setRowHidden(indx.row(), indx.parent(), false) ;
int rowCount = tree->model()->rowCount(indx);
for (int row = 0; row < rowCount; ++row)
{
QModelIndex child_index = indx.child(row,0);
recursMakeAllVisible(tree,child_index);
}
#ifdef EXPAND_WHILE_SEARCHING
tree->setExpanded(indx,false) ;
#endif
}
//#define DEBUG_SHARED_FILES_DIALOG //#define DEBUG_SHARED_FILES_DIALOG
static void recursMakeVisible(QTreeView *tree,const QSortFilterProxyModel *proxyModel,const QModelIndex& indx,uint32_t depth,const std::vector<std::set<void*> >& pointers) void recursMakeVisible(QTreeView *tree,const QSortFilterProxyModel *proxyModel,const QModelIndex& indx,uint32_t depth,const std::vector<std::set<void*> >& pointers,QList<QModelIndex>& hidden_list)
{ {
#ifdef DEBUG_SHARED_FILES_DIALOG #ifdef DEBUG_SHARED_FILES_DIALOG
for(uint32_t i=0;i<depth;++i) std::cerr << " " ; std::cerr << "depth " << depth << ": current ref=" << proxyModel->mapToSource(indx).internalPointer() << std::endl; for(uint32_t i=0;i<depth;++i) std::cerr << " " ; std::cerr << "depth " << depth << ": current ref=" << proxyModel->mapToSource(indx).internalPointer() << std::endl;
@ -1378,12 +1364,13 @@ static void recursMakeVisible(QTreeView *tree,const QSortFilterProxyModel *proxy
#ifdef DEBUG_SHARED_FILES_DIALOG #ifdef DEBUG_SHARED_FILES_DIALOG
for(uint32_t i=0;i<depth+1;++i) std::cerr << " " ; std::cerr << "object " << proxyModel->mapToSource(child_index).internalPointer() << " visible" << std::endl; for(uint32_t i=0;i<depth+1;++i) std::cerr << " " ; std::cerr << "object " << proxyModel->mapToSource(child_index).internalPointer() << " visible" << std::endl;
#endif #endif
recursMakeVisible(tree,proxyModel,child_index,depth+1,pointers) ; recursMakeVisible(tree,proxyModel,child_index,depth+1,pointers,hidden_list) ;
found = true ; found = true ;
} }
else else
{ {
tree->setRowHidden(child_index.row(), indx, true) ; tree->setRowHidden(child_index.row(), indx, true) ;
hidden_list.push_back(proxyModel->mapToSource(child_index)) ;
#ifdef EXPAND_WHILE_SEARCHING #ifdef EXPAND_WHILE_SEARCHING
tree->setExpanded(child_index,false) ; tree->setExpanded(child_index,false) ;
#endif #endif
@ -1395,7 +1382,23 @@ static void recursMakeVisible(QTreeView *tree,const QSortFilterProxyModel *proxy
} }
if(!found && depth == 0) if(!found && depth == 0)
{
tree->setRowHidden(indx.row(), indx.parent(), true) ; tree->setRowHidden(indx.row(), indx.parent(), true) ;
hidden_list.push_back(proxyModel->mapToSource(indx)) ;
}
}
void SharedFilesDialog::restoreInvisibleItems()
{
for(QList<QModelIndex>::const_iterator it(mHiddenIndexes.begin());it!=mHiddenIndexes.end();++it)
{
QModelIndex indx = proxyModel->mapFromSource(*it);
if(indx.isValid())
ui.dirTreeView->setRowHidden(indx.row(), indx.parent(), false) ;
}
mHiddenIndexes.clear();
} }
class QCursorContextBlocker class QCursorContextBlocker
@ -1436,6 +1439,7 @@ void SharedFilesDialog::FilterItems()
std::cerr << "New last text. Performing the filter" << std::endl; std::cerr << "New last text. Performing the filter" << std::endl;
mLastFilterText = text ; mLastFilterText = text ;
model->update() ; model->update() ;
restoreInvisibleItems();
QCursorContextBlocker q(ui.dirTreeView) ; QCursorContextBlocker q(ui.dirTreeView) ;
@ -1447,14 +1451,7 @@ void SharedFilesDialog::FilterItems()
std::list<DirDetails> result_list ; std::list<DirDetails> result_list ;
if(text == "") if(text == "")
{
int rowCount = ui.dirTreeView->model()->rowCount();
for (int row = 0; row < rowCount; ++row)
recursMakeAllVisible(ui.dirTreeView,ui.dirTreeView->model()->index(row, COLUMN_NAME)) ;
return ; return ;
}
if(text.length() < 3) if(text.length() < 3)
return ; return ;
@ -1525,7 +1522,7 @@ void SharedFilesDialog::FilterItems()
int rowCount = ui.dirTreeView->model()->rowCount(); int rowCount = ui.dirTreeView->model()->rowCount();
for (int row = 0; row < rowCount; ++row) for (int row = 0; row < rowCount; ++row)
recursMakeVisible(ui.dirTreeView,proxyModel,ui.dirTreeView->model()->index(row, COLUMN_NAME),0,pointers); recursMakeVisible(ui.dirTreeView,proxyModel,ui.dirTreeView->model()->index(row, COLUMN_NAME),0,pointers,mHiddenIndexes);
} }
else else
{ {
@ -1554,6 +1551,7 @@ bool SharedFilesDialog::flat_FilterItem(const QModelIndex &index, const QString
else else
{ {
ui.dirTreeView->setRowHidden(index.row(), index.parent(), true); ui.dirTreeView->setRowHidden(index.row(), index.parent(), true);
mHiddenIndexes.push_back(proxyModel->mapToSource(index));
return true ; return true ;
} }
} }
@ -1584,7 +1582,10 @@ bool SharedFilesDialog::tree_FilterItem(const QModelIndex &index, const QString
if (visible || visibleChildCount) { if (visible || visibleChildCount) {
ui.dirTreeView->setRowHidden(index.row(), index.parent(), false); ui.dirTreeView->setRowHidden(index.row(), index.parent(), false);
} else { } else {
{
ui.dirTreeView->setRowHidden(index.row(), index.parent(), true); ui.dirTreeView->setRowHidden(index.row(), index.parent(), true);
mHiddenIndexes.push_back(proxyModel->mapToSource(index));
}
} }
return (visible || visibleChildCount); return (visible || visibleChildCount);

View File

@ -107,6 +107,8 @@ protected:
bool tree_FilterItem(const QModelIndex &index, const QString &text, int level); bool tree_FilterItem(const QModelIndex &index, const QString &text, int level);
bool flat_FilterItem(const QModelIndex &index, const QString &text, int level); bool flat_FilterItem(const QModelIndex &index, const QString &text, int level);
void restoreInvisibleItems();
QModelIndexList getSelected(); QModelIndexList getSelected();
/** Defines the actions for the context menu for QTreeWidget */ /** Defines the actions for the context menu for QTreeWidget */
@ -133,6 +135,8 @@ protected:
QString lastFilterString; QString lastFilterString;
QString mLastFilterText ; QString mLastFilterText ;
QList<QModelIndex> mHiddenIndexes;
}; };
class LocalSharedFilesDialog : public SharedFilesDialog class LocalSharedFilesDialog : public SharedFilesDialog

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>969</width> <width>978</width>
<height>778</height> <height>778</height>
</rect> </rect>
</property> </property>
@ -279,7 +279,11 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add selected item to collection one by one.&lt;/p&gt;&lt;p&gt;Select parent dir to add this too.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic; vertical-align:sub;&quot;&gt;&amp;lt;Enter&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add selected item to collection one by one.&lt;/p&gt;&lt;p&gt;Select parent dir to add this too.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic; vertical-align:sub;&quot;&gt;&amp;lt;Enter&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="text"> <property name="text">
<string notr="true">&gt;</string> <string notr="true"/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/feedback_arrow.png</normaloff>:/images/feedback_arrow.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -301,7 +305,11 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add selected item to collection.&lt;/p&gt;&lt;p&gt;If a directory is selected, all of his children will be added.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; text-decoration: underline; vertical-align:sub;&quot;&gt;&amp;lt;Shift + Enter&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add selected item to collection.&lt;/p&gt;&lt;p&gt;If a directory is selected, all of his children will be added.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; text-decoration: underline; vertical-align:sub;&quot;&gt;&amp;lt;Shift + Enter&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="text"> <property name="text">
<string>&gt;&gt;</string> <string/>
</property>
<property name="icon">
<iconset resource="../../../../plugins/FeedReader/gui/FeedReader_images.qrc">
<normaloff>:/images/Update.png</normaloff>:/images/Update.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -323,7 +331,11 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Remove selected item from collection.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic; vertical-align:sub;&quot;&gt;&amp;lt;Del&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Remove selected item from collection.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic; vertical-align:sub;&quot;&gt;&amp;lt;Del&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="text"> <property name="text">
<string notr="true">&lt;</string> <string notr="true"/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/deletemail24.png</normaloff>:/images/deletemail24.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -345,7 +357,11 @@
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Make a new directory in the collection.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic; vertical-align:sub;&quot;&gt;&amp;lt;+&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Make a new directory in the collection.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-style:italic; vertical-align:sub;&quot;&gt;&amp;lt;+&amp;gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="text"> <property name="text">
<string>+</string> <string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/directoryadd_24x24_shadow.png</normaloff>:/images/directoryadd_24x24_shadow.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -501,6 +517,7 @@
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../../../../plugins/FeedReader/gui/FeedReader_images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -293,17 +293,27 @@ void ConnectFriendWizard::setCertificate(const QString &certificate, bool friend
#ifdef FRIEND_WIZARD_DEBUG #ifdef FRIEND_WIZARD_DEBUG
std::cerr << "ConnectFriendWizard got id : " << peerDetails.id << "; gpg_id : " << peerDetails.gpg_id << std::endl; std::cerr << "ConnectFriendWizard got id : " << peerDetails.id << "; gpg_id : " << peerDetails.gpg_id << std::endl;
#endif #endif
mCertificate = certificate.toUtf8().constData();
// Cyril: I disabled this because it seems to be not used anymore. if(peerDetails.id == rsPeers->getOwnId())
//setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion); {
setStartId(Page_Conclusion); setField("errorMessage", tr("This is your own certificate! You would not want to make friend with yourself. Wouldn't you?") ) ;
if (friendRequest){ error = false;
ui->cp_Label->show(); setStartId(Page_ErrorMessage);
ui->requestinfolabel->show(); }
setTitleText(ui->ConclusionPage, tr("Friend request")); else
ui->ConclusionPage->setSubTitle(tr("Details about the request")); {
} mCertificate = certificate.toUtf8().constData();
// Cyril: I disabled this because it seems to be not used anymore.
//setStartId(friendRequest ? Page_FriendRequest : Page_Conclusion);
setStartId(Page_Conclusion);
if (friendRequest){
ui->cp_Label->show();
ui->requestinfolabel->show();
setTitleText(ui->ConclusionPage, tr("Friend request"));
ui->ConclusionPage->setSubTitle(tr("Details about the request"));
}
}
} else { } else {
// error message // error message
setField("errorMessage", tr("Certificate Load Failed") + ": \n\n" + getErrorString(cert_load_error_code)) ; setField("errorMessage", tr("Certificate Load Failed") + ": \n\n" + getErrorString(cert_load_error_code)) ;
@ -497,8 +507,8 @@ void ConnectFriendWizard::initializePage(int id)
else else
ui->alreadyRegisteredLabel->hide(); ui->alreadyRegisteredLabel->hide();
if(tmp_det.ownsign) { if(tmp_det.ownsign) {
ui->signGPGCheckBox->setChecked(true); ui->signGPGCheckBox->setChecked(false); // if already signed, we dont allow to sign it again, and dont show the box.
ui->signGPGCheckBox->setEnabled(false); ui->signGPGCheckBox->setVisible(false);
ui->signGPGCheckBox->setToolTip(tr("You have already signed this key")); ui->signGPGCheckBox->setToolTip(tr("You have already signed this key"));
} }
@ -702,6 +712,13 @@ bool ConnectFriendWizard::validateCurrentPage()
#ifdef FRIEND_WIZARD_DEBUG #ifdef FRIEND_WIZARD_DEBUG
std::cerr << "ConnectFriendWizard got id : " << peerDetails.id << "; gpg_id : " << peerDetails.gpg_id << std::endl; std::cerr << "ConnectFriendWizard got id : " << peerDetails.id << "; gpg_id : " << peerDetails.gpg_id << std::endl;
#endif #endif
if(peerDetails.id == rsPeers->getOwnId())
{
setField("errorMessage", tr("This is your own certificate! You would not want to make friend with yourself. Wouldn't you?") ) ;
error = false;
}
break; break;
} }
// error message // error message
@ -735,6 +752,12 @@ bool ConnectFriendWizard::validateCurrentPage()
#ifdef FRIEND_WIZARD_DEBUG #ifdef FRIEND_WIZARD_DEBUG
std::cerr << "ConnectFriendWizard got id : " << peerDetails.id << "; gpg_id : " << peerDetails.gpg_id << std::endl; std::cerr << "ConnectFriendWizard got id : " << peerDetails.id << "; gpg_id : " << peerDetails.gpg_id << std::endl;
#endif #endif
if(peerDetails.id == rsPeers->getOwnId())
{
setField("errorMessage", tr("This is your own certificate! You would not want to make friend with yourself. Wouldn't you?") ) ;
error = false;
}
} else { } else {
setField("errorMessage", QString(tr("Certificate Load Failed:something is wrong with %1")).arg(fn) + " : " + getErrorString(cert_error_code)); setField("errorMessage", QString(tr("Certificate Load Failed:something is wrong with %1")).arg(fn) + " : " + getErrorString(cert_error_code));
error = false; error = false;

View File

@ -1618,8 +1618,8 @@ resources.</string>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../icons.qrc"/>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -92,6 +92,10 @@ GeneralPage::GeneralPage(QWidget * parent, Qt::WindowFlags flags) :
//connect(ui.runStartWizard_PB, SIGNAL(clicked()), this,SLOT(runStartWizard())) ; //connect(ui.runStartWizard_PB, SIGNAL(clicked()), this,SLOT(runStartWizard())) ;
connect(ui.checkAdvanced, SIGNAL(toggled(bool)), this,SLOT(updateAdvancedMode())) ; connect(ui.checkAdvanced, SIGNAL(toggled(bool)), this,SLOT(updateAdvancedMode())) ;
connect(ui.registerRetroShareProtocol, SIGNAL(toggled(bool)), this,SLOT(updateRegisterRSProtocol())) ; connect(ui.registerRetroShareProtocol, SIGNAL(toggled(bool)), this,SLOT(updateRegisterRSProtocol())) ;
// hide advanced checkbox, since the option is not used.
ui.advGBox->hide();
} }
/** Destructor */ /** Destructor */