rolled back commit 1200 only for popupchatdialog

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1215 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
joss17 2009-05-11 14:21:11 +00:00
parent 4ef40b5cd1
commit 3698fc5a2c
5 changed files with 667 additions and 530 deletions

View file

@ -98,16 +98,19 @@ SearchDialog::SearchDialog(QWidget *parent)
RshareSettings rsharesettings;
QString key (UI_PREF_ADVANCED_SEARCH);
bool useAdvanced = rsharesettings.value(key, QVariant(false)).toBool();
if (useAdvanced)
/*if (useAdvanced)
{
ui.toggleAdvancedSearchBtn->setChecked(true);
ui.SimpleSearchPanel->hide();
} else {
ui.AdvancedSearchPanel->hide();
}
}*/
connect(ui.toggleAdvancedSearchBtn, SIGNAL(toggled(bool)), this, SLOT(toggleAdvancedSearchDialog(bool)));
connect(ui.focusAdvSearchDialogBtn, SIGNAL(clicked()), this, SLOT(showAdvSearchDialog()));
//connect(ui.toggleAdvancedSearchBtn, SIGNAL(toggled(bool)), this, SLOT(toggleAdvancedSearchDialog(bool)));
//connect(ui.focusAdvSearchDialogBtn, SIGNAL(clicked()), this, SLOT(showAdvSearchDialog()));
connect(ui.toggleAdvancedSearchBtn, SIGNAL(clicked()), this, SLOT(showAdvSearchDialog()));
connect(ui.cloaseallsearchresultsButton, SIGNAL(clicked()), this, SLOT(searchRemoveAll()));
connect(ui.resetButton, SIGNAL(clicked()), this, SLOT(clearKeyword()));
/* End Advanced Search Panel specifics */
@ -129,6 +132,8 @@ SearchDialog::SearchDialog(QWidget *parent)
connect ( ui.searchSummaryWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem *, QTreeWidgetItem * ) ),
this, SLOT( selectSearchResults( void ) ) );
connect( ui.searchResultWidget, SIGNAL( itemDoubleClicked ( QTreeWidgetItem *, int)), this, SLOT(download()));
/* hide the Tree +/- */
ui.searchResultWidget -> setRootIsDecorated( false );
@ -149,8 +154,8 @@ SearchDialog::SearchDialog(QWidget *parent)
_smheader->setResizeMode (2, QHeaderView::Interactive);
_smheader->resizeSection ( 0, 80 );
_smheader->resizeSection ( 1, 75 );
_smheader->resizeSection ( 2, 75 );
_smheader->resizeSection ( 1, 60 );
_smheader->resizeSection ( 2, 30 );
ui.searchResultWidget->setColumnCount(6);
_smheader = ui.searchResultWidget->header () ;
@ -367,6 +372,7 @@ void SearchDialog::searchRemoveAll()
nextSearchId = 1;
}
<<<<<<< HEAD:retroshare-gui/src/gui/SearchDialog.cpp
/** clear keywords and ComboBox **/
void SearchDialog::clearKeyword()
{
@ -375,6 +381,16 @@ void SearchDialog::clearKeyword()
}
=======
/** clear keywords **/
void SearchDialog::clearKeyword()
{
ui.lineEdit->clear();
ui.FileTypeComboBox->setCurrentIndex(0);
}
>>>>>>> c9de750...
* Rolled back Modifications to SearchDialog and PopupChatDialog.:retroshare-gui/src/gui/SearchDialog.cpp
/* *****************************************************************
Advanced search implementation
*******************************************************************/

View file

