# HG changeset patch
# User insilmaril
# Date 1143576244 0
# Node ID 7d91b35c1b6fff006ff540db6668648b44acf8d3
# Parent  96b8406d4a2f2ae3992dedb5d11f0e42e6d62cdd
1.7.13 Tabs in Konqueror

diff -r 96b8406d4a2f -r 7d91b35c1b6f lang/vym_de.ts
--- a/lang/vym_de.ts	Mon Mar 27 20:21:58 2006 +0000
+++ b/lang/vym_de.ts	Tue Mar 28 20:04:04 2006 +0000
@@ -718,7 +718,7 @@
     </message>
     <message>
         <source>Set application to open an URL</source>
-        <translation type="obsolete">URLs öffnen mit...</translation>
+        <translation>URLs öffnen mit...</translation>
     </message>
     <message>
         <source>Edit branch after adding it</source>
@@ -875,11 +875,11 @@
     </message>
     <message>
         <source>Enter path for pdf reader:</source>
-        <translation>Pfad für pdf-Anwendung:</translation>
+        <translation type="obsolete">Pfad für pdf-Anwendung:</translation>
     </message>
     <message>
         <source>Enter path for application to open an URL:</source>
-        <translation>Pfad zum Öffnen von URLs:</translation>
+        <translation type="obsolete">Pfad zum Öffnen von URLs:</translation>
     </message>
     <message>
         <source>Save &amp;As</source>
@@ -954,7 +954,7 @@
     <message>
         <source>Couldn&apos;t find a viewer to read vym.pdf.
 Please use Settings-&gt;</source>
-        <translation>Konnte kein Programm zum Anzeigen von vym.pdf
+        <translation type="obsolete">Konnte kein Programm zum Anzeigen von vym.pdf
 finden. Bitte benutzen Sie Einstellungen-&gt;</translation>
     </message>
     <message>
@@ -1552,6 +1552,31 @@
         <source>Use hide flags</source>
         <translation>Während des Exports das &quot;Verbergen&quot; Flag verwenden </translation>
     </message>
+    <message>
+        <source>Open URL in new tab</source>
+        <translation>URL in neuen Tab öffnen</translation>
+    </message>
+    <message>
+        <source>Warning</source>
+        <translation>Warnung</translation>
+    </message>
+    <message>
+        <source>Couldn&apos;t find a viewer to open %1.
+</source>
+        <translation>Konnte kein Programm zum Öffnen von %1 finden.</translation>
+    </message>
+    <message>
+        <source>Please use Settings-&gt;</source>
+        <translation>Bitte setzen sie einen Pfad in Einstellungen-&gt;</translation>
+    </message>
+    <message>
+        <source>Couldn&apos;t start %1 to open a new tab in %2.</source>
+        <translation>Konnte %1 nicht starten um einen neuen Tab mit %2 zu öffnen.</translation>
+    </message>
+    <message>
+        <source>Set application to open PDF files</source>
+        <translation>PDFs öffnen mit</translation>
+    </message>
 </context>
 <context>
     <name>MapEditor</name>
diff -r 96b8406d4a2f -r 7d91b35c1b6f lang/vym_en.ts
--- a/lang/vym_en.ts	Mon Mar 27 20:21:58 2006 +0000
+++ b/lang/vym_en.ts	Tue Mar 28 20:04:04 2006 +0000
@@ -806,14 +806,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Enter path for pdf reader:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
-        <source>Enter path for application to open an URL:</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Critcal error</source>
         <translation type="unfinished"></translation>
     </message>
@@ -823,11 +815,6 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <source>Couldn&apos;t find a viewer to read vym.pdf.
-Please use Settings-&gt;</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <source>Add a branch by inserting and making selection its child</source>
         <translation type="unfinished"></translation>
     </message>
@@ -1192,6 +1179,35 @@
         <source>Use hide flags</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Open URL in new tab</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Warning</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Couldn&apos;t find a viewer to open %1.
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Please use Settings-&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set application to open an URL</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Couldn&apos;t start %1 to open a new tab in %2.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set application to open PDF files</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>MapEditor</name>
diff -r 96b8406d4a2f -r 7d91b35c1b6f lang/vym_es.ts
--- a/lang/vym_es.ts	Mon Mar 27 20:21:58 2006 +0000
+++ b/lang/vym_es.ts	Tue Mar 28 20:04:04 2006 +0000
@@ -746,7 +746,7 @@
     </message>
     <message>
         <source>Set application to open an URL</source>
