-rw-r--r-- | noncore/apps/opie-console/main.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/main.cpp b/noncore/apps/opie-console/main.cpp index 3b4321a..b17f8e8 100644 --- a/noncore/apps/opie-console/main.cpp +++ b/noncore/apps/opie-console/main.cpp | |||
@@ -1,114 +1,114 @@ | |||
1 | #include <sys/types.h> | 1 | #include <sys/types.h> |
2 | 2 | ||
3 | #include <stdio.h> | 3 | #include <stdio.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <signal.h> | 5 | #include <signal.h> |
6 | 6 | ||
7 | #include <qfile.h> | 7 | #include <qfile.h> |
8 | 8 | ||
9 | #include <qpe/qpeapplication.h> | 9 | #include <qpe/qpeapplication.h> |
10 | 10 | ||
11 | #include "mainwindow.h" | 11 | #include "mainwindow.h" |
12 | 12 | ||
13 | //#define FSCKED_DISTRIBUTION 1 | 13 | //#define FSCKED_DISTRIBUTION 1 |
14 | #ifdef FSCKED_DISTRIBUTION | 14 | #ifdef FSCKED_DISTRIBUTION |
15 | /* | 15 | /* |
16 | * The Zaurus rom | 16 | * The Zaurus rom |
17 | */ | 17 | */ |
18 | class FixIt { | 18 | class FixIt { |
19 | public: | 19 | public: |
20 | FixIt(); | 20 | FixIt(); |
21 | ~FixIt(); | 21 | ~FixIt(); |
22 | void fixIt(); | 22 | void fixIt(); |
23 | /* no real interested in implementing it */ | 23 | /* no real interested in implementing it */ |
24 | void breakIt() { | 24 | void breakIt() { |
25 | 25 | ||
26 | }; | 26 | }; |
27 | char* m_file; | 27 | char* m_file; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | FixIt::FixIt() { | 30 | FixIt::FixIt() { |
31 | /* the new inittab */ | 31 | /* the new inittab */ |
32 | m_file = "#\n# /etc/inittab | 32 | m_file = "#\n# /etc/inittab |
33 | # | 33 | # |
34 | 34 | ||
35 | # 0 - halt (Do NOT set initdefault to this) | 35 | # 0 - halt (Do NOT set initdefault to this) |
36 | # 1 - Single user mode | 36 | # 1 - Single user mode |
37 | # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) | 37 | # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) |
38 | # 3 - Full multiuser mode | 38 | # 3 - Full multiuser mode |
39 | # 4 - JavaVM(Intent) developer mode | 39 | # 4 - JavaVM(Intent) developer mode |
40 | # 5 - JavaVM(Intent) | 40 | # 5 - JavaVM(Intent) |
41 | # 6 - reboot (Do NOT set initdefault to this) | 41 | # 6 - reboot (Do NOT set initdefault to this) |
42 | # | 42 | # |
43 | id:5:initdefault: | 43 | id:5:initdefault: |
44 | 44 | ||
45 | # Specify things to do when starting | 45 | # Specify things to do when starting |
46 | si::sysinit:/etc/rc.d/rc.sysinit | 46 | si::sysinit:/etc/rc.d/rc.sysinit |
47 | 47 | ||
48 | l0:0:wait:/root/etc/rc.d/rc 0 | 48 | l0:0:wait:/root/etc/rc.d/rc 0 |
49 | l1:1:wait:/etc/rc.d/rc 1 | 49 | l1:1:wait:/etc/rc.d/rc 1 |
50 | l2:2:wait:/etc/rc.d/rc 2 | 50 | l2:2:wait:/etc/rc.d/rc 2 |
51 | l3:3:wait:/etc/rc.d/rc 3 | 51 | l3:3:wait:/etc/rc.d/rc 3 |
52 | l4:4:wait:/etc/rc.d/rc 4 | 52 | l4:4:wait:/etc/rc.d/rc 4 |
53 | l5:5:wait:/etc/rc.d/rc 5 | 53 | l5:5:wait:/etc/rc.d/rc 5 |
54 | l6:6:wait:/root/etc/rc.d/rc 6 | 54 | l6:6:wait:/root/etc/rc.d/rc 6 |
55 | 55 | ||
56 | # Specify things to do before rebooting | 56 | # Specify things to do before rebooting |
57 | um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1 | 57 | um::ctrlaltdel:/bin/umount -a -r > /dev/null 2>&1 |
58 | sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1 | 58 | sw::ctrlaltdel:/sbin/swapoff -a > /dev/null 2>&1 |
59 | 59 | ||
60 | # Specify program to run on ttyS0 | 60 | # Specify program to run on ttyS0 |
61 | s0:24:respawn:/sbin/getty 9600 ttyS0 | 61 | s0:24:respawn:/sbin/getty 9600 ttyS0 |
62 | #pd:5:respawn:/etc/sync/serialctl | 62 | #pd:5:respawn:/etc/sync/serialctl |
63 | 63 | ||
64 | # Specify program to run on tty1 | 64 | # Specify program to run on tty1 |
65 | 1:2:respawn:/sbin/getty 9600 tty1 | 65 | 1:2:respawn:/sbin/getty 9600 tty1 |
66 | ln:345:respawn:survive -l 6 /sbin/launch | 66 | ln:345:respawn:survive -l 6 /sbin/launch |
67 | #qt:5:respawn:/sbin/qt | 67 | #qt:5:respawn:/sbin/qt |
68 | 68 | ||
69 | # collie sp. | 69 | # collie sp. |
70 | sy::respawn:/sbin/shsync\n"; | 70 | sy::respawn:/sbin/shsync\n"; |
71 | 71 | ||
72 | 72 | ||
73 | } | 73 | } |
74 | FixIt::~FixIt() { | 74 | FixIt::~FixIt() { |
75 | } | 75 | } |
76 | /* | 76 | /* |
77 | * the retail Zaurus is broken in many ways | 77 | * the retail Zaurus is broken in many ways |
78 | * one is that pppd is listening on our port... | 78 | * one is that pppd is listening on our port... |
79 | * we've to stop it from that and then do kill(SIGHUP,1); | 79 | * we've to stop it from that and then do kill(SIGHUP,1); |
80 | */ | 80 | */ |
81 | void FixIt::fixIt() { | 81 | void FixIt::fixIt() { |
82 | ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); | 82 | ::rename("/etc/inittab", QPEApplication::qpeDir() + "/etc/inittab" ); |
83 | QFile file( "/etc/inittab" ); | 83 | QFile file( "/etc/inittab" ); |
84 | if ( file.open(IO_WriteOnly | IO_Raw ) ) { | 84 | if ( file.open(IO_WriteOnly | IO_Raw ) ) { |
85 | file.writeBlock(m_file,strlen(m_file) ); | 85 | file.writeBlock(m_file,strlen(m_file) ); |
86 | } | 86 | } |
87 | file.close(); | 87 | file.close(); |
88 | ::kill( SIGHUP, 1 ); | 88 | ::kill( SIGHUP, 1 ); |
89 | } | 89 | } |
90 | #endif | 90 | #endif |
91 | 91 | ||
92 | 92 | ||
93 | int main(int argc, char **argv) { | 93 | int main(int argc, char **argv) { |
94 | // too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole"; | 94 | // too bad this gives us trouble the taskbar... argv[0]="embeddedkonsole"; |
95 | QPEApplication app( argc, argv ); | 95 | QPEApplication app( argc, argv ); |
96 | 96 | ||
97 | #ifdef FSCKED_DISTRIBUTION | 97 | #ifdef FSCKED_DISTRIBUTION |
98 | qWarning("fscked"); | 98 | qWarning("fscked"); |
99 | FixIt it; | 99 | FixIt it; |
100 | it.fixIt(); | 100 | it.fixIt(); |
101 | #endif | 101 | #endif |
102 | 102 | ||
103 | MainWindow mw; | 103 | MainWindow mw; |
104 | mw.setCaption(QObject::tr("Opie console") ); | 104 | mw.setCaption(QObject::tr("Opie Console") ); |
105 | app.showMainWidget( &mw ); | 105 | app.showMainWidget( &mw ); |
106 | 106 | ||
107 | int ap = app.exec(); | 107 | int ap = app.exec(); |
108 | 108 | ||
109 | #ifdef FSCKED_DISTRIBUTION | 109 | #ifdef FSCKED_DISTRIBUTION |
110 | /* should add a signal handler too */ | 110 | /* should add a signal handler too */ |
111 | it.breakIt(); | 111 | it.breakIt(); |
112 | #endif | 112 | #endif |
113 | return ap; | 113 | return ap; |
114 | } | 114 | } |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 3acbfad..c48116d 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,520 +1,525 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qmenubar.h> | 4 | #include <qmenubar.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qpopupmenu.h> | 6 | #include <qpopupmenu.h> |
7 | #include <qtoolbar.h> | 7 | #include <qtoolbar.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qwhatsthis.h> | 10 | #include <qwhatsthis.h> |
11 | #include <qfileinfo.h> | 11 | #include <qfileinfo.h> |
12 | #include <qtextstream.h> | 12 | #include <qtextstream.h> |
13 | 13 | ||
14 | #include <qpe/resource.h> | 14 | #include <qpe/resource.h> |
15 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
16 | #include <qpe/filemanager.h> | 16 | #include <qpe/filemanager.h> |
17 | #include <qpe/mimetype.h> | 17 | #include <qpe/mimetype.h> |
18 | 18 | ||
19 | #include <opie/ofiledialog.h> | 19 | #include <opie/ofiledialog.h> |
20 | 20 | ||
21 | #include "TEmulation.h" | 21 | #include "TEmulation.h" |
22 | #include "keytrans.h" | 22 | #include "keytrans.h" |
23 | #include "profileeditordialog.h" | 23 | #include "profileeditordialog.h" |
24 | #include "configdialog.h" | 24 | #include "configdialog.h" |
25 | #include "default.h" | 25 | #include "default.h" |
26 | #include "metafactory.h" | 26 | #include "metafactory.h" |
27 | #include "profile.h" | 27 | #include "profile.h" |
28 | #include "profilemanager.h" | 28 | #include "profilemanager.h" |
29 | #include "mainwindow.h" | 29 | #include "mainwindow.h" |
30 | #include "tabwidget.h" | 30 | #include "tabwidget.h" |
31 | #include "transferdialog.h" | 31 | #include "transferdialog.h" |
32 | #include "function_keyboard.h" | 32 | #include "function_keyboard.h" |
33 | #include "emulation_handler.h" | 33 | #include "emulation_handler.h" |
34 | #include "script.h" | 34 | #include "script.h" |
35 | 35 | ||
36 | 36 | ||
37 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 37 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
38 | KeyTrans::loadAll(); | 38 | KeyTrans::loadAll(); |
39 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 39 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
40 | KeyTrans* s = KeyTrans::find(i ); | 40 | KeyTrans* s = KeyTrans::find(i ); |
41 | assert( s ); | 41 | assert( s ); |
42 | } | 42 | } |
43 | m_factory = new MetaFactory(); | 43 | m_factory = new MetaFactory(); |
44 | Default def(m_factory); | 44 | Default def(m_factory); |
45 | m_sessions.setAutoDelete( TRUE ); | 45 | m_sessions.setAutoDelete( TRUE ); |
46 | m_curSession = 0; | 46 | m_curSession = 0; |
47 | m_manager = new ProfileManager( m_factory ); | 47 | m_manager = new ProfileManager( m_factory ); |
48 | m_manager->load(); | 48 | m_manager->load(); |
49 | m_scriptsData.setAutoDelete(TRUE); | 49 | m_scriptsData.setAutoDelete(TRUE); |
50 | 50 | ||
51 | initUI(); | 51 | initUI(); |
52 | populateProfiles(); | 52 | populateProfiles(); |
53 | populateScripts(); | 53 | populateScripts(); |
54 | } | 54 | } |
55 | 55 | ||
56 | void MainWindow::initUI() { | 56 | void MainWindow::initUI() { |
57 | |||
57 | setToolBarsMovable( FALSE ); | 58 | setToolBarsMovable( FALSE ); |
58 | 59 | ||
59 | /* tool bar for the menu */ | 60 | /* tool bar for the menu */ |
60 | m_tool = new QToolBar( this ); | 61 | m_tool = new QToolBar( this ); |
61 | m_tool->setHorizontalStretchable( TRUE ); | 62 | m_tool->setHorizontalStretchable( TRUE ); |
62 | 63 | ||
63 | m_bar = new QMenuBar( m_tool ); | 64 | m_bar = new QMenuBar( m_tool ); |
64 | m_console = new QPopupMenu( this ); | 65 | m_console = new QPopupMenu( this ); |
65 | m_scripts = new QPopupMenu( this ); | 66 | m_scripts = new QPopupMenu( this ); |
66 | m_sessionsPop= new QPopupMenu( this ); | 67 | m_sessionsPop= new QPopupMenu( this ); |
67 | m_scriptsPop = new QPopupMenu( this ); | 68 | m_scriptsPop = new QPopupMenu( this ); |
68 | 69 | ||
69 | /* add a toolbar for icons */ | 70 | /* add a toolbar for icons */ |
70 | m_icons = new QToolBar(this); | 71 | m_icons = new QToolBar(this); |
71 | 72 | ||
72 | /* | 73 | /* |
73 | * the settings action | 74 | * the settings action |
74 | */ | 75 | */ |
75 | m_setProfiles = new QAction(tr("Configure Profiles"), | 76 | m_setProfiles = new QAction(tr("Configure Profiles"), |
76 | Resource::loadPixmap( "SettingsIcon" ), | 77 | Resource::loadPixmap( "SettingsIcon" ), |
77 | QString::null, 0, this, 0); | 78 | QString::null, 0, this, 0); |
78 | m_setProfiles->addTo( m_console ); | 79 | m_setProfiles->addTo( m_console ); |
79 | connect( m_setProfiles, SIGNAL(activated() ), | 80 | connect( m_setProfiles, SIGNAL(activated() ), |
80 | this, SLOT(slotConfigure() ) ); | 81 | this, SLOT(slotConfigure() ) ); |
81 | 82 | ||
82 | m_console->insertSeparator(); | 83 | m_console->insertSeparator(); |
83 | /* | 84 | /* |
84 | * new Action for new sessions | 85 | * new Action for new sessions |
85 | */ | 86 | */ |
86 | QAction* newCon = new QAction(tr("New Connection"), | 87 | QAction* newCon = new QAction(tr("New Connection"), |
87 | Resource::loadPixmap( "new" ), | 88 | Resource::loadPixmap( "new" ), |
88 | QString::null, 0, this, 0); | 89 | QString::null, 0, this, 0); |
89 | newCon->addTo( m_console ); | 90 | newCon->addTo( m_console ); |
90 | connect( newCon, SIGNAL(activated() ), | 91 | connect( newCon, SIGNAL(activated() ), |
91 | this, SLOT(slotNew() ) ); | 92 | this, SLOT(slotNew() ) ); |
92 | 93 | ||
93 | m_console->insertSeparator(); | 94 | m_console->insertSeparator(); |
94 | 95 | ||
95 | QAction *saveCon = new QAction(tr("Save Connection"), | 96 | QAction *saveCon = new QAction(tr("Save Connection"), |
96 | Resource::loadPixmap( "save" ), QString::null, | 97 | Resource::loadPixmap( "save" ), QString::null, |
97 | 0, this, 0 ); | 98 | 0, this, 0 ); |
98 | saveCon->addTo( m_console ); | 99 | saveCon->addTo( m_console ); |
99 | connect( saveCon, SIGNAL(activated() ), | 100 | connect( saveCon, SIGNAL(activated() ), |
100 | this, SLOT(slotSaveSession() ) ); | 101 | this, SLOT(slotSaveSession() ) ); |
101 | m_console->insertSeparator(); | 102 | m_console->insertSeparator(); |
102 | 103 | ||
103 | /* | 104 | /* |
104 | * connect action | 105 | * connect action |
105 | */ | 106 | */ |
106 | m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), | 107 | m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), |
107 | QString::null, 0, this, 0 ); | 108 | QString::null, 0, this, 0 ); |
108 | m_connect->addTo( m_console ); | 109 | m_connect->addTo( m_console ); |
109 | connect(m_connect, SIGNAL(activated() ), | 110 | connect(m_connect, SIGNAL(activated() ), |
110 | this, SLOT(slotConnect() ) ); | 111 | this, SLOT(slotConnect() ) ); |
111 | 112 | ||
112 | /* | 113 | /* |
113 | * disconnect action | 114 | * disconnect action |
114 | */ | 115 | */ |
115 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), | 116 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), |
116 | QString::null, 0, this, 0 ); | 117 | QString::null, 0, this, 0 ); |
117 | m_disconnect->addTo( m_console ); | 118 | m_disconnect->addTo( m_console ); |
118 | connect(m_disconnect, SIGNAL(activated() ), | 119 | connect(m_disconnect, SIGNAL(activated() ), |
119 | this, SLOT(slotDisconnect() ) ); | 120 | this, SLOT(slotDisconnect() ) ); |
120 | 121 | ||
121 | m_console->insertSeparator(); | 122 | m_console->insertSeparator(); |
122 | 123 | ||
124 | |||
123 | m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); | 125 | m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); |
124 | m_quickLaunch->addTo( m_icons ); | 126 | m_quickLaunch->addTo( m_icons ); |
125 | connect( m_quickLaunch, SIGNAL( activated() ), | 127 | connect( m_quickLaunch, SIGNAL( activated() ), |
126 | this, SLOT( slotQuickLaunch() ) ); | 128 | this, SLOT( slotQuickLaunch() ) ); |
127 | 129 | ||
130 | QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); | ||
131 | |||
128 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, | 132 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, |
129 | 0, this, 0 ); | 133 | 0, this, 0 ); |
130 | m_transfer->addTo( m_console ); | 134 | m_transfer->addTo( m_console ); |
131 | connect(m_transfer, SIGNAL(activated() ), | 135 | connect(m_transfer, SIGNAL(activated() ), |
132 | this, SLOT(slotTransfer() ) ); | 136 | this, SLOT(slotTransfer() ) ); |
133 | 137 | ||
134 | 138 | ||
135 | 139 | ||
136 | /* | 140 | /* |
137 | * immediate change of line wrap policy | 141 | * immediate change of line wrap policy |
138 | */ | 142 | */ |
139 | m_isWrapped = false; | 143 | m_isWrapped = false; |
140 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); | 144 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); |
141 | m_wrap->addTo( m_console ); | 145 | m_wrap->addTo( m_console ); |
142 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); | 146 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); |
143 | 147 | ||
144 | /* | 148 | /* |
145 | * fullscreen | 149 | * fullscreen |
146 | */ | 150 | */ |
147 | m_isFullscreen = false; | 151 | m_isFullscreen = false; |
148 | 152 | ||
149 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 153 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
150 | , QString::null, 0, this, 0); | 154 | , QString::null, 0, this, 0); |
151 | m_fullscreen->addTo( m_console ); | 155 | m_fullscreen->addTo( m_console ); |
152 | connect( m_fullscreen, SIGNAL( activated() ), | 156 | connect( m_fullscreen, SIGNAL( activated() ), |
153 | this, SLOT( slotFullscreen() ) ); | 157 | this, SLOT( slotFullscreen() ) ); |
154 | 158 | ||
155 | m_console->insertSeparator(); | 159 | m_console->insertSeparator(); |
156 | 160 | ||
157 | QAction *a = new QAction(); | 161 | QAction *a = new QAction(); |
158 | a->setText( tr("Save history") ); | 162 | a->setText( tr("Save history") ); |
159 | a->addTo( m_console ); | 163 | a->addTo( m_console ); |
160 | connect(a, SIGNAL(activated() ), | 164 | connect(a, SIGNAL(activated() ), |
161 | this, SLOT(slotSaveHistory() ) ); | 165 | this, SLOT(slotSaveHistory() ) ); |
162 | /* | 166 | /* |
163 | * terminate action | 167 | * terminate action |
164 | */ | 168 | */ |
165 | m_terminate = new QAction(); | 169 | m_terminate = new QAction(); |
166 | m_terminate->setText( tr("Terminate") ); | 170 | m_terminate->setText( tr("Terminate") ); |
167 | m_terminate->addTo( m_console ); | 171 | m_terminate->addTo( m_console ); |
168 | connect(m_terminate, SIGNAL(activated() ), | 172 | connect(m_terminate, SIGNAL(activated() ), |
169 | this, SLOT(slotTerminate() ) ); | 173 | this, SLOT(slotTerminate() ) ); |
170 | 174 | ||
171 | m_closewindow = new QAction(); | 175 | m_closewindow = new QAction(); |
172 | m_closewindow->setText( tr("Close Window") ); | 176 | m_closewindow->setText( tr("Close Window") ); |
173 | m_closewindow->addTo( m_console ); | 177 | m_closewindow->addTo( m_console ); |
174 | connect( m_closewindow, SIGNAL(activated() ), | 178 | connect( m_closewindow, SIGNAL(activated() ), |
175 | this, SLOT(slotClose() ) ); | 179 | this, SLOT(slotClose() ) ); |
176 | 180 | ||
177 | 181 | ||
178 | /* | 182 | /* |
179 | * script actions | 183 | * script actions |
180 | */ | 184 | */ |
181 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); | 185 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); |
182 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); | 186 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); |
183 | 187 | ||
184 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 188 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
185 | m_recordScript->addTo(m_scripts); | 189 | m_recordScript->addTo(m_scripts); |
186 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 190 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
187 | 191 | ||
188 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 192 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
189 | m_saveScript->addTo(m_scripts); | 193 | m_saveScript->addTo(m_scripts); |
190 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 194 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
191 | 195 | ||
192 | 196 | ||
193 | /* | 197 | /* |
194 | * action that open/closes the keyboard | 198 | * action that open/closes the keyboard |
195 | */ | 199 | */ |
196 | m_openKeys = new QAction (tr("Open Keyboard..."), | 200 | m_openKeys = new QAction (tr("Open Keyboard..."), |
197 | Resource::loadPixmap( "console/keys/keyboard_icon" ), | 201 | Resource::loadPixmap( "console/keys/keyboard_icon" ), |
198 | QString::null, 0, this, 0); | 202 | QString::null, 0, this, 0); |
199 | m_openKeys->setToggleAction(true); | 203 | m_openKeys->setToggleAction(true); |
200 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); | 204 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); |
201 | 205 | ||
202 | /* insert the submenu */ | 206 | /* insert the submenu */ |
203 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 207 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
204 | -1, 0); | 208 | -1, 0); |
205 | 209 | ||
206 | /* insert the connection menu */ | 210 | /* insert the connection menu */ |
207 | m_bar->insertItem( tr("Connection"), m_console ); | 211 | m_bar->insertItem( tr("Connection"), m_console ); |
208 | 212 | ||
209 | /* the scripts menu */ | 213 | /* the scripts menu */ |
210 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 214 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
211 | 215 | ||
212 | /* and the keyboard */ | 216 | /* and the keyboard */ |
213 | m_keyBar = new QToolBar(this); | 217 | m_keyBar = new QToolBar(this); |
214 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 218 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
215 | m_keyBar->setHorizontalStretchable( TRUE ); | 219 | m_keyBar->setHorizontalStretchable( TRUE ); |
216 | m_keyBar->hide(); | 220 | m_keyBar->hide(); |
217 | 221 | ||
218 | m_kb = new FunctionKeyboard(m_keyBar); | 222 | m_kb = new FunctionKeyboard(m_keyBar); |
219 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 223 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), |
220 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); | 224 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); |
221 | 225 | ||
222 | 226 | ||
223 | a = new QAction(tr("Copy"), | 227 | a = new QAction(tr("Copy"), |
224 | Resource::loadPixmap("copy"), QString::null, | 228 | Resource::loadPixmap("copy"), QString::null, |
225 | 0, this, 0 ); | 229 | 0, this, 0 ); |
226 | //a->addTo( m_icons ); | 230 | //a->addTo( m_icons ); |
227 | connect( a, SIGNAL(activated() ), | 231 | connect( a, SIGNAL(activated() ), |
228 | this, SLOT(slotCopy() ) ); | 232 | this, SLOT(slotCopy() ) ); |
229 | 233 | ||
230 | QAction *paste = new QAction(tr("Paste"), | 234 | QAction *paste = new QAction(tr("Paste"), |
231 | Resource::loadPixmap("paste"), QString::null, | 235 | Resource::loadPixmap("paste"), QString::null, |
232 | 0, this, 0 ); | 236 | 0, this, 0 ); |
233 | connect( paste, SIGNAL(activated() ), | 237 | connect( paste, SIGNAL(activated() ), |
234 | this, SLOT(slotPaste() ) ); | 238 | this, SLOT(slotPaste() ) ); |
235 | 239 | ||
236 | 240 | ||
237 | newCon->addTo( m_icons ); | 241 | newCon->addTo( m_icons ); |
238 | m_setProfiles->addTo( m_icons ); | 242 | //m_setProfiles->addTo( m_icons ); |
239 | paste->addTo( m_icons ); | 243 | paste->addTo( m_icons ); |
240 | m_openKeys->addTo(m_icons); | 244 | m_openKeys->addTo(m_icons); |
241 | m_fullscreen->addTo( m_icons ); | 245 | m_fullscreen->addTo( m_icons ); |
242 | 246 | ||
243 | m_connect->setEnabled( false ); | 247 | m_connect->setEnabled( false ); |
244 | m_disconnect->setEnabled( false ); | 248 | m_disconnect->setEnabled( false ); |
245 | m_terminate->setEnabled( false ); | 249 | m_terminate->setEnabled( false ); |
246 | m_transfer->setEnabled( false ); | 250 | m_transfer->setEnabled( false ); |
247 | m_scripts->setItemEnabled(m_runScript_id, false); | 251 | m_scripts->setItemEnabled(m_runScript_id, false); |
248 | m_recordScript->setEnabled( false ); | 252 | m_recordScript->setEnabled( false ); |
249 | m_saveScript->setEnabled( false ); | 253 | m_saveScript->setEnabled( false ); |
250 | m_fullscreen->setEnabled( false ); | 254 | m_fullscreen->setEnabled( false ); |
251 | m_closewindow->setEnabled( false ); | 255 | m_closewindow->setEnabled( false ); |
252 | m_wrap->setEnabled( false ); | 256 | m_wrap->setEnabled( false ); |
253 | 257 | ||
254 | /* | 258 | /* |
255 | * connect to the menu activation | 259 | * connect to the menu activation |
256 | */ | 260 | */ |
257 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 261 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
258 | this, SLOT(slotProfile( int ) ) ); | 262 | this, SLOT(slotProfile( int ) ) ); |
259 | 263 | ||
260 | m_consoleWindow = new TabWidget( this, "blah"); | 264 | m_consoleWindow = new TabWidget( this, "blah"); |
261 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 265 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
262 | this, SLOT(slotSessionChanged(Session*) ) ); | 266 | this, SLOT(slotSessionChanged(Session*) ) ); |
263 | setCentralWidget( m_consoleWindow ); | 267 | setCentralWidget( m_consoleWindow ); |
264 | 268 | ||
269 | slotQuickLaunch(); | ||
265 | } | 270 | } |
266 | 271 | ||
267 | ProfileManager* MainWindow::manager() { | 272 | ProfileManager* MainWindow::manager() { |
268 | return m_manager; | 273 | return m_manager; |
269 | } | 274 | } |
270 | TabWidget* MainWindow::tabWidget() { | 275 | TabWidget* MainWindow::tabWidget() { |
271 | return m_consoleWindow; | 276 | return m_consoleWindow; |
272 | } | 277 | } |
273 | void MainWindow::populateProfiles() { | 278 | void MainWindow::populateProfiles() { |
274 | m_sessionsPop->clear(); | 279 | m_sessionsPop->clear(); |
275 | Profile::ValueList list = manager()->all(); | 280 | Profile::ValueList list = manager()->all(); |
276 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 281 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
277 | m_sessionsPop->insertItem( (*it).name() ); | 282 | m_sessionsPop->insertItem( (*it).name() ); |
278 | } | 283 | } |
279 | 284 | ||
280 | } | 285 | } |
281 | 286 | ||
282 | void MainWindow::populateScripts() { | 287 | void MainWindow::populateScripts() { |
283 | m_scriptsPop->clear(); | 288 | m_scriptsPop->clear(); |
284 | m_scriptsData.clear(); | 289 | m_scriptsData.clear(); |
285 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); | 290 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); |
286 | QListIterator<DocLnk> dit(files.children()); | 291 | QListIterator<DocLnk> dit(files.children()); |
287 | for (; dit.current(); ++dit) { | 292 | for (; dit.current(); ++dit) { |
288 | if (*dit && (*dit)->name().length()>0) { | 293 | if (*dit && (*dit)->name().length()>0) { |
289 | QFileInfo info((*dit)->file()); | 294 | QFileInfo info((*dit)->file()); |
290 | if (info.extension(false) == "script") { | 295 | if (info.extension(false) == "script") { |
291 | m_scriptsData.append(new DocLnk(**dit)); | 296 | m_scriptsData.append(new DocLnk(**dit)); |
292 | m_scriptsPop->insertItem((*dit)->name()); | 297 | m_scriptsPop->insertItem((*dit)->name()); |
293 | } | 298 | } |
294 | } | 299 | } |
295 | } | 300 | } |
296 | 301 | ||
297 | } | 302 | } |
298 | 303 | ||
299 | MainWindow::~MainWindow() { | 304 | MainWindow::~MainWindow() { |
300 | delete m_factory; | 305 | delete m_factory; |
301 | manager()->save(); | 306 | manager()->save(); |
302 | } | 307 | } |
303 | 308 | ||
304 | MetaFactory* MainWindow::factory() { | 309 | MetaFactory* MainWindow::factory() { |
305 | return m_factory; | 310 | return m_factory; |
306 | } | 311 | } |
307 | 312 | ||
308 | Session* MainWindow::currentSession() { | 313 | Session* MainWindow::currentSession() { |
309 | return m_curSession; | 314 | return m_curSession; |
310 | } | 315 | } |
311 | 316 | ||
312 | QList<Session> MainWindow::sessions() { | 317 | QList<Session> MainWindow::sessions() { |
313 | return m_sessions; | 318 | return m_sessions; |
314 | } | 319 | } |
315 | 320 | ||
316 | void MainWindow::slotNew() { | 321 | void MainWindow::slotNew() { |
317 | ProfileEditorDialog dlg(factory() ); | 322 | ProfileEditorDialog dlg(factory() ); |
318 | dlg.showMaximized(); | 323 | dlg.showMaximized(); |
319 | dlg.setCaption( tr("New Connection") ); | 324 | dlg.setCaption( tr("New Connection") ); |
320 | int ret = dlg.exec(); | 325 | int ret = dlg.exec(); |
321 | 326 | ||
322 | if ( ret == QDialog::Accepted ) { | 327 | if ( ret == QDialog::Accepted ) { |
323 | create( dlg.profile() ); | 328 | create( dlg.profile() ); |
324 | } | 329 | } |
325 | } | 330 | } |
326 | 331 | ||
327 | void MainWindow::slotRecordScript() { | 332 | void MainWindow::slotRecordScript() { |
328 | if (currentSession()) { | 333 | if (currentSession()) { |
329 | currentSession()->emulationHandler()->startRecording(); | 334 | currentSession()->emulationHandler()->startRecording(); |
330 | m_saveScript->setEnabled(true); | 335 | m_saveScript->setEnabled(true); |
331 | m_recordScript->setEnabled(false); | 336 | m_recordScript->setEnabled(false); |
332 | } | 337 | } |
333 | } | 338 | } |
334 | 339 | ||
335 | void MainWindow::slotSaveScript() { | 340 | void MainWindow::slotSaveScript() { |
336 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 341 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
337 | QMap<QString, QStringList> map; | 342 | QMap<QString, QStringList> map; |
338 | QStringList text; | 343 | QStringList text; |
339 | text << "text/plain"; | 344 | text << "text/plain"; |
340 | map.insert(tr("Script"), text ); | 345 | map.insert(tr("Script"), text ); |
341 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | 346 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); |
342 | if (!filename.isEmpty()) { | 347 | if (!filename.isEmpty()) { |
343 | QFileInfo info(filename); | 348 | QFileInfo info(filename); |
344 | if (info.extension(FALSE) != "script") | 349 | if (info.extension(FALSE) != "script") |
345 | filename += ".script"; | 350 | filename += ".script"; |
346 | DocLnk nf; | 351 | DocLnk nf; |
347 | nf.setType("text/plain"); | 352 | nf.setType("text/plain"); |
348 | nf.setFile(filename); | 353 | nf.setFile(filename); |
349 | nf.setName(info.fileName()); | 354 | nf.setName(info.fileName()); |
350 | FileManager fm; | 355 | FileManager fm; |
351 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); | 356 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); |
352 | currentSession()->emulationHandler()->clearScript(); | 357 | currentSession()->emulationHandler()->clearScript(); |
353 | m_saveScript->setEnabled(false); | 358 | m_saveScript->setEnabled(false); |
354 | m_recordScript->setEnabled(true); | 359 | m_recordScript->setEnabled(true); |
355 | populateScripts(); | 360 | populateScripts(); |
356 | } | 361 | } |
357 | } | 362 | } |
358 | } | 363 | } |
359 | 364 | ||
360 | void MainWindow::slotRunScript(int id) { | 365 | void MainWindow::slotRunScript(int id) { |
361 | if (currentSession()) { | 366 | if (currentSession()) { |
362 | int index = m_scriptsPop->indexOf(id); | 367 | int index = m_scriptsPop->indexOf(id); |
363 | DocLnk *lnk = m_scriptsData.at(index); | 368 | DocLnk *lnk = m_scriptsData.at(index); |
364 | QString filePath = lnk->file(); | 369 | QString filePath = lnk->file(); |
365 | Script script(filePath); | 370 | Script script(filePath); |
366 | currentSession()->emulationHandler()->runScript(&script); | 371 | currentSession()->emulationHandler()->runScript(&script); |
367 | } | 372 | } |
368 | } | 373 | } |
369 | 374 | ||
370 | void MainWindow::slotConnect() { | 375 | void MainWindow::slotConnect() { |
371 | if ( currentSession() ) { | 376 | if ( currentSession() ) { |
372 | bool ret = currentSession()->layer()->open(); | 377 | bool ret = currentSession()->layer()->open(); |
373 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 378 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
374 | QObject::tr("Failed"), | 379 | QObject::tr("Failed"), |
375 | QObject::tr("Connecting failed for this session.")); | 380 | QObject::tr("Connecting failed for this session.")); |
376 | else { | 381 | else { |
377 | m_connect->setEnabled( false ); | 382 | m_connect->setEnabled( false ); |
378 | m_disconnect->setEnabled( true ); | 383 | m_disconnect->setEnabled( true ); |
379 | 384 | ||
380 | // if it does not support file transfer, disable the menu entry | 385 | // if it does not support file transfer, disable the menu entry |
381 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | 386 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { |
382 | m_transfer->setEnabled( false ); | 387 | m_transfer->setEnabled( false ); |
383 | } else { | 388 | } else { |
384 | m_transfer->setEnabled( true ); | 389 | m_transfer->setEnabled( true ); |
385 | } | 390 | } |
386 | 391 | ||
387 | m_recordScript->setEnabled( true ); | 392 | m_recordScript->setEnabled( true ); |
388 | m_scripts->setItemEnabled(m_runScript_id, true); | 393 | m_scripts->setItemEnabled(m_runScript_id, true); |
389 | } | 394 | } |
390 | } | 395 | } |
391 | } | 396 | } |
392 | 397 | ||
393 | void MainWindow::slotDisconnect() { | 398 | void MainWindow::slotDisconnect() { |
394 | if ( currentSession() ) { | 399 | if ( currentSession() ) { |
395 | currentSession()->layer()->close(); | 400 | currentSession()->layer()->close(); |
396 | m_connect->setEnabled( true ); | 401 | m_connect->setEnabled( true ); |
397 | m_disconnect->setEnabled( false ); | 402 | m_disconnect->setEnabled( false ); |
398 | m_transfer->setEnabled( false ); | 403 | m_transfer->setEnabled( false ); |
399 | m_recordScript->setEnabled( false); | 404 | m_recordScript->setEnabled( false); |
400 | m_saveScript->setEnabled( false ); | 405 | m_saveScript->setEnabled( false ); |
401 | m_scripts->setItemEnabled(m_runScript_id, false); | 406 | m_scripts->setItemEnabled(m_runScript_id, false); |
402 | } | 407 | } |
403 | } | 408 | } |
404 | 409 | ||
405 | void MainWindow::slotTerminate() { | 410 | void MainWindow::slotTerminate() { |
406 | if ( currentSession() ) | 411 | if ( currentSession() ) |
407 | currentSession()->layer()->close(); | 412 | currentSession()->layer()->close(); |
408 | 413 | ||
409 | slotClose(); | 414 | slotClose(); |
410 | /* FIXME move to the next session */ | 415 | /* FIXME move to the next session */ |
411 | } | 416 | } |
412 | 417 | ||
413 | 418 | ||
414 | 419 | ||
415 | 420 | ||
416 | 421 | ||
417 | 422 | ||
418 | void MainWindow::slotQuickLaunch() { | 423 | void MainWindow::slotQuickLaunch() { |
419 | Profile prof = manager()->profile( "default" ); | 424 | Profile prof = manager()->profile( "default" ); |
420 | if ( prof.name() == "default" ) { | 425 | if ( prof.name() == "default" ) { |
421 | create( prof ); | 426 | create( prof ); |
422 | } else { | 427 | } else { |
423 | Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 ); | 428 | Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 ); |
424 | newProf.setAutoConnect( true ); | 429 | newProf.setAutoConnect( true ); |
425 | create( newProf ); | 430 | create( newProf ); |
426 | } | 431 | } |
427 | 432 | ||
428 | } | 433 | } |
429 | 434 | ||
430 | void MainWindow::slotConfigure() { | 435 | void MainWindow::slotConfigure() { |
431 | ConfigDialog conf( manager()->all(), factory() ); | 436 | ConfigDialog conf( manager()->all(), factory() ); |
432 | conf.showMaximized(); | 437 | conf.showMaximized(); |
433 | 438 | ||
434 | int ret = conf.exec(); | 439 | int ret = conf.exec(); |
435 | 440 | ||
436 | if ( QDialog::Accepted == ret ) { | 441 | if ( QDialog::Accepted == ret ) { |
437 | manager()->setProfiles( conf.list() ); | 442 | manager()->setProfiles( conf.list() ); |
438 | manager()->save(); | 443 | manager()->save(); |
439 | populateProfiles(); | 444 | populateProfiles(); |
440 | } | 445 | } |
441 | } | 446 | } |
442 | /* | 447 | /* |
443 | * we will remove | 448 | * we will remove |
444 | * this window from the tabwidget | 449 | * this window from the tabwidget |
445 | * remove it from the list | 450 | * remove it from the list |
446 | * delete it | 451 | * delete it |
447 | * and set the currentSession() | 452 | * and set the currentSession() |
448 | */ | 453 | */ |
449 | void MainWindow::slotClose() { | 454 | void MainWindow::slotClose() { |
450 | if (!currentSession() ) | 455 | if (!currentSession() ) |
451 | return; | 456 | return; |
452 | 457 | ||
453 | Session* ses = currentSession(); | 458 | Session* ses = currentSession(); |
454 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 459 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); |
455 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 460 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
456 | m_curSession = NULL; | 461 | m_curSession = NULL; |
457 | tabWidget()->remove( /*currentSession()*/ses ); | 462 | tabWidget()->remove( /*currentSession()*/ses ); |
458 | /*it's autodelete */ | 463 | /*it's autodelete */ |
459 | m_sessions.remove( ses ); | 464 | m_sessions.remove( ses ); |
460 | qWarning("after remove!!"); | 465 | qWarning("after remove!!"); |
461 | 466 | ||
462 | if (!currentSession() ) { | 467 | if (!currentSession() ) { |
463 | m_connect->setEnabled( false ); | 468 | m_connect->setEnabled( false ); |
464 | m_disconnect->setEnabled( false ); | 469 | m_disconnect->setEnabled( false ); |
465 | m_terminate->setEnabled( false ); | 470 | m_terminate->setEnabled( false ); |
466 | m_transfer->setEnabled( false ); | 471 | m_transfer->setEnabled( false ); |
467 | m_recordScript->setEnabled( false ); | 472 | m_recordScript->setEnabled( false ); |
468 | m_saveScript->setEnabled( false ); | 473 | m_saveScript->setEnabled( false ); |
469 | m_scripts->setItemEnabled(m_runScript_id, false); | 474 | m_scripts->setItemEnabled(m_runScript_id, false); |
470 | m_fullscreen->setEnabled( false ); | 475 | m_fullscreen->setEnabled( false ); |
471 | m_wrap->setEnabled( false ); | 476 | m_wrap->setEnabled( false ); |
472 | m_closewindow->setEnabled( false ); | 477 | m_closewindow->setEnabled( false ); |
473 | } | 478 | } |
474 | 479 | ||
475 | m_kb->loadDefaults(); | 480 | m_kb->loadDefaults(); |
476 | } | 481 | } |
477 | 482 | ||
478 | /* | 483 | /* |
479 | * We will get the name | 484 | * We will get the name |
480 | * Then the profile | 485 | * Then the profile |
481 | * and then we will make a profile | 486 | * and then we will make a profile |
482 | */ | 487 | */ |
483 | void MainWindow::slotProfile( int id) { | 488 | void MainWindow::slotProfile( int id) { |
484 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 489 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
485 | create( prof ); | 490 | create( prof ); |
486 | } | 491 | } |
487 | 492 | ||
488 | 493 | ||
489 | 494 | ||
490 | void MainWindow::create( const Profile& prof ) { | 495 | void MainWindow::create( const Profile& prof ) { |
491 | if(m_curSession) | 496 | if(m_curSession) |
492 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); | 497 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); |
493 | 498 | ||
494 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 499 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
495 | 500 | ||
496 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 501 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
497 | { | 502 | { |
498 | QMessageBox::warning(this, | 503 | QMessageBox::warning(this, |
499 | QObject::tr("Session failed"), | 504 | QObject::tr("Session failed"), |
500 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 505 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
501 | //if(ses) delete ses; | 506 | //if(ses) delete ses; |
502 | return; | 507 | return; |
503 | } | 508 | } |
504 | 509 | ||
505 | m_sessions.append( ses ); | 510 | m_sessions.append( ses ); |
506 | tabWidget()->add( ses ); | 511 | tabWidget()->add( ses ); |
507 | tabWidget()->repaint(); | 512 | tabWidget()->repaint(); |
508 | m_curSession = ses; | 513 | m_curSession = ses; |
509 | 514 | ||
510 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 515 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
511 | m_connect->setEnabled( true ); | 516 | m_connect->setEnabled( true ); |
512 | m_disconnect->setEnabled( false ); | 517 | m_disconnect->setEnabled( false ); |
513 | m_terminate->setEnabled( true ); | 518 | m_terminate->setEnabled( true ); |
514 | m_fullscreen->setEnabled( true ); | 519 | m_fullscreen->setEnabled( true ); |
515 | m_wrap->setEnabled( true ); | 520 | m_wrap->setEnabled( true ); |
516 | m_closewindow->setEnabled( true ); | 521 | m_closewindow->setEnabled( true ); |
517 | m_transfer->setEnabled( false ); | 522 | m_transfer->setEnabled( false ); |
518 | m_recordScript->setEnabled( false ); | 523 | m_recordScript->setEnabled( false ); |
519 | m_saveScript->setEnabled( false ); | 524 | m_saveScript->setEnabled( false ); |
520 | m_scripts->setItemEnabled(m_runScript_id, false); | 525 | m_scripts->setItemEnabled(m_runScript_id, false); |