-rw-r--r-- | noncore/apps/opie-console/TEWidget.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp index 2db214c..d1ff85e 100644 --- a/noncore/apps/opie-console/TEWidget.cpp +++ b/noncore/apps/opie-console/TEWidget.cpp | |||
@@ -1033,307 +1033,311 @@ bool TEWidget::eventFilter( QObject *obj, QEvent *e ) | |||
1033 | QApplication::sendEvent(scrollbar, e); | 1033 | QApplication::sendEvent(scrollbar, e); |
1034 | } | 1034 | } |
1035 | 1035 | ||
1036 | #ifdef FAKE_CTRL_AND_ALT | 1036 | #ifdef FAKE_CTRL_AND_ALT |
1037 | static bool control = FALSE; | 1037 | static bool control = FALSE; |
1038 | static bool alt = FALSE; | 1038 | static bool alt = FALSE; |
1039 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); | 1039 | // qDebug(" Has a keyboard with no CTRL and ALT keys, but we fake it:"); |
1040 | bool dele=FALSE; | 1040 | bool dele=FALSE; |
1041 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { | 1041 | if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { |
1042 | QKeyEvent* ke = (QKeyEvent*)e; | 1042 | QKeyEvent* ke = (QKeyEvent*)e; |
1043 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); | 1043 | bool keydown = e->type() == QEvent::KeyPress || ke->isAutoRepeat(); |
1044 | switch (ke->key()) { | 1044 | switch (ke->key()) { |
1045 | case Key_F9: // let this be "Control" | 1045 | case Key_F9: // let this be "Control" |
1046 | control = keydown; | 1046 | control = keydown; |
1047 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); | 1047 | e = new QKeyEvent(QEvent::KeyPress, Key_Control, 0, ke->state()); |
1048 | dele=TRUE; | 1048 | dele=TRUE; |
1049 | break; | 1049 | break; |
1050 | case Key_F13: // let this be "Alt" | 1050 | case Key_F13: // let this be "Alt" |
1051 | alt = keydown; | 1051 | alt = keydown; |
1052 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); | 1052 | e = new QKeyEvent(QEvent::KeyPress, Key_Alt, 0, ke->state()); |
1053 | dele=TRUE; | 1053 | dele=TRUE; |
1054 | break; | 1054 | break; |
1055 | default: | 1055 | default: |
1056 | if ( control ) { | 1056 | if ( control ) { |
1057 | int a = toupper(ke->ascii())-64; | 1057 | int a = toupper(ke->ascii())-64; |
1058 | if ( a >= 0 && a < ' ' ) { | 1058 | if ( a >= 0 && a < ' ' ) { |
1059 | e = new QKeyEvent(e->type(), ke->key(), | 1059 | e = new QKeyEvent(e->type(), ke->key(), |
1060 | a, ke->state()|ControlButton, QChar(a,0)); | 1060 | a, ke->state()|ControlButton, QChar(a,0)); |
1061 | dele=TRUE; | 1061 | dele=TRUE; |
1062 | } | 1062 | } |
1063 | } | 1063 | } |
1064 | if ( alt ) { | 1064 | if ( alt ) { |
1065 | e = new QKeyEvent(e->type(), ke->key(), | 1065 | e = new QKeyEvent(e->type(), ke->key(), |
1066 | ke->ascii(), ke->state()|AltButton, ke->text()); | 1066 | ke->ascii(), ke->state()|AltButton, ke->text()); |
1067 | dele=TRUE; | 1067 | dele=TRUE; |
1068 | } | 1068 | } |
1069 | } | 1069 | } |
1070 | } | 1070 | } |
1071 | #endif | 1071 | #endif |
1072 | 1072 | ||
1073 | if ( e->type() == QEvent::KeyPress ) { | 1073 | if ( e->type() == QEvent::KeyPress ) { |
1074 | QKeyEvent* ke = (QKeyEvent*)e; | 1074 | QKeyEvent* ke = (QKeyEvent*)e; |
1075 | actSel=0; // Key stroke implies a screen update, so TEWidget won't | 1075 | actSel=0; // Key stroke implies a screen update, so TEWidget won't |
1076 | // know where the current selection is. | 1076 | // know where the current selection is. |
1077 | 1077 | ||
1078 | // qDebug("key pressed is 0x%x",ke->key()); | 1078 | // qDebug("key pressed is 0x%x",ke->key()); |
1079 | 1079 | ||
1080 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker | 1080 | if( ke->state() == ShiftButton && ke->key() == Key_Tab) { //lets hardcode this sucker |
1081 | 1081 | ||
1082 | // qDebug("key pressed 2 is 0x%x",ke->key()); | 1082 | // qDebug("key pressed 2 is 0x%x",ke->key()); |
1083 | emitText("\\"); // expose | 1083 | emitText("\\"); // expose |
1084 | } else | 1084 | } else |
1085 | emit keyPressedSignal(ke); // expose | 1085 | emit keyPressedSignal(ke); // expose |
1086 | ke->accept(); | 1086 | ke->accept(); |
1087 | #ifdef FAKE_CTRL_AND_ALT | 1087 | #ifdef FAKE_CTRL_AND_ALT |
1088 | if ( dele ) delete e; | 1088 | if ( dele ) delete e; |
1089 | #endif | 1089 | #endif |
1090 | return true; // stop the event | 1090 | return true; // stop the event |
1091 | } | 1091 | } |
1092 | if ( e->type() == QEvent::Enter ) { | 1092 | if ( e->type() == QEvent::Enter ) { |
1093 | QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), | 1093 | QObject::disconnect( (QObject*)cb, SIGNAL(dataChanged()), |
1094 | this, SLOT(onClearSelection()) ); | 1094 | this, SLOT(onClearSelection()) ); |
1095 | } | 1095 | } |
1096 | if ( e->type() == QEvent::Leave ) { | 1096 | if ( e->type() == QEvent::Leave ) { |
1097 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), | 1097 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), |
1098 | this, SLOT(onClearSelection()) ); | 1098 | this, SLOT(onClearSelection()) ); |
1099 | } | 1099 | } |
1100 | return QFrame::eventFilter( obj, e ); | 1100 | return QFrame::eventFilter( obj, e ); |
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | /* ------------------------------------------------------------------------- */ | 1103 | /* ------------------------------------------------------------------------- */ |
1104 | /* */ | 1104 | /* */ |
1105 | /* Frame */ | 1105 | /* Frame */ |
1106 | /* */ | 1106 | /* */ |
1107 | /* ------------------------------------------------------------------------- */ | 1107 | /* ------------------------------------------------------------------------- */ |
1108 | 1108 | ||
1109 | void TEWidget::frameChanged() | 1109 | void TEWidget::frameChanged() |
1110 | { | 1110 | { |
1111 | propagateSize(); | 1111 | propagateSize(); |
1112 | update(); | 1112 | update(); |
1113 | } | 1113 | } |
1114 | 1114 | ||
1115 | /* ------------------------------------------------------------------------- */ | 1115 | /* ------------------------------------------------------------------------- */ |
1116 | /* */ | 1116 | /* */ |
1117 | /* Sound */ | 1117 | /* Sound */ |
1118 | /* */ | 1118 | /* */ |
1119 | /* ------------------------------------------------------------------------- */ | 1119 | /* ------------------------------------------------------------------------- */ |
1120 | 1120 | ||
1121 | void TEWidget::Bell() | 1121 | void TEWidget::Bell() |
1122 | { | 1122 | { |
1123 | QApplication::beep(); | 1123 | QApplication::beep(); |
1124 | } | 1124 | } |
1125 | 1125 | ||
1126 | /* ------------------------------------------------------------------------- */ | 1126 | /* ------------------------------------------------------------------------- */ |
1127 | /* */ | 1127 | /* */ |
1128 | /* Auxiluary */ | 1128 | /* Auxiluary */ |
1129 | /* */ | 1129 | /* */ |
1130 | /* ------------------------------------------------------------------------- */ | 1130 | /* ------------------------------------------------------------------------- */ |
1131 | 1131 | ||
1132 | void TEWidget::clearImage() | 1132 | void TEWidget::clearImage() |
1133 | // initialize the image | 1133 | // initialize the image |
1134 | // for internal use only | 1134 | // for internal use only |
1135 | { | 1135 | { |
1136 | for (int y = 0; y < lines; y++) | 1136 | for (int y = 0; y < lines; y++) |
1137 | for (int x = 0; x < columns; x++) | 1137 | for (int x = 0; x < columns; x++) |
1138 | { | 1138 | { |
1139 | image[loc(x,y)].c = 0xff; //' '; | 1139 | image[loc(x,y)].c = 0xff; //' '; |
1140 | image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; | 1140 | image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; |
1141 | image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; | 1141 | image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; |
1142 | image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; | 1142 | image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; |
1143 | } | 1143 | } |
1144 | } | 1144 | } |
1145 | 1145 | ||
1146 | // Create Image /////////////////////////////////////////////////////// | 1146 | // Create Image /////////////////////////////////////////////////////// |
1147 | 1147 | ||
1148 | void TEWidget::calcGeometry() | 1148 | void TEWidget::calcGeometry() |
1149 | { | 1149 | { |
1150 | //FIXME: set rimX == rimY == 0 when running in full screen mode. | 1150 | //FIXME: set rimX == rimY == 0 when running in full screen mode. |
1151 | 1151 | ||
1152 | int showhscrollbar = 1; | 1152 | int showhscrollbar = 1; |
1153 | int hwidth = 0; | 1153 | int hwidth = 0; |
1154 | 1154 | ||
1155 | if(vcolumns == 0) showhscrollbar = 0; | 1155 | if(vcolumns == 0) showhscrollbar = 0; |
1156 | if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width(); | 1156 | if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width(); |
1157 | 1157 | ||
1158 | scrollbar->resize(QApplication::style().scrollBarExtent().width(), | 1158 | scrollbar->resize(QApplication::style().scrollBarExtent().width(), |
1159 | contentsRect().height() - hwidth); | 1159 | contentsRect().height() - hwidth); |
1160 | 1160 | ||
1161 | if(!showhscrollbar) cornerButton()->move(0, 0); | ||
1162 | else cornerButton()->move(contentsRect().width() - hwidth, contentsRect().height() - hwidth); | ||
1163 | |||
1164 | |||
1161 | if(showhscrollbar == 1) | 1165 | if(showhscrollbar == 1) |
1162 | { | 1166 | { |
1163 | hscrollbar->resize(contentsRect().width() - hwidth, hwidth); | 1167 | hscrollbar->resize(contentsRect().width() - hwidth, hwidth); |
1164 | hscrollbar->setRange(0, 40); | 1168 | hscrollbar->setRange(0, 40); |
1165 | 1169 | ||
1166 | QPoint p = contentsRect().bottomLeft(); | 1170 | QPoint p = contentsRect().bottomLeft(); |
1167 | hscrollbar->move(QPoint(p.x(), p.y() - hwidth)); | 1171 | hscrollbar->move(QPoint(p.x(), p.y() - hwidth)); |
1168 | hscrollbar->show(); | 1172 | hscrollbar->show(); |
1169 | } | 1173 | } |
1170 | else hscrollbar->hide(); | 1174 | else hscrollbar->hide(); |
1171 | 1175 | ||
1172 | switch(scrollLoc) | 1176 | switch(scrollLoc) |
1173 | { | 1177 | { |
1174 | case SCRNONE : | 1178 | case SCRNONE : |
1175 | columns = ( contentsRect().width() - 2 * rimX ) / font_w; | 1179 | columns = ( contentsRect().width() - 2 * rimX ) / font_w; |
1176 | if(vcolumns) columns = vcolumns; | 1180 | if(vcolumns) columns = vcolumns; |
1177 | blX = (contentsRect().width() - (columns*font_w) ) / 2; | 1181 | blX = (contentsRect().width() - (columns*font_w) ) / 2; |
1178 | if(showhscrollbar) | 1182 | if(showhscrollbar) |
1179 | blX = -hposition * font_w; | 1183 | blX = -hposition * font_w; |
1180 | brX = blX; | 1184 | brX = blX; |
1181 | scrollbar->hide(); | 1185 | scrollbar->hide(); |
1182 | break; | 1186 | break; |
1183 | case SCRLEFT : | 1187 | case SCRLEFT : |
1184 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; | 1188 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; |
1185 | if(vcolumns) columns = vcolumns; | 1189 | if(vcolumns) columns = vcolumns; |
1186 | brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; | 1190 | brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; |
1187 | if(showhscrollbar) | 1191 | if(showhscrollbar) |
1188 | brX = -hposition * font_w; | 1192 | brX = -hposition * font_w; |
1189 | blX = brX + scrollbar->width(); | 1193 | blX = brX + scrollbar->width(); |
1190 | scrollbar->move(contentsRect().topLeft()); | 1194 | scrollbar->move(contentsRect().topLeft()); |
1191 | scrollbar->show(); | 1195 | scrollbar->show(); |
1192 | break; | 1196 | break; |
1193 | case SCRRIGHT: | 1197 | case SCRRIGHT: |
1194 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; | 1198 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; |
1195 | if(vcolumns) columns = vcolumns; | 1199 | if(vcolumns) columns = vcolumns; |
1196 | blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; | 1200 | blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; |
1197 | if(showhscrollbar) | 1201 | if(showhscrollbar) |
1198 | blX = -hposition * font_w; | 1202 | blX = -hposition * font_w; |
1199 | brX = blX; | 1203 | brX = blX; |
1200 | scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); | 1204 | scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); |
1201 | scrollbar->show(); | 1205 | scrollbar->show(); |
1202 | break; | 1206 | break; |
1203 | } | 1207 | } |
1204 | //FIXME: support 'rounding' styles | 1208 | //FIXME: support 'rounding' styles |
1205 | lines = ( contentsRect().height() - 2 * rimY ) / font_h; | 1209 | lines = ( contentsRect().height() - 2 * rimY ) / font_h; |
1206 | bY = (contentsRect().height() - (lines *font_h)) / 2; | 1210 | bY = (contentsRect().height() - (lines *font_h)) / 2; |
1207 | 1211 | ||
1208 | if(showhscrollbar == 1) | 1212 | if(showhscrollbar == 1) |
1209 | { | 1213 | { |
1210 | //bY = bY - 10; | 1214 | lines = lines - (hwidth / font_h) - 1; |
1211 | lines = lines - 1; | 1215 | if(lines < 1) lines = 1; |
1212 | } | 1216 | } |
1213 | } | 1217 | } |
1214 | 1218 | ||
1215 | void TEWidget::makeImage() | 1219 | void TEWidget::makeImage() |
1216 | //FIXME: rename 'calcGeometry? | 1220 | //FIXME: rename 'calcGeometry? |
1217 | { | 1221 | { |
1218 | calcGeometry(); | 1222 | calcGeometry(); |
1219 | image = (ca*) malloc(lines*columns*sizeof(ca)); | 1223 | image = (ca*) malloc(lines*columns*sizeof(ca)); |
1220 | clearImage(); | 1224 | clearImage(); |
1221 | } | 1225 | } |
1222 | 1226 | ||
1223 | // calculate the needed size | 1227 | // calculate the needed size |
1224 | QSize TEWidget::calcSize(int cols, int lins) const | 1228 | QSize TEWidget::calcSize(int cols, int lins) const |
1225 | { | 1229 | { |
1226 | int frw = width() - contentsRect().width(); | 1230 | int frw = width() - contentsRect().width(); |
1227 | int frh = height() - contentsRect().height(); | 1231 | int frh = height() - contentsRect().height(); |
1228 | int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); | 1232 | int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); |
1229 | return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh ); | 1233 | return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh ); |
1230 | } | 1234 | } |
1231 | 1235 | ||
1232 | QSize TEWidget::sizeHint() const | 1236 | QSize TEWidget::sizeHint() const |
1233 | { | 1237 | { |
1234 | return size(); | 1238 | return size(); |
1235 | } | 1239 | } |
1236 | 1240 | ||
1237 | void TEWidget::styleChange(QStyle &) | 1241 | void TEWidget::styleChange(QStyle &) |
1238 | { | 1242 | { |
1239 | propagateSize(); | 1243 | propagateSize(); |
1240 | } | 1244 | } |
1241 | 1245 | ||
1242 | #ifndef QT_NO_DRAGANDDROP | 1246 | #ifndef QT_NO_DRAGANDDROP |
1243 | 1247 | ||
1244 | /* --------------------------------------------------------------------- */ | 1248 | /* --------------------------------------------------------------------- */ |
1245 | /* */ | 1249 | /* */ |
1246 | /* Drag & Drop */ | 1250 | /* Drag & Drop */ |
1247 | /* */ | 1251 | /* */ |
1248 | /* --------------------------------------------------------------------- */ | 1252 | /* --------------------------------------------------------------------- */ |
1249 | 1253 | ||
1250 | 1254 | ||
1251 | void TEWidget::dragEnterEvent(QDragEnterEvent* e) | 1255 | void TEWidget::dragEnterEvent(QDragEnterEvent* e) |
1252 | { | 1256 | { |
1253 | e->accept(QTextDrag::canDecode(e) || | 1257 | e->accept(QTextDrag::canDecode(e) || |
1254 | QUriDrag::canDecode(e)); | 1258 | QUriDrag::canDecode(e)); |
1255 | } | 1259 | } |
1256 | 1260 | ||
1257 | void TEWidget::dropEvent(QDropEvent* event) | 1261 | void TEWidget::dropEvent(QDropEvent* event) |
1258 | { | 1262 | { |
1259 | // The current behaviour when url(s) are dropped is | 1263 | // The current behaviour when url(s) are dropped is |
1260 | // * if there is only ONE url and if it's a LOCAL one, ask for paste or cd | 1264 | // * if there is only ONE url and if it's a LOCAL one, ask for paste or cd |
1261 | // * in all other cases, just paste | 1265 | // * in all other cases, just paste |
1262 | // (for non-local ones, or for a list of URLs, 'cd' is nonsense) | 1266 | // (for non-local ones, or for a list of URLs, 'cd' is nonsense) |
1263 | QStrList strlist; | 1267 | QStrList strlist; |
1264 | int file_count = 0; | 1268 | int file_count = 0; |
1265 | dropText = ""; | 1269 | dropText = ""; |
1266 | bool bPopup = true; | 1270 | bool bPopup = true; |
1267 | 1271 | ||
1268 | if(QUriDrag::decode(event, strlist)) { | 1272 | if(QUriDrag::decode(event, strlist)) { |
1269 | if (strlist.count()) { | 1273 | if (strlist.count()) { |
1270 | for(const char* p = strlist.first(); p; p = strlist.next()) { | 1274 | for(const char* p = strlist.first(); p; p = strlist.next()) { |
1271 | if(file_count++ > 0) { | 1275 | if(file_count++ > 0) { |
1272 | dropText += " "; | 1276 | dropText += " "; |
1273 | bPopup = false; // more than one file, don't popup | 1277 | bPopup = false; // more than one file, don't popup |
1274 | } | 1278 | } |
1275 | 1279 | ||
1276 | /* | 1280 | /* |
1277 | KURL url(p); | 1281 | KURL url(p); |
1278 | if (url.isLocalFile()) { | 1282 | if (url.isLocalFile()) { |
1279 | dropText += url.path(); // local URL : remove protocol | 1283 | dropText += url.path(); // local URL : remove protocol |
1280 | } | 1284 | } |
1281 | else { | 1285 | else { |
1282 | dropText += url.prettyURL(); | 1286 | dropText += url.prettyURL(); |
1283 | bPopup = false; // a non-local file, don't popup | 1287 | bPopup = false; // a non-local file, don't popup |
1284 | } | 1288 | } |
1285 | */ | 1289 | */ |
1286 | 1290 | ||
1287 | } | 1291 | } |
1288 | 1292 | ||
1289 | if (bPopup) | 1293 | if (bPopup) |
1290 | // m_drop->popup(pos() + event->pos()); | 1294 | // m_drop->popup(pos() + event->pos()); |
1291 | m_drop->popup(mapToGlobal(event->pos())); | 1295 | m_drop->popup(mapToGlobal(event->pos())); |
1292 | else | 1296 | else |
1293 | { | 1297 | { |
1294 | if (currentSession) { | 1298 | if (currentSession) { |
1295 | currentSession->getEmulation()->sendString(dropText.local8Bit()); | 1299 | currentSession->getEmulation()->sendString(dropText.local8Bit()); |
1296 | } | 1300 | } |
1297 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; | 1301 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; |
1298 | } | 1302 | } |
1299 | } | 1303 | } |
1300 | } | 1304 | } |
1301 | else if(QTextDrag::decode(event, dropText)) { | 1305 | else if(QTextDrag::decode(event, dropText)) { |
1302 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; | 1306 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; |
1303 | if (currentSession) { | 1307 | if (currentSession) { |
1304 | currentSession->getEmulation()->sendString(dropText.local8Bit()); | 1308 | currentSession->getEmulation()->sendString(dropText.local8Bit()); |
1305 | } | 1309 | } |
1306 | // Paste it | 1310 | // Paste it |
1307 | } | 1311 | } |
1308 | } | 1312 | } |
1309 | #endif | 1313 | #endif |
1310 | 1314 | ||
1311 | 1315 | ||
1312 | void TEWidget::drop_menu_activated(int) | 1316 | void TEWidget::drop_menu_activated(int) |
1313 | { | 1317 | { |
1314 | #ifndef QT_NO_DRAGANDDROP | 1318 | #ifndef QT_NO_DRAGANDDROP |
1315 | switch (item) | 1319 | switch (item) |
1316 | { | 1320 | { |
1317 | case 0: // paste | 1321 | case 0: // paste |
1318 | currentSession->getEmulation()->sendString(dropText.local8Bit()); | 1322 | currentSession->getEmulation()->sendString(dropText.local8Bit()); |
1319 | // KWM::activate((Window)this->winId()); | 1323 | // KWM::activate((Window)this->winId()); |
1320 | break; | 1324 | break; |
1321 | case 1: // cd ... | 1325 | case 1: // cd ... |
1322 | currentSession->getEmulation()->sendString("cd "); | 1326 | currentSession->getEmulation()->sendString("cd "); |
1323 | struct stat statbuf; | 1327 | struct stat statbuf; |
1324 | if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 ) | 1328 | if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 ) |
1325 | { | 1329 | { |
1326 | if ( !S_ISDIR(statbuf.st_mode) ) | 1330 | if ( !S_ISDIR(statbuf.st_mode) ) |
1327 | { | 1331 | { |
1328 | /* | 1332 | /* |
1329 | KURL url; | 1333 | KURL url; |
1330 | url.setPath( dropText ); | 1334 | url.setPath( dropText ); |
1331 | dropText = url.directory( true, false ); // remove filename | 1335 | dropText = url.directory( true, false ); // remove filename |
1332 | */ | 1336 | */ |
1333 | } | 1337 | } |
1334 | } | 1338 | } |
1335 | dropText.replace(QRegExp(" "), "\\ "); // escape spaces | 1339 | dropText.replace(QRegExp(" "), "\\ "); // escape spaces |
1336 | currentSession->getEmulation()->sendString(dropText.local8Bit()); | 1340 | currentSession->getEmulation()->sendString(dropText.local8Bit()); |
1337 | currentSession->getEmulation()->sendString("\n"); | 1341 | currentSession->getEmulation()->sendString("\n"); |
1338 | // KWM::activate((Window)this->winId()); | 1342 | // KWM::activate((Window)this->winId()); |
1339 | break; | 1343 | break; |