author | harlekin <harlekin> | 2002-07-13 14:02:59 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-07-13 14:02:59 (UTC) |
commit | 9a97566ac38b51e27707342556171af63f6a75b4 (patch) (unidiff) | |
tree | af9b6a746090f6ca243af5c250e688f07c7ea708 /noncore/net/opietooth/manager/obexdialog.cpp | |
parent | c86efeae9e7f7f63dca633f630b571019a5c71b6 (diff) | |
download | opie-9a97566ac38b51e27707342556171af63f6a75b4.zip opie-9a97566ac38b51e27707342556171af63f6a75b4.tar.gz opie-9a97566ac38b51e27707342556171af63f6a75b4.tar.bz2 |
obex dialog added and fixes to ppp dialog
Diffstat (limited to 'noncore/net/opietooth/manager/obexdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/obexdialog.cpp | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp new file mode 100644 index 0000000..cb142eb --- a/dev/null +++ b/noncore/net/opietooth/manager/obexdialog.cpp | |||
@@ -0,0 +1,84 @@ | |||
1 | |||
2 | #include "obexdialog.h" | ||
3 | #include <qpushbutton.h> | ||
4 | #include <qmultilineedit.h> | ||
5 | #include <qlineedit.h> | ||
6 | #include <qlayout.h> | ||
7 | #include <qlabel.h> | ||
8 | #include <qfileinfo.h> | ||
9 | |||
10 | #include <qpe/resource.h> | ||
11 | |||
12 | #include <opie/oprocess.h> | ||
13 | #include <opie/ofiledialog.h> | ||
14 | |||
15 | ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) | ||
16 | : QDialog( parent, name, modal, fl ) { | ||
17 | |||
18 | if ( !name ) | ||
19 | setName( "ObexDialog" ); | ||
20 | setCaption( tr( "beam files " ) ) ; | ||
21 | |||
22 | m_device = device; | ||
23 | |||
24 | layout = new QVBoxLayout( this ); | ||
25 | |||
26 | QLabel* info = new QLabel( this ); | ||
27 | info->setText( tr("Which file should be beamed?") ); | ||
28 | |||
29 | cmdLine = new QLineEdit( this ); | ||
30 | |||
31 | QPushButton *browserButton; | ||
32 | browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); | ||
33 | connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) ); | ||
34 | |||
35 | chNameLine = new QLineEdit( this ); | ||
36 | |||
37 | sendButton = new QPushButton( this ); | ||
38 | sendButton->setText( tr( "Send" ) ); | ||
39 | |||
40 | layout->addWidget(info); | ||
41 | layout->addWidget(cmdLine); | ||
42 | layout->addWidget(browserButton); | ||
43 | layout->addWidget(chNameLine); | ||
44 | layout->addWidget(sendButton); | ||
45 | |||
46 | connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); | ||
47 | |||
48 | } | ||
49 | |||
50 | ObexDialog::~ObexDialog() { | ||
51 | } | ||
52 | |||
53 | void ObexDialog::browse() { | ||
54 | |||
55 | MimeTypes types; | ||
56 | QStringList all; | ||
57 | all << "*/*"; | ||
58 | types.insert("All Files", all ); | ||
59 | |||
60 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); | ||
61 | cmdLine->setText( str ); | ||
62 | |||
63 | } | ||
64 | |||
65 | void ObexDialog::sendData() { | ||
66 | QString fileURL = cmdLine->text(); | ||
67 | QString file = QFileInfo( fileURL ).fileName(); | ||
68 | QString modifiedName = chNameLine->text(); | ||
69 | |||
70 | // vom popupmenu beziehen | ||
71 | OProcess* obexSend = new OProcess(); | ||
72 | if ( !modifiedName.isEmpty() ) { | ||
73 | *obexSend << "ussp-push" << m_device << fileURL << modifiedName; | ||
74 | } else { | ||
75 | *obexSend << "ussp-push" << m_device << fileURL << file; | ||
76 | } | ||
77 | if (!obexSend->start(OProcess::DontCare, OProcess::AllOutput) ) { | ||
78 | qWarning("could not start"); | ||
79 | delete obexSend; | ||
80 | } | ||
81 | |||
82 | |||
83 | |||
84 | } | ||