# HG changeset patch
# User insilmaril
# Date 1164298706 0
# Node ID 5db8dfd30ea25ce1f119e2a4239c061425973b06
# Parent  1c8ff1928b97d52939edd8573d2761c6dd258c18
Removed even more QT3 stuff. Drag & Drop not 100% functional at the moment

diff -r 1c8ff1928b97 -r 5db8dfd30ea2 mainwindow.cpp
--- a/mainwindow.cpp	Thu Nov 23 13:53:08 2006 +0000
+++ b/mainwindow.cpp	Thu Nov 23 16:18:26 2006 +0000
@@ -940,7 +940,7 @@
     a = new QAction(QPixmap(iconPath+"history.png"),  tr( "Show history window","View action" ),this );
 	a->setStatusTip ( tr( "Show history window" ));
 	a->setShortcut ( Qt::CTRL + Qt::Key_H  );
-	a->setToggleAction(false);
+	a->setToggleAction(true);
     a->addTo( tb );
 	viewMenu->addAction (a);
     connect( a, SIGNAL( triggered() ), this, SLOT(windowToggleHistory() ) );
@@ -1614,7 +1614,7 @@
 	currentMapEditor()->reselect();
 
 	// Update actions to in menus and toolbars according to editor
-	currentMapEditor()->updateActions();
+	updateActions();
 }
 
 void Main::fileNew()
@@ -3158,6 +3158,8 @@
 	MapEditor *me=currentMapEditor();
 	if (!me) return;
 
+	historyWindow->setCaption (tr("History for %1").arg(currentMapEditor()->getFileName()));
+
 	// updateActions is also called when NoteEditor is closed
 	actionViewToggleNoteEditor->setOn (textEditor->showWithMain());
 
diff -r 1c8ff1928b97 -r 5db8dfd30ea2 mapeditor.cpp
--- a/mapeditor.cpp	Thu Nov 23 13:53:08 2006 +0000
+++ b/mapeditor.cpp	Thu Nov 23 16:18:26 2006 +0000
@@ -1,7 +1,5 @@
 #include "mapeditor.h"
 
-//#include <q3urloperator.h>
-#include <q3paintdevicemetrics.h>
 #include <q3filedialog.h>
 
 #include <iostream>
@@ -498,8 +496,8 @@
 	if (saveSel) cout << "    saveSel="<<saveSel->getSelectString().ascii()<<endl;
 	cout << "    ---------------------------"<<endl;
 
+	setChanged();
 	mainWindow->updateHistory (undoSet);
-	setChanged();
 	updateActions();
 }
 
@@ -1208,9 +1206,7 @@
 		// 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 paperAspect = (double)printer->width()   / (double)printer->height();
 		double   mapAspect = (double)totalBBox.width() / (double)totalBBox.height();
 
 		QRect mapRect=totalBBox;
@@ -1266,11 +1262,11 @@
 		if (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) );	
 		}	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());	
 		}	
 
 		mapCanvas->drawArea(mapRect, &pp);	// draw Canvas to printer
@@ -1509,8 +1505,8 @@
 	undoSet.setEntry ("/history/curStep",QString::number(curStep));
 	undoSet.writeSettings(histPath);
 
+	updateActions();
 	mainWindow->updateHistory (undoSet);
-	updateActions();
 
 	/* TODO remove testing
 	cout << "ME::redo() end\n";
@@ -4081,7 +4077,7 @@
 			// Contains url to the img src in unicode16
 			QByteArray d = event->encodedData("application/x-moz-file-promise-url");
 			QString url = QString((const QChar*)d.data(),d.size()/2);
-			fetchImage(url);
+			//FIXME fetchImage(url);
             event->acceptProposedAction();
 			update=true;
 		} else if (event->mimeData()->hasUrls())
@@ -4195,7 +4191,8 @@
 }
 
 
-void MapEditor::imageDataFetched(const QByteArray &a, Q3NetworkOperation */*nop*/) 
+//void MapEditor::imageDataFetched(const QByteArray &a, Q3NetworkOperation */*nop*/) 
+/* FIXME not needed in QT4
 {
   if (!imageBuffer) imageBuffer = new QBuffer();
   if (!imageBuffer->isOpen()) {
@@ -4238,3 +4235,5 @@
 	  this, SLOT(imageDataFetched(const QByteArray &, Q3NetworkOperation *)));
   urlOperator->get();
 }
+
+*/
diff -r 1c8ff1928b97 -r 5db8dfd30ea2 mapeditor.h
--- a/mapeditor.h	Thu Nov 23 13:53:08 2006 +0000
+++ b/mapeditor.h	Thu Nov 23 16:18:26 2006 +0000
@@ -10,8 +10,6 @@
 #include "selection.h"
 #include "settings.h"
 
-class Q3NetworkOperation;
-class Q3UrlOperator;
 
 class MapEditor : public Q3CanvasView , public xmlObj {
     Q_OBJECT
@@ -39,9 +37,9 @@
     void addFloatImageInt(const QPixmap &img);
 
   private slots:
-    void fetchImage(const QString &img);
-    void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
-    void imageDataFinished(Q3NetworkOperation *);
+//FIXME not needed QT4    void fetchImage(const QString &img);
+//FIXME not needed QT4    void imageDataFetched(const QByteArray &, Q3NetworkOperation *);
+//FIXME not needed QT4    void imageDataFinished(Q3NetworkOperation *);
 
 public:
 	void toggleHistoryWindow();
diff -r 1c8ff1928b97 -r 5db8dfd30ea2 xml.cpp
--- a/xml.cpp	Thu Nov 23 13:53:08 2006 +0000
+++ b/xml.cpp	Thu Nov 23 16:18:26 2006 +0000
@@ -1,8 +1,8 @@
 #include "xml.h"
 
-#include <qmessagebox.h>
-#include <qcolor.h>
-#include <q3stylesheet.h>
+#include <QMessageBox>
+#include <QColor>
+// #include <q3stylesheet.h>
 #include <QTextStream>
 #include <iostream>
 
@@ -527,6 +527,8 @@
 			lines += stream.readLine()+"\n"; 
 		}
 		file.close();
+
+		/* TODO very likely not needed any longer
 		// Convert to richtext
 		if ( !Q3StyleSheet::mightBeRichText( lines ) )
 		{
@@ -535,9 +537,11 @@
 			// for the parser, but just <p> and <br> 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 ("<br>","<br />");
 		}	
+		*/
 
 		lines ="<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>"+lines + "</p></body></html>";
 		no.setNote (lines);
diff -r 1c8ff1928b97 -r 5db8dfd30ea2 xml.h
--- a/xml.h	Thu Nov 23 13:53:08 2006 +0000
+++ b/xml.h	Thu Nov 23 16:18:26 2006 +0000
@@ -1,9 +1,9 @@
-#ifndef XLM_H
-#define XLM_H
+#ifndef XML_H
+#define XML_H
 
 
-#include <qstring.h>
-#include <qxml.h>
+#include <QString>
+#include <QXmlAttributes>
 
 #include "file.h"
 #include "mapcenterobj.h"