-        <translation type="obsolete">Configurar aplicación para abrir una URL</translation>
+        <translation type="unfinished">Configurar aplicación para abrir una URL</translation>
     </message>
     <message>
         <source>Edit branch after adding it</source>
@@ -1017,11 +1017,11 @@
     </message>
     <message>
         <source>Enter path for pdf reader:</source>
-        <translation>Ingrese ruta para lector de pdf:</translation>
+        <translation type="obsolete">Ingrese ruta para lector de pdf:</translation>
     </message>
     <message>
         <source>Enter path for application to open an URL:</source>
-        <translation>Ingrese la ruta para aplicación para abrir una URL:</translation>
+        <translation type="obsolete">Ingrese la ruta para aplicación para abrir una URL:</translation>
     </message>
     <message>
         <source>Critcal error</source>
@@ -1036,7 +1036,7 @@
     <message>
         <source>Couldn&apos;t find a viewer to read vym.pdf.
 Please use Settings-&gt;</source>
-        <translation>No puede buscar un visor para leer vym.pdf.
+        <translation type="obsolete">No puede buscar un visor para leer vym.pdf.
 Por favor use Configuración-&gt;</translation>
     </message>
     <message>
@@ -1410,6 +1410,31 @@
         <source>Use hide flags</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Open URL in new tab</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Warning</source>
+        <translation type="unfinished">Advertencia</translation>
+    </message>
+    <message>
+        <source>Couldn&apos;t find a viewer to open %1.
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Please use Settings-&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Couldn&apos;t start %1 to open a new tab in %2.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set application to open PDF files</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>MapEditor</name>
diff -r 96b8406d4a2f -r 7d91b35c1b6f lang/vym_it.ts
--- a/lang/vym_it.ts	Mon Mar 27 20:21:58 2006 +0000
+++ b/lang/vym_it.ts	Tue Mar 28 20:04:04 2006 +0000
@@ -748,7 +748,7 @@
     </message>
     <message>
         <source>Set application to open an URL</source>
-        <translation type="obsolete">Scegli l&apos;applicazione per aprire gli URL</translation>
+        <translation type="unfinished">Scegli l&apos;applicazione per aprire gli URL</translation>
     </message>
     <message>
         <source>Edit branch after adding it</source>
@@ -1024,11 +1024,11 @@
     </message>
     <message>
         <source>Enter path for pdf reader:</source>
-        <translation>Seleziona il percorso del lettore pdf:</translation>
+        <translation type="obsolete">Seleziona il percorso del lettore pdf:</translation>
     </message>
     <message>
         <source>Enter path for application to open an URL:</source>
-        <translation>Seleziona il percorso dell&apos;aplicazione per aprire gli URL:</translation>
+        <translation type="obsolete">Seleziona il percorso dell&apos;aplicazione per aprire gli URL:</translation>
     </message>
     <message>
         <source>Critcal error</source>
@@ -1043,7 +1043,7 @@
     <message>
         <source>Couldn&apos;t find a viewer to read vym.pdf.
 Please use Settings-&gt;</source>
-        <translation>Non è possibile trovare un lettore per il file vym.pdf
+        <translation type="obsolete">Non è possibile trovare un lettore per il file vym.pdf
 Per favore usare Preferenze-&gt;</translation>
     </message>
     <message>
@@ -1419,6 +1419,31 @@
         <source>Couldn&apos;t open map %1</source>
         <translation type="unfinished"></translation>
     </message>
+    <message>
+        <source>Open URL in new tab</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Warning</source>
+        <translation type="unfinished">Attenzione</translation>
+    </message>
+    <message>
+        <source>Couldn&apos;t find a viewer to open %1.
+</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Please use Settings-&gt;</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Couldn&apos;t start %1 to open a new tab in %2.</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <source>Set application to open PDF files</source>
+        <translation type="unfinished"></translation>
+    </message>
 </context>
 <context>
     <name>MapEditor</name>
