author | drw <drw> | 2004-02-23 17:41:08 (UTC) |
---|---|---|
committer | drw <drw> | 2004-02-23 17:41:08 (UTC) |
commit | 0259f547f4dea6e10df1e02ee78b343137de24ed (patch) (side-by-side diff) | |
tree | c09a0a69c8dfe397238bf476a849875306072855 | |
parent | d1e639b1272a6ba18ebe3fc982148ce0cb5c8c84 (diff) | |
download | opie-0259f547f4dea6e10df1e02ee78b343137de24ed.zip opie-0259f547f4dea6e10df1e02ee78b343137de24ed.tar.gz opie-0259f547f4dea6e10df1e02ee78b343137de24ed.tar.bz2 |
Opie Console: libopie->libopie2
-rw-r--r-- | noncore/apps/opie-console/config.in | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/file_layer.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/filetransfer.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/filetransfer.h | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_bt.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_irda.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 74 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.control | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 112 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/sz_transfer.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/sz_transfer.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/tabwidget.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/console.pro | 10 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/senderui.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/transferdialog.cpp | 416 |
17 files changed, 318 insertions, 322 deletions
diff --git a/noncore/apps/opie-console/config.in b/noncore/apps/opie-console/config.in index 521154d..b5702a9 100644 --- a/noncore/apps/opie-console/config.in +++ b/noncore/apps/opie-console/config.in @@ -1,4 +1,4 @@ config OPIE-CONSOLE boolean "opie-console (scriptable terminal program)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI diff --git a/noncore/apps/opie-console/file_layer.cpp b/noncore/apps/opie-console/file_layer.cpp index 9ddef80..870e913 100644 --- a/noncore/apps/opie-console/file_layer.cpp +++ b/noncore/apps/opie-console/file_layer.cpp @@ -1,8 +1,6 @@ -#include <opie/oprocess.h> - #include "file_layer.h" FileTransferLayer::FileTransferLayer(IOLayer *layer) : QObject(), m_layer( layer ) { } diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp index 347d6e0..7eebc65 100644 --- a/noncore/apps/opie-console/filetransfer.cpp +++ b/noncore/apps/opie-console/filetransfer.cpp @@ -3,14 +3,12 @@ #include <errno.h> #include <fcntl.h> #include <unistd.h> #include <qsocketnotifier.h> -#include <opie/oprocess.h> - #include "procctl.h" #include "filetransfer.h" FileTransfer::FileTransfer( Type t, IOLayer* lay ) : FileTransferLayer( lay ), m_type( t ), m_pid ( 0 ) { diff --git a/noncore/apps/opie-console/filetransfer.h b/noncore/apps/opie-console/filetransfer.h index 8f55041..3b79cda 100644 --- a/noncore/apps/opie-console/filetransfer.h +++ b/noncore/apps/opie-console/filetransfer.h @@ -1,18 +1,19 @@ #ifndef OPIE_FILE_TRANSFER_H #define OPIE_FILE_TRANSFER_H #include <sys/types.h> +#include <opie2/oprocess.h> + #include <qfile.h> #include <qstringlist.h> #include "file_layer.h" class QSocketNotifier; -class OProcess; class FileTransferControl; class FileTransfer : public FileTransferLayer{ Q_OBJECT friend class FileTransferControl; public: enum Type { diff --git a/noncore/apps/opie-console/io_bt.h b/noncore/apps/opie-console/io_bt.h index 239eefb..df6dd38 100644 --- a/noncore/apps/opie-console/io_bt.h +++ b/noncore/apps/opie-console/io_bt.h @@ -1,10 +1,10 @@ #ifndef OPIE_IO_BT #define OPIE_IO_BT -#include <opie/oprocess.h> +#include <opie2/oprocess.h> #include "io_serial.h" /* Default values to be used if the profile information is incomplete */ #define BT_DEFAULT_DEVICE "/dev/ttyU0" #define BT_DEFAULT_BAUD 9600 #define BT_DEFAULT_PARITY 0 diff --git a/noncore/apps/opie-console/io_irda.h b/noncore/apps/opie-console/io_irda.h index 14b1ae3..69bed7d 100644 --- a/noncore/apps/opie-console/io_irda.h +++ b/noncore/apps/opie-console/io_irda.h @@ -1,10 +1,10 @@ #ifndef OPIE_IO_IRDA #define OPIE_IO_IRDA -#include <opie/oprocess.h> +#include <opie2/oprocess.h> #include "io_serial.h" /* Default values to be used if the profile information is incomplete */ #define IRDA_DEFAULT_DEVICE "/dev/ircomm0" #define IRDA_DEFAULT_BAUD 9600 #define IRDA_DEFAULT_PARITY 0 diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h index 2a926df..96ec3ef 100644 --- a/noncore/apps/opie-console/io_modem.h +++ b/noncore/apps/opie-console/io_modem.h @@ -1,10 +1,10 @@ #ifndef OPIE_IO_MODEM #define OPIE_IO_MODEM -#include <opie/oprocess.h> +#include <opie2/oprocess.h> #include "io_serial.h" #include "profile.h" /* Default values to be used if the profile information is incomplete */ #define MODEM_DEFAULT_DEVICE "/dev/ttyS0" #define MODEM_DEFAULT_BAUD 9600 @@ -61,13 +61,13 @@ public slots: private: QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2, m_dialSuf2, m_dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime, m_bpsDetect, m_dcdLines, m_multiLineUntag; - Profile m_profile; + Profile m_profile; private slots: void slotExited(OProcess* proc); }; diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 3fe9040..0a475d8 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -7,13 +7,13 @@ #include <qwhatsthis.h> #include <qfileinfo.h> #include <qpe/filemanager.h> #include <qpe/qpeapplication.h> -#include <opie/ofiledialog.h> +#include <opie2/ofiledialog.h> #include "TEmulation.h" #include "profileeditordialog.h" #include "configdialog.h" #include "default.h" #include "profilemanager.h" @@ -330,13 +330,13 @@ void MainWindow::slotRecordScript() { void MainWindow::slotSaveScript() { if (currentSession() && currentSession()->emulationHandler()->isRecording()) { QMap<QString, QStringList> map; QStringList text; text << "text/plain"; map.insert(tr("Script"), text ); - QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); + QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); if (!filename.isEmpty()) { QFileInfo info(filename); if (info.extension(FALSE) != "script") filename += ".script"; DocLnk nf; nf.setType("text/plain"); @@ -444,14 +444,14 @@ void MainWindow::slotConfigure() { void MainWindow::slotClose() { if (!currentSession() ) return; Session* ses = currentSession(); qWarning("removing! currentSession %s", currentSession()->name().latin1() ); - /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ - m_curSession = NULL; + /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ + m_curSession = NULL; tabWidget()->remove( /*currentSession()*/ses ); /*it's autodelete */ m_sessions.remove( ses ); qWarning("after remove!!"); if (!currentSession() ) { @@ -480,25 +480,25 @@ void MainWindow::slotProfile( int id) { create( prof ); } void MainWindow::create( const Profile& prof ) { - if(m_curSession) - if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); + if(m_curSession) + if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); Session *ses = manager()->fromProfile( prof, tabWidget() ); if((!ses) || (!ses->layer()) || (!ses->widgetStack())) - { - QMessageBox::warning(this, - QObject::tr("Session failed"), - QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); - //if(ses) delete ses; - return; - } + { + QMessageBox::warning(this, + QObject::tr("Session failed"), + QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); + //if(ses) delete ses; + return; + } m_sessions.append( ses ); tabWidget()->add( ses ); tabWidget()->repaint(); m_curSession = ses; @@ -533,22 +533,22 @@ void MainWindow::create( const Profile& prof ) { m_kb->load(currentSession()->profile()); } void MainWindow::slotTransfer() { if ( currentSession() ) { - Session *mysession = currentSession(); - TransferDialog dlg(/*mysession->widgetStack()*/this, this); - mysession->setTransferDialog(&dlg); - //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); - //dlg.showMaximized(); - currentSession()->widgetStack()->addWidget(&dlg, -1); - dlg.show(); - //dlg.exec(); - while(dlg.isRunning()) qApp->processEvents(); - mysession->setTransferDialog(0l); + Session *mysession = currentSession(); + TransferDialog dlg(/*mysession->widgetStack()*/this, this); + mysession->setTransferDialog(&dlg); + //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); + //dlg.showMaximized(); + currentSession()->widgetStack()->addWidget(&dlg, -1); + dlg.show(); + //dlg.exec(); + while(dlg.isRunning()) qApp->processEvents(); + mysession->setTransferDialog(0l); } } void MainWindow::slotOpenKeb(bool state) { @@ -569,16 +569,16 @@ void MainWindow::slotOpenButtons( bool state ) { void MainWindow::slotSessionChanged( Session* ses ) { qWarning("changed!"); - if(m_curSession) - if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); - if(ses) - if(ses->transferDialog()) ses->transferDialog()->show(); + if(m_curSession) + if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); + if(ses) + if(ses->transferDialog()) ses->transferDialog()->show(); if ( ses ) { m_curSession = ses; qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); if ( m_curSession->layer()->isConnected() ) { m_connect->setEnabled( false ); @@ -618,21 +618,21 @@ void MainWindow::slotWrap() if(m_curSession) { EmulationHandler *e = m_curSession->emulationHandler(); if(e) { if(m_isWrapped) - { - e->setWrap(80); - m_isWrapped = false; - } - else - { - e->setWrap(0); - m_isWrapped = true; - } + { + e->setWrap(80); + m_isWrapped = false; + } + else + { + e->setWrap(0); + m_isWrapped = true; + } } } } void MainWindow::slotFullscreen() { @@ -703,13 +703,13 @@ void MainWindow::slotSaveSession() { } void MainWindow::slotSaveHistory() { QMap<QString, QStringList> map; QStringList text; text << "text/plain"; map.insert(tr("History"), text ); - QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); + QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); if (filename.isEmpty() ) return; QFileInfo info(filename); DocLnk nf; nf.setType("text/plain"); diff --git a/noncore/apps/opie-console/opie-console.control b/noncore/apps/opie-console/opie-console.control index 5548baf..a7ff1f3 100644 --- a/noncore/apps/opie-console/opie-console.control +++ b/noncore/apps/opie-console/opie-console.control @@ -2,9 +2,9 @@ Package: opie-console Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* Priority: optional Section: opie/applications Maintainer: Opie Team <opie@handhelds.org> Architecture: arm Version: 0.6-$SUB_VERSION -Depends: qpe-base, libopie1, opie-console-help-en, lrzsz, opie-keytabs +Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs License: GPL Description: Opie terminal app diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index ccf2e08..d3d7b25 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro @@ -1,76 +1,76 @@ TEMPLATE = app -TMAKE_CXXFLAGS += -DHAVE_OPENPTY +TMAKE_CXXFLAGS += -DHAVE_OPENPTY CONFIG += qt warn_on release -#CONFIG = qt debug +#CONFIG = qt debug DESTDIR = $(OPIEDIR)/bin HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ - file_layer.h filetransfer.h \ - metafactory.h \ - session.h \ - mainwindow.h \ - profile.h \ - profileconfig.h \ - profilemanager.h \ - tabwidget.h \ - configdialog.h \ - keytrans.h \ - transferdialog.h \ - profiledialogwidget.h \ - profileeditordialog.h \ - default.h \ - iolayerbase.h \ - serialconfigwidget.h irdaconfigwidget.h \ - btconfigwidget.h modemconfigwidget.h \ - atconfigdialog.h dialdialog.h \ + file_layer.h filetransfer.h \ + metafactory.h \ + session.h \ + mainwindow.h \ + profile.h \ + profileconfig.h \ + profilemanager.h \ + tabwidget.h \ + configdialog.h \ + keytrans.h \ + transferdialog.h \ + profiledialogwidget.h \ + profileeditordialog.h \ + default.h \ + iolayerbase.h \ + serialconfigwidget.h irdaconfigwidget.h \ + btconfigwidget.h modemconfigwidget.h \ + atconfigdialog.h dialdialog.h \ procctl.h \ function_keyboard.h \ - receive_layer.h filereceive.h \ - script.h \ - dialer.h \ - terminalwidget.h \ - emulation_handler.h TECommon.h \ - TEHistory.h TEScreen.h TEWidget.h \ - TEmuVt102.h TEmulation.h MyPty.h \ - consoleconfigwidget.h + receive_layer.h filereceive.h \ + script.h \ + dialer.h \ + terminalwidget.h \ + emulation_handler.h TECommon.h \ + TEHistory.h TEScreen.h TEWidget.h \ + TEmuVt102.h TEmulation.h MyPty.h \ + consoleconfigwidget.h SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ - file_layer.cpp filetransfer.cpp \ + file_layer.cpp filetransfer.cpp \ main.cpp \ - metafactory.cpp \ - session.cpp \ - mainwindow.cpp \ - profile.cpp \ - profileconfig.cpp \ - profilemanager.cpp \ - tabwidget.cpp \ - configdialog.cpp \ - keytrans.cpp \ - transferdialog.cpp \ - profiledialogwidget.cpp \ - profileeditordialog.cpp \ - iolayerbase.cpp \ - serialconfigwidget.cpp irdaconfigwidget.cpp \ - btconfigwidget.cpp modemconfigwidget.cpp \ - atconfigdialog.cpp dialdialog.cpp \ - default.cpp procctl.cpp \ + metafactory.cpp \ + session.cpp \ + mainwindow.cpp \ + profile.cpp \ + profileconfig.cpp \ + profilemanager.cpp \ + tabwidget.cpp \ + configdialog.cpp \ + keytrans.cpp \ + transferdialog.cpp \ + profiledialogwidget.cpp \ + profileeditordialog.cpp \ + iolayerbase.cpp \ + serialconfigwidget.cpp irdaconfigwidget.cpp \ + btconfigwidget.cpp modemconfigwidget.cpp \ + atconfigdialog.cpp dialdialog.cpp \ + default.cpp procctl.cpp \ function_keyboard.cpp \ - receive_layer.cpp filereceive.cpp \ - script.cpp \ - dialer.cpp \ - terminalwidget.cpp \ - emulation_handler.cpp TEHistory.cpp \ - TEScreen.cpp TEWidget.cpp \ - TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ - consoleconfigwidget.cpp - + receive_layer.cpp filereceive.cpp \ + script.cpp \ + dialer.cpp \ + terminalwidget.cpp \ + emulation_handler.cpp TEHistory.cpp \ + TEScreen.cpp TEWidget.cpp \ + TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ + consoleconfigwidget.cpp + INTERFACES = configurebase.ui editbase.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopie -lutil +LIBS += -lqpe -lopiecore2 -lopieui2 -lutil TARGET = opie-console include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h index c731747..97bd650 100644 --- a/noncore/apps/opie-console/profileeditordialog.h +++ b/noncore/apps/opie-console/profileeditordialog.h @@ -1,11 +1,11 @@ #ifndef PROFILE_EDITOR_DIALOG #define PROFILE_EDITOR_DIALOG #include <qdialog.h> -#include <opie/otabwidget.h> +#include <opie2/otabwidget.h> #include "profile.h" class MetaFactory; class EditBase; class QTabWidget; diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp index 0a315cf..c47e73e 100644 --- a/noncore/apps/opie-console/sz_transfer.cpp +++ b/noncore/apps/opie-console/sz_transfer.cpp @@ -1,10 +1,9 @@ #include "sz_transfer.h" #include <qfile.h> -#include <opie/oprocess.h> #include <stdio.h> #include <sys/termios.h> SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) diff --git a/noncore/apps/opie-console/sz_transfer.h b/noncore/apps/opie-console/sz_transfer.h index d3e6621..aa97c32 100644 --- a/noncore/apps/opie-console/sz_transfer.h +++ b/noncore/apps/opie-console/sz_transfer.h @@ -1,11 +1,11 @@ #ifndef OPIE_FL_SZ_H #define OPIE_FL_SZ_H #include "file_layer.h" -#include <opie/oprocess.h> +#include <opie2/oprocess.h> class SzTransfer : public FileTransferLayer { Q_OBJECT public: diff --git a/noncore/apps/opie-console/tabwidget.h b/noncore/apps/opie-console/tabwidget.h index cbaa0f1..98450a3 100644 --- a/noncore/apps/opie-console/tabwidget.h +++ b/noncore/apps/opie-console/tabwidget.h @@ -1,11 +1,11 @@ #ifndef OPIE_TAB_WIDGET_H #define OPIE_TAB_WIDGET_H #include <qmap.h> -#include <opie/otabwidget.h> +#include <opie2/otabwidget.h> #include "session.h" /** * This is our central tab widget * we can add sessions here */ diff --git a/noncore/apps/opie-console/test/console.pro b/noncore/apps/opie-console/test/console.pro index 7b4c310..624f381 100644 --- a/noncore/apps/opie-console/test/console.pro +++ b/noncore/apps/opie-console/test/console.pro @@ -1,21 +1,21 @@ TEMPLATE = app #CONFIG = qt warn_on release -CONFIG = qt debug +CONFIG = qt debug #DESTDIR = $(OPIEDIR)/bin HEADERS = ../io_layer.h ../io_serial.h ../sz_transfer.h ../file_layer.h\ - senderui.h ../profile.h ../filetransfer.h ../procctl.h \ - ../filereceive.h ../receive_layer.h + senderui.h ../profile.h ../filetransfer.h ../procctl.h \ + ../filereceive.h ../receive_layer.h SOURCES = ../io_layer.cpp ../io_serial.cpp \ ../profile.cpp ../sz_transfer.cpp ../file_layer.cpp\ main.cpp senderui.cpp ../filetransfer.cpp ../procctl.cpp \ - ../filereceive.cpp ../receive_layer.cpp + ../filereceive.cpp ../receive_layer.cpp INTERFACES = sender.ui INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopie +LIBS += -lqpe -lopiecore2 TARGET = test include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp index 4026808..4a7202d 100644 --- a/noncore/apps/opie-console/test/senderui.cpp +++ b/noncore/apps/opie-console/test/senderui.cpp @@ -8,13 +8,13 @@ #include "../profile.h" #include "../io_serial.h" #include "../filetransfer.h" #include "../filereceive.h" -#include <opie/oprocess.h> +#include <opie2/oprocess.h> #include "senderui.h" SenderUI::SenderUI() : Sender() { diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp index 55dd748..30e7caf 100644 --- a/noncore/apps/opie-console/transferdialog.cpp +++ b/noncore/apps/opie-console/transferdialog.cpp @@ -5,271 +5,271 @@ #include <qpushbutton.h> #include <qmessagebox.h> #include <qprogressbar.h> #include <qradiobutton.h> #include <qbuttongroup.h> -#include <opie/ofiledialog.h> +#include <opie2/ofiledialog.h> #include "metafactory.h" #include "mainwindow.h" #include "transferdialog.h" TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const char *) : QDialog(parent, 0l, false), m_win(mainwindow) { m_lay = 0l; - m_recvlay = 0l; - QVBoxLayout *vbox, *vbox2; - QHBoxLayout *hbox, *hbox2, *hbox3; - QLabel *file, *mode, *progress, *status; - QButtonGroup *group; - QRadioButton *mode_send, *mode_receive; - - m_autocleanup = 0; - m_running = true; - - group = new QButtonGroup(QObject::tr("Transfer mode"), this); - mode_send = new QRadioButton(QObject::tr("Send"), group); - mode_receive = new QRadioButton(QObject::tr("Receive"), group); - group->insert(mode_send, id_send); - group->insert(mode_receive, id_receive); - vbox2 = new QVBoxLayout(group, 2); - vbox2->addSpacing(10); - hbox3 = new QHBoxLayout(vbox2, 2); - hbox3->add(mode_send); - hbox3->add(mode_receive); - mode_send->setChecked(true); - m_transfermode = id_send; - - file = new QLabel(QObject::tr("Send file"), this); - mode = new QLabel(QObject::tr("Transfer protocol"), this); - progress = new QLabel(QObject::tr("Progress"), this); - status = new QLabel(QObject::tr("Status"), this); - - statusbar = new QLabel(QObject::tr("Ready"), this); - statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); - - protocol = new QComboBox(this); - QStringList list = m_win->factory()->fileTransferLayers(); - for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) - protocol->insertItem((*it)); - - filename = new QLineEdit(this); - - progressbar = new QProgressBar(this); - progressbar->setProgress(0); - - selector = new QPushButton("...", this); - ok = new QPushButton(QObject::tr("Start transfer"), this); - cancel = new QPushButton(QObject::tr("Cancel"), this); - - vbox = new QVBoxLayout(this, 2); - vbox->add(group); - vbox->add(file); - hbox = new QHBoxLayout(vbox, 0); - hbox->add(filename); - hbox->add(selector); - vbox->add(mode); - vbox->add(protocol); - vbox->add(progress); - vbox->add(progressbar); - vbox->add(status); - vbox->add(statusbar); - vbox->addStretch(1); - hbox2 = new QHBoxLayout(vbox, 2); - hbox2->add(ok); - hbox2->add(cancel); - - setCaption(QObject::tr("File transfer")); - show(); - - connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); - connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); - connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); - connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int))); + m_recvlay = 0l; + QVBoxLayout *vbox, *vbox2; + QHBoxLayout *hbox, *hbox2, *hbox3; + QLabel *file, *mode, *progress, *status; + QButtonGroup *group; + QRadioButton *mode_send, *mode_receive; + + m_autocleanup = 0; + m_running = true; + + group = new QButtonGroup(QObject::tr("Transfer mode"), this); + mode_send = new QRadioButton(QObject::tr("Send"), group); + mode_receive = new QRadioButton(QObject::tr("Receive"), group); + group->insert(mode_send, id_send); + group->insert(mode_receive, id_receive); + vbox2 = new QVBoxLayout(group, 2); + vbox2->addSpacing(10); + hbox3 = new QHBoxLayout(vbox2, 2); + hbox3->add(mode_send); + hbox3->add(mode_receive); + mode_send->setChecked(true); + m_transfermode = id_send; + + file = new QLabel(QObject::tr("Send file"), this); + mode = new QLabel(QObject::tr("Transfer protocol"), this); + progress = new QLabel(QObject::tr("Progress"), this); + status = new QLabel(QObject::tr("Status"), this); + + statusbar = new QLabel(QObject::tr("Ready"), this); + statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); + + protocol = new QComboBox(this); + QStringList list = m_win->factory()->fileTransferLayers(); + for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) + protocol->insertItem((*it)); + + filename = new QLineEdit(this); + + progressbar = new QProgressBar(this); + progressbar->setProgress(0); + + selector = new QPushButton("...", this); + ok = new QPushButton(QObject::tr("Start transfer"), this); + cancel = new QPushButton(QObject::tr("Cancel"), this); + + vbox = new QVBoxLayout(this, 2); + vbox->add(group); + vbox->add(file); + hbox = new QHBoxLayout(vbox, 0); + hbox->add(filename); + hbox->add(selector); + vbox->add(mode); + vbox->add(protocol); + vbox->add(progress); + vbox->add(progressbar); + vbox->add(status); + vbox->add(statusbar); + vbox->addStretch(1); + hbox2 = new QHBoxLayout(vbox, 2); + hbox2->add(ok); + hbox2->add(cancel); + + setCaption(QObject::tr("File transfer")); + show(); + + connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); + connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); + connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); + connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int))); } TransferDialog::~TransferDialog() { } void TransferDialog::slotFilename() { - QString f; + QString f; - f = OFileDialog::getOpenFileName(0); - if(!f.isNull()) filename->setText(f); + f = Opie::OFileDialog::getOpenFileName(0); + if(!f.isNull()) filename->setText(f); } void TransferDialog::slotTransfer() { - if((m_transfermode == id_send) && (filename->text().isEmpty())) - { - QMessageBox::information(this, - QObject::tr("Attention"), - QObject::tr("No file has been specified.")); - return; - } - - ok->setEnabled(false); - - cleanup(); - m_autocleanup = 0; - - if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending...")); - else statusbar->setText(QObject::tr("Receiving...")); - - if(m_transfermode == id_send) - { - m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); - m_lay->sendFile(filename->text()); - - connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), - SLOT(slotProgress(const QString&, int, int, int, int, int))); - connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); - connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); - } - else - { - m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer()); - m_recvlay->receive(); - - connect(m_recvlay, SIGNAL(progress(const QString&, int, int, int, int, int)), - SLOT(slotProgress(const QString&, int, int, int, int, int))); - connect(m_recvlay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); - connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&))); - } + if((m_transfermode == id_send) && (filename->text().isEmpty())) + { + QMessageBox::information(this, + QObject::tr("Attention"), + QObject::tr("No file has been specified.")); + return; + } + + ok->setEnabled(false); + + cleanup(); + m_autocleanup = 0; + + if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending...")); + else statusbar->setText(QObject::tr("Receiving...")); + + if(m_transfermode == id_send) + { + m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); + m_lay->sendFile(filename->text()); + + connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), + SLOT(slotProgress(const QString&, int, int, int, int, int))); + connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); + connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); + } + else + { + m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer()); + m_recvlay->receive(); + + connect(m_recvlay, SIGNAL(progress(const QString&, int, int, int, int, int)), + SLOT(slotProgress(const QString&, int, int, int, int, int))); + connect(m_recvlay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); + connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&))); + } } void TransferDialog::cleanup() { - if(m_lay) - { - m_lay->cancel(); - delete m_lay; - m_lay = 0l; - } - if(m_recvlay) - { - m_recvlay->cancel(); - delete m_recvlay; - m_recvlay = 0l; - } + if(m_lay) + { + m_lay->cancel(); + delete m_lay; + m_lay = 0l; + } + if(m_recvlay) + { + m_recvlay->cancel(); + delete m_recvlay; + m_recvlay = 0l; + } } void TransferDialog::slotCancel() { - ok->setEnabled(true); - statusbar->setText(QObject::tr("Ready")); - - if((m_lay) || (m_recvlay)) - { - cleanup(); - if(m_autocleanup) - { - m_running = false; - close(); - } - else - { - QMessageBox::information(this, - QObject::tr("Cancelled"), - QObject::tr("The file transfer has been cancelled.")); - } - } - else - { - m_running = false; - close(); - } + ok->setEnabled(true); + statusbar->setText(QObject::tr("Ready")); + + if((m_lay) || (m_recvlay)) + { + cleanup(); + if(m_autocleanup) + { + m_running = false; + close(); + } + else + { + QMessageBox::information(this, + QObject::tr("Cancelled"), + QObject::tr("The file transfer has been cancelled.")); + } + } + else + { + m_running = false; + close(); + } } void TransferDialog::slotProgress(const QString& , int progress, int , int , int, int ) { - progressbar->setProgress(progress); + progressbar->setProgress(progress); } void TransferDialog::slotError(int error, const QString& ) { - statusbar->setText(QObject::tr("Ready")); - - switch(error) - { - case FileTransferLayer::NotSupported: - QMessageBox::critical(this, - QObject::tr("Error"), - QObject::tr("Operation not supported.")); - break; - case FileTransferLayer::StartError: - QMessageBox::critical(this, - QObject::tr("Error"), - QObject::tr("Transfer could not be started.")); - break; - case FileTransferLayer::NoError: - QMessageBox::critical(this, - QObject::tr("Error"), - QObject::tr("No error.")); - break; - case FileTransferLayer::Undefined: - QMessageBox::critical(this, - QObject::tr("Error"), - QObject::tr("Undefined error occured.")); - break; - case FileTransferLayer::Incomplete: - QMessageBox::critical(this, - QObject::tr("Error"), - QObject::tr("Incomplete transfer.")); - break; - case FileTransferLayer::Unknown: - default: - QMessageBox::critical(this, - QObject::tr("Error"), - QObject::tr("Unknown error occured.")); - break; - } - - m_autocleanup = 1; + statusbar->setText(QObject::tr("Ready")); + + switch(error) + { + case FileTransferLayer::NotSupported: + QMessageBox::critical(this, + QObject::tr("Error"), + QObject::tr("Operation not supported.")); + break; + case FileTransferLayer::StartError: + QMessageBox::critical(this, + QObject::tr("Error"), + QObject::tr("Transfer could not be started.")); + break; + case FileTransferLayer::NoError: + QMessageBox::critical(this, + QObject::tr("Error"), + QObject::tr("No error.")); + break; + case FileTransferLayer::Undefined: + QMessageBox::critical(this, + QObject::tr("Error"), + QObject::tr("Undefined error occured.")); + break; + case FileTransferLayer::Incomplete: + QMessageBox::critical(this, + QObject::tr("Error"), + QObject::tr("Incomplete transfer.")); + break; + case FileTransferLayer::Unknown: + default: + QMessageBox::critical(this, + QObject::tr("Error"), + QObject::tr("Unknown error occured.")); + break; + } + + m_autocleanup = 1; } void TransferDialog::slotSent() { - progressbar->setProgress(100); - QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been sent.")); - ok->setEnabled(true); - progressbar->setProgress(0); - statusbar->setText(QObject::tr("Ready")); - m_autocleanup = 1; + progressbar->setProgress(100); + QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been sent.")); + ok->setEnabled(true); + progressbar->setProgress(0); + statusbar->setText(QObject::tr("Ready")); + m_autocleanup = 1; } void TransferDialog::slotReceived(const QString& ) { - progressbar->setProgress(100); - QMessageBox::information(this, QObject::tr("Received"), QObject::tr("File has been received.")); - //QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been received as %1.").arg(file)); - ok->setEnabled(true); - progressbar->setProgress(0); - statusbar->setText(QObject::tr("Ready")); - m_autocleanup = 1; + progressbar->setProgress(100); + QMessageBox::information(this, QObject::tr("Received"), QObject::tr("File has been received.")); + //QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been received as %1.").arg(file)); + ok->setEnabled(true); + progressbar->setProgress(0); + statusbar->setText(QObject::tr("Ready")); + m_autocleanup = 1; } void TransferDialog::slotMode(int id) { - if(id == id_send) - { - selector->setEnabled(true); - filename->setEnabled(true); - } - else - { - selector->setEnabled(false); - filename->setEnabled(false); - } - m_transfermode = id; + if(id == id_send) + { + selector->setEnabled(true); + filename->setEnabled(true); + } + else + { + selector->setEnabled(false); + filename->setEnabled(false); + } + m_transfermode = id; } bool TransferDialog::isRunning() { - return m_running; + return m_running; } |