@ -5,16 +5,34 @@
<rect>
<x>0</x>
<y>0</y>
<<<<<<< HEAD:retroshare-gui/src/gui/SearchDialog.ui
<width>654</width>
<height>374</height>
=======
<width>685</width>
<height>474</height>
>>>>>>> c9de750...
* Rolled back Modifications to SearchDialog and PopupChatDialog.:retroshare-gui/src/gui/SearchDialog.ui
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>1</horstretch>
<verstretch>1</verstretch>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeIncrement" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="palette" >
<palette>
<active>
@ -499,6 +517,7 @@
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout" >
<<<<<<< HEAD:retroshare-gui/src/gui/SearchDialog.ui
<property name="leftMargin" >
<number>6</number>
</property>
@ -538,214 +557,113 @@
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
=======
<property name="verticalSpacing" >
<number>4</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>5</number>
</property>
<property name="topMargin" >
<number>5</number>
</property>
<property name="rightMargin" >
<number>5</number>
</property>
<property name="bottomMargin" >
<number>5</number>
</property>
<item>
<widget class="QPushButton" name="toggleAdvancedSearchBtn" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item row="0" column="0" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="minimumSize" >
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="toolTip" >
<string>Toggle advanced searching on and off.</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/advsearch_24x24.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable" >
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text" >
<string/>
>>>>>>> c9de750...
* Rolled back Modifications to SearchDialog and PopupChatDialog.:retroshare-gui/src/gui/SearchDialog.ui
</property>
<property name="pixmap" >
<pixmap resource="images.qrc" >:/images/find.png</pixmap>
</property>
<property name="scaledContents" >
<bool>true</bool>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<item row="0" column="1" >
<widget class="QLabel" name="label_3" >
<property name="maximumSize" >
<size>
<width>20</width>
<height>0</height>
<width>16777215</width>
<height>32</height>
</size>
</property>
</spacer>
<property name="text" >
<string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:12pt; font-weight:600;">Search&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="SearchModeFrame" >
<item row="1" column="0" >
<widget class="QToolBox" name="toolBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>255</horstretch>
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>390</width>
<height>24</height>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
<property name="maximumSize" >
<size>
<width>220</width>
<height>152</height>
</size>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<property name="currentIndex" >
<number>0</number>
</property>
<property name="leftMargin" >
<number>0</number>
<widget class="QWidget" name="page" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>235</width>
<height>131</height>
</rect>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QFrame" name="SimpleSearchPanel" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>0</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<attribute name="label" >
<string>Keyword Search</string>
</attribute>
<layout class="QGridLayout" >
<item row="0" column="0" >
<layout class="QGridLayout" >
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
<property name="verticalSpacing" >
<number>6</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_3" >
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Plain</enum>
</property>
<property name="text" >
<string>&lt;h3>Simple Search:&lt;/h3></string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<item row="0" column="0" colspan="2" >
<widget class="QLabel" name="label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Keywords </string>
<string>Type your Search here</string>
</property>
</widget>
</item>
<item>
<item row="1" column="0" colspan="2" >
<widget class="QLineEdit" name="lineEdit" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
@ -761,33 +679,7 @@
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>16</width>
<height>32</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Format&lt;/p>&lt;/body>&lt;/html></string>
</property>
</widget>
</item>
<item>
<item row="2" column="0" >
<widget class="QComboBox" name="FileTypeComboBox" >
<item>
<property name="text" >
@ -817,110 +709,7 @@ p, li { white-space: pre-wrap; }
<property name="text" >
<string>CD-Image</string>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/FileTypeCDImage.png</iconset>
</property>
</item>
<item>
<property name="text" >
<string>Document</string>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/FileTypeDocument.png</iconset>
</property>
</item>
<item>
<property name="text" >
<string>Picture</string>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/FileTypePicture.png</iconset>
</property>
</item>
<item>
<property name="text" >
<string>Program</string>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/FileTypeProgram.png</iconset>
</property>
</item>
<item>
<property name="text" >
<string>Video</string>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/FileTypeVideo.png</iconset>
</property>
</item>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>16</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButtonsearch" >
<property name="minimumSize" >
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>34</width>
<height>34</height>
</size>
</property>
<property name="toolTip" >
<string>Perform simple search</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/find.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="AdvancedSearchPanel" >
<property name="enabled" >
<bool>true</bool>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<<<<<<< HEAD:retroshare-gui/src/gui/SearchDialog.ui
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>0</number>
@ -1026,28 +815,77 @@ p, li { white-space: pre-wrap; }
<verstretch>0</verstretch>
</sizepolicy>
</property>
=======
<property name="icon" >
<iconset resource="images.qrc" >:/images/FileTypeCDImage.png</iconset>
</property>
</item>
<item>
<property name="text" >
<string>Document</string>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/FileTypeDocument.png</iconset>
</property>
</item>
<item>
<property name="text" >
<string>Picture</string>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/FileTypePicture.png</iconset>
</property>
</item>
<item>
<property name="text" >
<string>Program</string>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/FileTypeProgram.png</iconset>
</property>
</item>
<item>
<property name="text" >
<string>Video</string>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/FileTypeVideo.png</iconset>
</property>
</item>
</widget>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="pushButtonsearch" >
>>>>>>> c9de750...
* Rolled back Modifications to SearchDialog and PopupChatDialog.:retroshare-gui/src/gui/SearchDialog.ui
<property name="minimumSize" >
<size>
<width>34</width>
<height>34</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>34</width>
<height>34</height>
<width>200</width>
<height>200</height>
</size>
</property>
<property name="toolTip" >
<<<<<<< HEAD:retroshare-gui/src/gui/SearchDialog.ui
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Reset Search Keyword and File Type&lt;/p>&lt;/body>&lt;/html></string>
=======
<string>Perform simple search</string>
>>>>>>> c9de750...
* Rolled back Modifications to SearchDialog and PopupChatDialog.:retroshare-gui/src/gui/SearchDialog.ui
</property>
<property name="text" >
<string/>
<string>Search</string>
</property>
<property name="icon" >
<<<<<<< HEAD:retroshare-gui/src/gui/SearchDialog.ui
<iconset resource="images.qrc" >:/images/reset.png</iconset>
</property>
<property name="iconSize" >
@ -1055,37 +893,42 @@ p, li { white-space: pre-wrap; }
<width>24</width>
<height>24</height>
</size>
=======
<iconset resource="images.qrc" >:/images/find.png</iconset>
>>>>>>> c9de750...
* Rolled back Modifications to SearchDialog and PopupChatDialog.:retroshare-gui/src/gui/SearchDialog.ui
</property>
</widget>
</item>
<item>
<item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>0</height>
<width>88</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
<item row="3" column="1" >
<widget class="QPushButton" name="resetButton" >
<property name="text" >
<string>Reset</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QSplitter" name="splitter" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</layout>
</widget>
</widget>
</item>
<item rowspan="2" row="1" column="1" >
<layout class="QGridLayout" >
<item row="0" column="0" colspan="4" >
<widget class="SearchTreeWidget" name="searchResultWidget" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
@ -1136,6 +979,156 @@ p, li { white-space: pre-wrap; }
</property>
</column>
</widget>
</item>
<item row="1" column="0" >
<widget class="QPushButton" name="pushButtonDownload" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>120</width>
<height>25</height>
</size>
</property>
<property name="toolTip" >
<string>Download</string>
</property>
<property name="text" >
<string>Download</string>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/down_24x24.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>158</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="3" >
<widget class="QPushButton" name="cloaseallsearchresultsButton" >
<property name="minimumSize" >
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="text" >
<string>Close All Search Results</string>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QPushButton" name="toggleAdvancedSearchBtn" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>34</width>
<height>24</height>
</size>
</property>
<property name="toolTip" >
<string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">advanced searching&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/advsearch_24x24.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="checkable" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" >
<widget class="QToolBox" name="toolBox_2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>220</width>
<height>0</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>220</width>
<height>16777215</height>
</size>
</property>
<property name="currentIndex" >
<number>0</number>
</property>
<property name="tabSpacing" stdset="0" >
<number>6</number>
</property>
<widget class="QWidget" name="page_2" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>224</width>
<height>221</height>
</rect>
</property>
<attribute name="label" >
<string>Search Activity</string>
</attribute>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QTreeWidget" name="searchSummaryWidget" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
@ -1143,6 +1136,12 @@ p, li { white-space: pre-wrap; }
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="maximumSize" >
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="sizeIncrement" >
<size>
<width>0</width>
@ -1180,9 +1179,10 @@ p, li { white-space: pre-wrap; }
</property>
</column>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0" >
<widget class="QPushButton" name="pushButtonDownload" >
@ -1238,38 +1238,5 @@ p, li { white-space: pre-wrap; }
<resources>
<include location="images.qrc" />
</resources>
<connections>
<connection>
<sender>toggleAdvancedSearchBtn</sender>
<signal>toggled(bool)</signal>
<receiver>SimpleSearchPanel</receiver>
<slot>setHidden(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>29</x>
<y>35</y>
</hint>
<hint type="destinationlabel" >
<x>72</x>
<y>43</y>
</hint>
</hints>
</connection>
<connection>
<sender>toggleAdvancedSearchBtn</sender>
<signal>toggled(bool)</signal>
<receiver>AdvancedSearchPanel</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>28</x>
<y>29</y>
</hint>
<hint type="destinationlabel" >
<x>80</x>
<y>64</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>

View file

@ -33,9 +33,13 @@
#include <QIcon>
#include <QPixmap>
#include <QHashIterator>
#include <QDesktopServices>
#include "rsiface/rspeers.h"
#include "rsiface/rsmsgs.h"
#include "rsiface/rsfiles.h"
#include "gui/feeds/SubFileItem.h"
#define appDir QApplication::applicationDirPath()
@ -76,6 +80,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
connect(ui.chattextEdit, SIGNAL(textChanged ( ) ), this, SLOT(checkChat( ) ));
connect(ui.sendButton, SIGNAL(clicked( ) ), this, SLOT(sendChat( ) ));
connect(ui.addFileButton, SIGNAL(clicked() ), this , SLOT(addExtraFile()));
connect(ui.textboldButton, SIGNAL(clicked()), this, SLOT(setFont()));
connect(ui.textunderlineButton, SIGNAL(clicked()), this, SLOT(setFont()));
@ -85,10 +90,13 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
connect(ui.emoteiconButton, SIGNAL(clicked()), this, SLOT(smileyWidget()));
connect(ui.styleButton, SIGNAL(clicked()), SLOT(changeStyle()));
connect(ui.textBrowser, SIGNAL(anchorClicked(const QUrl &)), SLOT(anchorClicked(const QUrl &)));
// Create the status bar
resetStatusBar() ;
ui.textBrowser->setOpenExternalLinks ( false );
ui.textBrowser->setOpenLinks ( false );
QString title = QString::fromStdString(name) + " :" + tr(" RetroShare - Encrypted Chat") ;
setWindowTitle(title);
@ -131,7 +139,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
void PopupChatDialog::resetStatusBar()
{
statusBar()->showMessage(QString("Chatting with ") + QString::fromStdString(dialogName) + " (" +QString::fromStdString(dialogId)+ ")") ;
statusBar()->showMessage(tr("Chatting with ") + QString::fromStdString(dialogName) + " (" +QString::fromStdString(dialogId)+ ")") ;
}
void PopupChatDialog::updateStatusTyping()
@ -243,6 +251,19 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci)
QString name = QString::fromStdString(ci ->name);
QString message = QString::fromStdWString(ci -> msg);
//replace url by a link
//first, avoid DTD link taht stands at the beginning of the string
QString messageSubString = message.mid(110, -1);
//replace http:// and www. with <a href> links
messageSubString.replace(QRegExp("(http://[^ <]*)|(www\\.[^ <]*)"), "<a href=\"\\1\\2\">\\1\\2</a>");
//rebuild the full message
message = message.left(109) + messageSubString;
#ifdef CHAT_DEBUG
std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() << std::endl;
#endif
/*QHashIterator<QString, QString> i(smileys);
while(i.hasNext())
{
@ -678,3 +699,123 @@ void PopupChatDialog::getAvatar()
}
}
void PopupChatDialog::addExtraFile()
{
// select a file
QString qfile = QFileDialog::getOpenFileName(this, tr("Add Extra File"), "", "", 0,
QFileDialog::DontResolveSymlinks);
std::string filePath = qfile.toStdString();
if (filePath != "")
{
/* add a SubFileItem to the attachment section */
std::cerr << "PopupChatDialog::addExtraFile() hashing file.";
std::cerr << std::endl;
/* add widget in for new destination */
SubFileItem *file = new SubFileItem(filePath);
//file->
ui.vboxLayout->addWidget(file, 1, 0);
//when the file is local or is finished hashing, call the fileHashingFinished method to send a chat message
if (file->getState() == SFI_STATE_LOCAL) {
fileHashingFinished(file);
} else {
QObject::connect(file,SIGNAL(fileFinished(SubFileItem *)), SLOT(fileHashingFinished(SubFileItem *))) ;
}
}
}
void PopupChatDialog::fileHashingFinished(SubFileItem* file) {
std::cerr << "PopupChatDialog::fileHashingFinished() started.";
std::cerr << std::endl;
ChatInfo ci;
{
rsiface->lockData(); /* Lock Interface */
const RsConfig &conf = rsiface->getConfig();
ci.rsid = conf.ownId;
ci.name = conf.ownName;
rsiface->unlockData(); /* Unlock Interface */
}
//convert fileSize from uint_64 to string for html link
char fileSizeChar [100];
sprintf(fileSizeChar, "%lld", file->FileSize());
std::string fileSize = *(&fileSizeChar);
std::string mesgString = "<a href='file:?fileHash=" + (file->FileHash()) + "&fileName=" + (file->FileName()) + "&fileSize=" + fileSize + "'>" + (file->FileName()) + "</a>";
#ifdef CHAT_DEBUG
std::cerr << "PopupChatDialog::anchorClicked mesgString : " << mesgString << std::endl;
#endif
const char * messageString = mesgString.c_str ();
//convert char massageString to w_char
wchar_t* message;
int requiredSize = mbstowcs(NULL, messageString, 0); // C4996
/* Add one to leave room for the NULL terminator */
message = (wchar_t *)malloc( (requiredSize + 1) * sizeof( wchar_t ));
if (! message)
{
std::cerr << ("Memory allocation failure.\n");
}
int size = mbstowcs( message, messageString, requiredSize + 1); // C4996
if (size == (size_t) (-1))
{
printf("Couldn't convert string--invalid multibyte character.\n");
}
ci.msg = message;
ci.chatflags = RS_CHAT_PRIVATE;
addChatMsg(&ci);
/* put proper destination */
ci.rsid = dialogId;
ci.name = dialogName;
rsMsgs -> ChatSend(ci);
}
void PopupChatDialog::anchorClicked (const QUrl& link ) {
#ifdef CHAT_DEBUG
std::cerr << "PopupChatDialog::anchorClicked link.scheme() : " << link.scheme().toStdString() << std::endl;
#endif
if (link.scheme() == "file") {
std::string fileName = link.queryItemValue(QString("fileName")).toStdString();
std::string fileHash = link.queryItemValue(QString("fileHash")).toStdString();
uint32_t fileSize = link.queryItemValue(QString("fileSize")).toInt();
#ifdef CHAT_DEBUG
std::cerr << "PopupChatDialog::anchorClicked FileRequest : fileName : " << fileName << ". fileHash : " << fileHash << ". fileSize : " << fileSize;
std::cerr << ". source id : " << dialogId << std::endl;
#endif
if (fileName != "" &&
fileHash != "") {
std::list<std::string> srcIds;
srcIds.push_front(dialogId);
rsFiles->FileRequest(fileName, fileHash, fileSize, "", 0, srcIds);
QMessageBox mb(tr("File Request Confirmation"), tr("The file has been added to your download list."),QMessageBox::Information,QMessageBox::Ok,0,0);
mb.setButtonText( QMessageBox::Ok, "OK" );
mb.exec();
} else {
QMessageBox mb(tr("File Request Error"), tr("The file link is malformed."),QMessageBox::Information,QMessageBox::Ok,0,0);
mb.setButtonText( QMessageBox::Ok, "OK" );
mb.exec();
}
} else if (link.scheme() == "http") {
QDesktopServices::openUrl(link);
} else if (link.scheme() == "") {
//it's probably a web adress, let's add http:// at the beginning of the link
QString newAddress = link.toString();
newAddress.prepend("http://");
QDesktopServices::openUrl(QUrl(newAddress));
}
}

