added clear Filter Button

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2315 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-02-14 12:29:50 +00:00
parent fbb9349613
commit 4a5a281424
3 changed files with 151 additions and 72 deletions

View File

@ -91,6 +91,9 @@ MessagesDialog::MessagesDialog(QWidget *parent)
connect(ui.actionSave_as, SIGNAL(triggered()), this, SLOT(fileSaveAs())); connect(ui.actionSave_as, SIGNAL(triggered()), this, SLOT(fileSaveAs()));
connect( ui.clearButton, SIGNAL(clicked()), this, SLOT(clearFilter()));
connect( ui.filterPatternLineEdit, SIGNAL( textChanged(const QString &)), this, SLOT(toggleclearButton()));
connect(ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)), connect(ui.filterPatternLineEdit, SIGNAL(textChanged(const QString &)),
this, SLOT(filterRegExpChanged())); this, SLOT(filterRegExpChanged()));
@ -169,6 +172,9 @@ MessagesDialog::MessagesDialog(QWidget *parent)
//sertting default filter by column as subject //sertting default filter by column as subject
proxyModel->setFilterKeyColumn(ui.filterColumnComboBox->currentIndex()); proxyModel->setFilterKeyColumn(ui.filterColumnComboBox->currentIndex());
ui.clearButton->hide();
/* Hide platform specific features */ /* Hide platform specific features */
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
@ -1299,3 +1305,26 @@ void MessagesDialog::updateMessageSummaryList()
} }
} }
/** clear Filter **/
void MessagesDialog::clearFilter()
{
ui.filterPatternLineEdit->clear();
ui.filterPatternLineEdit->setFocus();
}
/* toggle clearButton */
void MessagesDialog::toggleclearButton()
{
QString text = ui.filterPatternLineEdit->text();
if (text.isEmpty())
{
ui.clearButton->hide();
}
else
{
ui.clearButton->show();
}
}

View File

@ -90,6 +90,9 @@ private slots:
void filterRegExpChanged(); void filterRegExpChanged();
void filterColumnChanged(); void filterColumnChanged();
void clearFilter();
void toggleclearButton();
private: private:
/** A RetroShare Settings object used for saving/loading settings */ /** A RetroShare Settings object used for saving/loading settings */
RshareSettings *_settings; RshareSettings *_settings;

View File

@ -534,6 +534,60 @@ border: 1px solid #CCCCCC;}</string>
<property name="margin"> <property name="margin">
<number>2</number> <number>2</number>
</property> </property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QToolButton" name="newmessageButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>167777</width>
<height>167777</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;New Message&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Compose</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/folder-draft24.png</normaloff>:/images/folder-draft24.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="QToolButton" name="replymessageButton"> <widget class="QToolButton" name="replymessageButton">
<property name="sizePolicy"> <property name="sizePolicy">
@ -654,6 +708,13 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="5">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="6"> <item row="0" column="6">
<widget class="QToolButton" name="removemessageButton"> <widget class="QToolButton" name="removemessageButton">
<property name="minimumSize"> <property name="minimumSize">
@ -698,64 +759,6 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0">
<widget class="QToolButton" name="newmessageButton">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>167777</width>
<height>167777</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;New Message&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Compose</string>
</property>
<property name="icon">
<iconset resource="images.qrc">
<normaloff>:/images/folder-draft24.png</normaloff>:/images/folder-draft24.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="0" column="7"> <item row="0" column="7">
<widget class="QToolButton" name="printbutton"> <widget class="QToolButton" name="printbutton">
<property name="sizePolicy"> <property name="sizePolicy">
@ -829,9 +832,66 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="9">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="10"> <item row="0" column="10">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>1</number>
</property>
<item>
<widget class="QLineEdit" name="filterPatternLineEdit"/> <widget class="QLineEdit" name="filterPatternLineEdit"/>
</item> </item>
<item>
<widget class="QPushButton" name="clearButton">
<property name="minimumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="toolTip">
<string>Reset</string>
</property>
<property name="styleSheet">
<string notr="true">QPushButton
{
border-image: url(:/images/closenormal.png)
}
QPushButton:hover
{
border-image: url(:/images/closehover.png)
}
QPushButton:pressed {
border-image: url(:/images/closepressed.png)
}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="11"> <item row="0" column="11">
<widget class="QComboBox" name="filterColumnComboBox"> <widget class="QComboBox" name="filterColumnComboBox">
<property name="currentIndex"> <property name="currentIndex">
@ -859,19 +919,6 @@ p, li { white-space: pre-wrap; }
</item> </item>
</widget> </widget>
</item> </item>
<item row="0" column="9">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>