summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Koller <[email protected]>2015-11-01 23:35:58 +0100
committerMartin Koller <[email protected]>2015-11-01 23:35:58 +0100
commit46331c210cd96ce8ab61cf4832cd1e0ebe255358 (patch)
treebcc23feef4f15268962b3e7672263743a3536e9b
parent01aa6534a7f34defeafc91aee416ca93cacdc08d (diff)
mroe KF5 port
-rw-r--r--cervisiapart.cpp12
-rw-r--r--cervisiapart.h4
-rw-r--r--cervisiapart.kcfg6
-rw-r--r--cervisiasettings.kcfgc2
-rw-r--r--cervisiashell.cpp30
-rw-r--r--cervisiashell.h3
-rw-r--r--changelogdialog.cpp14
-rw-r--r--cvsservice/cvsaskpass.cpp30
-rw-r--r--cvsservice/cvsservice.cpp4
-rw-r--r--cvsservice/repository.cpp8
-rw-r--r--historydialog.cpp7
-rw-r--r--logdialog.cpp4
-rw-r--r--logdialog.h1
-rw-r--r--loginfo.cpp21
-rw-r--r--logtree.cpp1
-rw-r--r--main.cpp59
-rw-r--r--misc.cpp7
-rw-r--r--protocolview.cpp5
-rw-r--r--qttableview.cpp12
-rw-r--r--settingsdialog.cpp38
-rw-r--r--settingsdialog.h6
-rw-r--r--settingsdialog_advanced.ui14
-rw-r--r--tooltip.cpp7
-rw-r--r--updateview_items.cpp5
-rw-r--r--watchdialog.cpp23
25 files changed, 159 insertions, 164 deletions
diff --git a/cervisiapart.cpp b/cervisiapart.cpp
index 1a6bf00..b09ccbf 100644
--- a/cervisiapart.cpp
+++ b/cervisiapart.cpp
@@ -33,7 +33,6 @@
#include <kfiledialog.h>
#include <kinputdialog.h>
#include <kcomponentdata.h>
-#include <klocale.h>
#include <knotification.h>
#include <kshell.h>
#include <kpropertiesdialog.h>
@@ -48,6 +47,7 @@
#include <kactioncollection.h>
#include <ktoggleaction.h>
#include <krecentfilesaction.h>
+#include <KLocalizedString>
#include <repositoryinterface.h>
#include <KConfigGroup>
@@ -86,6 +86,7 @@
using Cervisia::TagDialog;
+#define TRANSLATION_DOMAIN "cervisia"
K_PLUGIN_FACTORY( CervisiaFactory, registerPlugin<CervisiaPart>(); )
K_EXPORT_PLUGIN( CervisiaFactory( "cervisiapart", "cervisia" ) )
@@ -197,7 +198,7 @@ KConfig *CervisiaPart::config()
// destroyed
}
-bool CervisiaPart::openUrl( const KUrl &u )
+bool CervisiaPart::openUrl( const QUrl &u )
{
// right now, we are unfortunately not network-aware
if( !u.isLocalFile() )
@@ -220,7 +221,7 @@ bool CervisiaPart::openUrl( const KUrl &u )
// make a deep copy as if we're called via KRecentFilesAction::urlSelected()
// KRecentFilesAction::addUrl() makes the URL invalid
- const KUrl deepCopy(u);
+ const QUrl deepCopy(u);
return openSandbox(deepCopy);
}
@@ -788,7 +789,7 @@ void CervisiaPart::slotOpenSandbox()
if (dirname.isEmpty())
return;
- openSandbox(KUrl(dirname));
+ openSandbox(QUrl::fromLocalFile(dirname));
}
@@ -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?
if( !cvsService )
@@ -1999,7 +2000,6 @@ void CervisiaPart::guiActivateEvent(KParts::GUIActivateEvent* event)
CervisiaBrowserExtension::CervisiaBrowserExtension( CervisiaPart *p )
: KParts::BrowserExtension( p )
{
- KGlobal::locale()->insertCatalog("cervisia");
}
CervisiaBrowserExtension::~CervisiaBrowserExtension()
diff --git a/cervisiapart.h b/cervisiapart.h
index c9d4cea..1b74a2c 100644
--- a/cervisiapart.h
+++ b/cervisiapart.h
@@ -69,7 +69,7 @@ public:
public slots:
// unused because we overwrite the default behaviour of openUrl()
virtual bool openFile() { return true; }
- virtual bool openUrl( const KUrl & );
+ virtual bool openUrl( const QUrl & );
void openFile(QString filename);
void openFiles(const QStringList &filenames);
@@ -152,7 +152,7 @@ private:
void readSettings();
void writeSettings();
- bool openSandbox(const KUrl& url);
+ bool openSandbox(const QUrl& url);
void updateSandbox(const QString &extraopt = QString());
void addOrRemove(AddRemoveDialog::ActionType action);
void addOrRemoveWatch(WatchDialog::ActionType action);
diff --git a/cervisiapart.kcfg b/cervisiapart.kcfg
index 6a32b51..fdda229 100644
--- a/cervisiapart.kcfg
+++ b/cervisiapart.kcfg
@@ -32,13 +32,13 @@
<entry name="ProtocolFont" type="Font">
</entry>
<entry name="AnnotateFont" type="Font">
- <default code="true">KGlobalSettings::fixedFont()</default>
+ <default code="true">QFontDatabase::systemFont(QFontDatabase::FixedFont)</default>
</entry>
<entry name="DiffFont" type="Font">
- <default code="true">KGlobalSettings::fixedFont()</default>
+ <default code="true">QFontDatabase::systemFont(QFontDatabase::FixedFont)</default>
</entry>
<entry name="ChangeLogFont" type="Font">
- <default code="true">KGlobalSettings::fixedFont()</default>
+ <default code="true">QFontDatabase::systemFont(QFontDatabase::FixedFont)</default>
</entry>
</group>
<group name="General" >
diff --git a/cervisiasettings.kcfgc b/cervisiasettings.kcfgc
index 7c0469e..8dfc679 100644
--- a/cervisiasettings.kcfgc
+++ b/cervisiasettings.kcfgc
@@ -2,4 +2,4 @@ File=cervisiapart.kcfg
ClassName=CervisiaSettings
Singleton=true
Mutators=true
-SourceIncludeFiles=kcolorscheme.h,kglobalsettings.h
+SourceIncludeFiles=kcolorscheme.h,QFontDatabase
diff --git a/cervisiashell.cpp b/cervisiashell.cpp
index dbd4f4d..764a010 100644
--- a/cervisiashell.cpp
+++ b/cervisiashell.cpp
@@ -22,18 +22,22 @@
#include "cervisiashell.h"
#include <kactioncollection.h>
-#include <kapplication.h>
#include <kconfig.h>
+#include <KSharedConfig>
#include <kedittoolbar.h>
#include <khelpmenu.h>
-#include <klocale.h>
#include <kpluginfactory.h>
#include <kpluginloader.h>
#include <kmessagebox.h>
#include <kshortcutsdialog.h>
#include <kstandardaction.h>
#include <kstatusbar.h>
-#include <kurl.h>
+#include <KLocalizedString>
+#include <KAboutData>
+#include <KConfigGroup>
+
+#include <QApplication>
+#include <QAction>
CervisiaShell::CervisiaShell( const char *name )
@@ -72,7 +76,7 @@ CervisiaShell::CervisiaShell( const char *name )
setAutoSaveSettings("MainWindow", true);
// if the session is restoring, we already read the settings
- if( !kapp->isSessionRestored() )
+ if( !qApp->isSessionRestored() )
readSettings();
}
@@ -103,7 +107,7 @@ void CervisiaShell::setupActions()
action->setWhatsThis( hint );
setHelpMenuEnabled(false);
- (void) new KHelpMenu(this, componentData().aboutData(), false, actionCollection());
+ (void) new KHelpMenu(this, componentData(), false);
action = actionCollection()->action("help_contents");
hint = i18n("Invokes the KDE help system with the Cervisia documentation");
@@ -130,11 +134,11 @@ void CervisiaShell::setupActions()
void CervisiaShell::openURL()
{
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);
}
@@ -152,7 +156,8 @@ void CervisiaShell::slotConfigureKeys()
void CervisiaShell::slotConfigureToolBars()
{
- saveMainWindowSettings( KGlobal::config()->group( autoSaveGroup() ) );
+ KConfigGroup cg(KSharedConfig::openConfig(), autoSaveGroup());
+ saveMainWindowSettings(cg);
KEditToolBar dlg( factory() );
connect(&dlg,SIGNAL(newToolbarConfig()),this,SLOT(slotNewToolbarConfig()));
dlg.exec();
@@ -160,7 +165,8 @@ void CervisiaShell::slotConfigureToolBars()
void CervisiaShell::slotNewToolbarConfig()
{
- applyMainWindowSettings( KGlobal::config()->group( autoSaveGroup() ) );
+ KConfigGroup cg(KSharedConfig::openConfig(), autoSaveGroup());
+ applyMainWindowSettings(cg);
}
void CervisiaShell::closeEvent(QCloseEvent *event)
@@ -176,7 +182,7 @@ void CervisiaShell::readProperties(const KConfigGroup& config)
// if the session is restoring, make sure we open the URL
// since it's not handled by main()
- if( kapp->isSessionRestored() )
+ if( qApp->isSessionRestored() )
openURL();
}
@@ -196,7 +202,7 @@ void CervisiaShell::saveProperties(KConfigGroup & config)
void CervisiaShell::readSettings()
{
- KConfigGroup cg( KGlobal::config(), "Session");
+ KConfigGroup cg(KSharedConfig::openConfig(), "Session");
readProperties(cg);
}
@@ -204,7 +210,7 @@ void CervisiaShell::readSettings()
void CervisiaShell::writeSettings()
{
- KConfigGroup cg( KGlobal::config(), "Session");
+ KConfigGroup cg(KSharedConfig::openConfig(), "Session");
saveProperties(cg);
}
diff --git a/cervisiashell.h b/cervisiashell.h
index f47c811..b35d0da 100644
--- a/cervisiashell.h
+++ b/cervisiashell.h
@@ -23,6 +23,7 @@
#define CERVISIASHELL_H
#include <kparts/mainwindow.h>
+#include <kparts/readonlypart.h>
@@ -40,7 +41,7 @@ public:
public slots:
void openURL();
- void openURL(const KUrl& url);
+ void openURL(const QUrl& url);
void slotConfigureKeys();
void slotConfigureToolBars();
diff --git a/changelogdialog.cpp b/changelogdialog.cpp
index 314c6cd..fc0fe9c 100644
--- a/changelogdialog.cpp
+++ b/changelogdialog.cpp
@@ -25,12 +25,12 @@
#include <qfile.h>
#include <qtextstream.h>
-#include <kconfig.h>
-#include <kconfiggroup.h>
-#include <klocale.h>
+#include <KSharedConfig>
#include <kmessagebox.h>
#include <ktextedit.h>
#include <KConfigGroup>
+#include <KLocalizedString>
+
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
@@ -64,8 +64,6 @@ ChangeLogDialog::ChangeLogDialog(KConfig& cfg, QWidget *parent)
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
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);
edit = new KTextEdit(this);
@@ -79,8 +77,10 @@ ChangeLogDialog::ChangeLogDialog(KConfig& cfg, QWidget *parent)
mainLayout->addWidget(edit);
+ mainLayout->addWidget(buttonBox);
+
KConfigGroup cg(&partConfig, "ChangeLogDialog");
- restoreDialogSize(cg);
+ restoreGeometry(cg.readEntry<QByteArray>("geometry", QByteArray()));
connect(okButton,SIGNAL(clicked()),this,SLOT(slotOk()));
}
@@ -88,7 +88,7 @@ ChangeLogDialog::ChangeLogDialog(KConfig& cfg, QWidget *parent)
ChangeLogDialog::~ChangeLogDialog()
{
KConfigGroup cg(&partConfig, "ChangeLogDialog");
- saveDialogSize(cg);
+ cg.writeEntry("geometry", saveGeometry());
}
diff --git a/cvsservice/cvsaskpass.cpp b/cvsservice/cvsaskpass.cpp
index b793908..3c92555 100644
--- a/cvsservice/cvsaskpass.cpp
+++ b/cvsservice/cvsaskpass.cpp
@@ -19,12 +19,11 @@
*/
#include <QRegExp>
+#include <QApplication>
+#include <QCommandLineParser>
#include <kaboutdata.h>
-#include <kapplication.h>
-#include <kcmdlineargs.h>
-#include <klocale.h>
-#include <kpassworddialog.h>
+#include <KPasswordDialog>
#include <iostream>
@@ -32,29 +31,30 @@
extern "C" KDE_EXPORT int kdemain(int argc, char** argv)
{
- KAboutData about("cvsaskpass", 0, ki18n("cvsaskpass"), "0.1",
- ki18n("ssh-askpass for the CVS D-Bus Service"),
+ KAboutData about("cvsaskpass", 0, i18n("cvsaskpass"), "0.1",
+ i18n("ssh-askpass for the CVS D-Bus Service"),
KAboutData::License_LGPL,
- ki18n("Copyright (c) 2003 Christian Loose"));
+ i18n("Copyright (c) 2003 Christian Loose"));
- KCmdLineArgs::init(argc, argv, &about);
-
- KCmdLineOptions options;
- options.add("+[prompt]", ki18n("prompt"));
- KCmdLineArgs::addCmdLineOptions(options);
+ KAboutData::setApplicationData(about);
// no need to register with the dcop server
//KApplication::disableAutoDcopRegistration();
- KApplication app;
+ QApplication app(argc, argv);
+
+ QCommandLineParser parser;
+ parser.addPositionalArgument(QCommandlineOption(QLatin1String("prompt"), i18n("prompt"), QLatin1String("[prompt]")));
// no need for session management
app.disableSessionManagement();
- if( !KCmdLineArgs::parsedArgs()->count() )
+ parser.process(app);
+
+ if( !parser.positionalArguments()->count() )
return 1;
// parse repository name from the passed argument
- QString prompt = KCmdLineArgs::parsedArgs()->arg(0);
+ QString prompt = parser.positionalArguments()[0];
QRegExp rx("(.*@.*)'s password:");
KPasswordDialog dlg;
diff --git a/cvsservice/cvsservice.cpp b/cvsservice/cvsservice.cpp
index 30113b7..b5e3ac1 100644
--- a/cvsservice/cvsservice.cpp
+++ b/cvsservice/cvsservice.cpp
@@ -28,7 +28,6 @@
#include <klocale.h>
#include <kmessagebox.h>
#include <kshell.h>
-#include <kglobal.h>
#include <QDebug>
#include "cvsjob.h"
@@ -82,8 +81,7 @@ CvsService::CvsService()
// create repository manager
d->repository = new Repository();
- KSharedConfig::Ptr config = KGlobal::config();
- KConfigGroup cs(config, "General");
+ KConfigGroup cs(KSharedConfig::open(), "General");
if( cs.readEntry("UseSshAgent", false) )
{
// use the existing or start a new ssh-agent
diff --git a/cvsservice/repository.cpp b/cvsservice/repository.cpp
index d72a46f..a611feb 100644
--- a/cvsservice/repository.cpp
+++ b/cvsservice/repository.cpp
@@ -23,13 +23,11 @@
#include <qdir.h>
#include <qfile.h>
#include <qstring.h>
-//Added by qt3to4:
#include <QTextStream>
#include <ksharedconfig.h>
#include <kdirwatch.h>
#include <kstandarddirs.h>
-#include <kglobal.h>
#include "sshagent.h"
#include <QDBusConnection>
@@ -200,7 +198,7 @@ void Repository::slotConfigDirty(const QString& fileName)
if( fileName == d->configFileName )
{
// reread the configuration data from disk
- KGlobal::config()->reparseConfiguration();
+ KSharedConfig::openConfig()->reparseConfiguration();
d->readConfig();
}
}
@@ -209,14 +207,14 @@ void Repository::slotConfigDirty(const QString& fileName)
void Repository::Private::readGeneralConfig()
{
// get path to cvs client program
- KConfigGroup cg(KGlobal::config(), "General");
+ KConfigGroup cg(KSharedConfig::openConfig(), "General");
client = cg.readPathEntry("CVSPath", "cvs");
}
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.
//
diff --git a/historydialog.cpp b/historydialog.cpp
index ffdeb52..c6c5b08 100644
--- a/historydialog.cpp
+++ b/historydialog.cpp
@@ -28,13 +28,8 @@
#include <QTreeWidget>
#include <QHeaderView>
-#include <kglobal.h>
#include <QPushButton>
-#include <kconfig.h>
#include <QLineEdit>
-#include <klocale.h>
-#include <kdatetime.h>
-#include <kconfiggroup.h>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
@@ -105,7 +100,7 @@ bool HistoryItem::operator<(const QTreeWidgetItem &other) const
QVariant HistoryItem::data(int column, int role) const
{
if ( (role == Qt::DisplayRole) && (column == Date) )
- return KGlobal::locale()->formatDateTime(m_date);
+ return QLocale().toString(m_date);
return QTreeWidgetItem::data(column, role);
}
diff --git a/logdialog.cpp b/logdialog.cpp
index 58408dd..530b7ca 100644
--- a/logdialog.cpp
+++ b/logdialog.cpp
@@ -353,7 +353,7 @@ bool LogDialog::parseCvsLog(OrgKdeCervisiaCvsserviceCvsserviceInterface* service
QString date = dateTimeStr.section(' ', 0, 0);
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();
@@ -485,7 +485,7 @@ void LogDialog::slotOk()
QFile::setPermissions(tempFileName, QFileDevice::ReadOwner);
// open file in preferred editor
- KUrl url;
+ QUrl url;
url.setPath(tempFileName);
(void) new KRun(url, 0, true);
}
diff --git a/logdialog.h b/logdialog.h
index 32bb15d..e19ad7f 100644
--- a/logdialog.h
+++ b/logdialog.h
@@ -61,7 +61,6 @@ public:
bool parseCvsLog(OrgKdeCervisiaCvsserviceCvsserviceInterface* service, const QString& fileName);
protected slots:
- virtual void slotButtonClicked(int button);
void slotOk();
void slotApply();
diff --git a/loginfo.cpp b/loginfo.cpp
index afe628c..9e6e68d 100644
--- a/loginfo.cpp
+++ b/loginfo.cpp
@@ -20,10 +20,9 @@
#include "loginfo.h"
#include <qtextdocument.h>
+#include <QLocale>
-#include <kglobal.h>
-#include <klocale.h>
-
+#include <KLocalizedString>
namespace Cervisia
{
@@ -72,17 +71,17 @@ QString TagInfo::typeToString() const
QString LogInfo::createToolTipText(bool showTime) const
{
QString text(QLatin1String("<nobr><b>"));
- text += Qt::escape(m_revision);
+ text += m_revision.toHtmlEscaped();
text += QLatin1String("</b>&nbsp;&nbsp;");
- text += Qt::escape(m_author);
+ text += m_author.toHtmlEscaped();
text += QLatin1String("&nbsp;&nbsp;<b>");
- text += Qt::escape(dateTimeToString(showTime));
+ text += dateTimeToString(showTime).toHtmlEscaped();
text += QLatin1String("</b></nobr>");
if (!m_comment.isEmpty())
{
text += QLatin1String("<pre>");
- text += Qt::escape(m_comment);
+ text += m_comment.toHtmlEscaped();
text += QLatin1String("</pre>");
}
@@ -94,7 +93,7 @@ QString LogInfo::createToolTipText(bool showTime) const
{
if (it != m_tags.begin() || m_comment.isEmpty())
text += QLatin1String("<br>");
- text += Qt::escape((*it).toString());
+ text += (*it).toString().toHtmlEscaped();
}
text += QLatin1String("</i>");
}
@@ -105,11 +104,11 @@ QString LogInfo::createToolTipText(bool showTime) const
QString LogInfo::dateTimeToString(bool showTime, bool shortFormat) const
{
- KLocale::DateFormat format = shortFormat ? KLocale::ShortDate : KLocale::LongDate;
+ QLocale::FormatType format = shortFormat ? QLocale::ShortFormat : QLocale::LongFormat;
if( showTime )
- return KGlobal::locale()->formatDateTime(m_dateTime, format);
+ return QLocale().toString(m_dateTime, format);
else
- return KGlobal::locale()->formatDate(m_dateTime.date(), format);
+ return QLocale().toString(m_dateTime.date(), format);
}
diff --git a/logtree.cpp b/logtree.cpp
index 407cf37..91edb7d 100644
--- a/logtree.cpp
+++ b/logtree.cpp
@@ -23,7 +23,6 @@
#include <QApplication>
#include <qpainter.h>
#include <QDebug>
-#include <kglobal.h>
#include <kcolorscheme.h>
#include "loginfo.h"
diff --git a/main.cpp b/main.cpp
index 3205501..e844d16 100644
--- a/main.cpp
+++ b/main.cpp
@@ -23,12 +23,12 @@
#include <QFileInfo>
#include <kaboutdata.h>
-#include <kapplication.h>
-#include <kcmdlineargs.h>
+#include <QApplication>
+#include <QCommandLineParser>
#include <kconfig.h>
-#include <klocale.h>
#include <kurl.h>
#include <ktoolinvocation.h>
+#include <KLocalizedString>
#include "misc.h"
#include "cervisiashell.h"
@@ -139,48 +139,52 @@ static int ShowAnnotateDialog(const QString& fileName)
extern "C" KDE_EXPORT int kdemain(int argc, char **argv)
{
- KAboutData about("cervisia", 0, ki18n("Cervisia"), CERVISIA_VERSION,
- ki18n("A CVS frontend"), KAboutData::License_GPL,
- ki18n("Copyright (c) 1999-2002 Bernd Gehrmann\n"
- "Copyright (c) 2002-2008 the Cervisia authors"), KLocalizedString(),
- "http://cervisia.kde.org");
+ KAboutData about("cervisia", i18n("Cervisia"), CERVISIA_VERSION,
+ i18n("A CVS frontend"), KAboutLicense::GPL,
+ i18n("Copyright (c) 1999-2002 Bernd Gehrmann\n"
+ "Copyright (c) 2002-2008 the Cervisia authors"), QString(),
+ QLatin1String("http://cervisia.kde.org"));
- about.addAuthor(ki18n("Bernd Gehrmann"), ki18n("Original author and former "
+ about.addAuthor(i18n("Bernd Gehrmann"), i18n("Original author and former "
"maintainer"), "[email protected]");
- about.addAuthor(ki18n("Christian Loose"), ki18n("Maintainer"),
+ about.addAuthor(i18n("Christian Loose"), i18n("Maintainer"),
- about.addAuthor(ki18n("Andr\303\251 W\303\266bbeking"), ki18n("Developer"),
+ about.addAuthor(i18n("Andr\303\251 W\303\266bbeking"), i18n("Developer"),
- about.addAuthor(ki18n("Carlos Woelz"), ki18n("Documentation"),
+ about.addAuthor(i18n("Carlos Woelz"), i18n("Documentation"),
- about.addCredit(ki18n("Richard Moore"), ki18n("Conversion to KPart"),
+ about.addCredit(i18n("Richard Moore"), i18n("Conversion to KPart"),
- about.addCredit(ki18n("Laurent Montel"), ki18n("Conversion to D-Bus"),
+ about.addCredit(i18n("Laurent Montel"), i18n("Conversion to D-Bus"),
+ about.addCredit(i18n("Martin Koller"), i18n("Port to KDE Frameworks 5"),
- KCmdLineArgs::init(argc, argv, &about);
+ KAboutData::setApplicationData(about);
- KCmdLineOptions options;
- options.add("+[directory]", ki18n("The sandbox to be loaded"));
- options.add("resolve <file>", ki18n("Show resolve dialog for the given file"));
- options.add("log <file>", ki18n("Show log dialog for the given file"));
- options.add("annotate <file>", ki18n("Show annotation dialog for the given file"));
- KCmdLineArgs::addCmdLineOptions(options);
+ QApplication app(argc, argv);
- KApplication app;
+ QCommandLineParser parser;
- QString resolvefile = KCmdLineArgs::parsedArgs()->getOption("resolve");
+ parser.addPositionalArgument(QLatin1String("directory"), i18n("The sandbox to be loaded"), QLatin1String("[directory]"));
+ parser.addOption(QCommandLineOption("resolve <file>", i18n("Show resolve dialog for the given file")));
+ parser.addOption(QCommandLineOption("log <file>", i18n("Show log dialog for the given file")));
+ parser.addOption(QCommandLineOption("annotate <file>", i18n("Show annotation dialog for the given file")));
+
+ parser.process(app);
+
+ QString resolvefile = parser.value(QLatin1String("resolve"));
if (!resolvefile.isEmpty())
return ShowResolveDialog(resolvefile);
// is command line option 'show log dialog' specified?
- QString logFile = KCmdLineArgs::parsedArgs()->getOption("log");
+ QString logFile = parser.value(QLatin1String("log"));
if( !logFile.isEmpty() )
return ShowLogDialog(logFile);
// is command line option 'show annotation dialog' specified?
- QString annotateFile = KCmdLineArgs::parsedArgs()->getOption("annotate");
+ QString annotateFile = parser.value(QLatin1String("annotate"));
if( !annotateFile.isEmpty() )
return ShowAnnotateDialog(annotateFile);
@@ -189,10 +193,9 @@ extern "C" KDE_EXPORT int kdemain(int argc, char **argv)
} else {
CervisiaShell* shell = new CervisiaShell();
- const KCmdLineArgs* args = KCmdLineArgs::parsedArgs();
- if( args->count() )
+ if( parser.positionalArguments().count() )
{
- KUrl directory = args->url(0);
+ QUrl directory = QUrl::fromLocalFile(parser.positionalArguments()[0]);
shell->openURL(directory);
}
else
diff --git a/misc.cpp b/misc.cpp
index 5af4980..55f45f2 100644
--- a/misc.cpp
+++ b/misc.cpp
@@ -20,6 +20,7 @@
#include "misc.h"
+#include "debug.h"
#include <ctype.h>
#include <pwd.h>
@@ -30,8 +31,8 @@
#include <qregexp.h>
#include <qstringlist.h>
#include <kemailsettings.h>
-#include <klocale.h>
#include <kmessagebox.h>
+#include <KLocalizedString>
#include <QTemporaryFile>
#include <kuser.h>
#include <QDebug>
@@ -273,9 +274,7 @@ QString tempFileName(const QString& suffix)
if (!tempFiles)
tempFiles = new QStringList;
- QTemporaryFile f;
-//code was f.setSuffix(suffix);
-//Add to constructor and adapt if necessary: QDir::tempPath() + QLatin1String("/myapp_XXXXXX") + QLatin1String(suffix)
+ QTemporaryFile f(QDir::tempPath() + QLatin1String("/cervisia_XXXXXX") + suffix);
f.setAutoRemove(false);
f.open();
tempFiles->append(f.fileName());
diff --git a/protocolview.cpp b/protocolview.cpp
index d0f2ad8..4500661 100644
--- a/protocolview.cpp
+++ b/protocolview.cpp
@@ -24,7 +24,7 @@
#include <QAction>
#include <QMenu>
-//#include <QTextDocument>
+#include <QContextMenuEvent>
#include <klocale.h>
#include <kmessagebox.h>
@@ -32,6 +32,7 @@
#include "cervisiapart.h"
#include "cervisiasettings.h"
#include "cvsjobinterface.h"
+#include "debug.h"
ProtocolView::ProtocolView(const QString& appId, QWidget *parent)
@@ -166,7 +167,7 @@ void ProtocolView::appendLine(const QString &line)
{
// Escape output line, so that html tags in commit
// messages aren't interpreted
- const QString escapedLine = Qt::escape(line);
+ const QString escapedLine = line.toHtmlEscaped();
// When we don't get the output from an update job then
// just add it to the text edit.
diff --git a/qttableview.cpp b/qttableview.cpp
index f878537..62e1f66 100644
--- a/qttableview.cpp
+++ b/qttableview.cpp
@@ -932,7 +932,7 @@ void QtTableView::updateCell( int row, int col, bool erase )
QRect uR = QRect( xPos, yPos,
cellW ? cellW : cellWidth(col),
cellH ? cellH : cellHeight(row) );
- repaint( uR.intersect(viewRect()), erase );
+ repaint( uR.intersected(viewRect()), erase );
}
@@ -1301,7 +1301,7 @@ void QtTableView::paintEvent( QPaintEvent *e )
cellR.setRect( xPos, yPos, cellW ? cellW : cellWidth(col),
cellH ? cellH : cellHeight(row) );
- cellUR = cellR.intersect( updateR );
+ cellUR = cellR.intersected( updateR );
if ( cellUR.isValid() ) {
cellUpdateR = cellUR;
cellUpdateR.translate( -xPos, -yPos ); // cell coordinates
@@ -1364,17 +1364,17 @@ void QtTableView::paintEvent( QPaintEvent *e )
r.setLeft( xPos );
r.setBottom( yPos<maxY?yPos:maxY );
if ( inherits( "QMultiLineEdit" ) )
- paint.fillRect( r.intersect( updateR ), g.base() );
+ paint.fillRect( r.intersected( updateR ), g.base() );
else
- paint.eraseRect( r.intersect( updateR ) );
+ paint.eraseRect( r.intersected( updateR ) );
}
if ( yPos <= maxY ) {
QRect r = viewR;
r.setTop( yPos );
if ( inherits( "QMultiLineEdit" ) )
- paint.fillRect( r.intersect( updateR ), g.base() );
+ paint.fillRect( r.intersected( updateR ), g.base() );
else
- paint.eraseRect( r.intersect( updateR ) );
+ paint.eraseRect( r.intersected( updateR ) );
}
}
diff --git a/settingsdialog.cpp b/settingsdialog.cpp
index 4c79f4c..d2ba372 100644
--- a/settingsdialog.cpp
+++ b/settingsdialog.cpp
@@ -30,13 +30,9 @@
#include <kcolorbutton.h>
#include <kconfig.h>
-#include <kfontdialog.h>
-#include <kglobal.h>
+#include <QFontDialog>
#include <QLineEdit>
-#include <knuminput.h>
#include <kurlrequester.h>
-#include <kcomponentdata.h>
-#include <kvbox.h>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
@@ -57,7 +53,11 @@ void FontButton::chooseFont()
{
QFont newFont(font());
- if (KFontDialog::getFont(newFont, KFontChooser::NoDisplayFlags, this) == QDialog::Rejected)
+ bool ok;
+
+ QFontDialog::getFont(&ok, newFont, this);
+
+ if ( !ok )
return;
setFont(newFont);
@@ -116,7 +116,7 @@ SettingsDialog::SettingsDialog(KConfig *conf, QWidget *parent)
readSettings();
- setHelp("customization", "cervisia");
+ //setHelp("customization", "cervisia");
}
SettingsDialog::~SettingsDialog()
@@ -206,7 +206,7 @@ void SettingsDialog::writeSettings()
config->sync();
- CervisiaSettings::self()->writeConfig();
+ CervisiaSettings::self()->save();
}
void SettingsDialog::done(int res)
@@ -263,9 +263,8 @@ void SettingsDialog::addDiffPage()
QGridLayout* layout = new QGridLayout(diffPage);
QLabel *contextlabel = new QLabel( i18n("&Number of context lines in diff dialog:"), diffPage );
- contextedit = new KIntNumInput( 0, diffPage );
+ contextedit = new QSpinBox(diffPage);
contextedit->setRange(0, 65535);
- contextedit->setSliderEnabled(false);
contextlabel->setBuddy(contextedit);
layout->addWidget(contextlabel, 0, 0);
@@ -279,9 +278,8 @@ void SettingsDialog::addDiffPage()
layout->addWidget(diffoptedit, 1, 1);
QLabel *tabwidthlabel = new QLabel(i18n("Tab &width in diff dialog:"), diffPage);
- tabwidthedit = new KIntNumInput(0, diffPage);
+ tabwidthedit = new QSpinBox(diffPage);
tabwidthedit->setRange(1, 16);
- tabwidthedit->setSliderEnabled(false);
tabwidthlabel->setBuddy(tabwidthedit);
layout->addWidget(tabwidthlabel, 2, 0);
@@ -305,7 +303,9 @@ void SettingsDialog::addDiffPage()
*/
void SettingsDialog::addStatusPage()
{
- KVBox* statusPage = new KVBox;
+ QWidget* statusPage = new QWidget;
+ QVBoxLayout *statusPageVBoxLayout = new QVBoxLayout(statusPage);
+ statusPageVBoxLayout->setMargin(0);
KPageWidgetItem *page = new KPageWidgetItem( statusPage, i18n("Status") );
page->setIcon( QIcon::fromTheme("fork") );
@@ -332,10 +332,9 @@ void SettingsDialog::addAdvancedPage()
m_advancedPage = new Ui::AdvancedPage;
m_advancedPage->setupUi(frame);
- m_advancedPage->kcfg_Timeout->setRange(0, 50000, 100);
- m_advancedPage->kcfg_Timeout->setSliderEnabled(false);
+ m_advancedPage->kcfg_Timeout->setRange(0, 50000);
+ m_advancedPage->kcfg_Timeout->setSingleStep(100);
m_advancedPage->kcfg_Compression->setRange(0, 9);
- m_advancedPage->kcfg_Compression->setSliderEnabled(false);
addPage(page);
}
@@ -346,11 +345,14 @@ void SettingsDialog::addAdvancedPage()
*/
void SettingsDialog::addLookAndFeelPage()
{
- KVBox* lookPage = new KVBox;
+ QWidget* lookPage = new QWidget;
+ QVBoxLayout *lookPageVBoxLayout = new QVBoxLayout(lookPage);
+ lookPageVBoxLayout->setMargin(0);
KPageWidgetItem *page = new KPageWidgetItem( lookPage, i18n("Appearance") );
page->setIcon( QIcon::fromTheme("preferences-desktop-theme") );
QGroupBox* fontGroupBox = new QGroupBox(i18n("Fonts"), lookPage);
+ lookPageVBoxLayout->addWidget(fontGroupBox);
m_protocolFontBox = new FontButton(i18n("Font for &Protocol Window..."),
fontGroupBox);
@@ -368,6 +370,7 @@ void SettingsDialog::addLookAndFeelPage()
fontLayout->addWidget( m_changelogFontBox );
QGroupBox* colorGroupBox = new QGroupBox(i18n("Colors"), lookPage);
+ lookPageVBoxLayout->addWidget(colorGroupBox);
QLabel* conflictLabel = new QLabel(i18n("Conflict:"), colorGroupBox);
m_conflictButton = new KColorButton(colorGroupBox);
@@ -415,6 +418,7 @@ void SettingsDialog::addLookAndFeelPage()
colorLayout->addWidget( m_diffDeleteButton, 2, 4 );
m_splitterBox = new QCheckBox(i18n("Split main window &horizontally"), lookPage);
+ lookPageVBoxLayout->addWidget(m_splitterBox);
addPage(page);
}
diff --git a/settingsdialog.h b/settingsdialog.h
index 797270e..2a4fc43 100644
--- a/settingsdialog.h
+++ b/settingsdialog.h
@@ -26,7 +26,7 @@
class QCheckBox;
-class KIntNumInput;
+class QSpinBox;
class QLineEdit;
class KConfig;
class KColorButton;
@@ -71,8 +71,8 @@ private:
void addLookAndFeelPage();
KConfig *config;
- KIntNumInput *contextedit;
- KIntNumInput *tabwidthedit;
+ QSpinBox *contextedit;
+ QSpinBox *tabwidthedit;
KUrlRequester *cvspathedit;
QLineEdit *usernameedit;
QLineEdit *diffoptedit;
diff --git a/settingsdialog_advanced.ui b/settingsdialog_advanced.ui
index dd6c58e..11717db 100644
--- a/settingsdialog_advanced.ui
+++ b/settingsdialog_advanced.ui
@@ -60,7 +60,7 @@
</widget>
</item>
<item row="1" column="1" >
- <widget class="KIntNumInput" name="kcfg_Compression" >
+ <widget class="QSpinBox" name="kcfg_Compression" >
<property name="minimum" >
<number>0</number>
</property>
@@ -70,7 +70,7 @@
</widget>
</item>
<item row="0" column="1" >
- <widget class="KIntNumInput" name="kcfg_Timeout" >
+ <widget class="QSpinBox" name="kcfg_Timeout" >
<property name="minimum" >
<number>0</number>
</property>
@@ -81,14 +81,4 @@
</item>
</layout>
</widget>
- <customwidgets>
- <customwidget>
- <class>KIntNumInput</class>
- <extends>QWidget</extends>
- <header location="global" >knuminput.h</header>
- </customwidget>
- </customwidgets>
- <includes>
- <include location="local" >knuminput.h</include>
- </includes>
</ui>
diff --git a/tooltip.cpp b/tooltip.cpp
index 691d91f..06e9bc0 100644
--- a/tooltip.cpp
+++ b/tooltip.cpp
@@ -19,12 +19,11 @@
#include "tooltip.h"
-#include <kglobal.h>
-#include <kglobalsettings.h>
-
#include <qevent.h>
#include <qtextdocument.h>
#include <qtooltip.h>
+#include <QApplication>
+#include <QDesktopWidget>
namespace Cervisia
@@ -58,7 +57,7 @@ bool ToolTip::eventFilter(QObject* watched, QEvent* event)
text = truncateLines(text,
QToolTip::font(),
helpEvent->globalPos(),
- KGlobalSettings::desktopGeometry(parentWidget));
+ qApp->desktop()->availableGeometry(parentWidget));
QToolTip::showText(helpEvent->globalPos(), text, parentWidget, rect);
}
diff --git a/updateview_items.cpp b/updateview_items.cpp
index 81a5e2a..e46be7e 100644
--- a/updateview_items.cpp
+++ b/updateview_items.cpp
@@ -30,7 +30,6 @@
#include <QDebug>
#include <kcolorscheme.h>
#include <kiconloader.h>
-#include <klocale.h>
#include "cvsdir.h"
#include "entry.h"
@@ -522,7 +521,7 @@ void UpdateFileItem::setRevTag(const QString& rev, const QString& tag)
const QDateTime tagDateTimeLocal(tagDateTimeUtc.addSecs(localUtcOffset));
- m_entry.m_tag = KGlobal::locale()->formatDateTime(tagDateTimeLocal);
+ m_entry.m_tag = QLocale().toString(tagDateTimeLocal);
}
else
m_entry.m_tag = tag;
@@ -649,7 +648,7 @@ QVariant UpdateFileItem::data(int column, int role) const
case Timestamp:
if (entry().m_dateTime.isValid())
- return KGlobal::locale()->formatDateTime(entry().m_dateTime);
+ return QLocale().toString(entry().m_dateTime);
break;
}
}
diff --git a/watchdialog.cpp b/watchdialog.cpp
index 0bc2214..957b9e8 100644
--- a/watchdialog.cpp
+++ b/watchdialog.cpp
@@ -26,9 +26,11 @@
#include <qradiobutton.h>
#include <QGridLayout>
#include <QBoxLayout>
+#include <QGroupBox>
-#include <klocale.h>
#include <KConfigGroup>
+#include <KLocalizedString>
+
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
@@ -40,25 +42,21 @@ WatchDialog::WatchDialog(ActionType action, QWidget *parent)
setWindowTitle( (action==Add)? i18n("CVS Watch Add") : i18n("CVS Watch Remove") );
setModal(true);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel|QDialogButtonBox::Help);
- QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
- mainLayout->addWidget(mainWidget);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
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);
QFrame* mainWidget = new QFrame(this);
mainLayout->addWidget(mainWidget);
QBoxLayout *layout = new QVBoxLayout(mainWidget);
- mainLayout->addWidget(layout);
- layout->setSpacing(spacingHint());
+ mainLayout->addLayout(layout);
+ //layout->setSpacing(spacingHint());
layout->setMargin(0);
QLabel *textlabel = new QLabel
@@ -98,10 +96,17 @@ WatchDialog::WatchDialog(ActionType action, QWidget *parent)
eventslayout->addWidget(uneditbox, 2, 1);
QButtonGroup* group = new QButtonGroup(mainWidget);
- mainLayout->addWidget(group);
group->addButton(all_button);
group->addButton(only_button);
+ QGroupBox *box = new QGroupBox(mainWidget);
+ mainLayout->addWidget(box);
+ QVBoxLayout *v = new QVBoxLayout(box);
+ v->addWidget(group->button(0));
+ v->addWidget(group->button(1));
+
+ mainLayout->addWidget(buttonBox);
+
connect( only_button, SIGNAL(toggled(bool)),
commitbox, SLOT(setEnabled(bool)) );
connect( only_button, SIGNAL(toggled(bool)),
@@ -109,7 +114,7 @@ WatchDialog::WatchDialog(ActionType action, QWidget *parent)
connect( only_button, SIGNAL(toggled(bool)),
uneditbox, SLOT(setEnabled(bool)) );
- setHelp("watches");
+ //setHelp("watches");
}