diff --git a/Makefile.am b/Makefile.am
index ceb6902fa..8e3b5ad66 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,9 +3,14 @@ INCLUDES= -I$(top_srcdir)/kviewshell $(all_includes) $(LIBFREETYPE_CFLAGS)
# claim, which subdirectories you want to install
SUBDIRS = . pix
+bin_PROGRAMS = kdvi
+
# you can add here more. This one gets installed
kde_module_LTLIBRARIES= kdvipart.la
noinst_PROGRAMS = squeeze
+noinst_LTLIBRARIES = ../kviewshell/libifaces.la
+
+libifaces_la_SOURCES = ../kviewshell/kviewpart_iface.cpp
# just to make sure, automake makes them
METASOURCES = AUTO
@@ -33,6 +38,10 @@ squeeze_SOURCES = squeeze.c
KDE_OPTIONS = nofinal
+kdvi_SOURCES = main.cpp ../kviewshell/kviewshell.cpp
+kdvi_LDFLAGS = $(all_libraries) $(KDE_RPATH)
+kdvi_LDADD = ../kviewshell/libifaces.la -lkparts
+
## this option you can leave out. Just, if you use "make dist", you need it
noinst_HEADERS = dvi.h dviwin.h xdvi.h
@@ -46,10 +55,8 @@ xdg_apps_DATA = kdvi.desktop
tip_DATA = tips
tipdir = $(kde_datadir)/kdvi
-bin_SCRIPTS = kdvi
-
partdir = $(kde_datadir)/kdvi
-part_DATA = kdvi_part.rc
+part_DATA = ../kviewshell/kviewshell.rc kdvi_part.rc
psheader.c: psheader.txt squeeze
./squeeze $(srcdir)/psheader.txt $@
diff --git a/kdvi b/kdvi
deleted file mode 100755
index 5ad0e0ce7..000000000
--- a/kdvi
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-kviewshell dvi "$@"
diff --git a/kdvi.desktop b/kdvi.desktop
index c2b732c41..902f91b88 100644
--- a/kdvi.desktop
+++ b/kdvi.desktop
@@ -16,7 +16,6 @@ GenericName[el]=Προβολέας DVI
GenericName[eo]=DVI-rigardilo
GenericName[es]=Visor de documentos DVI
GenericName[et]=DVI failide vaataja
-GenericName[fa]=نمایشگر دیویآی
GenericName[fi]=DVI-katsoja
GenericName[fr]=Afficheur DVI
GenericName[gl]=Visor de DVI
@@ -29,7 +28,6 @@ GenericName[is]=DVI sjá
GenericName[it]=Visore DVI
GenericName[ja]=DVIビューア
GenericName[ko]=DVI 보기
-GenericName[lo]=ຕົວສະແດງຜົນ DVI
GenericName[lt]=DVI Žiūriklis
GenericName[lv]=DVI Skatītājs
GenericName[mk]=Прикажувач на DVI
@@ -37,7 +35,7 @@ GenericName[mt]=Werrej DVI
GenericName[nb]=DVI-fremviser
GenericName[nl]=DVI-weergaveprogramma
GenericName[nn]=DVI-lesar
-GenericName[oc]=Visualisor DVI
+GenericName[pa]=DVI ਦਰਸ਼ਕ
GenericName[pl]=Przeglądarka plików DVI
GenericName[pt]=Visualizador de DVIs
GenericName[pt_BR]=Visualizador de DVI
@@ -48,7 +46,6 @@ GenericName[sk]=Prehliadač DVI súborov
GenericName[sl]=Pregledovalnik datotek DVI
GenericName[sr]=DVI приказивач
GenericName[sr@Latn]=DVI prikazivač
-GenericName[ss]=Sibuki se DVI
GenericName[sv]=DVI-visare
GenericName[ta]=DVI காட்சி
GenericName[tg]=Намоиши файли DVI
@@ -71,7 +68,7 @@ Name[hi]=के-डीवीआई
Name[xx]=xxKDVIxx
MimeType=application/x-dvi;application/x-gzdvi;application/x-bz2dvi;
InitialPreference=6
-Exec=kviewshell dvi %f -caption "%c" %i %m
+Exec=kdvi %f -caption "%c" %i %m
Icon=kdvi
Path=
Type=Application
diff --git a/kdvi_multipage.cpp b/kdvi_multipage.cpp
index e5343b055..b93a66628 100644
--- a/kdvi_multipage.cpp
+++ b/kdvi_multipage.cpp
@@ -129,9 +129,6 @@ KDVIMultiPage::KDVIMultiPage(QWidget *parentWidget, const char *widgetName, QObj
exportTextAction = new KAction(i18n("Text..."), 0, this, SLOT(doExportText()), actionCollection(), "export_text");
KStdAction::tipOfDay(this, SLOT(showTip()), actionCollection(), "help_tipofday");
- new KAction(i18n("About KDVI"), 0, this, SLOT(about()), actionCollection(), "about_kdvi");
- new KAction(i18n("KDVI Handbook"), 0, this, SLOT(helpme()), actionCollection(), "help_dvi");
- new KAction(i18n("Report Bug in KDVI..."), 0, this, SLOT(bugform()), actionCollection(), "bug_dvi");
setXMLFile("kdvi_part.rc");
@@ -386,64 +383,6 @@ void KDVIMultiPage::addConfigDialogs(KConfigDialog* configDialog)
}
-void KDVIMultiPage::about()
-{
- KAboutDialog *ab = new KAboutDialog(KAboutDialog::AbtAppStandard,
- i18n("the KDVI plugin"),
- KAboutDialog::Close, KAboutDialog::Close);
-
- ab->setProduct("kdvi", "1.2", QString::null, QString::null);
- ab->addTextPage (i18n("About"),
- i18n("A previewer for Device Independent files (DVI files) produced "
- "by the TeX typesetting system.
"
- "Based on kdvi 0.4.3 and on xdvik, version 18f.
"
- "For latest information, visit "
- "KDVI's Homepage."),
- true);
- ab->addTextPage (i18n("Authors"),
- i18n("Stefan Kebekus
"
- ""
- "http://www.mi.uni-koeln.de/~kebekus
"
- "kebekus@kde.org
"
- "Current maintainer of kdvi. Major rewrite of version 0.4.3."
- "Implementation of hyperlinks.
"
- "
"
- "Philipp Lehmann
"
- "testing and bug reporting"
- "
"
- "Markku Hinhala
"
- "Author of kdvi 0.4.3"
- "
"
- "Nicolai Langfeldt
"
- "Maintainer of xdvik"
- "
"
- "Paul Vojta
"
- " Author of xdvi
"
- "
"
- "Many others. Really, lots of people who were involved in kdvi, xdvik and "
- "xdvi. I apologize to those who I did not mention here. Please send me an "
- "email if you think your name belongs here."),
- true);
-
- ab->setMinimumWidth(500);
- ab->show();
-}
-
-
-void KDVIMultiPage::bugform()
-{
- KAboutData *kab = new KAboutData("kdvi", I18N_NOOP("KDVI"), "1.1", 0, 0, 0, 0, 0);
- KBugReport *kbr = new KBugReport(0, true, kab );
- kbr->show();
-}
-
-
-void KDVIMultiPage::helpme()
-{
- kapp->invokeHelp( "", "kdvi" );
-}
-
-
void KDVIMultiPage::preferencesChanged()
{
#ifdef KDVI_MULTIPAGE_DEBUG
@@ -766,13 +705,6 @@ void KDVIMultiPage::showTipOnStart(void)
}
-void KDVIMultiPage::guiActivateEvent( KParts::GUIActivateEvent * event )
-{
- if (event->activated() && url().isEmpty())
- emit setWindowCaption( i18n("KDVI") );
-}
-
-
DocumentWidget* KDVIMultiPage::createDocumentWidget()
{
// TODO: handle different sizes per page.
diff --git a/kdvi_multipage.h b/kdvi_multipage.h
index 64584e479..f8345e44a 100644
--- a/kdvi_multipage.h
+++ b/kdvi_multipage.h
@@ -115,9 +115,6 @@ protected:
//before the timerEvent function.
void timerEvent( QTimerEvent *e );
- // Set initial window caption
- void guiActivateEvent( KParts::GUIActivateEvent * event );
-
virtual void reload();
protected slots:
@@ -126,11 +123,8 @@ protected slots:
void doExportText();
void doSelectAll();
void doEnableWarnings();
- void about();
- void helpme();
- void bugform();
void preferencesChanged();
-
+
void contentsMovingInScrollView(int x, int y);
/** Makes page # pageNr visible, selects the text Elements
diff --git a/kdvi_part.rc b/kdvi_part.rc
index ee66851fe..6198752f4 100644
--- a/kdvi_part.rc
+++ b/kdvi_part.rc
@@ -27,11 +27,7 @@
diff --git a/main.cpp b/main.cpp
new file mode 100644
index 000000000..a34a72938
--- /dev/null
+++ b/main.cpp
@@ -0,0 +1,138 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#include "kviewshell.h"
+
+
+static KCmdLineOptions options[] =
+{
+ { "unique", I18N_NOOP("Check if the file is loaded in another KDVI. If it is, bring up the other KDVI. Otherwise, load the file."), 0 },
+ { "paper ", I18N_NOOP("Sets paper size (not implemented at the moment, only for compatibility with lyx)"), 0 },
+ { "+file(s)", I18N_NOOP("Files to load"), 0 },
+ KCmdLineLastOption
+};
+
+
+static const char description[] = I18N_NOOP("A previewer for Device Independent files (DVI files) produced by the TeX typesetting system.");
+
+
+int main(int argc, char** argv)
+{
+ KAboutData about ("kdvi", I18N_NOOP("KDVI"), "1.2",
+ description, KAboutData::License_GPL,
+ "Markku Hinhala, Stephan Kebekus",
+ I18N_NOOP("Displays Device Independent (DVI) files."
+ "Based on original code from kdvi version 0.43 and xdvik."));
+
+ about.addAuthor ("Stefan Kebekus",
+ I18N_NOOP("Current Maintainer.\n"
+ "Major rewrite of version 0.4.3.\n"
+ "Implementation of hyperlinks. "),
+ "kebekus@kde.org",
+ "http://www.mi.uni-koeln.de/~kebekus");
+
+ about.addAuthor ("Markku Hinhala",
+ I18N_NOOP("Author of kdvi 0.4.3"));
+
+ about.addAuthor ("Nicolai Langfeldt",
+ I18N_NOOP("Maintainer of xdvik"));
+
+ about.addAuthor ("Paul Vojta",
+ I18N_NOOP("Author of xdvi"));
+
+ about.addCredit ("Philipp Lehmann",
+ I18N_NOOP("testing and bug reporting."));
+
+ KCmdLineArgs::init(argc, argv, &about);
+ KCmdLineArgs::addCmdLineOptions(options);
+ KApplication app;
+ KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
+
+ if (args->isSet("unique"))
+ {
+ // With --unique, we need 2 arguments.
+ if (args->count() < 1)
+ {
+ args->usage();
+ exit(-1);
+ }
+
+ // Find the fully qualified file name of the file we are
+ // loading. Complain, if we are given a URL which does not point
+ // to a local file.
+ KURL url(args->url(0));
+
+ if (!args->url(0).isValid())
+ {
+ kdError(4300) << QString(I18N_NOOP("The URL %1 is not well-formed.")).arg(args->arg(0)) << endl;
+ return -1;
+ }
+
+ if (!args->url(0).isLocalFile())
+ {
+ kdError(4300) << QString(I18N_NOOP("The URL %1 does not point to a local file. You can only specify local "
+ "files if you are using the '--unique' option.")).arg(args->arg(0)) << endl;
+ return -1;
+ }
+
+
+ QString qualPath = QFileInfo(args->url(1).path()).absFilePath();
+
+ app.dcopClient()->attach();
+ // We need to register as "kviewshell" to stay compatible with existing DCOP-skripts.
+ QCString id = app.dcopClient()->registerAs("unique-kviewshell");
+ if (id.isNull())
+ kdError(4300) << "There was an error using dcopClient()->registerAs()." << endl;
+ QCStringList apps = app.dcopClient()->registeredApplications();
+ for ( QCStringList::Iterator it = apps.begin(); it != apps.end(); ++it )
+ {
+ if ((*it).find("kdvi") == 0)
+ {
+ QByteArray data, replyData;
+ QCString replyType;
+ QDataStream arg(data, IO_WriteOnly);
+ bool result;
+ arg << qualPath.stripWhiteSpace();
+ if (!app.dcopClient()->call( *it, "kmultipage", "is_file_loaded(QString)", data, replyType, replyData))
+ kdError(4300) << "There was an error using DCOP." << endl;
+ else
+ {
+ QDataStream reply(replyData, IO_ReadOnly);
+ if (replyType == "bool")
+ {
+ reply >> result;
+ if (result == true)
+ {
+ if (app.dcopClient()->send( *it, "kmultipage", "jumpToReference(QString)", args->url(0).ref()) == true)
+ {
+ app.dcopClient()->detach();
+ return 0;
+ }
+ }
+ }
+ else
+ kdError(4300) << "The DCOP function 'doIt' returned an unexpected type of reply!";
+ }
+ }
+ }
+ }
+
+ // We need to register as "kviewshell" to stay compatible with existing DCOP-skripts.
+ app.dcopClient()->registerAs("kviewshell");
+ KViewShell* shell = new KViewShell("dvi");
+
+ if (args->count() > 0)
+ shell->openURL(args->url(0));
+
+ shell->show();
+ return app.exec();
+}