00001 #include "inputDialog.h"
00002
00003 #include <opie2/ofiledialog.h>
00004 #include <opie2/oresource.h>
00005
00006 #include <qpe/applnk.h>
00007
00008 #include <qlineedit.h>
00009 #include <qpushbutton.h>
00010
00011 using namespace Opie::Ui;
00012 InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
00013 : QDialog( parent, name, modal, fl ) {
00014 if ( !name ) {
00015 setName( "InputDialog" );
00016 }
00017 resize( 234, 115);
00018 setMaximumSize( QSize( 240, 40));
00019 setCaption( tr( name ) );
00020
00021 QPushButton *browserButton;
00022 browserButton = new QPushButton( Opie::Core::OResource::loadPixmap("fileopen", Opie::Core::OResource::SmallIcon),"",this,"BrowseButton");
00023 browserButton->setGeometry( QRect( 205, 10, AppLnk::smallIconSize(), AppLnk::smallIconSize()));
00024 connect( browserButton, SIGNAL(released()),this,SLOT(browse()));
00025 LineEdit1 = new QLineEdit( this, "LineEdit1" );
00026 LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) );
00027 LineEdit1->setFocus();
00028 }
00029
00030
00031
00032 QString InputDialog::text() const {
00033 return LineEdit1->text();
00034 }
00035
00036
00037
00038 InputDialog::~InputDialog() {
00039 }
00040
00041 void InputDialog::browse() {
00042
00043 MimeTypes types;
00044 QStringList audio, video, all;
00045 audio << "audio/*";
00046 audio << "playlist/plain";
00047 audio << "audio/x-mpegurl";
00048
00049 video << "video/*";
00050 video << "playlist/plain";
00051
00052 all += audio;
00053 all += video;
00054 types.insert("All Media Files", all );
00055 types.insert("Audio", audio );
00056 types.insert("Video", video );
00057
00058 QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 );
00059 LineEdit1->setText(str);
00060 }
00061