# HG changeset patch # User insilmaril # Date 1167400337 0 # Node ID 8059b6aa74d7bfca8f87e207758f545b7486d20a # Parent 910ba9fab728956865c10b2e9c9aadf08d3009ca Removed some FIXMEs. Added translations diff -r 910ba9fab728 -r 8059b6aa74d7 branchobj.cpp --- a/branchobj.cpp Thu Dec 14 17:01:44 2006 +0000 +++ b/branchobj.cpp Fri Dec 29 13:52:17 2006 +0000 @@ -232,7 +232,7 @@ } // updateLink is called implicitly in move - reposition(); // FIXME shouldn't be this a request? + requestReposition(); // FIXME shouldn't be this a request? } void BranchObj::unsetParObjTmp() diff -r 910ba9fab728 -r 8059b6aa74d7 demos/todo.vym Binary file demos/todo.vym has changed diff -r 910ba9fab728 -r 8059b6aa74d7 exportxhtmldialog.cpp --- a/exportxhtmldialog.cpp Thu Dec 14 17:01:44 2006 +0000 +++ b/exportxhtmldialog.cpp Fri Dec 29 13:52:17 2006 +0000 @@ -57,7 +57,7 @@ useTextColor=false; ui.textColorButton->setChecked(useTextColor); -/* FIXME this was used in old html export, is not yet in new stylesheet +/* TODO this was used in old html export, is not yet in new stylesheet if ( settings.readEntry ("/export/html/useHeading","no")=="yes") useHeading=true; else diff -r 910ba9fab728 -r 8059b6aa74d7 file.cpp --- a/file.cpp Thu Dec 14 17:01:44 2006 +0000 +++ b/file.cpp Fri Dec 29 13:52:17 2006 +0000 @@ -291,13 +291,13 @@ { r=max_w / pix.width(); pix.resize(qRound(pix.width()*r), qRound(pix.height()*r)); - // FIXME not a resize, but a shrink/enlarge is needed here... + // TODO not a resize, but a shrink/enlarge is needed here... } if (pix.height()>max_h) { r=max_h / pix.height(); pix.resize(qRound(pix.width()*r), qRound(pix.height()*r)); - // FIXME not a resize, but a shrink/enlarge is needed here... + // TODO not a resize, but a shrink/enlarge is needed here... } setPixmap( pix ); } diff -r 910ba9fab728 -r 8059b6aa74d7 linkablemapobj.cpp --- a/linkablemapobj.cpp Thu Dec 14 17:01:44 2006 +0000 +++ b/linkablemapobj.cpp Fri Dec 29 13:52:17 2006 +0000 @@ -72,7 +72,7 @@ linkpos=LinkBottom; arcsegs=13; -// FIXME instead of linkcolor pen.color() could be used all around +// TODO instead of linkcolor pen.color() could be used all around pen.setWidth (1); pen.setColor (linkcolor); pen.setCapStyle ( Qt::RoundCap ); diff -r 910ba9fab728 -r 8059b6aa74d7 mainwindow.cpp --- a/mainwindow.cpp Thu Dec 14 17:01:44 2006 +0000 +++ b/mainwindow.cpp Fri Dec 29 13:52:17 2006 +0000 @@ -92,7 +92,6 @@ // Initialize history window; historyWindow=new HistoryWindow(); - // FIXME historyWindow.setStepsTotal(stepsTotal); // Initialize some settings, which are platform dependant QString p,s; @@ -3095,7 +3094,6 @@ m.reset(); currentMapEditor()->setMatrix( m ); currentMapEditor()->setViewCenter(); - currentMapEditor()->adjustCanvasSize(); } } @@ -3107,7 +3105,6 @@ m.scale( 1.25, 1.25 ); currentMapEditor()->setMatrix( m ); currentMapEditor()->setViewCenter(); - currentMapEditor()->adjustCanvasSize(); } } @@ -3119,7 +3116,6 @@ m.scale( 0.8, 0.8 ); currentMapEditor()->setMatrix( m ); currentMapEditor()->setViewCenter(); - currentMapEditor()->adjustCanvasSize(); } } @@ -3366,7 +3362,6 @@ if ( (typeid(*selection) == typeid(FloatImageObj)) ) { FloatObj *fo=(FloatImageObj*)selection; -//FIXME do this in mainwindow standardFlagsDefault->setEnabled (false); actionEditOpenURL->setEnabled (false); actionEditOpenVymLink->setEnabled (false); diff -r 910ba9fab728 -r 8059b6aa74d7 mapeditor.cpp --- a/mapeditor.cpp Thu Dec 14 17:01:44 2006 +0000 +++ b/mapeditor.cpp Fri Dec 29 13:52:17 2006 +0000 @@ -3,7 +3,6 @@ #include #include #include -#include #include #include @@ -72,13 +71,6 @@ setScene (mapScene); - /* FIXME scrollview handles not needed in QT4? - // Maybe check QAbstractScrollArea... - // Always show scroll bars (automatic would flicker sometimes) - setVScrollBarMode ( QScrollView::AlwaysOn ); - setHScrollBarMode ( QScrollView::AlwaysOn ); - */ - mapCenter = new MapCenterObj(mapScene); mapCenter->setVisibility (true); mapCenter->setMapEditor (this); @@ -170,73 +162,6 @@ return mapScene; } -void MapEditor::adjustCanvasSize() -{ - -/* FIXME QT4 adjustcanvassize probably not needed any longer! - - // To adjust the scene to map, viewport size and position, we have to - // do some coordinate magic... - // - // Get rectangle of (scroll-)view. - // We want to be in scene coords, so - // we map. Important if view is zoomed... - QRectF view = inverseWorldMatrix().mapRect( QRectF( contentsX(), contentsY(), - visibleWidth(), visibleHeight()) ); - - // Now we need the bounding box of view AND map to calc the correct scene size. - // Why? Because if the map itself is moved out of view, the view has to be enlarged - // to avoid jumping aroung... - QRectF map=mapCenter->getTotalBBox(); - - // right edge - left edge - int cw= max(map.x() + map.width(), view.x() + view.width()) - min(map.x(), view.x()); - int ch= max(map.y() + map.height(), view.y() + view.height()) - min(map.y(), view.y()); - - - if ( (cw!=mapScene->width()) || (ch!=mapScene->height()) || - !mapScene->onCanvas (map.topLeft()) || !mapScene->onCanvas (map.bottomRight()) - ) - { - // move the map on scene (in order to not move it on screen) this is neccessary - // a) if topleft corner of scene is left or above topleft corner of view and also left of - // above topleft corner of map. E.g. if map is completly inside view, but it would be possible - // to scroll to an empty area of scene to the left. - // b) if topleft corner of map left of or above topleft of scene - int dx=0; - int dy=0; - - if (cw > mapScene->width() ) - { - if (map.x()<0) dx=-map.x(); - } - if (cw < mapScene->width() ) - dx=-min (view.x(),map.x()); - if (ch > mapScene->height() ) - { - if (map.y()<0) dy=-map.y(); - } - if (ch < mapScene->height() ) - { - dy=-min (view.y(),map.y()); - } - // We really have to resize now. Let's go... - // FIXME old code mapScene->resize (cw,ch); - mapScene->setSceneRect (QRectFF(0,0,cw,ch)); - if ( (dx!=0) || (dy!=0) ) - { - mapCenter->moveAllBy(dx,dy); - mapCenter->reposition(); -// mapCenter->positionBBox(); // To move float - - // scroll the view (in order to not move map on screen) - scrollBy (dx,dy); - } - } - - */ -} - bool MapEditor::isRepositionBlocked() { return blockReposition; @@ -1108,7 +1033,6 @@ if ( ok ) { mapCenter->reposition(); - adjustCanvasSize(); if (lmode==NewMap) { mapDefault=false; @@ -1179,6 +1103,8 @@ printer = new QPrinter; printer->setColorMode (QPrinter::Color); printer->setPrinterName (settings.value("/mainwindow/printerName",printer->printerName()).toString()); + printer->setOutputFormat((QPrinter::OutputFormat)settings.value("/mainwindow/printerFormat",printer->outputFormat()).toInt()); + printer->setOutputFileName(settings.value("/mainwindow/printerFileName",printer->outputFileName()).toString()); } QRectF totalBBox=mapCenter->getTotalBBox(); @@ -1200,6 +1126,9 @@ { QPainter pp(printer); + //pp.setRenderHints(renderHints()); + pp.setRenderHint(QPainter::Antialiasing,true); + // Don't print the visualisation of selection LinkableMapObj *oldselection=NULL; if (selection) @@ -1208,22 +1137,9 @@ selection->unselect(); } - // Handle sizes of map and paper: - // - // setWindow defines which part of the scene will be transformed - // setViewport defines area on paper in device coordinates (dpi) - // e.g. (0,50,700,700) is upper part on A4 - // see also /usr/lib/qt3/doc/html/coordsys.html - - Q3PaintDeviceMetrics metrics (printer); - - double paperAspect = (double)metrics.width() / (double)metrics.height(); - double mapAspect = (double)totalBBox.width() / (double)totalBBox.height(); - QRectF mapRect=totalBBox; QGraphicsRectItem *frame=NULL; - QGraphicsTextItem *footerFN=NULL; - QGraphicsTextItem *footerDate=NULL; + if (printFrame || printFooter) { @@ -1232,63 +1148,72 @@ // Print frame around map mapRect.setRect (totalBBox.x()-10, totalBBox.y()-10, totalBBox.width()+20, totalBBox.height()+20); - frame=mapScene->addRect (mapRect, QPen(Qt::black),QBrush(Qt::red)); + frame=mapScene->addRect (mapRect, QPen(Qt::black),QBrush(Qt::NoBrush)); frame->setZValue(0); frame->show(); } - // TODO remove after testing - //QCanvasLine *l=new QCanvasLine (mapScene); - //l->setPoints (0,0,mapRect.width(),mapRect.height()); - //l->setPen (QPen(QColor(black), 1)); - //l->setZ (200); - //l->show(); if (printFooter) { // Print footer below map QFont font; font.setPointSize(10); - footerFN=mapScene->addText ("VYM - " + fileName,font); - footerFN->setPos (mapRect.x(), mapRect.y() + mapRect.height() ); - footerFN->setZValue (Z_TEXT); - footerFN->show(); - footerDate=mapScene->addText (QDate::currentDate().toString(Qt::TextDate),font); - footerDate->setPos(mapRect.x()+mapRect.width()-footerDate->boundingRect().width(), mapRect.y() + mapRect.height() ); - footerDate->setZValue(Z_TEXT); - footerDate->show(); + pp.setFont (font); + QRectF footerBox(0,printer->height()-15,printer->width(),15); + pp.drawText ( footerBox,Qt::AlignLeft,"VYM - " +fileName); + pp.drawText ( footerBox, Qt::AlignRight, QDate::currentDate().toString(Qt::TextDate)); } - //pp.setWindow (mapRect.x(), mapRect.y(), mapRect.width(), mapRect.height()+20); - } else - { - //pp.setWindow (mapRect); - //pp.setWindow (mapRect.x(), mapRect.y(), mapRect.width(), mapRect.height()+20); - } - -/* + } + + /* + double paperAspect = (double)printer->width() / (double)printer->height(); + double mapAspect = (double)mapRect.width() / (double)mapRect.height(); + cout <<"mapAspect="<=paperAspect) { // Fit horizontally to paper width - pp.setViewport(0,0, metrics.width(),(int)(metrics.width()/mapAspect) ); + pp.setViewport(0,0, printer->width(),(int)(printer->width()/mapAspect) ); + qWarning ("Fit hor"); } else { // Fit vertically to paper height - pp.setViewport(0,0,(int)(metrics.height()*mapAspect),metrics.height()); + pp.setViewport(0,0,(int)(printer->height()*mapAspect),printer->height()); + qWarning ("Fit ver"); } -*/ - QRect viewport=rect(); - render (&pp, QRect(),QRect()); - + */ + mapScene->render ( + &pp, + //pp.viewport(), + QRectF (0,0,printer->width(),printer->height()-15), + QRectF(mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height()) + ); + + //render (&pp,printer->pageRect(), QRect ((int)mapRect.x(),(int)mapRect.y(),400,400)); + + //pp.setWindow (QRect (mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height())); //mapScene->render(&pp); // draw scene to printer -/* - // Delete Frame and footer - if (footerFN) - { - delete (footerFN); - delete (footerDate); - } -*/ -// if (frame) delete (frame); + // Viewport has paper dimension + pp.drawLine (QLine (0,0,printer->width(),printer->height())); + cout << "sceneRect: " + <sceneRect().x()<<"," + <sceneRect().y()<<"," + <sceneRect().width()<<"," + <sceneRect().height()<<","<height()<printerName()); + settings.writeEntry("/mainwindow/printerFormat",printer->outputFormat()); + settings.writeEntry("/mainwindow/printerFileName",printer->outputFileName()); } } @@ -1349,7 +1276,6 @@ hidemode=mode; mapCenter->setHideTmp (hidemode); mapCenter->reposition(); - adjustCanvasSize(); scene()->update(); } @@ -1749,7 +1675,6 @@ QString("Paste to %1").arg( getName(selection)) ); mapCenter->reposition(); - adjustCanvasSize(); } } @@ -1764,7 +1689,6 @@ copy(); cutNoSave(); mapCenter->reposition(); - adjustCanvasSize(); } void MapEditor::move(const int &x, const int &y) @@ -1779,7 +1703,6 @@ QString("Move %1 to %2").arg(getName(selection)).arg(ps)); selection->move(x,y); mapCenter->reposition(); - adjustCanvasSize(); } } @@ -1798,7 +1721,6 @@ QString("Move %1 to relativ position %2").arg(getName(selection)).arg(ps)); ((OrnamentedObj*)selection)->move2RelPos (x,y); mapCenter->reposition(); - adjustCanvasSize(); } } @@ -1869,7 +1791,6 @@ editingBO->setHeading(s ); editingBO=NULL; mapCenter->reposition(); - adjustCanvasSize(); ensureSelectionVisible(); } } @@ -1883,7 +1804,6 @@ { ((BranchObj*)selection)->setURL(s); mapCenter->reposition(); - adjustCanvasSize(); ensureSelectionVisible(); } } @@ -1896,7 +1816,6 @@ { ((BranchObj*)selection)->setHeading(s); mapCenter->reposition(); - adjustCanvasSize(); ensureSelectionVisible(); } } @@ -1910,7 +1829,6 @@ { ((BranchObj*)selection)->setVymLink(s); mapCenter->reposition(); - adjustCanvasSize(); ensureSelectionVisible(); } } @@ -1967,14 +1885,13 @@ if (newbo) { saveState( - selection, // FIXME sholdnt newbo be deleted here??? + selection, // FIXME addNewBranch (int pos) sholdnt newbo be deleted here??? "delete ()", selection, QString ("addBranch (%1)").arg(pos-2), QString ("Add new branch to %1").arg(getName(bo))); mapCenter->reposition(); - adjustCanvasSize(); } } return newbo; @@ -2007,7 +1924,6 @@ QString ("Add branch before %1").arg(getName(bo))); mapCenter->reposition(); - adjustCanvasSize(); } } return newbo; @@ -2027,7 +1943,6 @@ selection->select(); ensureSelectionVisible(); mapCenter->reposition(); - adjustCanvasSize(); } if (selection && typeid(*selection) ==typeid(FloatImageObj) ) { @@ -2046,7 +1961,6 @@ selection->select(); ensureSelectionVisible(); mapCenter->reposition(); - adjustCanvasSize(); } } @@ -2085,7 +1999,6 @@ if (selection) unselect(); selection=lmo; selection->select(); - adjustCanvasSize(); ensureSelectionVisible(); return true; } @@ -2106,8 +2019,6 @@ if (selection) selection->unselect(); selection=lmo; selection->select(); - - adjustCanvasSize(); } } @@ -2328,7 +2239,6 @@ par->unselect(); selection=bo; selection->select(); - adjustCanvasSize(); ensureSelectionVisible(); } } @@ -2343,7 +2253,6 @@ selection->unselect(); selection=par; selection->select(); - adjustCanvasSize(); ensureSelectionVisible(); } } else @@ -2356,7 +2265,6 @@ selection->unselect(); selection=bo; selection->select(); - adjustCanvasSize(); ensureSelectionVisible(); } } @@ -2400,7 +2308,6 @@ selection->unselect(); selection=par; selection->select(); - adjustCanvasSize(); ensureSelectionVisible(); } } else @@ -2413,7 +2320,6 @@ selection->unselect(); selection=bo; selection->select(); - adjustCanvasSize(); ensureSelectionVisible(); } } @@ -2440,7 +2346,6 @@ ensureSelectionVisible(); } } - adjustCanvasSize(); } } @@ -2462,7 +2367,6 @@ ensureSelectionVisible(); } } - adjustCanvasSize(); } } @@ -2481,7 +2385,7 @@ if ( fd->exec() == QDialog::Accepted ) { - // FIXME in QT4 use: lastImageDir=fd->directory(); + // TODO selectMapBackgroundImg in QT4 use: lastImageDir=fd->directory(); lastImageDir=QDir (fd->dirPath()); setMapBackgroundImage (fd->selectedFile()); } @@ -2611,7 +2515,6 @@ QString("%1 (\"%2\")").arg(r).arg(f), QString("Toggling standard flag \"%1\" of %2").arg(f).arg(getName(bo))); bo->toggleStandardFlag (f,mainWindow->useFlagGroups()); - adjustCanvasSize(); } } } @@ -2651,7 +2554,6 @@ if (selection) ((BranchObj*)selection)->unselect(); selection=itFind; selection->select(); - adjustCanvasSize(); ensureSelectionVisible(); } if (textEditor->findText(s,flags)) @@ -2666,7 +2568,6 @@ if (selection) ((BranchObj*)selection)->unselect(); selection=itFind; selection->select(); - adjustCanvasSize(); ensureSelectionVisible(); searching=false; } @@ -2679,7 +2580,6 @@ } if (!searching) { - adjustCanvasSize(); return (BranchObj*)selection; } else return NULL; @@ -2817,7 +2717,6 @@ bo->setVymLink (fd->selectedFile() ); updateActions(); mapCenter->reposition(); - adjustCanvasSize(); scene()->update(); } } @@ -2839,7 +2738,6 @@ bo->setVymLink ("" ); updateActions(); mapCenter->reposition(); - adjustCanvasSize(); scene()->update(); } } @@ -2863,7 +2761,6 @@ ); updateActions(); mapCenter->reposition(); - adjustCanvasSize(); scene()->update(); } } @@ -2925,7 +2822,6 @@ select (sel); ((BranchObj*)selection)->move2RelPos (p); mapCenter->reposition(); - adjustCanvasSize(); } } @@ -2987,7 +2883,7 @@ void MapEditor::updateActions() { mainWindow->updateActions(); - // FIXME maybe don't update if blockReposition is set + // TODO maybe don't update if blockReposition is set } void MapEditor::updateNoteFlag() @@ -3166,7 +3062,6 @@ QString ("%1 %2").arg(r).arg(getName(bo)) ); bo->toggleScroll(); - adjustCanvasSize(); scene()->update(); } } @@ -3204,7 +3099,7 @@ QString fn; if ( fd->exec() == QDialog::Accepted ) { - // FIXME in QT4 use: lastImageDir=fd->directory(); + // FIXME loadFIO in QT4 use: lastImageDir=fd->directory(); lastImageDir=QDir (fd->dirPath()); QStringList flist = fd->selectedFiles(); QStringList::Iterator it = flist.begin(); @@ -3215,7 +3110,7 @@ bo->addFloatImage(); fio=bo->getLastFloatImage(); fio->load(*it); - // FIXME check if load of fio was successful + // FIXME loadFIO check if load of fio was successful saveState( (LinkableMapObj*)fio, "delete ()", @@ -3228,7 +3123,6 @@ } mapCenter->reposition(); - adjustCanvasSize(); scene()->update(); } delete (p); @@ -3392,7 +3286,6 @@ BranchObj *bo=((BranchObj*)selection); importDirInt (bo,QDir(fd->selectedFile()) ); mapCenter->reposition(); - adjustCanvasSize(); scene()->update(); } } @@ -3436,7 +3329,7 @@ } if (dia.deleteXLink()) ((BranchObj*)selection)->deleteXLinkAt(i); - //saveStateComplete("Edit xLink"); //FIXME undoCommand + //saveStateComplete("Edit xLink"); //FIXME editXLink undoCommand } } } @@ -3502,7 +3395,7 @@ void MapEditor::updateViewCenter() { -/* FIXME still to port to QT4 inverseworldmatrix +/* FIXME updateViewCenter still to port to QT4 inverseworldmatrix // Update movingCenter, so that we can zoom comfortably later QRectF rc = QRectF( contentsX(), contentsY(), visibleWidth(), visibleHeight() ); @@ -3528,7 +3421,6 @@ if (selection) selection->unselect(); selection=lmo; selection->select(); - adjustCanvasSize(); } // Context Menu if (selection) @@ -3705,8 +3597,6 @@ { movingObj=NULL; // move Content not Obj movingObj_start=e->globalPos(); - // FIXME not ported to QT4 yet (move canvasView) - //movingCont_start=QPointF (contentsX(), contentsY() ); movingCont_start=QPointF ( horizontalScrollBar()->value(), verticalScrollBar()->value()); @@ -3841,9 +3731,6 @@ QPointF p=e->globalPos(); movingVec.setX(-p.x() + movingObj_start.x() ); movingVec.setY(-p.y() + movingObj_start.y() ); - // FIXME not ported to QT4 yet (move canvasView) - //setContentsPos( movingCont_start.x() + movingVec.x(), - //movingCont_start.y() + movingVec.y(); horizontalScrollBar()->setSliderPosition((int)( movingCont_start.x()+movingVec.x() )); verticalScrollBar()->setSliderPosition((int)( movingCont_start.y()+movingVec.y() ) ); } @@ -3913,7 +3800,6 @@ "moveRel "+pnow, QString("Move %1 to relativ position %2").arg(getName(selection)).arg(pnow)); - // FIXME Why calling parObj here? selection->getParObj()->requestReposition(); mapCenter->reposition(); } @@ -3927,8 +3813,7 @@ dst=NULL; if (typeid(*selection) == typeid(MapCenterObj) ) - { // The MapCenter was moved - cout << "FIXME missing savestate...\n"; + { // FIXME The MapCenter was moved, no savestate yet } if (typeid(*selection) == typeid(BranchObj) ) @@ -4002,7 +3887,6 @@ mapCenter->reposition(); } // Finally resize scene, if needed - adjustCanvasSize(); scene()->update(); movingObj=NULL; @@ -4033,68 +3917,25 @@ void MapEditor::resizeEvent (QResizeEvent* e) { QGraphicsView::resizeEvent( e ); - adjustCanvasSize(); } -void MapEditor::contentsDragEnterEvent(QDragEnterEvent *event) +void MapEditor::dragEnterEvent(QDragEnterEvent *event) { - //FIXME not ported to QT4 yet - -// for (unsigned int i=0;event->format(i);i++) // Debug mime type -// cerr << event->format(i) << endl; - - if (selection && - (typeid(*selection) == typeid(BranchObj)) || - (typeid(*selection) == typeid(MapCenterObj))) { - - // If QImageDrag can decode mime type - if (Q3ImageDrag::canDecode(event)) { - event->accept(); - return; - } - - // If image are dragged from firefox - if (event->provides("application/x-moz-file-promise-url") && - event->provides("application/x-moz-nativeimage")) { - event->accept(true); - return; - } - - // If QUriDrag can decode mime type - if (Q3UriDrag::canDecode(event)) { - event->accept(); - return; - } - - // If Uri are dragged from firefox - if (event->provides("_NETSCAPE_URL")){ - event->accept(); - return; - } - - // If QTextDrag can decode mime type - if (Q3TextDrag::canDecode(event)) { - event->accept(); - return; - } - - } - event->ignore(); + for (unsigned int i=0;event->format(i);i++) // Debug mime type + cerr << event->format(i) << endl; + + if (event->mimeData()->hasFormat("image/png")) + event->acceptProposedAction(); } -bool isUnicode16(const QByteArray &d) +void MapEditor::dropEvent(QDropEvent *event) { - // TODO: make more precise check for unicode 16. - // Guess unicode16 if any of second bytes are zero - unsigned int length = max(0,d.size()-2)/2; - for (unsigned int i = 0; imimeData()->hasFormat("image/png")) } - + void MapEditor::contentsDropEvent(QDropEvent *event) { - //FIXME not ported to QT4 yet + //FIXME dropEvent not ported to QT4 yet if (selection && (typeid(*selection) == typeid(BranchObj)) || (typeid(*selection) == typeid(MapCenterObj))) @@ -4170,7 +4011,7 @@ } */ - /* FIXME not ported yet QSTRINGLIST has no next... + /* not ported yet QSTRINGLIST has no next... if (uris.count()>0) { QStringList files; @@ -4209,15 +4050,71 @@ */ if (update) { - //FIXME saveState has to be called earlier for each of the drops... + //FIXME dropEvent: saveState has to be called earlier for each of the drops... //saveStateComplete("Drop Event"); //TODO undo Command mapCenter->reposition(); - adjustCanvasSize(); scene()->update(); } } } + +void MapEditor::contentsDragEnterEvent(QDragEnterEvent *event) +{ + //FIXME contentsDragEnterEvent not ported to QT4 yet + +// for (unsigned int i=0;event->format(i);i++) // Debug mime type +// cerr << event->format(i) << endl; + + if (selection && + (typeid(*selection) == typeid(BranchObj)) || + (typeid(*selection) == typeid(MapCenterObj))) { + + // If QImageDrag can decode mime type + if (Q3ImageDrag::canDecode(event)) { + event->accept(); + return; + } + + // If image are dragged from firefox + if (event->provides("application/x-moz-file-promise-url") && + event->provides("application/x-moz-nativeimage")) { + event->accept(true); + return; + } + + // If QUriDrag can decode mime type + if (Q3UriDrag::canDecode(event)) { + event->accept(); + return; + } + + // If Uri are dragged from firefox + if (event->provides("_NETSCAPE_URL")){ + event->accept(); + return; + } + + // If QTextDrag can decode mime type + if (Q3TextDrag::canDecode(event)) { + event->accept(); + return; + } + + } + event->ignore(); +} + +bool isUnicode16(const QByteArray &d) +{ + // TODO: make more precise check for unicode 16. + // Guess unicode16 if any of second bytes are zero + unsigned int length = max(0,d.size()-2)/2; + for (unsigned int i = 0; iload(img); fio->setOriginalFilename("Image added by Drag and Drop"); mapCenter->reposition(); - adjustCanvasSize(); scene()->update(); } } - -void MapEditor::imageDataFetched(const QByteArray &a, Q3NetworkOperation */*nop*/) +/* + +void MapEditor::imageDataFetched(const QByteArray &a, Q3NetworkOperation * / *nop* /) { if (!imageBuffer) imageBuffer = new QBuffer(); if (!imageBuffer->isOpen()) { @@ -4281,3 +4178,5 @@ this, SLOT(imageDataFetched(const QByteArray &, Q3NetworkOperation *))); urlOperator->get(); } +*/ + diff -r 910ba9fab728 -r 8059b6aa74d7 mapeditor.h --- a/mapeditor.h Thu Dec 14 17:01:44 2006 +0000 +++ b/mapeditor.h Fri Dec 29 13:52:17 2006 +0000 @@ -21,7 +21,6 @@ ~MapEditor(); MapCenterObj* getMapCenter(); QGraphicsScene * getScene(); - void adjustCanvasSize();// adjust canvas size to map and scrollview bool isRepositionBlocked(); // block while load or undo private: @@ -38,10 +37,12 @@ private: void addFloatImageInt(const QPixmap &img); +/* private slots: void fetchImage(const QString &img); void imageDataFetched(const QByteArray &, Q3NetworkOperation *); void imageDataFinished(Q3NetworkOperation *); + */ public: bool isDefault(); // false, if map was changed once @@ -193,6 +194,9 @@ virtual void mouseDoubleClickEvent(QMouseEvent*); virtual void mouseMoveEvent(QMouseEvent*); + virtual void dragEnterEvent (QDragEnterEvent *); + virtual void dropEvent (QDropEvent *); + virtual void contentsDragEnterEvent(QDragEnterEvent *event); virtual void contentsDropEvent(QDropEvent *event); private: diff -r 910ba9fab728 -r 8059b6aa74d7 mapobj.cpp --- a/mapobj.cpp Thu Dec 14 17:01:44 2006 +0000 +++ b/mapobj.cpp Fri Dec 29 13:52:17 2006 +0000 @@ -104,13 +104,6 @@ bool MapObj::inBox(const QPointF &p) { -/* FIXME testing QT4 only - cout << "MO::inBox "<= clickBox.left() && p.x() <= clickBox.right() && p.y() <= clickBox.bottom() && p.y() >= clickBox.top() ) return true; diff -r 910ba9fab728 -r 8059b6aa74d7 xml.cpp --- a/xml.cpp Thu Dec 14 17:01:44 2006 +0000 +++ b/xml.cpp Fri Dec 29 13:52:17 2006 +0000 @@ -2,7 +2,6 @@ #include #include -// #include #include #include @@ -528,21 +527,6 @@ } file.close(); - /* TODO very likely not needed any longer - // Convert to richtext - if ( !Q3StyleSheet::mightBeRichText( lines ) ) - { - // Here we are workarounding the QT conversion method: - // convertFromPlainText does not generate valid xml, needed - // for the parser, but just

and
without closing tags. - // So we have to add those by ourselves - //lines=quotemeta (lines); - qWarning ("xml.cpp: Still using Q3StyleSheet::mightBeRichText"); - lines = Q3StyleSheet::convertFromPlainText( lines, Q3StyleSheetItem::WhiteSpaceNormal ); - lines.replace ("
","
"); - } - */ - lines =""+lines + "

"; no.setNote (lines); }