00001 #include "scqtfiledlg.h"
00002
00003
00004 #include <opie2/odebug.h>
00005 using namespace Opie::Core;
00006
00007
00008 #include <qcombobox.h>
00009 #include <qlineedit.h>
00010 #include <qlistview.h>
00011 #include <qtoolbutton.h>
00012 #include <qlayout.h>
00013 #include <qtooltip.h>
00014 #include <qwhatsthis.h>
00015
00016 static const char* const image0_data[] = {
00017 "24 16 3 1",
00018 ". c None",
00019 "# c #000040",
00020 "a c #808080",
00021 "........................",
00022 "........................",
00023 ".................####...",
00024 ".................####...",
00025 ".......##........#aa#...",
00026 "......###........#aa#...",
00027 ".....####........#aa#...",
00028 "....##############aa#...",
00029 "...###aaaaaaaaaaaaaa#...",
00030 "..####aaaaaaaaaaaaaa#...",
00031 "...###aaaaaaaaaaaaaa#...",
00032 "....#################...",
00033 ".....####...............",
00034 "......###...............",
00035 ".......##...............",
00036 "........................"};
00037
00038 static const char* const image1_data[] = {
00039 "24 16 4 1",
00040 ". c None",
00041 "a c #008080",
00042 "b c #808080",
00043 "# c #ff0000",
00044 "........................",
00045 "........................",
00046 "...####..........####...",
00047 "...#####........#####...",
00048 "....######.....#####a...",
00049 ".....######...#####ba...",
00050 ".....aa###########bba...",
00051 "....aaaaa#######aabba...",
00052 "...aaabbb######bbbbba...",
00053 "..aaaabb########bbbba...",
00054 "...aaa############bba...",
00055 "....a######aaa#####aa...",
00056 "....######.....######...",
00057 "...#####a........####...",
00058 "...####aa.........###...",
00059 "........................"};
00060
00061 static const char* const image2_data[] = {
00062 "17 15 4 1",
00063 "# c #000000",
00064 ". c #dcdcdc",
00065 "a c #ffff00",
00066 "b c #ffffff",
00067 ".................",
00068 "............#....",
00069 ".................",
00070 "............#....",
00071 ".........#.....#.",
00072 "....####..#.#.#..",
00073 "...#abab#..#.#...",
00074 "..##########..#.#",
00075 "..#babababab##...",
00076 "..#ababababa#.#..",
00077 "..#babababab#..#.",
00078 "..#ababababa#....",
00079 "..#babababab#....",
00080 "..#ababababa#....",
00081 "..###########...."};
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 ScQtFileDlg::ScQtFileDlg( QWidget* parent, const char* name, bool modal, WFlags fl )
00092 : QDialog( parent, name, modal, fl )
00093 {
00094 QPixmap image0( ( const char** ) image0_data );
00095 QPixmap image1( ( const char** ) image1_data );
00096 QPixmap image2( ( const char** ) image2_data );
00097 if ( !name )
00098 setName( "ScQtFileDlg" );
00099 resize( 196, 279 );
00100 if (!name)
00101 setCaption( tr( "FileDlg" ) );
00102 else
00103 setCaption(name);
00104 ScQtFileDlgLayout = new QVBoxLayout( this );
00105 ScQtFileDlgLayout->setSpacing( 6 );
00106 ScQtFileDlgLayout->setMargin( 11 );
00107
00108 Layout5 = new QVBoxLayout;
00109 Layout5->setSpacing( 6 );
00110 Layout5->setMargin( 0 );
00111
00112 Layout4 = new QVBoxLayout;
00113 Layout4->setSpacing( 6 );
00114 Layout4->setMargin( 0 );
00115
00116 Layout3 = new QHBoxLayout;
00117 Layout3->setSpacing( 6 );
00118 Layout3->setMargin( 0 );
00119
00120 TypeComboBox = new QComboBox( FALSE, this, "TypeComboBox" );
00121 TypeComboBox->setEditable( TRUE );
00122 TypeComboBox->setInsertionPolicy( QComboBox::AtBottom );
00123 TypeComboBox->setAutoCompletion( FALSE );
00124 TypeComboBox->setDuplicatesEnabled( FALSE );
00125 QToolTip::add( TypeComboBox, tr( "file type filter" ) );
00126 QWhatsThis::add( TypeComboBox, tr( "ComboBox FileTypeFilter\n"
00127 "\n"
00128 "edit or select the filter" ) );
00129 Layout3->addWidget( TypeComboBox );
00130 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00131 Layout3->addItem( spacer );
00132
00133 OkButton = new QToolButton( this, "OkButton" );
00134 OkButton->setText( "" );
00135 OkButton->setPixmap( image0 );
00136 OkButton->setUsesBigPixmap( FALSE );
00137 QToolTip::add( OkButton, tr( "confirms the selection and closes the form" ) );
00138 QWhatsThis::add( OkButton, tr( "OKButton" ) );
00139 Layout3->addWidget( OkButton );
00140
00141 CancelButton = new QToolButton( this, "CancelButton" );
00142 CancelButton->setText( "" );
00143 CancelButton->setPixmap( image1 );
00144 CancelButton->setUsesBigPixmap( FALSE );
00145 QToolTip::add( CancelButton, tr( "cancels the selection and closes the form" ) );
00146 QWhatsThis::add( CancelButton, tr( "CancelButton" ) );
00147 Layout3->addWidget( CancelButton );
00148 Layout4->addLayout( Layout3 );
00149
00150 Layout3_2 = new QHBoxLayout;
00151 Layout3_2->setSpacing( 6 );
00152 Layout3_2->setMargin( 0 );
00153
00154 FNameLineEdit = new QLineEdit( this, "FNameLineEdit" );
00155 QToolTip::add( FNameLineEdit, tr( "shows the selected filename" ) );
00156 QWhatsThis::add( FNameLineEdit, tr( "Filename LineEdit\n"
00157 "\n"
00158 "shows the selected file\n"
00159 "and allows the direct filename\n"
00160 "edit" ) );
00161 Layout3_2->addWidget( FNameLineEdit );
00162
00163 MkDirButton = new QToolButton( this, "MkDirButton" );
00164 MkDirButton->setText( "" );
00165 MkDirButton->setPixmap( image2 );
00166 MkDirButton->setUsesBigPixmap( FALSE );
00167 QToolTip::add( MkDirButton, tr( "confirms the selection and closes the form" ) );
00168 QWhatsThis::add( MkDirButton, tr( "OKButton" ) );
00169 Layout3_2->addWidget( MkDirButton );
00170 Layout4->addLayout( Layout3_2 );
00171
00172 DirComboBox = new QComboBox( FALSE, this, "DirComboBox" );
00173 DirComboBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, DirComboBox->sizePolicy().hasHeightForWidth() ) );
00174 DirComboBox->setEditable( TRUE );
00175 DirComboBox->setDuplicatesEnabled( FALSE );
00176 QWhatsThis::add( DirComboBox, tr( "ComboBox Directory \n"
00177 "edit or select the directories name" ) );
00178 Layout4->addWidget( DirComboBox );
00179 Layout5->addLayout( Layout4 );
00180
00181 ListView = new QListView( this, "ListView" );
00182 ListView->addColumn( tr( "Name" ) );
00183 ListView->addColumn( tr( "size" ) );
00184 ListView->addColumn( tr( "type" ) );
00185 ListView->setRootIsDecorated( TRUE );
00186 QToolTip::add( ListView, tr( "directory listview" ) );
00187 QWhatsThis::add( ListView, tr( "Directory ListView\n"
00188 "\n"
00189 "shows the list of dirs and files" ) );
00190 Layout5->addWidget( ListView );
00191 ScQtFileDlgLayout->addLayout( Layout5 );
00192
00193
00194 connect( OkButton, SIGNAL( clicked() ), this, SLOT( slotOK() ) );
00195 connect( DirComboBox, SIGNAL( activated(int) ), this, SLOT( slotDirComboBoxChanged(int) ) );
00196 connect( TypeComboBox, SIGNAL( activated(int) ), this, SLOT( slotTypeComboBoxChanged(int) ) );
00197 connect( CancelButton, SIGNAL( clicked() ), this, SLOT( slotCancel() ) );
00198 connect( ListView, SIGNAL( returnPressed(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem*) ) );
00199 connect( ListView, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( slotSelectionChanged(QListViewItem*) ) );
00200 connect( ListView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( slotDoubleClicked(QListViewItem*) ) );
00201 connect( FNameLineEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotFileTextChanged(const QString&) ) );
00202 connect( FNameLineEdit, SIGNAL( returnPressed() ), this, SLOT( slotOK() ) );
00203 connect( MkDirButton, SIGNAL( clicked() ), this, SLOT( slotMkDir() ) );
00204 }
00205
00206
00207
00208
00209 ScQtFileDlg::~ScQtFileDlg()
00210 {
00211
00212 }
00213
00214 void ScQtFileDlg::slotCancel()
00215 {
00216 owarn << "ScQtFileDlg::slotCancel(): Not implemented yet!" << oendl;
00217 }
00218
00219 void ScQtFileDlg::slotDirComboBoxChanged( int )
00220 {
00221 owarn << "ScQtFileDlg::slotDirComboBoxChanged( int ): Not implemented yet!" << oendl;
00222 }
00223
00224 void ScQtFileDlg::slotDoubleClicked(QListViewItem *)
00225 {
00226 owarn << "ScQtFileDlg::slotDoubleClicked(QListViewItem *): Not implemented yet!" << oendl;
00227 }
00228
00229 void ScQtFileDlg::slotFileTextChanged( const QString & )
00230 {
00231 owarn << "ScQtFileDlg::slotFileTextChanged( const QString & ): Not implemented yet!" << oendl;
00232 }
00233
00234 void ScQtFileDlg::slotMkDir()
00235 {
00236 owarn << "ScQtFileDlg::slotMkDir(): Not implemented yet!" << oendl;
00237 }
00238
00239 void ScQtFileDlg::slotOK()
00240 {
00241 owarn << "ScQtFileDlg::slotOK(): Not implemented yet!" << oendl;
00242 }
00243
00244 void ScQtFileDlg::slotSelectionChanged(QListViewItem *)
00245 {
00246 owarn << "ScQtFileDlg::slotSelectionChanged(QListViewItem *): Not implemented yet!" << oendl;
00247 }
00248
00249 void ScQtFileDlg::slotTypeComboBoxChanged( int )
00250 {
00251 owarn << "ScQtFileDlg::slotTypeComboBoxChanged( int ): Not implemented yet!" << oendl;
00252 }
00253