diff -r 96b8406d4a2f -r 7d91b35c1b6f main.cpp
--- a/main.cpp	Mon Mar 27 20:21:58 2006 +0000
+++ b/main.cpp	Tue Mar 28 20:04:04 2006 +0000
@@ -45,6 +45,7 @@
 QAction *actionEditMoveDown;
 QAction *actionEditToggleScroll;
 QAction *actionEditOpenURL;
+QAction *actionEditOpenURLTab;
 QAction *actionEditURL;
 QAction *actionEditHeading2URL;
 QAction *actionEditBugzilla2URL;
diff -r 96b8406d4a2f -r 7d91b35c1b6f mainwindow.cpp
--- a/mainwindow.cpp	Mon Mar 27 20:21:58 2006 +0000
+++ b/mainwindow.cpp	Tue Mar 28 20:04:04 2006 +0000
@@ -101,6 +101,7 @@
 extern QAction *actionEditMoveDown;
 extern QAction *actionEditToggleScroll;
 extern QAction* actionEditOpenURL;
+extern QAction* actionEditOpenURLTab;
 extern QAction* actionEditURL;
 extern QAction* actionEditHeading2URL;
 extern QAction* actionEditBugzilla2URL;
@@ -207,6 +208,8 @@
 	makeSubDirs (clipboardDir);
 	clipboardEmpty=true;
 
+	procBrowser=NULL;
+
 	// FIXME not used currently
 	// Set random seed (random used for object IDs)
     // QTime t = QTime::currentTime();		// set random seed
@@ -519,6 +522,11 @@
 	a->setEnabled (false);
 	actionEditOpenURL=a;
 
+	a = new QAction( tr( "Open URL in new tab" ), QPixmap(), tr( "Open URL in new tab" ), ALT + Key_U, this, "urltab" );
+    connect( a, SIGNAL( activated() ), this, SLOT( editOpenURLTab() ) );
+	a->setEnabled (false);
+	actionEditOpenURLTab=a;
+
 	a = new QAction( tr( "Edit URL" ), QPixmap(), tr( "Edit URL"+QString("...") ), SHIFT + CTRL + Key_U, this, "url" );
     connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) );
 	a->setEnabled (false);
@@ -1134,6 +1142,7 @@
 
 	branchContextMenu->insertSeparator();	
 	actionEditOpenURL->addTo ( branchContextMenu );
+	actionEditOpenURLTab->addTo ( branchContextMenu );
 	actionEditURL->addTo ( branchContextMenu );
 	actionEditHeading2URL->addTo ( branchContextMenu );
     if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
@@ -2177,8 +2186,53 @@
 
 void Main::editOpenURL()
 {
+	// Open new browser
 	if (currentMapEditor())
-	    currentMapEditor()->openURL();
+	{	
+	    QString url=currentMapEditor()->getURL();
+		if (url=="") return;
+		QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
+		procBrowser = new QProcess( this );
+
+		procBrowser->addArgument( browser);
+		procBrowser->addArgument( url);
+
+		if ( !procBrowser->start() ) 
+		{
+			// try to set path to browser
+			QMessageBox::warning(0, 
+				tr("Warning"),
+				tr("Couldn't find a viewer to open %1.\n").arg(url)+
+				tr("Please use Settings->")+tr("Set application to open an URL"));
+			settingsURL() ; 
+		}	
+	}	
+}
+void Main::editOpenURLTab()
+{
+	if (currentMapEditor())
+	{	
+	    QString url=currentMapEditor()->getURL();
+		if (url=="") return;
+		QString browser=settings.readEntry("/vym/mainwindow/readerURL" );
+		if (browser.contains("konqueror") && procBrowser && procBrowser->isRunning())
+		{
+			// Try to open new tab in existing browser
+			QProcess *p=new QProcess (this);
+			p->addArgument ("dcop");
+			p->addArgument (QString("konqueror-%1").arg(procBrowser->processIdentifier()));
+			p->addArgument ("konqueror-mainwindow#1");
+			p->addArgument ("newTab");
+			p->addArgument (url);
+			if ( !p->start() ) 
+				// try to set browser
+				QMessageBox::warning(0, 
+					tr("Warning"),
+					tr("Couldn't start %1 to open a new tab in %2.").arg("dcop").arg("konqueror"));
+		} else
+			// Open new browser
+			editOpenURL();
+	}	
 }
 
 void Main::editURL()
