00001
00002
00003
00004
00005
00006 #include "SearchResults.h"
00007 #include "gutenbrowser.h"
00008 #include "LibraryDialog.h"
00009
00010 #include <qpe/qpeapplication.h>
00011 #include <stdio.h>
00012 #include <qstrlist.h>
00013 #include <qclipboard.h>
00014
00015 #include <qlayout.h>
00016 #include <qlistbox.h>
00017 #include <qpushbutton.h>
00018 #include <qlayout.h>
00019 #include <qvariant.h>
00020
00021
00022
00023 SearchResultsDlg::SearchResultsDlg( QWidget* parent, const char* name, bool modal, WFlags fl, QStringList stringList )
00024 : QDialog( parent, name, modal, fl )
00025 {
00026 if ( !name )
00027 setName( "SearchResultsDlg" );
00028
00029 QGridLayout *layout = new QGridLayout( this );
00030 layout->setSpacing( 2);
00031 layout->setMargin( 2);
00032
00033 ListBox1 = new QListBox( this, "ListBox1" );
00034 outPutLabel=new QLabel( this, "outPutLabel" );
00035 statusLabel=new QLabel( this, "StatusLabel" );
00036 QString local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/";
00037
00038 buttonOk = new QPushButton(this,"buttonOk");
00039 buttonCancel = new QPushButton(this,"buttonCancel");
00040
00041 layout->addMultiCellWidget( buttonOk, 0, 0, 0, 0);
00042 layout->addMultiCellWidget( buttonCancel, 0, 0, 1, 1);
00043
00044 layout->addMultiCellWidget( ListBox1, 1, 4, 0, 1);
00045
00046 outPutLabel->setMaximumHeight(30);
00047 statusLabel->setMaximumHeight(30);
00048
00049 layout->addMultiCellWidget( outPutLabel, 5, 5, 0, 1);
00050 layout->addMultiCellWidget( statusLabel, 6, 6, 0, 1);
00051
00052
00053 setCaption( tr( "Search Results" ) );
00054 buttonOk->setText( tr( "&Download" ) );
00055 buttonOk->setAutoDefault( TRUE );
00056 buttonCancel->setText( tr( "&Cancel" ) );
00057 buttonCancel->setAutoDefault( TRUE );
00058 buttonOk->setDefault( TRUE );
00059 ListBox1->setSelectionMode( QListBox::Single );
00060 ListBox1->setMultiSelection(true);
00061 statusLabel->setText( "Double click a title to begin downloading." );
00062
00063
00064 connect( buttonOk, SIGNAL( clicked() ), this, SLOT( dwnLd() ) );
00065 connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
00066 connect( ListBox1, SIGNAL( doubleClicked(QListBoxItem *)), SLOT( slotListClicked(QListBoxItem * )) );
00067
00068 ListBox1->insertStringList( stringList);
00069 numListItems= ListBox1->numRows();
00070 QString strOut;
00071
00072 outPutLabel->setText( "Number of results: "+ strOut.sprintf("%d", numListItems) );
00073
00074
00075
00076 }
00077
00078 SearchResultsDlg::~SearchResultsDlg()
00079 {
00080 }
00081
00082 void SearchResultsDlg::slotListClicked(QListBoxItem *it) {
00083
00084 resultsList.append(it->text() );
00085
00086
00087 accept();
00088 }
00089
00090 void SearchResultsDlg::dwnLd() {
00091
00092 for(unsigned int ji=0; ji< ListBox1->count() ; ji++ ) {
00093 if( ListBox1->isSelected( ji) )
00094 resultsList.append(ListBox1->text( ji));
00095 }
00096 accept();
00097 }
00098
00099 void SearchResultsDlg::downloadButtonSlot() {
00100
00101 }