summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-24 12:49:24 (UTC)
committer harlekin <harlekin>2002-10-24 12:49:24 (UTC)
commit263b907b4f3bd3be7725d234ff42be86cff39ab7 (patch) (side-by-side diff)
tree2c5edaf127210e80030af54122c55ab836dac4d2
parentc2a6bda0c89ee3ac97323108f0eec80b658a3995 (diff)
downloadopie-263b907b4f3bd3be7725d234ff42be86cff39ab7.zip
opie-263b907b4f3bd3be7725d234ff42be86cff39ab7.tar.gz
opie-263b907b4f3bd3be7725d234ff42be86cff39ab7.tar.bz2
de- /activate file transfer menu entry according to layer capabilities
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp29
1 files changed, 11 insertions, 18 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index ddaaf1b..c7750be 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -161,64 +161,48 @@ void MainWindow::initUI() {
m_recordScript->addTo(m_scripts);
connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
m_saveScript->addTo(m_scripts);
connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0);
m_runScript->addTo(m_scripts);
connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript()));
/*
* action that open/closes the keyboard
*/
m_openKeys = new QAction (tr("Open Keyboard..."),
Resource::loadPixmap( "console/keys/keyboard_icon" ),
QString::null, 0, this, 0);
m_openKeys->setToggleAction(true);
connect (m_openKeys, SIGNAL(toggled(bool)),
this, SLOT(slotOpenKeb(bool)));
m_openKeys->addTo(m_icons);
-
- /*
- * action that open/closes the keyboard
-
- m_openButtons = new QAction ( tr( "Open Buttons..." ),
- Resource::loadPixmap( "" ),
- QString::null, 0, this, 0 );
-
- m_openButtons->setToggleAction( true );
-
- connect ( m_openButtons, SIGNAL( toggled( bool ) ),
- this, SLOT( slotOpenButtons( bool ) ) );
- m_openButtons->addTo( m_icons );
-
- */
-
/* insert the submenu */
m_console->insertItem(tr("New from Profile"), m_sessionsPop,
-1, 0);
/* insert the connection menu */
m_bar->insertItem( tr("Connection"), m_console );
/* the scripts menu */
m_bar->insertItem( tr("Scripts"), m_scripts );
/* the settings menu */
// m_bar->insertItem( tr("Settings"), m_settings );
/* and the keyboard */
m_keyBar = new QToolBar(this);
addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
m_keyBar->setHorizontalStretchable( TRUE );
m_keyBar->hide();
m_kb = new FunctionKeyboard(m_keyBar);
connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)),
this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool)));
m_buttonBar = new QToolBar( this );
@@ -331,57 +315,59 @@ void MainWindow::slotRunScript() {
if (currentSession()) {
MimeTypes types;
QStringList script;
script << "text/plain";
script << "text/all";
script << "application/octet-stream";
types.insert("Script", script);
QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types);
if (!filename.isEmpty()) {
Script script(DocLnk(filename).file());
currentSession()->emulationHandler()->runScript(&script);
}
}
}
void MainWindow::slotConnect() {
if ( currentSession() ) {
bool ret = currentSession()->layer()->open();
if(!ret) QMessageBox::warning(currentSession()->widgetStack(),
QObject::tr("Failed"),
QObject::tr("Connecting failed for this session."));
else {
m_connect->setEnabled( false );
m_disconnect->setEnabled( true );
+ m_transfer->setEnabled( true );
}
}
}
void MainWindow::slotDisconnect() {
if ( currentSession() ) {
currentSession()->layer()->close();
m_connect->setEnabled( true );
m_disconnect->setEnabled( false );
+ m_transfer->setEnabled( false );
}
}
void MainWindow::slotTerminate() {
if ( currentSession() )
currentSession()->layer()->close();
slotClose();
/* FIXME move to the next session */
}
void MainWindow::slotConfigure() {
ConfigDialog conf( manager()->all(), factory() );
conf.showMaximized();
int ret = conf.exec();
if ( QDialog::Accepted == ret ) {
manager()->setProfiles( conf.list() );
manager()->save();
populateProfiles();
}
}
/*
@@ -426,109 +412,116 @@ void MainWindow::slotProfile( int id) {
Profile prof = manager()->profile( m_sessionsPop->text( id) );
create( prof );
}
void MainWindow::create( const Profile& prof ) {
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;
}
m_sessions.append( ses );
tabWidget()->add( ses );
tabWidget()->repaint();
m_curSession = ses;
// dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
m_connect->setEnabled( true );
m_disconnect->setEnabled( false );
m_terminate->setEnabled( true );
- m_transfer->setEnabled( true );
m_recordScript->setEnabled( true );
m_saveScript->setEnabled( true );
m_runScript->setEnabled( true );
m_fullscreen->setEnabled( true );
m_closewindow->setEnabled( true );
-
+ m_transfer->setEnabled( false );
// is io_layer wants direct connection, then autoconnect
//if ( ( m_curSession->layer() )->supports()[0] == 1 ) {
if (prof.autoConnect()) {
slotConnect();
}
+
+
QWidget *w = currentSession()->widget();
if(w) w->setFocus();
}
void MainWindow::slotTransfer()
{
if ( currentSession() ) {
TransferDialog dlg(currentSession()->widgetStack(), this);
dlg.showMaximized();
//currentSession()->widgetStack()->add(dlg);
dlg.exec();
}
}
void MainWindow::slotOpenKeb(bool state) {
if (state) m_keyBar->show();
else m_keyBar->hide();
}
void MainWindow::slotOpenButtons( bool state ) {
if ( state ) {
m_buttonBar->show();
} else {
m_buttonBar->hide();
}
}
void MainWindow::slotSessionChanged( Session* ses ) {
qWarning("changed!");
if ( ses ) {
m_curSession = ses;
qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
if ( m_curSession->layer()->isConnected() ) {
m_connect->setEnabled( false );
m_disconnect->setEnabled( true );
} else {
m_connect->setEnabled( true );
m_disconnect->setEnabled( false );
}
+ if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
+ m_transfer->setEnabled( false );
+ } else {
+ m_transfer->setEnabled( true );
+ }
+
QWidget *w = m_curSession->widget();
if(w) w->setFocus();
}
}
void MainWindow::slotFullscreen() {
if ( m_isFullscreen ) {
( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true );
( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() );
( m_curSession->emulationHandler() )->cornerButton()->hide();
disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
} else {
savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget();
( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop
, QPoint(0,0), false );
( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() );
( m_curSession->widgetStack() )->setFocus();
( m_curSession->widgetStack() )->show();