@@ -2573,7 +2627,7 @@
 	// Default browser is set in constructor
 	bool ok;
 	QString text = QInputDialog::getText(
-		"VYM", tr("Enter path for pdf reader:"), QLineEdit::Normal,
+		"VYM", tr("Set application to open PDF files")+":", QLineEdit::Normal,
 		settings.readEntry("/vym/mainwindow/readerPDF"), &ok, this );
 	if (ok)
 		settings.writeEntry ("/vym/mainwindow/readerPDF",text);
@@ -2586,7 +2640,7 @@
 	// Default browser is set in constructor
 	bool ok;
 	QString text = QInputDialog::getText(
-		"VYM", tr("Enter path for application to open an URL:"), QLineEdit::Normal,
+		"VYM", tr("Set application to open an URL")+":", QLineEdit::Normal,
 		settings.readEntry("/vym/mainwindow/readerURL")
 		, &ok, this );
 	if (ok)
@@ -2686,10 +2740,11 @@
 	if ( !pdfProc->start() ) 
 	{
 		// error handling
-		QMessageBox::critical(0, 
-		tr("Critcal error"),
-		tr("Couldn't find a viewer to read vym.pdf.\n"
-		"Please use Settings->")+tr("Set application to open pdf files"));
+		QMessageBox::warning(0, 
+			tr("Warning"),
+			tr("Couldn't find a viewer to open %1.\n").arg("vym.pdf")+
+			tr("Please use Settings->")+tr("Set application to open PDF files"));
+		settingsPDF();	
 		return;
 	}
 }
diff -r 96b8406d4a2f -r 7d91b35c1b6f mainwindow.h
--- a/mainwindow.h	Mon Mar 27 20:21:58 2006 +0000
+++ b/mainwindow.h	Tue Mar 28 20:04:04 2006 +0000
@@ -91,6 +91,7 @@
 	void editFindChanged();
 public slots:
 	void editOpenURL();
+	void editOpenURLTab();
 private slots:
 	void editURL();
 	void editHeading2URL();
@@ -176,12 +177,13 @@
     void helpAboutQT();
 
 private:
-    QCanvas* canvas;
+// not needed?    QCanvas* canvas;
 	QTabWidget *tabWidget;
 	FindWindow *findWindow;
 	QStringList lastMaps;
 	int maxLastMaps;
 	QString lastFileDir;
+	QProcess *procBrowser;
 };
 
 
diff -r 96b8406d4a2f -r 7d91b35c1b6f mapeditor.cpp
--- a/mapeditor.cpp	Mon Mar 27 20:21:58 2006 +0000
+++ b/mapeditor.cpp	Tue Mar 28 20:04:04 2006 +0000
@@ -59,6 +59,7 @@
 extern QAction *actionEditMoveDown;
 extern QAction *actionEditToggleScroll;
 extern QAction *actionEditOpenURL;
+extern QAction *actionEditOpenURLTab;
 extern QAction *actionEditURL;
 extern QAction *actionEditHeading2URL;
 extern QAction *actionEditBugzilla2URL;
@@ -2211,28 +2212,6 @@
 	EOFind=false;
 }
 
