author | zecke <zecke> | 2003-01-22 14:59:26 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-01-22 14:59:26 (UTC) |
commit | a7b33b069107b64112b1760dc3eca02469a052d9 (patch) (unidiff) | |
tree | 22185acb673480104d5ddd10f2e6e209aeaebc4e | |
parent | 36fab41fa6b38b9f3aa5ecd74b750eaf739beb16 (diff) | |
download | opie-a7b33b069107b64112b1760dc3eca02469a052d9.zip opie-a7b33b069107b64112b1760dc3eca02469a052d9.tar.gz opie-a7b33b069107b64112b1760dc3eca02469a052d9.tar.bz2 |
Make it compile with Opie/X11
-rw-r--r-- | noncore/apps/opie-console/TEWidget.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/TEWidget.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/TEWidget.cpp b/noncore/apps/opie-console/TEWidget.cpp index 3d010cb..444924b 100644 --- a/noncore/apps/opie-console/TEWidget.cpp +++ b/noncore/apps/opie-console/TEWidget.cpp | |||
@@ -1219,65 +1219,65 @@ void TEWidget::calcGeometry() | |||
1219 | lines = lines - (hwidth / font_h) - 1; | 1219 | lines = lines - (hwidth / font_h) - 1; |
1220 | if(lines < 1) lines = 1; | 1220 | if(lines < 1) lines = 1; |
1221 | } | 1221 | } |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | void TEWidget::makeImage() | 1224 | void TEWidget::makeImage() |
1225 | //FIXME: rename 'calcGeometry? | 1225 | //FIXME: rename 'calcGeometry? |
1226 | { | 1226 | { |
1227 | calcGeometry(); | 1227 | calcGeometry(); |
1228 | image = (ca*) malloc(lines*columns*sizeof(ca)); | 1228 | image = (ca*) malloc(lines*columns*sizeof(ca)); |
1229 | clearImage(); | 1229 | clearImage(); |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | // calculate the needed size | 1232 | // calculate the needed size |
1233 | QSize TEWidget::calcSize(int cols, int lins) const | 1233 | QSize TEWidget::calcSize(int cols, int lins) const |
1234 | { | 1234 | { |
1235 | int frw = width() - contentsRect().width(); | 1235 | int frw = width() - contentsRect().width(); |
1236 | int frh = height() - contentsRect().height(); | 1236 | int frh = height() - contentsRect().height(); |
1237 | int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); | 1237 | int scw = (scrollLoc==SCRNONE?0:scrollbar->width()); |
1238 | return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh ); | 1238 | return QSize( font_w*cols + 2*rimX + frw + scw, font_h*lins + 2*rimY + frh ); |
1239 | } | 1239 | } |
1240 | 1240 | ||
1241 | QSize TEWidget::sizeHint() const | 1241 | QSize TEWidget::sizeHint() const |
1242 | { | 1242 | { |
1243 | return size(); | 1243 | return size(); |
1244 | } | 1244 | } |
1245 | 1245 | ||
1246 | void TEWidget::styleChange(QStyle &) | 1246 | void TEWidget::styleChange(QStyle &) |
1247 | { | 1247 | { |
1248 | propagateSize(); | 1248 | propagateSize(); |
1249 | } | 1249 | } |
1250 | 1250 | ||
1251 | #ifndef QT_NO_DRAGANDDROP | 1251 | #ifdef QT_NO_DRAGANDDROP_FOO |
1252 | 1252 | ||
1253 | /* --------------------------------------------------------------------- */ | 1253 | /* --------------------------------------------------------------------- */ |
1254 | /* */ | 1254 | /* */ |
1255 | /* Drag & Drop */ | 1255 | /* Drag & Drop */ |
1256 | /* */ | 1256 | /* */ |
1257 | /* --------------------------------------------------------------------- */ | 1257 | /* --------------------------------------------------------------------- */ |
1258 | 1258 | ||
1259 | 1259 | ||
1260 | void TEWidget::dragEnterEvent(QDragEnterEvent* e) | 1260 | void TEWidget::dragEnterEvent(QDragEnterEvent* e) |
1261 | { | 1261 | { |
1262 | e->accept(QTextDrag::canDecode(e) || | 1262 | e->accept(QTextDrag::canDecode(e) || |
1263 | QUriDrag::canDecode(e)); | 1263 | QUriDrag::canDecode(e)); |
1264 | } | 1264 | } |
1265 | 1265 | ||
1266 | void TEWidget::dropEvent(QDropEvent* event) | 1266 | void TEWidget::dropEvent(QDropEvent* event) |
1267 | { | 1267 | { |
1268 | // The current behaviour when url(s) are dropped is | 1268 | // The current behaviour when url(s) are dropped is |
1269 | // * if there is only ONE url and if it's a LOCAL one, ask for paste or cd | 1269 | // * if there is only ONE url and if it's a LOCAL one, ask for paste or cd |
1270 | // * in all other cases, just paste | 1270 | // * in all other cases, just paste |
1271 | // (for non-local ones, or for a list of URLs, 'cd' is nonsense) | 1271 | // (for non-local ones, or for a list of URLs, 'cd' is nonsense) |
1272 | QStrList strlist; | 1272 | QStrList strlist; |
1273 | int file_count = 0; | 1273 | int file_count = 0; |
1274 | dropText = ""; | 1274 | dropText = ""; |
1275 | bool bPopup = true; | 1275 | bool bPopup = true; |
1276 | 1276 | ||
1277 | if(QUriDrag::decode(event, strlist)) { | 1277 | if(QUriDrag::decode(event, strlist)) { |
1278 | if (strlist.count()) { | 1278 | if (strlist.count()) { |
1279 | for(const char* p = strlist.first(); p; p = strlist.next()) { | 1279 | for(const char* p = strlist.first(); p; p = strlist.next()) { |
1280 | if(file_count++ > 0) { | 1280 | if(file_count++ > 0) { |
1281 | dropText += " "; | 1281 | dropText += " "; |
1282 | bPopup = false; // more than one file, don't popup | 1282 | bPopup = false; // more than one file, don't popup |
1283 | } | 1283 | } |
@@ -1291,65 +1291,65 @@ void TEWidget::dropEvent(QDropEvent* event) | |||
1291 | dropText += url.prettyURL(); | 1291 | dropText += url.prettyURL(); |
1292 | bPopup = false; // a non-local file, don't popup | 1292 | bPopup = false; // a non-local file, don't popup |
1293 | } | 1293 | } |
1294 | */ | 1294 | */ |
1295 | 1295 | ||
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | if (bPopup) | 1298 | if (bPopup) |
1299 | // m_drop->popup(pos() + event->pos()); | 1299 | // m_drop->popup(pos() + event->pos()); |
1300 | m_drop->popup(mapToGlobal(event->pos())); | 1300 | m_drop->popup(mapToGlobal(event->pos())); |
1301 | else | 1301 | else |
1302 | { | 1302 | { |
1303 | if (currentSession) { | 1303 | if (currentSession) { |
1304 | currentSession->getEmulation()->sendString(dropText.local8Bit()); | 1304 | currentSession->getEmulation()->sendString(dropText.local8Bit()); |
1305 | } | 1305 | } |
1306 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; | 1306 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; |
1307 | } | 1307 | } |
1308 | } | 1308 | } |
1309 | } | 1309 | } |
1310 | else if(QTextDrag::decode(event, dropText)) { | 1310 | else if(QTextDrag::decode(event, dropText)) { |
1311 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; | 1311 | // kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; |
1312 | if (currentSession) { | 1312 | if (currentSession) { |
1313 | currentSession->getEmulation()->sendString(dropText.local8Bit()); | 1313 | currentSession->getEmulation()->sendString(dropText.local8Bit()); |
1314 | } | 1314 | } |
1315 | // Paste it | 1315 | // Paste it |
1316 | } | 1316 | } |
1317 | } | 1317 | } |
1318 | #endif | 1318 | #endif |
1319 | 1319 | ||
1320 | 1320 | ||
1321 | void TEWidget::drop_menu_activated(int) | 1321 | void TEWidget::drop_menu_activated(int) |
1322 | { | 1322 | { |
1323 | #ifndef QT_NO_DRAGANDDROP | 1323 | #ifdef QT_NO_DRAGANDDROP_FOO |
1324 | switch (item) | 1324 | switch (item) |
1325 | { | 1325 | { |
1326 | case 0: // paste | 1326 | case 0: // paste |
1327 | currentSession->getEmulation()->sendString(dropText.local8Bit()); | 1327 | currentSession->getEmulation()->sendString(dropText.local8Bit()); |
1328 | // KWM::activate((Window)this->winId()); | 1328 | // KWM::activate((Window)this->winId()); |
1329 | break; | 1329 | break; |
1330 | case 1: // cd ... | 1330 | case 1: // cd ... |
1331 | currentSession->getEmulation()->sendString("cd "); | 1331 | currentSession->getEmulation()->sendString("cd "); |
1332 | struct stat statbuf; | 1332 | struct stat statbuf; |
1333 | if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 ) | 1333 | if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 ) |
1334 | { | 1334 | { |
1335 | if ( !S_ISDIR(statbuf.st_mode) ) | 1335 | if ( !S_ISDIR(statbuf.st_mode) ) |
1336 | { | 1336 | { |
1337 | /* | 1337 | /* |
1338 | KURL url; | 1338 | KURL url; |
1339 | url.setPath( dropText ); | 1339 | url.setPath( dropText ); |
1340 | dropText = url.directory( true, false ); // remove filename | 1340 | dropText = url.directory( true, false ); // remove filename |
1341 | */ | 1341 | */ |
1342 | } | 1342 | } |
1343 | } | 1343 | } |
1344 | dropText.replace(QRegExp(" "), "\\ "); // escape spaces | 1344 | dropText.replace(QRegExp(" "), "\\ "); // escape spaces |
1345 | currentSession->getEmulation()->sendString(dropText.local8Bit()); | 1345 | currentSession->getEmulation()->sendString(dropText.local8Bit()); |
1346 | currentSession->getEmulation()->sendString("\n"); | 1346 | currentSession->getEmulation()->sendString("\n"); |
1347 | // KWM::activate((Window)this->winId()); | 1347 | // KWM::activate((Window)this->winId()); |
1348 | break; | 1348 | break; |
1349 | } | 1349 | } |
1350 | #endif | 1350 | #endif |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | QPushButton* TEWidget::cornerButton() { | 1353 | QPushButton* TEWidget::cornerButton() { |
1354 | return m_cornerButton; | 1354 | return m_cornerButton; |
1355 | } | 1355 | } |
diff --git a/noncore/apps/opie-console/TEWidget.h b/noncore/apps/opie-console/TEWidget.h index 6ff731b..900a659 100644 --- a/noncore/apps/opie-console/TEWidget.h +++ b/noncore/apps/opie-console/TEWidget.h | |||
@@ -99,65 +99,65 @@ signals: | |||
99 | void configureRequest( TEWidget*, int state, int x, int y ); | 99 | void configureRequest( TEWidget*, int state, int x, int y ); |
100 | 100 | ||
101 | void clearSelectionSignal(); | 101 | void clearSelectionSignal(); |
102 | void beginSelectionSignal( const int x, const int y ); | 102 | void beginSelectionSignal( const int x, const int y ); |
103 | void extendSelectionSignal( const int x, const int y ); | 103 | void extendSelectionSignal( const int x, const int y ); |
104 | void endSelectionSignal(const BOOL preserve_line_breaks); | 104 | void endSelectionSignal(const BOOL preserve_line_breaks); |
105 | 105 | ||
106 | 106 | ||
107 | protected: | 107 | protected: |
108 | 108 | ||
109 | virtual void styleChange( QStyle& ); | 109 | virtual void styleChange( QStyle& ); |
110 | 110 | ||
111 | bool eventFilter( QObject *, QEvent * ); | 111 | bool eventFilter( QObject *, QEvent * ); |
112 | 112 | ||
113 | void drawAttrStr(QPainter &paint, QRect rect, | 113 | void drawAttrStr(QPainter &paint, QRect rect, |
114 | QString& str, ca attr, BOOL pm, BOOL clear); | 114 | QString& str, ca attr, BOOL pm, BOOL clear); |
115 | void paintEvent( QPaintEvent * ); | 115 | void paintEvent( QPaintEvent * ); |
116 | 116 | ||
117 | void resizeEvent(QResizeEvent*); | 117 | void resizeEvent(QResizeEvent*); |
118 | 118 | ||
119 | void fontChange(const QFont &font); | 119 | void fontChange(const QFont &font); |
120 | void frameChanged(); | 120 | void frameChanged(); |
121 | 121 | ||
122 | void mouseDoubleClickEvent(QMouseEvent* ev); | 122 | void mouseDoubleClickEvent(QMouseEvent* ev); |
123 | void mousePressEvent( QMouseEvent* ); | 123 | void mousePressEvent( QMouseEvent* ); |
124 | void mouseReleaseEvent( QMouseEvent* ); | 124 | void mouseReleaseEvent( QMouseEvent* ); |
125 | void mouseMoveEvent( QMouseEvent* ); | 125 | void mouseMoveEvent( QMouseEvent* ); |
126 | 126 | ||
127 | void focusInEvent( QFocusEvent * ); | 127 | void focusInEvent( QFocusEvent * ); |
128 | void focusOutEvent( QFocusEvent * ); | 128 | void focusOutEvent( QFocusEvent * ); |
129 | bool focusNextPrevChild( bool next ); | 129 | bool focusNextPrevChild( bool next ); |
130 | 130 | ||
131 | #ifndef QT_NO_DRAGANDDROP | 131 | #ifdef QT_NO_DRAGANDDROP_FOO_BAR_ |
132 | // Dnd | 132 | // Dnd |
133 | void dragEnterEvent(QDragEnterEvent* event); | 133 | void dragEnterEvent(QDragEnterEvent* event); |
134 | void dropEvent(QDropEvent* event); | 134 | void dropEvent(QDropEvent* event); |
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | virtual int charClass(char) const; | 137 | virtual int charClass(char) const; |
138 | 138 | ||
139 | void clearImage(); | 139 | void clearImage(); |
140 | 140 | ||
141 | public: | 141 | public: |
142 | const QPixmap *backgroundPixmap(); | 142 | const QPixmap *backgroundPixmap(); |
143 | 143 | ||
144 | void setSelection(const QString &t); | 144 | void setSelection(const QString &t); |
145 | 145 | ||
146 | virtual void setFont(const QFont &); | 146 | virtual void setFont(const QFont &); |
147 | void setVTFont(const QFont &); | 147 | void setVTFont(const QFont &); |
148 | QFont getVTFont(); | 148 | QFont getVTFont(); |
149 | 149 | ||
150 | void setMouseMarks(bool on); | 150 | void setMouseMarks(bool on); |
151 | 151 | ||
152 | public slots: | 152 | public slots: |
153 | 153 | ||
154 | void onClearSelection(); | 154 | void onClearSelection(); |
155 | 155 | ||
156 | protected slots: | 156 | protected slots: |
157 | 157 | ||
158 | void scrollChanged(int value); | 158 | void scrollChanged(int value); |
159 | void hscrollChanged(int value); | 159 | void hscrollChanged(int value); |
160 | void blinkEvent(); | 160 | void blinkEvent(); |
161 | 161 | ||
162 | private: | 162 | private: |
163 | 163 | ||