View file

@ -30,6 +30,7 @@
#include <gui/Preferences/rsharesettings.h>
#include "rsiface/rsiface.h"
#include "gui/feeds/SubFileItem.h"
@ -74,15 +75,19 @@ public slots:
void addSmiley();
void changeStyle();
void fileHashingFinished(SubFileItem* file);
void resetStatusBar() ;
void updateStatusTyping() ;
void updateStatusString(const QString&) ;
void anchorClicked (const QUrl &);
protected:
void closeEvent (QCloseEvent * event);
private slots:
void addExtraFile();
void showAvatarFrame(bool show);
void setColor();
@ -95,7 +100,6 @@ private slots:
void getAvatar();
private:
void colorChanged(const QColor &c);
@ -120,10 +124,9 @@ private:
QStringList history;
QString wholeChat;
/** Qt Designer generated object */
Ui::PopupChatDialog ui;
};
#endif

View file

@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>484</width>
<height>437</height>
<height>439</height>
</rect>
</property>
<property name="windowTitle" >
@ -446,7 +446,7 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
<item row="3" column="0" >
<layout class="QGridLayout" >
<layout class="QHBoxLayout" >
<property name="leftMargin" >
<number>0</number>
</property>
@ -456,23 +456,30 @@ p, li { white-space: pre-wrap; }
<property name="bottomMargin" >
<number>2</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
<item>
<widget class="QPushButton" name="addFileButton" >
<property name="text" >
<string/>
</property>
<item row="0" column="0" >
<property name="icon" >
<iconset resource="../images.qrc" >:/images/add-share24.png</iconset>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>351</width>
<width>331</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" >
<item>
<widget class="QPushButton" name="sendButton" >
<property name="text" >
<string>Send</string>
@ -481,6 +488,9 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</item>
<item row="4" column="0" >
<layout class="QVBoxLayout" />
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar" />