-void MapEditor::openURL()
-{
-	if (selection )
-	{
-		if (typeid(*selection) == typeid(BranchObj) ||
-			typeid(*selection) == typeid(MapCenterObj))
-		{
-			QString url=((BranchObj*)selection)->getURL();
-
-			QProcess *proc = new QProcess( this );
-
-			proc->addArgument( settings.readEntry("/vym/mainwindow/readerURL" ));
-			proc->addArgument( url);
-
-			if ( !proc->start() ) 
-				// error handling
-				if (mainWindow->settingsURL() ) 
-					openURL();
-		}	
-	}	
-}
-
 void MapEditor::editURL()
 {
 	if (selection && (typeid(*selection) == typeid(BranchObj) ||
@@ -2253,6 +2232,15 @@
 	}
 }
 
+QString MapEditor::getURL()
+{
+	if (selection && (typeid(*selection) == typeid(BranchObj) ||
+			typeid(*selection) == typeid(MapCenterObj)) )
+		return ((BranchObj*)selection)->getURL();
+	else
+		return "";
+}
+
 void MapEditor::editHeading2URL()
 {
 	if (selection && (typeid(*selection) == typeid(BranchObj) ||
@@ -2531,10 +2519,15 @@
 				actionEditToggleScroll->setOn(false);
 
 			if ( bo->getURL().isEmpty() )
+			{
 				actionEditOpenURL->setEnabled (false);
+				actionEditOpenURLTab->setEnabled (false);
+			}	
 			else	
+			{
 				actionEditOpenURL->setEnabled (true);
-
+				actionEditOpenURLTab->setEnabled (true);
+			}
 			if ( bo->getVymLink().isEmpty() )
 			{
 				actionEditOpenVymLink->setEnabled (false);
@@ -3172,7 +3165,12 @@
 			{
 				// Do not move, if systemFlag clicked
 				if (foname=="url") 
-					openURL();
+				{
+					if (e->state() & QMouseEvent::ControlButton)
+						mainWindow->editOpenURLTab();
+					else	
+						mainWindow->editOpenURL();
+				}	
 				else if (foname=="vymLink")
 				{
 					mainWindow->editOpenVymLink();
diff -r 96b8406d4a2f -r 7d91b35c1b6f mapeditor.h
--- a/mapeditor.h	Mon Mar 27 20:21:58 2006 +0000
+++ b/mapeditor.h	Tue Mar 28 20:04:04 2006 +0000
@@ -122,8 +122,8 @@
 	virtual void setViewCenter();			// needed for zooming
     BranchObj* findText(QString,bool);		// Find object
     void findReset();						// Reset Find 
-	void openURL();							// open URL in external browser
 	void editURL();							// edit the URL
+	QString getURL();						// returns URL of selection or ""
 	void editHeading2URL();					// copy heading to URL
 	void editBugzilla2URL();				// create URL to Bugzilla
 	void editFATE2URL();					// create URL to FATE
diff -r 96b8406d4a2f -r 7d91b35c1b6f tex/vym.changelog
--- a/tex/vym.changelog	Mon Mar 27 20:21:58 2006 +0000
+++ b/tex/vym.changelog	Tue Mar 28 20:04:04 2006 +0000
@@ -1,3 +1,9 @@
+-------------------------------------------------------------------
+Tue Mar 28 21:54:31 CEST 2006 - uwe
+
+- Version 1.7.13
+- Feature: Konqueror can open URLs in new tabs now.
+
 -------------------------------------------------------------------
 Thu Mar 23 13:26:46 CET 2006 - uwedr
 
diff -r 96b8406d4a2f -r 7d91b35c1b6f tex/vym.tex
--- a/tex/vym.tex	Mon Mar 27 20:21:58 2006 +0000
+++ b/tex/vym.tex	Tue Mar 28 20:04:04 2006 +0000
@@ -508,6 +508,10 @@
 \begin{center}
 	\includegraphics[width=0.5cm]{flag-url.png}
 \end{center}
+If you use konqueror as browser, \vym will remember the konqueror which
+was opened first by \vym. You can also press \key{Alt} and click to
+open the link in a new tab then.
+
 If you want to keep bookmarks in a map, select a branch where you want
 to add the bookmark, then simply drag the URL from your browser to the
 map. Also you could use an existing heading as URL: Right click onto the
@@ -847,7 +851,7 @@
 \subsubsection*{Create a xLink}
 Choose the link mode from the modifier toolbar (by clicking or pressing
 \key{L}). Select the branch, where the xLink should start. Press the
-modifier key \key{Ctr} and simultanously click on the branch where the
+modifier key \key{Ctrl} and simultanously click on the branch where the
 link should end. (The link is already drawn before you release the mouse
 key). If you release the mouse over a branch the xLink becomes
 permanent.
diff -r 96b8406d4a2f -r 7d91b35c1b6f version.h
--- a/version.h	Mon Mar 27 20:21:58 2006 +0000
+++ b/version.h	Tue Mar 28 20:04:04 2006 +0000
@@ -2,7 +2,7 @@
 #define VERSION_H
 
 #define __VYM "VYM"
-#define __VYM_VERSION "1.7.12"
-#define __BUILD_DATE "March 27, 2006"
+#define __VYM_VERSION "1.7.13"
+#define __BUILD_DATE "March 28, 2006"
 
 #endif