summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-02-29 19:50:45 (UTC)
committer llornkcor <llornkcor>2004-02-29 19:50:45 (UTC)
commit225b92ec28bbe3a9368e8534323a3c335432e447 (patch) (unidiff)
treefd87695f00a655bcfa0a9276bb43dc9ac2e1fa13
parent1a59dd467d210703b69d2d694f95988f2e97c27f (diff)
downloadopie-225b92ec28bbe3a9368e8534323a3c335432e447.zip
opie-225b92ec28bbe3a9368e8534323a3c335432e447.tar.gz
opie-225b92ec28bbe3a9368e8534323a3c335432e447.tar.bz2
initialize int
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp
index 2e3e0f5..de5e585 100644
--- a/core/apps/embeddedkonsole/TEWidget.cpp
+++ b/core/apps/embeddedkonsole/TEWidget.cpp
@@ -1037,385 +1037,385 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e )
1037 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 1037 if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
1038 QKeyEvent* ke = (QKeyEvent*)e; 1038 QKeyEvent* ke = (QKeyEvent*)e;
1039 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); 1039 bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat();
1040 switch (ke->key()) { 1040 switch (ke->key()) {
1041 case Key_F9: // let this be "Control" 1041 case Key_F9: // let this be "Control"
1042 control = keydown; 1042 control = keydown;
1043 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); 1043 e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state());
1044 dele=TRUE; 1044 dele=TRUE;
1045 break; 1045 break;
1046 case Key_F13: // let this be "Alt" 1046 case Key_F13: // let this be "Alt"
1047 alt = keydown; 1047 alt = keydown;
1048 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); 1048 e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state());
1049 dele=TRUE; 1049 dele=TRUE;
1050 break; 1050 break;
1051 default: 1051 default:
1052 if ( control ) { 1052 if ( control ) {
1053 int a = toupper(ke->ascii())-64; 1053 int a = toupper(ke->ascii())-64;
1054 if ( a >= 0 && a < ' ' ) { 1054 if ( a >= 0 && a < ' ' ) {
1055 e = new QKeyEvent(e->type(), ke->key(), 1055 e = new QKeyEvent(e->type(), ke->key(),
1056 a, ke->state()|ControlButton, QChar(a,0)); 1056 a, ke->state()|ControlButton, QChar(a,0));
1057 dele=TRUE; 1057 dele=TRUE;
1058 } 1058 }
1059 } 1059 }
1060 if ( alt ) { 1060 if ( alt ) {
1061 e = new QKeyEvent(e->type(), ke->key(), 1061 e = new QKeyEvent(e->type(), ke->key(),
1062 ke->ascii(), ke->state()|AltButton, ke->text()); 1062 ke->ascii(), ke->state()|AltButton, ke->text());
1063 dele=TRUE; 1063 dele=TRUE;
1064 } 1064 }
1065 } 1065 }
1066 } 1066 }
1067#endif 1067#endif
1068 1068
1069 if ( e->type() == QEvent::KeyPress ) { 1069 if ( e->type() == QEvent::KeyPress ) {
1070 QKeyEvent* ke = (QKeyEvent*)e; 1070 QKeyEvent* ke = (QKeyEvent*)e;
1071 actSel=0; // Key stroke implies a screen update, so TEWidget won't 1071 actSel=0; // Key stroke implies a screen update, so TEWidget won't
1072 // know where the current selection is. 1072 // know where the current selection is.
1073 1073
1074// qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state()); 1074// qDebug("key pressed is 0x%x, ascii is 0x%x, state %d", ke->key(), ke->ascii(), ke->state());
1075 1075
1076 bool special_function = true; 1076 bool special_function = true;
1077 switch(ke->key()) { 1077 switch(ke->key()) {
1078 //case 0x201b: // fn-5 1078 //case 0x201b: // fn-5
1079 //case Key_F1: 1079 //case Key_F1:
1080 // switch sessions (?) 1080 // switch sessions (?)
1081 // emitText("\\"); // expose (??) 1081 // emitText("\\"); // expose (??)
1082 // break; 1082 // break;
1083 1083
1084 case 0x2016: // fn-p 1084 case 0x2016: // fn-p
1085 case Key_F2: 1085 case Key_F2:
1086 pasteClipboard(); 1086 pasteClipboard();
1087 break; 1087 break;
1088 1088
1089 case 0x2018: // fn-S 1089 case 0x2018: // fn-S
1090 case Key_F3: 1090 case Key_F3:
1091 emit changeSession(1); 1091 emit changeSession(1);
1092 break; 1092 break;
1093 1093
1094 case 0x2019: // fn-n 1094 case 0x2019: // fn-n
1095 emit newSession(); 1095 emit newSession();
1096 break; 1096 break;
1097 1097
1098 case Qt::Key_Tab: 1098 case Qt::Key_Tab:
1099 if (ke->state() == ControlButton) { 1099 if (ke->state() == ControlButton) {
1100 emit changeSession(1); 1100 emit changeSession(1);
1101 } else { 1101 } else {
1102 special_function = false; 1102 special_function = false;
1103 } 1103 }
1104 break; 1104 break;
1105 1105
1106#if 0 1106#if 0
1107 case Qt::Key_Left: 1107 case Qt::Key_Left:
1108 if (vcolumns == 0) { 1108 if (vcolumns == 0) {
1109 emit changeSession(-1); 1109 emit changeSession(-1);
1110 } else { 1110 } else {
1111 special_function = false; 1111 special_function = false;
1112 } 1112 }
1113 break; 1113 break;
1114 1114
1115 case Qt::Key_Right: 1115 case Qt::Key_Right:
1116 if (vcolumns == 0) { 1116 if (vcolumns == 0) {
1117 emit changeSession(1); 1117 emit changeSession(1);
1118 } else { 1118 } else {
1119 special_function = false; 1119 special_function = false;
1120 } 1120 }
1121 break; 1121 break;
1122#endif 1122#endif
1123 1123
1124 case 0x201b: // fn-5 1124 case 0x201b: // fn-5
1125 case Key_F4: 1125 case Key_F4:
1126 emit toggleFullScreen(); 1126 emit toggleFullScreen();
1127 break; 1127 break;
1128 1128
1129 case 0x200f: // fn-1 magnify minus 1129 case 0x200f: // fn-1 magnify minus
1130 case Key_F5: 1130 case Key_F5:
1131 emit changeFontSize(-1); 1131 emit changeFontSize(-1);
1132 break; 1132 break;
1133 1133
1134 case 0x2010: // fn-2 magnify plus 1134 case 0x2010: // fn-2 magnify plus
1135 case Key_F6: 1135 case Key_F6:
1136 emit changeFontSize(1); 1136 emit changeFontSize(1);
1137 break; 1137 break;
1138 1138
1139 default: 1139 default:
1140 special_function = false; 1140 special_function = false;
1141 } 1141 }
1142 if (special_function) { 1142 if (special_function) {
1143 return true; 1143 return true;
1144 } 1144 }
1145 // else if( ke->state() == ControlButton && ke->key() == Key_V) { 1145 // else if( ke->state() == ControlButton && ke->key() == Key_V) {
1146 // pasteClipboard(); 1146 // pasteClipboard();
1147 // } 1147 // }
1148 // else if( ke->state() == ControlButton && ke->key() == Key_C) { 1148 // else if( ke->state() == ControlButton && ke->key() == Key_C) {
1149 // pasteClipboard(); 1149 // pasteClipboard();
1150 // } 1150 // }
1151 emit keyPressedSignal(ke); // expose 1151 emit keyPressedSignal(ke); // expose
1152 ke->accept(); 1152 ke->accept();
1153#ifdef FAKE_CTRL_AND_ALT 1153#ifdef FAKE_CTRL_AND_ALT
1154 if ( dele ) delete e; 1154 if ( dele ) delete e;
1155#endif 1155#endif
1156 return true; // stop the event 1156 return true; // stop the event
1157 } 1157 }
1158 if ( e->type() == QEvent::Enter ) { 1158 if ( e->type() == QEvent::Enter ) {
1159 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), 1159 QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()),
1160 this, SLOT(onClearSelection()) ); 1160 this, SLOT(onClearSelection()) );
1161 } 1161 }
1162 if ( e->type() == QEvent::Leave ) { 1162 if ( e->type() == QEvent::Leave ) {
1163 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), 1163 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
1164 this, SLOT(onClearSelection()) ); 1164 this, SLOT(onClearSelection()) );
1165 } 1165 }
1166 return QFrame::eventFilter( obj, e ); 1166 return QFrame::eventFilter( obj, e );
1167} 1167}
1168 1168
1169/* ------------------------------------------------------------------------- */ 1169/* ------------------------------------------------------------------------- */
1170/* */ 1170/* */
1171/* Frame */ 1171/* Frame */
1172/* */ 1172/* */
1173/* ------------------------------------------------------------------------- */ 1173/* ------------------------------------------------------------------------- */
1174 1174
1175void TEWidget::frameChanged() 1175void TEWidget::frameChanged()
1176{ 1176{
1177 propagateSize(); 1177 propagateSize();
1178 update(); 1178 update();
1179} 1179}
1180/* ------------------------------------------------------------------------- */ 1180/* ------------------------------------------------------------------------- */
1181/* */ 1181/* */
1182/* Sound */ 1182/* Sound */
1183/* */ 1183/* */
1184/* ------------------------------------------------------------------------- */ 1184/* ------------------------------------------------------------------------- */
1185 1185
1186void TEWidget::Bell() 1186void TEWidget::Bell()
1187{ 1187{
1188//#ifdef QT_QWS_SL5XXX 1188//#ifdef QT_QWS_SL5XXX
1189//# ifndef QT_NO_COP 1189//# ifndef QT_NO_COP
1190 if(useBeep) 1190 if(useBeep)
1191 QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); 1191 QCopEnvelope( "QPE/TaskBar", "soundAlarm()" );
1192 1192
1193//# endif 1193//# endif
1194//#else 1194//#else
1195//# ifndef QT_NO_SOUND 1195//# ifndef QT_NO_SOUND
1196// QSound::play(Resource::findSound("alarm")); 1196// QSound::play(Resource::findSound("alarm"));
1197//# endif 1197//# endif
1198//#endif 1198//#endif
1199 1199
1200// QApplication::beep(); 1200// QApplication::beep();
1201} 1201}
1202 1202
1203/* ------------------------------------------------------------------------- */ 1203/* ------------------------------------------------------------------------- */
1204/* */ 1204/* */
1205/* Auxiluary */ 1205/* Auxiluary */
1206/* */ 1206/* */
1207/* ------------------------------------------------------------------------- */ 1207/* ------------------------------------------------------------------------- */
1208 1208
1209void TEWidget::clearImage() 1209void TEWidget::clearImage()
1210// initialize the image 1210// initialize the image
1211// for internal use only 1211// for internal use only
1212{ 1212{
1213 for (int y = 0; y < lines; y++) 1213 for (int y = 0; y < lines; y++)
1214 for (int x = 0; x < columns; x++) 1214 for (int x = 0; x < columns; x++)
1215 { 1215 {
1216 image[loc(x,y)].c = 0xff; //' '; 1216 image[loc(x,y)].c = 0xff; //' ';
1217 image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; 1217 image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR;
1218 image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; 1218 image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR;
1219 image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; 1219 image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION;
1220 } 1220 }
1221} 1221}
1222 1222
1223// Create Image /////////////////////////////////////////////////////// 1223// Create Image ///////////////////////////////////////////////////////
1224 1224
1225void TEWidget::calcGeometry() 1225void TEWidget::calcGeometry()
1226{ 1226{
1227 int showhscrollbar = 1; 1227 int showhscrollbar = 1;
1228 int hwidth = 0; 1228 int hwidth = 0;
1229 int dcolumns; 1229 int dcolumns = 0;
1230 Config cfg( "Konsole" ); 1230 Config cfg( "Konsole" );
1231 cfg.setGroup("ScrollBar"); 1231 cfg.setGroup("ScrollBar");
1232 useHorzScroll=cfg.readBoolEntry("HorzScroll",0); 1232 useHorzScroll=cfg.readBoolEntry("HorzScroll",0);
1233 1233
1234 if(vcolumns == 0) showhscrollbar = 0; 1234 if(vcolumns == 0) showhscrollbar = 0;
1235 if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width(); 1235 if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width();
1236 1236
1237 scrollbar->resize(QApplication::style().scrollBarExtent().width(), 1237 scrollbar->resize(QApplication::style().scrollBarExtent().width(),
1238 contentsRect().height() - hwidth); 1238 contentsRect().height() - hwidth);
1239 1239
1240 switch(scrollLoc) { 1240 switch(scrollLoc) {
1241 case SCRNONE : 1241 case SCRNONE :
1242 columns = ( contentsRect().width() - 2 * rimX ) / font_w; 1242 columns = ( contentsRect().width() - 2 * rimX ) / font_w;
1243 dcolumns = columns; 1243 dcolumns = columns;
1244 if(vcolumns) columns = vcolumns; 1244 if(vcolumns) columns = vcolumns;
1245 blX = (contentsRect().width() - (columns*font_w) ) / 2; 1245 blX = (contentsRect().width() - (columns*font_w) ) / 2;
1246 if(showhscrollbar) 1246 if(showhscrollbar)
1247 blX = -hposition * font_w; 1247 blX = -hposition * font_w;
1248 brX = blX; 1248 brX = blX;
1249 scrollbar->hide(); 1249 scrollbar->hide();
1250 break; 1250 break;
1251 case SCRLEFT : 1251 case SCRLEFT :
1252 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; 1252 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
1253 dcolumns = columns; 1253 dcolumns = columns;
1254 if(vcolumns) columns = vcolumns; 1254 if(vcolumns) columns = vcolumns;
1255 brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; 1255 brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
1256 if(showhscrollbar) 1256 if(showhscrollbar)
1257 brX = -hposition * font_w; 1257 brX = -hposition * font_w;
1258 blX = brX + scrollbar->width(); 1258 blX = brX + scrollbar->width();
1259 scrollbar->move(contentsRect().topLeft()); 1259 scrollbar->move(contentsRect().topLeft());
1260 scrollbar->show(); 1260 scrollbar->show();
1261 break; 1261 break;
1262 case SCRRIGHT: 1262 case SCRRIGHT:
1263 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; 1263 columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w;
1264 dcolumns = columns; 1264 dcolumns = columns;
1265 if(vcolumns) columns = vcolumns; 1265 if(vcolumns) columns = vcolumns;
1266 blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; 1266 blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2;
1267 if(showhscrollbar) 1267 if(showhscrollbar)
1268 blX = -hposition * font_w; 1268 blX = -hposition * font_w;
1269 brX = blX; 1269 brX = blX;
1270 scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); 1270 scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0));
1271 scrollbar->show(); 1271 scrollbar->show();
1272 break; 1272 break;
1273 } 1273 }
1274 //FIXME: support 'rounding' styles 1274 //FIXME: support 'rounding' styles
1275 lines = ( contentsRect().height() - 2 * rimY ) / font_h; 1275 lines = ( contentsRect().height() - 2 * rimY ) / font_h;
1276 bY = (contentsRect().height() - (lines *font_h)) / 2; 1276 bY = (contentsRect().height() - (lines *font_h)) / 2;
1277 1277
1278 if(showhscrollbar == 1) { 1278 if(showhscrollbar == 1) {
1279 hScrollbar->resize(contentsRect().width() - hwidth, hwidth); 1279 hScrollbar->resize(contentsRect().width() - hwidth, hwidth);
1280 hScrollbar->setRange(0, vcolumns - dcolumns); 1280 hScrollbar->setRange(0, vcolumns - dcolumns);
1281 1281
1282 QPoint p = contentsRect().bottomLeft(); 1282 QPoint p = contentsRect().bottomLeft();
1283 if(scrollLoc == SCRLEFT) 1283 if(scrollLoc == SCRLEFT)
1284 hScrollbar->move(QPoint(p.x()+hwidth, p.y() - hwidth)); 1284 hScrollbar->move(QPoint(p.x()+hwidth, p.y() - hwidth));
1285 else 1285 else
1286 hScrollbar->move(QPoint(p.x(), p.y() - hwidth)); 1286 hScrollbar->move(QPoint(p.x(), p.y() - hwidth));
1287 1287
1288 hScrollbar->show(); 1288 hScrollbar->show();
1289 } 1289 }
1290 else hScrollbar->hide(); 1290 else hScrollbar->hide();
1291 1291
1292 if(showhscrollbar == 1) { 1292 if(showhscrollbar == 1) {
1293 lines = lines - (hwidth / font_h) - 1; 1293 lines = lines - (hwidth / font_h) - 1;
1294 if(lines < 1) lines = 1; 1294 if(lines < 1) lines = 1;
1295 } 1295 }
1296 //FIXME: support 'rounding' styles 1296 //FIXME: support 'rounding' styles
1297} 1297}
1298 1298
1299void TEWidget::makeImage() 1299void TEWidget::makeImage()
1300//FIXME: rename 'calcGeometry? 1300//FIXME: rename 'calcGeometry?
1301{ 1301{
1302 calcGeometry(); 1302 calcGeometry();
1303 image = (ca*) malloc(lines*columns*sizeof(ca)); 1303 image = (ca*) malloc(lines*columns*sizeof(ca));
1304 clearImage(); 1304 clearImage();
1305} 1305}
1306 1306
1307// calculate the needed size 1307// calculate the needed size
1308QSize TEWidget::calcSize(int cols, int lins) const 1308QSize TEWidget::calcSize(int cols, int lins) const
1309{ 1309{
1310 int frw = width() - contentsRect().width(); 1310 int frw = width() - contentsRect().width();
1311 int frh = height() - contentsRect().height(); 1311 int frh = height() - contentsRect().height();
1312 int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); 1312 int scw = (scrollLoc==SCRNONE?0:scrollbar->width());
1313 return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh ); 1313 return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh );
1314} 1314}
1315 1315
1316QSize TEWidget::sizeHint() const 1316QSize TEWidget::sizeHint() const
1317{ 1317{
1318 return size(); 1318 return size();
1319} 1319}
1320 1320
1321void TEWidget::styleChange(QStyle &) 1321void TEWidget::styleChange(QStyle &)
1322{ 1322{
1323 propagateSize(); 1323 propagateSize();
1324} 1324}
1325 1325
1326#ifndef QT_NO_DRAGANDDROP 1326#ifndef QT_NO_DRAGANDDROP
1327 1327
1328/* --------------------------------------------------------------------- */ 1328/* --------------------------------------------------------------------- */
1329/* */ 1329/* */
1330/* Drag & Drop */ 1330/* Drag & Drop */
1331/* */ 1331/* */
1332/* --------------------------------------------------------------------- */ 1332/* --------------------------------------------------------------------- */
1333 1333
1334 1334
1335void TEWidget::dragEnterEvent(QDragEnterEvent* e) 1335void TEWidget::dragEnterEvent(QDragEnterEvent* e)
1336{ 1336{
1337 e->accept(QTextDrag::canDecode(e) || 1337 e->accept(QTextDrag::canDecode(e) ||
1338 QUriDrag::canDecode(e)); 1338 QUriDrag::canDecode(e));
1339} 1339}
1340 1340
1341void TEWidget::dropEvent(QDropEvent* event) 1341void TEWidget::dropEvent(QDropEvent* event)
1342{ 1342{
1343 // The current behaviour when url(s) are dropped is 1343 // The current behaviour when url(s) are dropped is
1344 // * if there is only ONE url and if it's a LOCAL one, ask for paste or cd 1344 // * if there is only ONE url and if it's a LOCAL one, ask for paste or cd
1345 // * in all other cases, just paste 1345 // * in all other cases, just paste
1346 // (for non-local ones, or for a list of URLs, 'cd' is nonsense) 1346 // (for non-local ones, or for a list of URLs, 'cd' is nonsense)
1347 QStrList strlist; 1347 QStrList strlist;
1348 int file_count = 0; 1348 int file_count = 0;
1349 dropText = ""; 1349 dropText = "";
1350 bool bPopup = true; 1350 bool bPopup = true;
1351 1351
1352 if(QUriDrag::decode(event, strlist)) { 1352 if(QUriDrag::decode(event, strlist)) {
1353 if (strlist.count()) { 1353 if (strlist.count()) {
1354 for(const char* p = strlist.first(); p; p = strlist.next()) { 1354 for(const char* p = strlist.first(); p; p = strlist.next()) {
1355 if(file_count++ > 0) { 1355 if(file_count++ > 0) {
1356 dropText += " "; 1356 dropText += " ";
1357 bPopup = false; // more than one file, don't popup 1357 bPopup = false; // more than one file, don't popup
1358 } 1358 }
1359 1359
1360/* 1360/*
1361 KURL url(p); 1361 KURL url(p);
1362 if (url.isLocalFile()) { 1362 if (url.isLocalFile()) {
1363 dropText += url.path(); // local URL : remove protocol 1363 dropText += url.path(); // local URL : remove protocol
1364 } 1364 }
1365 else { 1365 else {
1366 dropText += url.prettyURL(); 1366 dropText += url.prettyURL();
1367 bPopup = false; // a non-local file, don't popup 1367 bPopup = false; // a non-local file, don't popup
1368 } 1368 }
1369*/ 1369*/
1370 1370
1371 } 1371 }
1372 1372
1373 if (bPopup) 1373 if (bPopup)
1374 // m_drop->popup(pos() + event->pos()); 1374 // m_drop->popup(pos() + event->pos());
1375 m_drop->popup(mapToGlobal(event->pos())); 1375 m_drop->popup(mapToGlobal(event->pos()));
1376 else 1376 else
1377 { 1377 {
1378 if (currentSession) { 1378 if (currentSession) {
1379 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1379 currentSession->getEmulation()->sendString(dropText.local8Bit());
1380 } 1380 }
1381// kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; 1381// kdDebug() << "Drop:" << dropText.local8Bit() << "\n";
1382 } 1382 }
1383 } 1383 }
1384 } 1384 }
1385 else if(QTextDrag::decode(event, dropText)) { 1385 else if(QTextDrag::decode(event, dropText)) {
1386// kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; 1386// kdDebug() << "Drop:" << dropText.local8Bit() << "\n";
1387 if (currentSession) { 1387 if (currentSession) {
1388 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1388 currentSession->getEmulation()->sendString(dropText.local8Bit());
1389 } 1389 }
1390 // Paste it 1390 // Paste it
1391 } 1391 }
1392} 1392}
1393#endif 1393#endif
1394 1394
1395 1395
1396void TEWidget::drop_menu_activated(int item) 1396void TEWidget::drop_menu_activated(int item)
1397{ 1397{
1398#ifndef QT_NO_DRAGANDDROP 1398#ifndef QT_NO_DRAGANDDROP
1399 switch (item) 1399 switch (item)
1400 { 1400 {
1401 case 0: // paste 1401 case 0: // paste
1402 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1402 currentSession->getEmulation()->sendString(dropText.local8Bit());
1403// KWM::activate((Window)this->winId()); 1403// KWM::activate((Window)this->winId());
1404 break; 1404 break;
1405 case 1: // cd ... 1405 case 1: // cd ...
1406 currentSession->getEmulation()->sendString("cd "); 1406 currentSession->getEmulation()->sendString("cd ");
1407 struct stat statbuf; 1407 struct stat statbuf;
1408 if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 ) 1408 if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 )
1409 { 1409 {
1410 if ( !S_ISDIR(statbuf.st_mode) ) 1410 if ( !S_ISDIR(statbuf.st_mode) )
1411 { 1411 {
1412/* 1412/*
1413 KURL url; 1413 KURL url;
1414 url.setPath( dropText ); 1414 url.setPath( dropText );
1415 dropText = url.directory( true, false ); // remove filename 1415 dropText = url.directory( true, false ); // remove filename
1416*/ 1416*/
1417 } 1417 }
1418 } 1418 }
1419 dropText.replace(QRegExp(" "), "\\ "); // escape spaces 1419 dropText.replace(QRegExp(" "), "\\ "); // escape spaces
1420 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1420 currentSession->getEmulation()->sendString(dropText.local8Bit());
1421 currentSession->getEmulation()->sendString("\n"); 1421 currentSession->getEmulation()->sendString("\n");