Commit 46331c21 authored by Martin Koller's avatar Martin Koller

mroe KF5 port

parent 01aa6534
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <kfiledialog.h> #include <kfiledialog.h>
#include <kinputdialog.h> #include <kinputdialog.h>
#include <kcomponentdata.h> #include <kcomponentdata.h>
#include <klocale.h>
#include <knotification.h> #include <knotification.h>
#include <kshell.h> #include <kshell.h>
#include <kpropertiesdialog.h> #include <kpropertiesdialog.h>
...@@ -48,6 +47,7 @@ ...@@ -48,6 +47,7 @@
#include <kactioncollection.h> #include <kactioncollection.h>
#include <ktoggleaction.h> #include <ktoggleaction.h>
#include <krecentfilesaction.h> #include <krecentfilesaction.h>
#include <KLocalizedString>
#include <repositoryinterface.h> #include <repositoryinterface.h>
#include <KConfigGroup> #include <KConfigGroup>
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
using Cervisia::TagDialog; using Cervisia::TagDialog;
#define TRANSLATION_DOMAIN "cervisia"
K_PLUGIN_FACTORY( CervisiaFactory, registerPlugin<CervisiaPart>(); ) K_PLUGIN_FACTORY( CervisiaFactory, registerPlugin<CervisiaPart>(); )
K_EXPORT_PLUGIN( CervisiaFactory( "cervisiapart", "cervisia" ) ) K_EXPORT_PLUGIN( CervisiaFactory( "cervisiapart", "cervisia" ) )
...@@ -197,7 +198,7 @@ KConfig *CervisiaPart::config() ...@@ -197,7 +198,7 @@ KConfig *CervisiaPart::config()
// destroyed // destroyed
} }
bool CervisiaPart::openUrl( const KUrl &u ) bool CervisiaPart::openUrl( const QUrl &u )
{ {
// right now, we are unfortunately not network-aware // right now, we are unfortunately not network-aware
if( !u.isLocalFile() ) if( !u.isLocalFile() )
...@@ -220,7 +221,7 @@ bool CervisiaPart::openUrl( const KUrl &u ) ...@@ -220,7 +221,7 @@ bool CervisiaPart::openUrl( const KUrl &u )
// make a deep copy as if we're called via KRecentFilesAction::urlSelected() // make a deep copy as if we're called via KRecentFilesAction::urlSelected()
// KRecentFilesAction::addUrl() makes the URL invalid // KRecentFilesAction::addUrl() makes the URL invalid
const KUrl deepCopy(u); const QUrl deepCopy(u);
return openSandbox(deepCopy); return openSandbox(deepCopy);
} }
...@@ -788,7 +789,7 @@ void CervisiaPart::slotOpenSandbox() ...@@ -788,7 +789,7 @@ void CervisiaPart::slotOpenSandbox()
if (dirname.isEmpty()) if (dirname.isEmpty())
return; return;
openSandbox(KUrl(dirname)); openSandbox(QUrl::fromLocalFile(dirname));
} }
...@@ -1794,7 +1795,7 @@ void CervisiaPart::slotJobFinished() ...@@ -1794,7 +1795,7 @@ void CervisiaPart::slotJobFinished()
} }
bool CervisiaPart::openSandbox(const KUrl& url) bool CervisiaPart::openSandbox(const QUrl& url)
{ {
// Do we have a cvs service? // Do we have a cvs service?
if( !cvsService ) if( !cvsService )
...@@ -1999,7 +2000,6 @@ void CervisiaPart::guiActivateEvent(KParts::GUIActivateEvent* event) ...@@ -1999,7 +2000,6 @@ void CervisiaPart::guiActivateEvent(KParts::GUIActivateEvent* event)
CervisiaBrowserExtension::CervisiaBrowserExtension( CervisiaPart *p ) CervisiaBrowserExtension::CervisiaBrowserExtension( CervisiaPart *p )
: KParts::BrowserExtension( p ) : KParts::BrowserExtension( p )
{ {
KGlobal::locale()->insertCatalog("cervisia");
} }
CervisiaBrowserExtension::~CervisiaBrowserExtension() CervisiaBrowserExtension::~CervisiaBrowserExtension()
......
...@@ -69,7 +69,7 @@ public: ...@@ -69,7 +69,7 @@ public:
public slots: public slots:
// unused because we overwrite the default behaviour of openUrl() // unused because we overwrite the default behaviour of openUrl()
virtual bool openFile() { return true; } virtual bool openFile() { return true; }
virtual bool openUrl( const KUrl & ); virtual bool openUrl( const QUrl & );
void openFile(QString filename); void openFile(QString filename);
void openFiles(const QStringList &filenames); void openFiles(const QStringList &filenames);
...@@ -152,7 +152,7 @@ private: ...@@ -152,7 +152,7 @@ private:
void readSettings(); void readSettings();
void writeSettings(); void writeSettings();
bool openSandbox(const KUrl& url); bool openSandbox(const QUrl& url);
void updateSandbox(const QString &extraopt = QString()); void updateSandbox(const QString &extraopt = QString());
void addOrRemove(AddRemoveDialog::ActionType action); void addOrRemove(AddRemoveDialog::ActionType action);
void addOrRemoveWatch(WatchDialog::ActionType action); void addOrRemoveWatch(WatchDialog::ActionType action);
......
...@@ -32,13 +32,13 @@ ...@@ -32,13 +32,13 @@
<entry name="ProtocolFont" type="Font"> <entry name="ProtocolFont" type="Font">
</entry> </entry>
<entry name="AnnotateFont" type="Font"> <entry name="AnnotateFont" type="Font">
<default code="true">KGlobalSettings::fixedFont()</default> <default code="true">QFontDatabase::systemFont(QFontDatabase::FixedFont)</default>
</entry> </entry>
<entry name="DiffFont" type="Font"> <entry name="DiffFont" type="Font">
<default code="true">KGlobalSettings::fixedFont()</default> <default code="true">QFontDatabase::systemFont(QFontDatabase::FixedFont)</default>
</entry> </entry>
<entry name="ChangeLogFont" type="Font"> <entry name="ChangeLogFont" type="Font">
<default code="true">KGlobalSettings::fixedFont()</default> <default code="true">QFontDatabase::systemFont(QFontDatabase::FixedFont)</default>
</entry> </entry>
</group> </group>
<group name="General" > <group name="General" >
......
...@@ -2,4 +2,4 @@ File=cervisiapart.kcfg ...@@ -2,4 +2,4 @@ File=cervisiapart.kcfg
ClassName=CervisiaSettings ClassName=CervisiaSettings
Singleton=true Singleton=true
Mutators=true Mutators=true
SourceIncludeFiles=kcolorscheme.h,kglobalsettings.h SourceIncludeFiles=kcolorscheme.h,QFontDatabase
...@@ -22,18 +22,22 @@ ...@@ -22,18 +22,22 @@
#include "cervisiashell.h" #include "cervisiashell.h"
#include <kactioncollection.h> #include <kactioncollection.h>
#include <kapplication.h>
#include <kconfig.h> #include <kconfig.h>
#include <KSharedConfig>
#include <kedittoolbar.h> #include <kedittoolbar.h>
#include <khelpmenu.h> #include <khelpmenu.h>
#include <klocale.h>
#include <kpluginfactory.h> #include <kpluginfactory.h>
#include <kpluginloader.h> #include <kpluginloader.h>
#include <kmessagebox.h> #include <kmessagebox.h>
#include <kshortcutsdialog.h> #include <kshortcutsdialog.h>
#include <kstandardaction.h> #include <kstandardaction.h>
#include <kstatusbar.h> #include <kstatusbar.h>
#include <kurl.h> #include <KLocalizedString>
#include <KAboutData>
#include <KConfigGroup>
#include <QApplication>
#include <QAction>
CervisiaShell::CervisiaShell( const char *name ) CervisiaShell::CervisiaShell( const char *name )
...@@ -72,7 +76,7 @@ CervisiaShell::CervisiaShell( const char *name ) ...@@ -72,7 +76,7 @@ CervisiaShell::CervisiaShell( const char *name )
setAutoSaveSettings("MainWindow", true); setAutoSaveSettings("MainWindow", true);
// if the session is restoring, we already read the settings // if the session is restoring, we already read the settings
if( !kapp->isSessionRestored() ) if( !qApp->isSessionRestored() )
readSettings(); readSettings();
} }
...@@ -103,7 +107,7 @@ void CervisiaShell::setupActions() ...@@ -103,7 +107,7 @@ void CervisiaShell::setupActions()
action->setWhatsThis( hint ); action->setWhatsThis( hint );
setHelpMenuEnabled(false); setHelpMenuEnabled(false);
(void) new KHelpMenu(this, componentData().aboutData(), false, actionCollection()); (void) new KHelpMenu(this, componentData(), false);
action = actionCollection()->action("help_contents"); action = actionCollection()->action("help_contents");
hint = i18n("Invokes the KDE help system with the Cervisia documentation"); hint = i18n("Invokes the KDE help system with the Cervisia documentation");
...@@ -130,11 +134,11 @@ void CervisiaShell::setupActions() ...@@ -130,11 +134,11 @@ void CervisiaShell::setupActions()
void CervisiaShell::openURL() void CervisiaShell::openURL()
{ {
if( !m_lastOpenDir.isEmpty() ) if( !m_lastOpenDir.isEmpty() )
m_part->openUrl( KUrl( m_lastOpenDir ) ); m_part->openUrl( QUrl::fromLocalFile( m_lastOpenDir ) );
} }
void CervisiaShell::openURL(const KUrl& url) void CervisiaShell::openURL(const QUrl& url)
{ {
m_part->openUrl(url); m_part->openUrl(url);
} }
...@@ -152,7 +156,8 @@ void CervisiaShell::slotConfigureKeys() ...@@ -152,7 +156,8 @@ void CervisiaShell::slotConfigureKeys()
void CervisiaShell::slotConfigureToolBars() void CervisiaShell::slotConfigureToolBars()
{ {
saveMainWindowSettings( KGlobal::config()->group( autoSaveGroup() ) ); KConfigGroup cg(KSharedConfig::openConfig(), autoSaveGroup());
saveMainWindowSettings(cg);
KEditToolBar dlg( factory() ); KEditToolBar dlg( factory() );
connect(&dlg,SIGNAL(newToolbarConfig()),this,SLOT(slotNewToolbarConfig())); connect(&dlg,SIGNAL(newToolbarConfig()),this,SLOT(slotNewToolbarConfig()));
dlg.exec(); dlg.exec();
...@@ -160,7 +165,8 @@ void CervisiaShell::slotConfigureToolBars() ...@@ -160,7 +165,8 @@ void CervisiaShell::slotConfigureToolBars()
void CervisiaShell::slotNewToolbarConfig() void CervisiaShell::slotNewToolbarConfig()
{ {
applyMainWindowSettings( KGlobal::config()->group( autoSaveGroup() ) ); KConfigGroup cg(KSharedConfig::openConfig(), autoSaveGroup());
applyMainWindowSettings(cg);
} }
void CervisiaShell::closeEvent(QCloseEvent *event) void CervisiaShell::closeEvent(QCloseEvent *event)
...@@ -176,7 +182,7 @@ void CervisiaShell::readProperties(const KConfigGroup& config) ...@@ -176,7 +182,7 @@ void CervisiaShell::readProperties(const KConfigGroup& config)
// if the session is restoring, make sure we open the URL // if the session is restoring, make sure we open the URL
// since it's not handled by main() // since it's not handled by main()
if( kapp->isSessionRestored() ) if( qApp->isSessionRestored() )
openURL(); openURL();
} }
...@@ -196,7 +202,7 @@ void CervisiaShell::saveProperties(KConfigGroup & config) ...@@ -196,7 +202,7 @@ void CervisiaShell::saveProperties(KConfigGroup & config)
void CervisiaShell::readSettings() void CervisiaShell::readSettings()
{ {
KConfigGroup cg( KGlobal::config(), "Session"); KConfigGroup cg(KSharedConfig::openConfig(), "Session");
readProperties(cg); readProperties(cg);
} }
...@@ -204,7 +210,7 @@ void CervisiaShell::readSettings() ...@@ -204,7 +210,7 @@ void CervisiaShell::readSettings()
void CervisiaShell::writeSettings() void CervisiaShell::writeSettings()
{ {
KConfigGroup cg( KGlobal::config(), "Session"); KConfigGroup cg(KSharedConfig::openConfig(), "Session");
saveProperties(cg); saveProperties(cg);
} }
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#define CERVISIASHELL_H #define CERVISIASHELL_H
#include <kparts/mainwindow.h> #include <kparts/mainwindow.h>
#include <kparts/readonlypart.h>
...@@ -40,7 +41,7 @@ public: ...@@ -40,7 +41,7 @@ public:
public slots: public slots:
void openURL(); void openURL();
void openURL(const KUrl& url); void openURL(const QUrl& url);
void slotConfigureKeys(); void slotConfigureKeys();
void slotConfigureToolBars(); void slotConfigureToolBars();
......
...@@ -25,12 +25,12 @@ ...@@ -25,12 +25,12 @@
#include <qfile.h> #include <qfile.h>
#include <qtextstream.h> #include <qtextstream.h>
#include <kconfig.h> #include <KSharedConfig>
#include <kconfiggroup.h>
#include <klocale.h>
#include <kmessagebox.h> #include <kmessagebox.h>
#include <ktextedit.h> #include <ktextedit.h>
#include <KConfigGroup> #include <KConfigGroup>
#include <KLocalizedString>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QPushButton> #include <QPushButton>
#include <QVBoxLayout> #include <QVBoxLayout>
...@@ -64,8 +64,6 @@ ChangeLogDialog::ChangeLogDialog(KConfig& cfg, QWidget *parent) ...@@ -64,8 +64,6 @@ ChangeLogDialog::ChangeLogDialog(KConfig& cfg, QWidget *parent)
okButton->setShortcut(Qt::CTRL | Qt::Key_Return); okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
//PORTING SCRIPT: WARNING mainLayout->addWidget(buttonBox) must be last item in layout. Please move it.
mainLayout->addWidget(buttonBox);
okButton->setDefault(true); okButton->setDefault(true);
edit = new KTextEdit(this); edit = new KTextEdit(this);
...@@ -79,8 +77,10 @@ ChangeLogDialog::ChangeLogDialog(KConfig& cfg, QWidget *parent) ...@@ -79,8 +77,10 @@ ChangeLogDialog::ChangeLogDialog(KConfig& cfg, QWidget *parent)
mainLayout->addWidget(edit); mainLayout->addWidget(edit);
mainLayout->addWidget(buttonBox);
KConfigGroup cg(&partConfig, "ChangeLogDialog"); KConfigGroup cg(&partConfig, "ChangeLogDialog");
restoreDialogSize(cg); restoreGeometry(cg.readEntry<QByteArray>("geometry", QByteArray()));
connect(okButton,SIGNAL(clicked()),this,SLOT(slotOk())); connect(okButton,SIGNAL(clicked()),this,SLOT(slotOk()));
} }
...@@ -88,7 +88,7 @@ ChangeLogDialog::ChangeLogDialog(KConfig& cfg, QWidget *parent) ...@@ -88,7 +88,7 @@ ChangeLogDialog::ChangeLogDialog(KConfig& cfg, QWidget *parent)
ChangeLogDialog::~ChangeLogDialog() ChangeLogDialog::~ChangeLogDialog()
{ {
KConfigGroup cg(&partConfig, "ChangeLogDialog"); KConfigGroup cg(&partConfig, "ChangeLogDialog");
saveDialogSize(cg); cg.writeEntry("geometry", saveGeometry());
} }
......
...@@ -19,12 +19,11 @@ ...@@ -19,12 +19,11 @@
*/ */
#include <QRegExp> #include <QRegExp>
#include <QApplication>
#include <QCommandLineParser>
#include <kaboutdata.h> #include <kaboutdata.h>
#include <kapplication.h> #include <KPasswordDialog>
#include <kcmdlineargs.h>
#include <klocale.h>
#include <kpassworddialog.h>
#include <iostream> #include <iostream>
...@@ -32,29 +31,30 @@ ...@@ -32,29 +31,30 @@
extern "C" KDE_EXPORT int kdemain(int argc, char** argv) extern "C" KDE_EXPORT int kdemain(int argc, char** argv)
{ {
KAboutData about("cvsaskpass", 0, ki18n("cvsaskpass"), "0.1", KAboutData about("cvsaskpass", 0, i18n("cvsaskpass"), "0.1",
ki18n("ssh-askpass for the CVS D-Bus Service"), i18n("ssh-askpass for the CVS D-Bus Service"),
KAboutData::License_LGPL, KAboutData::License_LGPL,
ki18n("Copyright (c) 2003 Christian Loose")); i18n("Copyright (c) 2003 Christian Loose"));
KCmdLineArgs::init(argc, argv, &about); KAboutData::setApplicationData(about);
KCmdLineOptions options;
options.add("+[prompt]", ki18n("prompt"));
KCmdLineArgs::addCmdLineOptions(options);
// no need to register with the dcop server // no need to register with the dcop server
//KApplication::disableAutoDcopRegistration(); //KApplication::disableAutoDcopRegistration();
KApplication app; QApplication app(argc, argv);
QCommandLineParser parser;
parser.addPositionalArgument(QCommandlineOption(QLatin1String("prompt"), i18n("prompt"), QLatin1String("[prompt]")));
// no need for session management // no need for session management
app.disableSessionManagement(); app.disableSessionManagement();
if( !KCmdLineArgs::parsedArgs()->count() ) parser.process(app);
if( !parser.positionalArguments()->count() )
return 1; return 1;
// parse repository name from the passed argument // parse repository name from the passed argument
QString prompt = KCmdLineArgs::parsedArgs()->arg(0); QString prompt = parser.positionalArguments()[0];
QRegExp rx("(.*@.*)'s password:"); QRegExp rx("(.*@.*)'s password:");
KPasswordDialog dlg; KPasswordDialog dlg;
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
#include <klocale.h> #include <klocale.h>
#include <kmessagebox.h> #include <kmessagebox.h>
#include <kshell.h> #include <kshell.h>
#include <kglobal.h>
#include <QDebug> #include <QDebug>
#include "cvsjob.h" #include "cvsjob.h"
...@@ -82,8 +81,7 @@ CvsService::CvsService() ...@@ -82,8 +81,7 @@ CvsService::CvsService()
// create repository manager // create repository manager
d->repository = new Repository(); d->repository = new Repository();
KSharedConfig::Ptr config = KGlobal::config(); KConfigGroup cs(KSharedConfig::open(), "General");
KConfigGroup cs(config, "General");
if( cs.readEntry("UseSshAgent", false) ) if( cs.readEntry("UseSshAgent", false) )
{ {
// use the existing or start a new ssh-agent // use the existing or start a new ssh-agent
......
...@@ -23,13 +23,11 @@ ...@@ -23,13 +23,11 @@
#include <qdir.h> #include <qdir.h>
#include <qfile.h> #include <qfile.h>
#include <qstring.h> #include <qstring.h>
//Added by qt3to4:
#include <QTextStream> #include <QTextStream>
#include <ksharedconfig.h> #include <ksharedconfig.h>
#include <kdirwatch.h> #include <kdirwatch.h>
#include <kstandarddirs.h> #include <kstandarddirs.h>
#include <kglobal.h>
#include "sshagent.h" #include "sshagent.h"
#include <QDBusConnection> #include <QDBusConnection>
...@@ -200,7 +198,7 @@ void Repository::slotConfigDirty(const QString& fileName) ...@@ -200,7 +198,7 @@ void Repository::slotConfigDirty(const QString& fileName)
if( fileName == d->configFileName ) if( fileName == d->configFileName )
{ {
// reread the configuration data from disk // reread the configuration data from disk
KGlobal::config()->reparseConfiguration(); KSharedConfig::openConfig()->reparseConfiguration();
d->readConfig(); d->readConfig();
} }
} }
...@@ -209,14 +207,14 @@ void Repository::slotConfigDirty(const QString& fileName) ...@@ -209,14 +207,14 @@ void Repository::slotConfigDirty(const QString& fileName)
void Repository::Private::readGeneralConfig() void Repository::Private::readGeneralConfig()
{ {
// get path to cvs client program // get path to cvs client program
KConfigGroup cg(KGlobal::config(), "General"); KConfigGroup cg(KSharedConfig::openConfig(), "General");
client = cg.readPathEntry("CVSPath", "cvs"); client = cg.readPathEntry("CVSPath", "cvs");
} }
void Repository::Private::readConfig() void Repository::Private::readConfig()
{ {
KSharedConfig::Ptr config = KGlobal::config(); KSharedConfig::Ptr config = KSharedConfig::openConfig();
// Sometimes the location can be unequal to the entry in the CVS/Root. // Sometimes the location can be unequal to the entry in the CVS/Root.
// //
......
...@@ -28,13 +28,8 @@ ...@@ -28,13 +28,8 @@
#include <QTreeWidget> #include <QTreeWidget>
#include <QHeaderView> #include <QHeaderView>
#include <kglobal.h>
#include <QPushButton> #include <QPushButton>
#include <kconfig.h>
#include <QLineEdit> #include <QLineEdit>
#include <klocale.h>
#include <kdatetime.h>
#include <kconfiggroup.h>
#include <KConfigGroup> #include <KConfigGroup>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QPushButton> #include <QPushButton>
...@@ -105,7 +100,7 @@ bool HistoryItem::operator<(const QTreeWidgetItem &other) const ...@@ -105,7 +100,7 @@ bool HistoryItem::operator<(const QTreeWidgetItem &other) const
QVariant HistoryItem::data(int column, int role) const QVariant HistoryItem::data(int column, int role) const
{ {
if ( (role == Qt::DisplayRole) && (column == Date) ) if ( (role == Qt::DisplayRole) && (column == Date) )
return KGlobal::locale()->formatDateTime(m_date); return QLocale().toString(m_date);
return QTreeWidgetItem::data(column, role); return QTreeWidgetItem::data(column, role);
} }
......
...@@ -353,7 +353,7 @@ bool LogDialog::parseCvsLog(OrgKdeCervisiaCvsserviceCvsserviceInterface* service ...@@ -353,7 +353,7 @@ bool LogDialog::parseCvsLog(OrgKdeCervisiaCvsserviceCvsserviceInterface* service
QString date = dateTimeStr.section(' ', 0, 0); QString date = dateTimeStr.section(' ', 0, 0);
QString time = dateTimeStr.section(' ', 1, 1); QString time = dateTimeStr.section(' ', 1, 1);
logInfo.m_dateTime.setTime_t(KDateTime::fromString(date + 'T' + time).toTime_t()); logInfo.m_dateTime.setTime_t(QDateTime::fromString(date + 'T' + time, Qt::ISODate).toTime_t());
logInfo.m_author = strList[1].section(':', 1, 1).trimmed(); logInfo.m_author = strList[1].section(':', 1, 1).trimmed();
...@@ -485,7 +485,7 @@ void LogDialog::slotOk() ...@@ -485,7 +485,7 @@ void LogDialog::slotOk()
QFile::setPermissions(tempFileName, QFileDevice::ReadOwner); QFile::setPermissions(tempFileName, QFileDevice::ReadOwner);
// open file in preferred editor // open file in preferred editor
KUrl url; QUrl url;
url.setPath(tempFileName); url.setPath(tempFileName);
(void) new KRun(url, 0, true); (void) new KRun(url, 0, true);
} }
......
...@@ -61,7 +61,6 @@ public: ...@@ -61,7 +61,6 @@ public:
bool parseCvsLog(OrgKdeCervisiaCvsserviceCvsserviceInterface* service, const QString& fileName); bool parseCvsLog(OrgKdeCervisiaCvsserviceCvsserviceInterface* service, const QString& fileName);
protected slots: protected slots:
virtual void slotButtonClicked(int button);
void slotOk(); void slotOk();
void slotApply(); void slotApply();
......
...@@ -20,10 +20,9 @@ ...@@ -20,10 +20,9 @@