split message into several paras and fix file extension markup
[kdepim.git] / knode / knsearchdialog.cpp
blob9bf4ba512cb01933c96369ab3c9943fc27ec91b5
1 /*
2 KNode, the KDE newsreader
3 Copyright (c) 1999-2005 the KNode authors.
4 See file AUTHORS for details
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 You should have received a copy of the GNU General Public License
11 along with this program; if not, write to the Free Software Foundation,
12 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
15 #include <QCheckBox>
17 #include <klocale.h>
18 #include <kiconloader.h>
19 #include <kvbox.h>
21 #include "knfilterconfigwidget.h"
22 #include "knarticlefilter.h"
23 #include "utilities.h"
24 #include "knsearchdialog.h"
26 using namespace KNode;
28 KNode::SearchDialog::SearchDialog( searchType type, QWidget *parent ) :
29 KDialog( parent )
31 Q_UNUSED( type );
32 setCaption( i18n("Find Articles") );
33 setButtons( User1 | User2 | Close );
34 setModal( false );
35 setDefaultButton( User1 );
37 setWindowIcon( KIcon("knode") );
38 setButtonsOrientation( Qt::Vertical );
39 setButtonGuiItem( User1, KGuiItem( i18n("&Search"), "edit-find" ) );
40 setButtonGuiItem( User2, KGuiItem( i18n("C&lear"), "edit-clear" ) );
42 connect( this, SIGNAL(closeClicked()), SLOT(slotClose()) );
43 connect( this, SIGNAL(user1Clicked()), SLOT(slotUser1()) );
44 connect( this, SIGNAL(user2Clicked()), SLOT(slotUser2()) );
46 KVBox *filterBox = new KVBox( this );
47 setMainWidget( filterBox );
49 completeThreads = new QCheckBox( i18n("Sho&w complete threads"), filterBox );
50 fcw = new KNFilterConfigWidget( filterBox );
51 fcw->reset();
53 f_ilter = new KNArticleFilter();
54 f_ilter->setLoaded( true );
55 f_ilter->setSearchFilter( true );
57 setFixedHeight( sizeHint().height() );
58 KNHelper::restoreWindowSize( "searchDlg", this, sizeHint() );
59 fcw->setStartFocus();
64 KNode::SearchDialog::~SearchDialog()
66 delete f_ilter;
67 KNHelper::saveWindowSize("searchDlg", size());
71 void KNode::SearchDialog::slotUser1()
73 f_ilter->status=fcw->status->filter();
74 f_ilter->score=fcw->score->filter();
75 f_ilter->age=fcw->age->filter();
76 f_ilter->lines=fcw->lines->filter();
77 f_ilter->subject=fcw->subject->filter();
78 f_ilter->from=fcw->from->filter();
79 f_ilter->messageId=fcw->messageId->filter();
80 f_ilter->references=fcw->references->filter();
81 f_ilter->setApplyOn(completeThreads->isChecked()? 1:0);
82 emit doSearch(f_ilter);
87 void KNode::SearchDialog::slotUser2()
89 fcw->reset();
94 void KNode::SearchDialog::slotClose()
96 emit dialogDone();
100 void KNode::SearchDialog::closeEvent( QCloseEvent * )
102 emit dialogDone();
106 #include "knsearchdialog.moc"