Commit f051e7fe authored by Christoph Cullmann's avatar Christoph Cullmann

initial Kate application port, still a lot work

parent ec28f3e2
......@@ -83,7 +83,7 @@ ecm_optional_add_subdirectory (part)
ecm_optional_add_subdirectory (kwrite)
# kate application
#macro_optional_add_subdirectory (kate)
ecm_optional_add_subdirectory (kate)
# addons, e.g. ktexteditor plugins, kate plugins, plasma applets, ...
#macro_optional_add_subdirectory (addons)
......
......@@ -6,7 +6,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/interfaces)
add_subdirectory( interfaces/kate )
add_subdirectory( app )
add_subdirectory( filetree )
#add_subdirectory( filetree )
add_subdirectory( data )
......
......@@ -27,47 +27,23 @@ set(kateinterfaces_LIB_SRCS kateappadaptor.cpp
kde4_add_library(kateinterfaces SHARED ${kateinterfaces_LIB_SRCS})
# some stuff to have it compile for KDE 4.4
if (NOT KDE_NO_DEPRECATED)
set (KDE_4_4_LIBS_NEEDED ${KDE4_KUTILS_LIBS})
endif()
target_link_libraries(kateinterfaces ${KDE_4_4_LIBS_NEEDED} ${QT_QTXML_LIBRARY} ${KDE4_KTEXTEDITOR_LIBS} ${KDE4_KPARTS_LIBS} ${KACTIVITIES_LIBRARY} )
target_link_libraries(kateinterfaces LINK_INTERFACE_LIBRARIES "${KDE4_KPARTS_LIBS}" )
add_library (kateinterfaces SHARED ${kateinterfaces_LIB_SRCS})
target_link_libraries (kateinterfaces ktexteditor
KF5::KParts
KF5::KDE4Support
KF5::KNewStuff Qt5::Script KF5::SonnetCore KF5::KArchive KF5::KCMUtils KF5::KPrintUtils KF5::ItemViews
)
set_target_properties(kateinterfaces PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
install(TARGETS kateinterfaces ${INSTALL_TARGETS_DEFAULT_ARGS} )
#
# Kate Application
#
kf5_add_kdeinit_executable(kate katemain.cpp)
target_link_libraries(kdeinit_kate ktexteditor kateinterfaces)
########### next target ###############
set(kate_KDEINIT_SRCS katemain.cpp)
if (WIN32)
configure_file(${KDE4_MODULE_DIR}/kde4init_dummy.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/kate_dummy.cpp)
list(APPEND kate_KDEINIT_SRCS ${CMAKE_CURRENT_BINARY_DIR}/kate_dummy.cpp)
#kde4_add_app_icon(kate_KDEINIT_SRCS "${KDE4_INSTALL_DIR}/share/icons/oxygen/*/apps/kate.png")
kde4_add_app_icon(kate_KDEINIT_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/../pics/hi*-app-kate.png")
kde4_add_executable(kate ${kate_KDEINIT_SRCS} )
target_link_libraries( kate ${QT_QTMAIN_LIBRARY} ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBS} kateinterfaces )
else (WIN32)
kde4_add_kdeinit_executable( kate ${kate_KDEINIT_SRCS})
target_link_libraries(kdeinit_kate ${QT_QTGUI_LIBRARY} ${KDE4_KDECORE_LIBS} kateinterfaces )
install(TARGETS kdeinit_kate ${INSTALL_TARGETS_DEFAULT_ARGS} )
target_link_libraries( kate kdeinit_kate )
endif (WIN32)
install(TARGETS kate ${INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS kate ${INSTALL_TARGETS_DEFAULT_ARGS})
install(TARGETS kdeinit_kate ${INSTALL_TARGETS_DEFAULT_ARGS})
......@@ -36,6 +36,7 @@
#include <kdebug.h>
#include <KMessageBox>
#include <KLocale>
#include <KGlobal>
#include <KStartupInfo>
#include <QFileInfo>
......@@ -46,10 +47,10 @@
#include <unistd.h>
#include "kateappadaptor.h"
KateApp::KateApp (KCmdLineArgs *args)
: KApplication ()
KateApp::KateApp(int & argc, char ** argv)
: QApplication (argc, argv)
, m_shouldExit(false)
, m_args (args)
, m_args (0)
{
setQuitOnLastWindowClosed (false);
......@@ -99,7 +100,7 @@ KateApp::~KateApp ()
KateApp *KateApp::self ()
{
return static_cast<KateApp *>(kapp);
return static_cast<KateApp *>(QApplication::instance());
}
Kate::Application *KateApp::application ()
......@@ -121,7 +122,7 @@ void KateApp::initKate ()
{
kDebug() << "Setting KATE_PID: '" << getpid() << "'";
::setenv( "KATE_PID", QString("%1").arg(getpid()).toLatin1(), 1 );
::setenv( "KATE_PID", QString("%1").arg(getpid()).toLatin1().constData(), 1 );
// handle restore different
if (isSessionRestored())
......@@ -146,6 +147,11 @@ void KateApp::initKate ()
void KateApp::restoreKate ()
{
#ifdef FIXME
/// FIXME KF5
// activate again correct session!!!
QString lastSession (sessionConfig()->group("General").readEntry ("Last Session", QString()));
sessionManager()->activateSession (KateSession::Ptr(new KateSession (sessionManager(), lastSession)), false, false, false);
......@@ -159,7 +165,8 @@ void KateApp::restoreKate ()
// restore all windows ;)
for (int n = 1; KMainWindow::canBeRestored(n); n++)
newMainWindow(sessionConfig(), QString ("%1").arg(n));
#endif
// oh, no mainwindow, create one, should not happen, but make sure ;)
if (mainWindows() == 0)
newMainWindow ();
......@@ -167,6 +174,10 @@ void KateApp::restoreKate ()
bool KateApp::startupKate ()
{
#if FIXME
// FIXME KF5
// user specified session to open
if (m_args->isSet ("startanon"))
{
......@@ -194,6 +205,8 @@ bool KateApp::startupKate ()
sessionManager()->activateSession( KateSession::Ptr(new KateSession (sessionManager(), QString())), false, false );
}
#endif
// oh, no mainwindow, create one, should not happen, but make sure ;)
if (mainWindows() == 0)
newMainWindow ();
......@@ -202,6 +215,12 @@ bool KateApp::startupKate ()
#ifdef Q_WS_X11
KStartupInfo::setNewStartupId( activeMainWindow(), startupId());
#endif
#if FIXME
// FIXME KF5
QTextCodec *codec = m_args->isSet("encoding") ? QTextCodec::codecForName(m_args->getOption("encoding").toUtf8()) : 0;
bool tempfileSet = KCmdLineArgs::isTempFileSet();
......@@ -273,6 +292,8 @@ bool KateApp::startupKate ()
if (nav && activeMainWindow()->viewManager()->activeView ())
activeMainWindow()->viewManager()->activeView ()->setCursorPosition (KTextEditor::Cursor (line, column));
#endif
// show the nice tips
KTipDialog::showTip(activeMainWindow());
......
......@@ -52,7 +52,7 @@ class KCmdLineArgs;
* Kate Application
* This class represents the core kate application object
*/
class KATEINTERFACES_EXPORT KateApp : public KApplication
class KATEINTERFACES_EXPORT KateApp : public QApplication
{
Q_OBJECT
......@@ -62,9 +62,8 @@ class KATEINTERFACES_EXPORT KateApp : public KApplication
public:
/**
* application constructor
* @param args parsed command line args
*/
KateApp (KCmdLineArgs *args);
KateApp (int & argc, char ** argv);
/**
* application destructor
......
......@@ -21,6 +21,7 @@
#include <QDir>
#include <QTimer>
#include <KLocale>
#include <klocalizedstring.h>
#include "kateapp.h"
#include "kateappcommands.h"
......
......@@ -31,7 +31,6 @@
#include "katesession.h"
#include <KTextEditor/ConfigPage>
#include <KTextEditor/EditorChooser>
#include <kdebug.h>
#include <KGlobal>
......@@ -40,6 +39,7 @@
#include <KConfig>
#include <kstandardaction.h>
#include <KVBox>
#include <klocalizedstring.h>
#include <QCheckBox>
#include <QLabel>
......@@ -56,16 +56,16 @@ KateConfigDialog::KateConfigDialog ( KateMainWindow *parent, KTextEditor::View *
, m_view( view )
{
setFaceType( Tree );
setCaption( i18n("Configure") );
setButtons( Ok | Apply | Cancel | Help );
setDefaultButton( Ok );
// FIXME KF5 setCaption( i18n("Configure") );
// FIXME KF5 setButtons( Ok | Apply | Cancel | Help );
// FIXME KF5 setDefaultButton( Ok );
setObjectName( "configdialog" );
setHelp( QString(), KGlobal::mainComponent().componentName() );
// FIXME KF5 setHelp( QString(), KGlobal::mainComponent().componentName() );
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup cgGeneral = KConfigGroup( config, "General" );
enableButton( Apply, false );
// FIXME KF5 enableButton( Apply, false );
KPageWidgetItem *applicationItem = addPage( new QWidget, i18n("Application") );
applicationItem->setIcon( KIcon( "preferences-other" ) );
......@@ -368,13 +368,13 @@ void KateConfigDialog::slotApply()
config->sync();
m_dataChanged = false;
enableButton( Apply, false );
// FIXME KF5 enableButton( Apply, false );
}
void KateConfigDialog::slotChanged()
{
m_dataChanged = true;
enableButton( Apply, true );
// FIXME KF5 enableButton( Apply, true );
m_daysMetaInfos->setSuffix(i18ncp("The suffix of 'Delete unused meta-information after'", " day", " days", m_daysMetaInfos->value()));
}
......
......@@ -26,7 +26,9 @@
#include <kate/plugin.h>
#include <kate/pluginconfigpageinterface.h>
#include <KTextEditor/EditorChooser>
#include <KTextEditor/Editor>
#include <KTextEditor/Document>
#include <KTextEditor/View>
#include <KPageDialog>
#include <QList>
......
......@@ -23,6 +23,7 @@
#include "katepluginmanager.h"
#include "kateconfigdialog.h"
#include <klocalizedstring.h>
class KatePluginListItem : public QTreeWidgetItem
{
......
......@@ -28,7 +28,7 @@
#include <KTextEditor/View>
#include <KTextEditor/SessionConfigInterface>
#include <KTextEditor/EditorChooser>
#include <KTextEditor/Editor>
#include <KTextEditor/ContainerInterface>
#include <KParts/Factory>
......@@ -44,10 +44,12 @@
#include <KIconLoader>
#include <KProgressDialog>
#include <KColorScheme>
#include <klocalizedstring.h>
#include <QDateTime>
#include <QTextCodec>
#include <QByteArray>
#include <QtCore/QCryptographicHash>
#include <QHash>
#include <QListView>
#include <QTimer>
......@@ -60,7 +62,7 @@ KateDocManager::KateDocManager (QObject *parent)
, m_suppressOpeningErrorDialogs (false)
{
// Constructed the beloved editor ;)
m_editor = KTextEditor::EditorChooser::editor();
m_editor = KTextEditor::editor();
if ( !m_editor )
{
......@@ -81,7 +83,7 @@ KateDocManager::KateDocManager (QObject *parent)
m_documentManager = new Kate::DocumentManager (this);
m_metaInfos = new KConfig("metainfos", KConfig::NoGlobals, "appdata" );
m_metaInfos = new KConfig("metainfos", KConfig::NoGlobals, QStandardPaths::DataLocation );
createDoc ();
}
......@@ -454,7 +456,7 @@ bool KateDocManager::queryCloseDocuments(KateMainWindow *w)
if (msgres == KMessageBox::Yes)
{
KEncodingFileDialog::Result r = KEncodingFileDialog::getSaveUrlAndEncoding( doc->encoding(), QString(), QString(), w, i18n("Save As"));
KEncodingFileDialog::Result r = KEncodingFileDialog::getSaveUrlAndEncoding( doc->encoding(), QUrl(), QString(), w, i18n("Save As"));
doc->setEncoding( r.encoding );
......@@ -623,7 +625,7 @@ bool KateDocManager::loadMetaInfos(KTextEditor::Document *doc, const KUrl &url)
KConfigGroup urlGroup( m_metaInfos, url.prettyUrl() );
const QString old_md5 = urlGroup.readEntry("MD5");
if ((const char *)md5 == old_md5)
if (QString (md5) == old_md5)
{
if (KTextEditor::ParameterizedSessionConfigInterface *iface =
qobject_cast<KTextEditor::ParameterizedSessionConfigInterface *>(doc))
......@@ -667,7 +669,7 @@ void KateDocManager::saveMetaInfos(const QList<KTextEditor::Document *> &documen
if (computeUrlMD5(doc->url(), md5))
{
KConfigGroup urlGroup( m_metaInfos, doc->url().prettyUrl() );
KConfigGroup urlGroup( m_metaInfos, doc->url().toString() );
if (KTextEditor::SessionConfigInterface *iface = qobject_cast<KTextEditor::SessionConfigInterface *>(doc))
iface->writeSessionConfig(urlGroup);
......@@ -688,12 +690,10 @@ bool KateDocManager::computeUrlMD5(const KUrl &url, QByteArray &result)
if (f.exists() && f.open(QIODevice::ReadOnly))
{
KMD5 md5;
if (!md5.update(f))
return false;
md5.hexDigest(result);
QCryptographicHash crypto(QCryptographicHash::Md5);
while(!f.atEnd())
crypto.addData (f.read(256 * 1024));
result = crypto.result();
f.close();
}
else
......
......@@ -78,68 +78,74 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
// here we go, construct the Kate version
QByteArray kateVersion = KateApp::kateVersion().toLatin1();
KAboutData aboutData ("kate", 0, ki18n("Kate"), kateVersion,
ki18n( "Kate - Advanced Text Editor" ), KAboutData::License_LGPL_V2,
ki18n( "(c) 2000-2013 The Kate Authors" ), KLocalizedString(), "http://www.kate-editor.org");
KAboutData aboutData ("kate", 0, i18n("Kate"), kateVersion,
i18n( "Kate - Advanced Text Editor" ), KAboutData::License_LGPL_V2,
i18n( "(c) 2000-2013 The Kate Authors" ), QString(), "http://www.kate-editor.org");
aboutData.setOrganizationDomain("kde.org");
aboutData.addAuthor (ki18n("Christoph Cullmann"), ki18n("Maintainer"), "cullmann@kde.org", "http://www.cullmann.io");
aboutData.addAuthor (ki18n("Anders Lund"), ki18n("Core Developer"), "anders@alweb.dk", "http://www.alweb.dk");
aboutData.addAuthor (ki18n("Joseph Wenninger"), ki18n("Core Developer"), "jowenn@kde.org", "http://stud3.tuwien.ac.at/~e9925371");
aboutData.addAuthor (ki18n("Hamish Rodda"), ki18n("Core Developer"), "rodda@kde.org");
aboutData.addAuthor (ki18n("Dominik Haumann"), ki18n("Developer & Highlight wizard"), "dhdev@gmx.de");
aboutData.addAuthor (ki18n("Waldo Bastian"), ki18n( "The cool buffersystem" ), "bastian@kde.org" );
aboutData.addAuthor (ki18n("Charles Samuels"), ki18n("The Editing Commands"), "charles@kde.org");
aboutData.addAuthor (ki18n("Matt Newell"), ki18n("Testing, ..."), "newellm@proaxis.com");
aboutData.addAuthor (ki18n("Michael Bartl"), ki18n("Former Core Developer"), "michael.bartl1@chello.at");
aboutData.addAuthor (ki18n("Michael McCallum"), ki18n("Core Developer"), "gholam@xtra.co.nz");
aboutData.addAuthor (ki18n("Jochen Wilhemly"), ki18n( "KWrite Author" ), "digisnap@cs.tu-berlin.de" );
aboutData.addAuthor (ki18n("Michael Koch"), ki18n("KWrite port to KParts"), "koch@kde.org");
aboutData.addAuthor (ki18n("Christian Gebauer"), KLocalizedString(), "gebauer@kde.org" );
aboutData.addAuthor (ki18n("Simon Hausmann"), KLocalizedString(), "hausmann@kde.org" );
aboutData.addAuthor (ki18n("Glen Parker"), ki18n("KWrite Undo History, Kspell integration"), "glenebob@nwlink.com");
aboutData.addAuthor (ki18n("Scott Manson"), ki18n("KWrite XML Syntax highlighting support"), "sdmanson@alltel.net");
aboutData.addAuthor (ki18n("John Firebaugh"), ki18n("Patches and more"), "jfirebaugh@kde.org");
aboutData.addAuthor (ki18n("Pablo Martín"), ki18n("Python Plugin Developer"), "goinnn@gmail.com", "http://github.com/goinnn/");
aboutData.addAuthor (ki18n("Gerald Senarclens de Grancy"), ki18n("QA and Scripting"), "oss@senarclens.eu", "http://find-santa.eu/");
aboutData.addCredit (ki18n("Matteo Merli"), ki18n("Highlighting for RPM Spec-Files, Perl, Diff and more"), "merlim@libero.it");
aboutData.addCredit (ki18n("Rocky Scaletta"), ki18n("Highlighting for VHDL"), "rocky@purdue.edu");
aboutData.addCredit (ki18n("Yury Lebedev"), ki18n("Highlighting for SQL"));
aboutData.addCredit (ki18n("Chris Ross"), ki18n("Highlighting for Ferite"));
aboutData.addCredit (ki18n("Nick Roux"), ki18n("Highlighting for ILERPG"));
aboutData.addCredit (ki18n("Carsten Niehaus"), ki18n("Highlighting for LaTeX"));
aboutData.addCredit (ki18n("Per Wigren"), ki18n("Highlighting for Makefiles, Python"));
aboutData.addCredit (ki18n("Jan Fritz"), ki18n("Highlighting for Python"));
aboutData.addCredit (ki18n("Daniel Naber"));
aboutData.addCredit (ki18n("Roland Pabel"), ki18n("Highlighting for Scheme"));
aboutData.addCredit (ki18n("Cristi Dumitrescu"), ki18n("PHP Keyword/Datatype list"));
aboutData.addCredit (ki18n("Carsten Pfeiffer"), ki18n("Very nice help"));
aboutData.addCredit (ki18n("All people who have contributed and I have forgotten to mention"));
aboutData.addAuthor (i18n("Christoph Cullmann"), i18n("Maintainer"), "cullmann@kde.org", "http://www.cullmann.io");
aboutData.addAuthor (i18n("Anders Lund"), i18n("Core Developer"), "anders@alweb.dk", "http://www.alweb.dk");
aboutData.addAuthor (i18n("Joseph Wenninger"), i18n("Core Developer"), "jowenn@kde.org", "http://stud3.tuwien.ac.at/~e9925371");
aboutData.addAuthor (i18n("Hamish Rodda"), i18n("Core Developer"), "rodda@kde.org");
aboutData.addAuthor (i18n("Dominik Haumann"), i18n("Developer & Highlight wizard"), "dhdev@gmx.de");
aboutData.addAuthor (i18n("Waldo Bastian"), i18n( "The cool buffersystem" ), "bastian@kde.org" );
aboutData.addAuthor (i18n("Charles Samuels"), i18n("The Editing Commands"), "charles@kde.org");
aboutData.addAuthor (i18n("Matt Newell"), i18n("Testing, ..."), "newellm@proaxis.com");
aboutData.addAuthor (i18n("Michael Bartl"), i18n("Former Core Developer"), "michael.bartl1@chello.at");
aboutData.addAuthor (i18n("Michael McCallum"), i18n("Core Developer"), "gholam@xtra.co.nz");
aboutData.addAuthor (i18n("Jochen Wilhemly"), i18n( "KWrite Author" ), "digisnap@cs.tu-berlin.de" );
aboutData.addAuthor (i18n("Michael Koch"), i18n("KWrite port to KParts"), "koch@kde.org");
aboutData.addAuthor (i18n("Christian Gebauer"), QString(), "gebauer@kde.org" );
aboutData.addAuthor (i18n("Simon Hausmann"), QString(), "hausmann@kde.org" );
aboutData.addAuthor (i18n("Glen Parker"), i18n("KWrite Undo History, Kspell integration"), "glenebob@nwlink.com");
aboutData.addAuthor (i18n("Scott Manson"), i18n("KWrite XML Syntax highlighting support"), "sdmanson@alltel.net");
aboutData.addAuthor (i18n("John Firebaugh"), i18n("Patches and more"), "jfirebaugh@kde.org");
aboutData.addAuthor (i18n("Pablo Martín"), i18n("Python Plugin Developer"), "goinnn@gmail.com", "http://github.com/goinnn/");
aboutData.addAuthor (i18n("Gerald Senarclens de Grancy"), i18n("QA and Scripting"), "oss@senarclens.eu", "http://find-santa.eu/");
aboutData.addCredit (i18n("Matteo Merli"), i18n("Highlighting for RPM Spec-Files, Perl, Diff and more"), "merlim@libero.it");
aboutData.addCredit (i18n("Rocky Scaletta"), i18n("Highlighting for VHDL"), "rocky@purdue.edu");
aboutData.addCredit (i18n("Yury Lebedev"), i18n("Highlighting for SQL"));
aboutData.addCredit (i18n("Chris Ross"), i18n("Highlighting for Ferite"));
aboutData.addCredit (i18n("Nick Roux"), i18n("Highlighting for ILERPG"));
aboutData.addCredit (i18n("Carsten Niehaus"), i18n("Highlighting for LaTeX"));
aboutData.addCredit (i18n("Per Wigren"), i18n("Highlighting for Makefiles, Python"));
aboutData.addCredit (i18n("Jan Fritz"), i18n("Highlighting for Python"));
aboutData.addCredit (i18n("Daniel Naber"));
aboutData.addCredit (i18n("Roland Pabel"), i18n("Highlighting for Scheme"));
aboutData.addCredit (i18n("Cristi Dumitrescu"), i18n("PHP Keyword/Datatype list"));
aboutData.addCredit (i18n("Carsten Pfeiffer"), i18n("Very nice help"));
aboutData.addCredit (i18n("All people who have contributed and I have forgotten to mention"));
#ifdef TODO
// FIXME KF5
// command line args init and co
KCmdLineArgs::init (argc, argv, &aboutData);
KCmdLineOptions options;
options.add("s");
options.add("start <name>", ki18n("Start Kate with a given session"));
options.add("startanon", ki18n("Start Kate with a new anonymous session, implies '-n'"));
options.add("start <name>", i18n("Start Kate with a given session"));
options.add("startanon", i18n("Start Kate with a new anonymous session, implies '-n'"));
options.add("n");
options.add("new", ki18n("Force start of a new kate instance (is ignored if start is used and another kate instance already has the given session opened), forced if no parameters and no URLs are given at all"));
options.add("new", i18n("Force start of a new kate instance (is ignored if start is used and another kate instance already has the given session opened), forced if no parameters and no URLs are given at all"));
options.add("b");
options.add("block", ki18n("If using an already running kate instance, block until it exits, if URLs given to open"));
options.add("block", i18n("If using an already running kate instance, block until it exits, if URLs given to open"));
options.add("p");
options.add("pid <pid>", ki18n("Only try to reuse kate instance with this pid (is ignored if start is used and another kate instance already has the given session opened)"));
options.add("pid <pid>", i18n("Only try to reuse kate instance with this pid (is ignored if start is used and another kate instance already has the given session opened)"));
options.add("e");
options.add("encoding <name>", ki18n("Set encoding for the file to open"));
options.add("encoding <name>", i18n("Set encoding for the file to open"));
options.add("l");
options.add("line <line>", ki18n("Navigate to this line"));
options.add("line <line>", i18n("Navigate to this line"));
options.add("c");
options.add("column <column>", ki18n("Navigate to this column"));
options.add("column <column>", i18n("Navigate to this column"));
options.add("i");
options.add("stdin", ki18n("Read the contents of stdin"));
options.add("stdin", i18n("Read the contents of stdin"));
options.add("u");
options.add("use", ki18n("Reuse existing Kate instance; default, only for compatibility"));
options.add("+[URL]", ki18n("Document to open"));
options.add("use", i18n("Reuse existing Kate instance; default, only for compatibility"));
options.add("+[URL]", i18n("Document to open"));
KCmdLineArgs::addCmdLineOptions (options);
KCmdLineArgs::addTempFileOption();
......@@ -371,9 +377,10 @@ extern "C" KDE_EXPORT int kdemain( int argc, char **argv )
// this will wait until exiting is emitted by the used instance, if wanted...
return needToBlock ? app.exec () : 0;
}
#endif
// construct the real kate app object ;)
KateApp app (args);
KateApp app (argc, argv);
if (app.shouldExit()) return 0;
// execute ourself ;)
......
......@@ -63,6 +63,7 @@
#include <KAboutData>
#include <kwindowsystem.h>
#include <KToolBar>
#include <klocalizedstring.h>
#include <QDragEnterEvent>
#include <QEvent>
......@@ -111,7 +112,7 @@ KateMainWindow::KateMainWindow (KConfig *sconfig, const QString &sgroup)
m_modignore = false;
// here we go, set some usable default sizes
if (!initialGeometrySet())
if (false /* FIXME KF5 !initialGeometrySet()*/)
{
int scnum = QApplication::desktop()->screenNumber(parentWidget());
QRect desk = QApplication::desktop()->screenGeometry(scnum);
......@@ -207,7 +208,7 @@ KateMainWindow::KateMainWindow (KConfig *sconfig, const QString &sgroup)
KateMainWindow::~KateMainWindow()
{
// first, save our fallback window size ;)
saveWindowSize (KConfigGroup(KGlobal::config(), "MainWindow"));
// FIXME KF5 saveWindowSize (KConfigGroup(KGlobal::config(), "MainWindow"));
// save other options ;=)
saveOptions();
......@@ -259,7 +260,7 @@ void KateMainWindow::setupMainWindow ()
void KateMainWindow::setupActions()
{
KAction *a;
QAction *a;
actionCollection()->addAction( KStandardAction::New, "file_new", m_viewManager, SLOT(slotDocumentNew()) )
->setWhatsThis(i18n("Create a new document"));
......@@ -463,12 +464,18 @@ bool KateMainWindow::queryClose_internal(KTextEditor::Document* doc)
*/
bool KateMainWindow::queryClose()
{
#ifdef FIXME
// FIXME KF5
// session saving, can we close all views ?
// just test, not close them actually
if (KateApp::self()->sessionSaving())
{
return queryClose_internal ();
}
#endif
// normal closing of window
// allow to close all windows until the last without restrictions
......@@ -493,7 +500,7 @@ void KateMainWindow::newWindow ()
void KateMainWindow::slotEditToolbars()
{
saveMainWindowSettings(KConfigGroup(KGlobal::config(), "MainWindow"));
// FIXME KF5 saveMainWindowSettings(KConfigGroup(KGlobal::config(), "MainWindow"));
KEditToolBar dlg( factory() );
connect( &dlg, SIGNAL(newToolBarConfig()), this, SLOT(slotNewToolbarConfig()) );
......@@ -670,7 +677,7 @@ void KateMainWindow::editKeys()
// kDebug(13001)<<client->actionCollection();
// kDebug(13001)<<client->componentData().aboutData();
// kDebug(13001)<<client->componentData().aboutData()->programName();
dlg.addCollection ( client->actionCollection(), client->componentData().aboutData()->programName() );
dlg.addCollection ( client->actionCollection(), client->componentName() );
}
dlg.configure();
......@@ -735,7 +742,7 @@ void KateMainWindow::mSlotFixOpenWithMenu()
return;
// cleanup menu
KMenu *menu = documentOpenWith->menu();
QMenu *menu = documentOpenWith->menu();
menu->clear();
// get a list of appropriate services.
......@@ -790,8 +797,8 @@ void KateMainWindow::pluginHelp()
void KateMainWindow::aboutEditor()
{
KAboutApplicationDialog ad(KateDocManager::self()->editor()->aboutData(),this);
ad.exec();
// FIXME KF5 KAboutApplicationDialog ad(KateDocManager::self()->editor()->aboutData(),this);
// FIXME KF5 ad.exec();
}
void KateMainWindow::tipOfTheDay()
......@@ -865,7 +872,7 @@ void KateMainWindow::updateCaption (KTextEditor::Document *doc)
}
else
{
c = m_viewManager->activeView()->document()->url().pathOrUrl();
c = m_viewManager->activeView()->document()->url().toString();
}
QString sessName = KateApp::self()->sessionManager()->activeSession()->sessionName();
......
......@@ -38,6 +38,7 @@
#include <QModelIndex>
#include <QHash>
#include <QStackedWidget>
#include <QStackedLayout>
class QMenu;
......@@ -62,7 +63,6 @@ class KateViewManager;
class KateMwModOnHdDialog;
class KateQuickOpen;
#include <QtGui/QStackedLayout>
// Helper layout class to always provide minimum size
class KateContainerStackedLayout : public QStackedLayout
{
......
......@@ -40,6 +40,8 @@
#include <kvbox.h>
#include <kxmlguifactory.h>
#include <kdeversion.h>
#include <klocalizedstring.h>
#include <KShortcut>
#include <QEvent>
//Added by qt3to4:
......@@ -161,7 +163,7 @@ namespace KateMDI
sc = KShortcut( cfg->group("Shortcuts").readEntry( aname, QString() ) );
KToggleAction *a = new ToggleToolViewAction(i18n("Show %1", tv->text), tv, this );
a->setShortcut(sc, KAction::ActiveShortcut); // no DefaultShortcut! see bug #144945
// FIXME KF5 a->setShortcut(sc, QAction::ActiveShortcut); // no DefaultShortcut! see bug #144945
actionCollection()->addAction( aname.toLatin1(), a );
m_toolViewActions.append(a);
......@@ -174,7 +176,7 @@ namespace KateMDI
void GUIClient::unregisterToolView (ToolView *tv)
{
KAction *a = m_toolToAction[tv];
QAction *a = m_toolToAction[tv];
if (!a)
return;
......
......@@ -88,8 +88,8 @@ namespace KateMDI
private:
MainWindow *m_mw;
KToggleAction *m_showSidebarsAction;
QList<KAction*> m_toolViewActions;
QMap<ToolView*, KAction*> m_toolToAction;
QList<QAction*> m_toolViewActions;
QMap<ToolView*, QAction*> m_toolToAction;
KActionMenu *m_toolMenu;
};
......
......@@ -30,6 +30,7 @@
#include <KTemporaryFile>
#include <KPushButton>
#include <KVBox>
#include <klocalizedstring.h>
#include <QHeaderView>
#include <QLabel>
......@@ -43,7 +44,7 @@ class KateDocItem : public QTreeWidgetItem
: QTreeWidgetItem( tw ),
document( doc )
{
setText( 0, doc->url().pathOrUrl() );
setText( 0, doc->url().toString() );
setText( 1, status );
if ( ! doc->isModified() )
setCheckState( 0, Qt::Checked );
......@@ -182,7 +183,7 @@ void KateMwModOnHdDialog::handleSelected( int action )
{
KMessageBox::sorry( this,
i18n("Could not save the document \n'%1'",
item->document->url().pathOrUrl() ) );
item->document->url().toString() ) );
}
break;
......
......@@ -42,6 +42,7 @@
#include <qcoreapplication.h>
#include <QDesktopWidget>
#include <QFileInfo>
#include <klocalizedstring.h>
Q_DECLARE_METATYPE(QPointer<KTextEditor::Document>)
......@@ -167,17 +168,17 @@ void KateQuickOpen::update ()
KTextEditor::Document *doc = i2.value()->document();
alreadySeenDocs.insert (doc);
//QStandardItem *item=new QStandardItem(i18n("%1: %2",doc->documentName(),doc->url().pathOrUrl()));
//QStandardItem *item=new QStandardItem(i18n("%1: %2",doc->documentName(),doc->url().toString()));
QStandardItem *itemName = new QStandardItem(doc->documentName());
itemName->setData(qVariantFromValue(QPointer<KTextEditor::Document> (doc)), DocumentRole);
itemName->setData(QString("%1: %2").arg(doc->documentName()).arg(doc->url().pathOrUrl()), SortFilterRole);
itemName->setData(QString("%1: %2").arg(doc->documentName()).arg(doc->url().toString()), SortFilterRole);
itemName->setEditable(false);
QFont font = itemName->font();
font.setBold(true);
itemName->setFont(font);
QStandardItem *itemUrl = new QStandardItem(doc->url().pathOrUrl());
QStandardItem *itemUrl = new QStandardItem(doc->url().toString());
itemUrl->setEditable(false);
base_model->setItem(linecount, 0, itemName);
base_model->setItem(linecount, 1, itemUrl);
......@@ -202,17 +203,17 @@ void KateQuickOpen::update ()
if (alreadySeenDocs.contains (doc))
continue;