Avoid adding duplicate recommended files.

Added static scroll area for hashing files.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3873 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-11-26 15:32:46 +00:00
parent aeabbbd58a
commit 78dea3c630
2 changed files with 65 additions and 22 deletions

View File

@ -125,6 +125,8 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
setAttribute ( Qt::WA_DeleteOnClose, true ); setAttribute ( Qt::WA_DeleteOnClose, true );
ui.hashBox->hide();
// connect up the buttons. // connect up the buttons.
connect( ui.actionSend, SIGNAL( triggered (bool)), this, SLOT( sendMessage( ) ) ); connect( ui.actionSend, SIGNAL( triggered (bool)), this, SLOT( sendMessage( ) ) );
//connect( ui.actionReply, SIGNAL( triggered (bool)), this, SLOT( replyMessage( ) ) ); //connect( ui.actionReply, SIGNAL( triggered (bool)), this, SLOT( replyMessage( ) ) );
@ -751,6 +753,13 @@ void MessageComposer::insertFileList(const std::list<FileInfo>& files_info)
void MessageComposer::addFile(const FileInfo &fileInfo) void MessageComposer::addFile(const FileInfo &fileInfo)
{ {
for(std::list<FileInfo>::iterator it = _recList.begin(); it != _recList.end(); it++) {
if (it->hash == fileInfo.hash) {
/* File already added */
return;
}
}
_recList.push_back(fileInfo) ; _recList.push_back(fileInfo) ;
/* make a widget per person */ /* make a widget per person */
@ -2144,8 +2153,9 @@ void MessageComposer::addAttachment(std::string filePath)
/* add widget in for new destination */ /* add widget in for new destination */
AttachFileItem *file = new AttachFileItem(filePath); AttachFileItem *file = new AttachFileItem(filePath);
//file->
ui.hashBox->show();
ui.msgFileList->hide();
ui.verticalLayout->addWidget(file, 1, 0); ui.verticalLayout->addWidget(file, 1, 0);
//when the file is local or is finished hashing, call the fileHashingFinished method to send a chat message //when the file is local or is finished hashing, call the fileHashingFinished method to send a chat message
@ -2195,8 +2205,6 @@ void MessageComposer::checkAttachmentReady()
{ {
if (!(*fit)->ready()) if (!(*fit)->ready())
{ {
/*
*/
ui.actionSend->setEnabled(false); ui.actionSend->setEnabled(false);
break; break;
} }
@ -2206,6 +2214,8 @@ void MessageComposer::checkAttachmentReady()
if (fit == mAttachments.end()) if (fit == mAttachments.end())
{ {
ui.actionSend->setEnabled(true); ui.actionSend->setEnabled(true);
ui.hashBox->hide();
ui.msgFileList->show();
} }
/* repeat... */ /* repeat... */

View File

@ -17,7 +17,7 @@
<string>Compose</string> <string>Compose</string>
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/folder-draft.png</normaloff>:/images/folder-draft.png</iconset> <normaloff>:/images/folder-draft.png</normaloff>:/images/folder-draft.png</iconset>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
@ -379,7 +379,7 @@ border: 1px solid #CCCCCC;}</string>
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/textedit/format_font_size_more.png</normaloff>:/images/textedit/format_font_size_more.png</iconset> <normaloff>:/images/textedit/format_font_size_more.png</normaloff>:/images/textedit/format_font_size_more.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@ -408,7 +408,7 @@ border: 1px solid #CCCCCC;}</string>
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/textedit/format_font_size_less.png</normaloff>:/images/textedit/format_font_size_less.png</iconset> <normaloff>:/images/textedit/format_font_size_less.png</normaloff>:/images/textedit/format_font_size_less.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@ -443,7 +443,7 @@ border: 1px solid #CCCCCC;}</string>
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/textedit/textbold.png</normaloff>:/images/textedit/textbold.png</iconset> <normaloff>:/images/textedit/textbold.png</normaloff>:/images/textedit/textbold.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@ -481,7 +481,7 @@ border: 1px solid #CCCCCC;}</string>
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/textedit/textunder.png</normaloff>:/images/textedit/textunder.png</iconset> <normaloff>:/images/textedit/textunder.png</normaloff>:/images/textedit/textunder.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@ -519,7 +519,7 @@ border: 1px solid #CCCCCC;}</string>
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/textedit/textitalic.png</normaloff>:/images/textedit/textitalic.png</iconset> <normaloff>:/images/textedit/textitalic.png</normaloff>:/images/textedit/textitalic.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@ -616,7 +616,7 @@ border: 1px solid #CCCCCC;}</string>
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset> <normaloff>:/images/add_image24.png</normaloff>:/images/add_image24.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@ -639,7 +639,7 @@ border: 1px solid #CCCCCC;}</string>
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/textedit/hi22-action-format-text-code.png</normaloff>:/images/textedit/hi22-action-format-text-code.png</iconset> <normaloff>:/images/textedit/hi22-action-format-text-code.png</normaloff>:/images/textedit/hi22-action-format-text-code.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@ -669,7 +669,7 @@ border: 1px solid #CCCCCC;}</string>
<item row="0" column="3"> <item row="0" column="3">
<widget class="QToolButton" name="emoticonButton"> <widget class="QToolButton" name="emoticonButton">
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/emoticons/kopete/kopete020.png</normaloff>:/images/emoticons/kopete/kopete020.png</iconset> <normaloff>:/images/emoticons/kopete/kopete020.png</normaloff>:/images/emoticons/kopete/kopete020.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
@ -836,7 +836,42 @@ border: 1px solid #CCCCCC;}</string>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<layout class="QVBoxLayout" name="verticalLayout"/> <widget class="QScrollArea" name="hashBox">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>560</width>
<height>57</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>46</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -884,7 +919,7 @@ border: 1px solid #CCCCCC;}</string>
</widget> </widget>
<action name="actionSend"> <action name="actionSend">
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/send24.png</normaloff>:/images/send24.png</iconset> <normaloff>:/images/send24.png</normaloff>:/images/send24.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -896,7 +931,7 @@ border: 1px solid #CCCCCC;}</string>
</action> </action>
<action name="actionReply"> <action name="actionReply">
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/replymail24.png</normaloff>:/images/replymail24.png</iconset> <normaloff>:/images/replymail24.png</normaloff>:/images/replymail24.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -905,7 +940,7 @@ border: 1px solid #CCCCCC;}</string>
</action> </action>
<action name="actionContactsView"> <action name="actionContactsView">
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/contacts24.png</normaloff>:/images/contacts24.png</iconset> <normaloff>:/images/contacts24.png</normaloff>:/images/contacts24.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -917,7 +952,7 @@ border: 1px solid #CCCCCC;}</string>
</action> </action>
<action name="actionSaveas"> <action name="actionSaveas">
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/save24.png</normaloff>:/images/save24.png</iconset> <normaloff>:/images/save24.png</normaloff>:/images/save24.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -929,7 +964,7 @@ border: 1px solid #CCCCCC;}</string>
</action> </action>
<action name="actionAttach"> <action name="actionAttach">
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/attach.png</normaloff>:/images/attach.png</iconset> <normaloff>:/images/attach.png</normaloff>:/images/attach.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -944,7 +979,7 @@ border: 1px solid #CCCCCC;}</string>
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../images.qrc"> <iconset>
<normaloff>:/images/quote_24.png</normaloff>:/images/quote_24.png</iconset> <normaloff>:/images/quote_24.png</normaloff>:/images/quote_24.png</iconset>
</property> </property>
<property name="text"> <property name="text">
@ -960,8 +995,6 @@ border: 1px solid #CCCCCC;}</string>
<tabstop>msgText</tabstop> <tabstop>msgText</tabstop>
<tabstop>msgFileList</tabstop> <tabstop>msgFileList</tabstop>
</tabstops> </tabstops>
<resources> <resources/>
<include location="../images.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>