Commit a88e01ca authored by Jeremy Whiting's avatar Jeremy Whiting

Port away from KUniqueApplication (Including fixing the .desktop file Exec line).

Port away from KCmdLineParser and QString::toAscii.
Add required dependencies to remove KDELibs4Support dependency.
parent 3f5ecfa0
...@@ -16,8 +16,13 @@ include(FeatureSummary) ...@@ -16,8 +16,13 @@ include(FeatureSummary)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Widgets)
find_package (KF5 REQUIRED find_package (KF5 REQUIRED
KDELibs4Support ConfigWidgets
DBusAddons
DocTools
I18n
IconThemes
Notifications Notifications
XmlGui
) )
find_package(Phonon4Qt5 REQUIRED NO_MODULE) find_package(Phonon4Qt5 REQUIRED NO_MODULE)
......
...@@ -10,11 +10,24 @@ include_directories(${PHONON_INCLUDE_DIR} ${X11_INCLUDE_DIR}) ...@@ -10,11 +10,24 @@ include_directories(${PHONON_INCLUDE_DIR} ${X11_INCLUDE_DIR})
set(kmousetool_SRCS mtstroke.cpp kmousetool.cpp main.cpp ) set(kmousetool_SRCS mtstroke.cpp kmousetool.cpp main.cpp )
kde4_add_ui_files(kmousetool_SRCS kmousetoolui.ui ) ki18n_wrap_ui(kmousetool_SRCS kmousetoolui.ui )
kde4_add_executable(kmousetool ${kmousetool_SRCS}) add_executable(kmousetool ${kmousetool_SRCS})
target_link_libraries(kmousetool KF5::KDELibs4Support ${PHONON_LIBRARIES} KF5::Notifications Qt5::Core Qt5::Gui Qt5::Widgets ${X11_XTest_LIB} ${X11_Xext_LIB} ${X11_LIBRARIES}) target_link_libraries(kmousetool
Qt5::Core
Qt5::Gui
Qt5::Widgets
${PHONON_LIBRARIES}
KF5::ConfigWidgets
KF5::DBusAddons
KF5::I18n
KF5::IconThemes
KF5::Notifications
KF5::XmlGui
${X11_XTest_LIB}
${X11_Xext_LIB}
${X11_LIBRARIES})
install(TARGETS kmousetool ${INSTALL_TARGETS_DEFAULT_ARGS} ) install(TARGETS kmousetool ${INSTALL_TARGETS_DEFAULT_ARGS} )
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
#include "kmousetool.h" #include "kmousetool.h"
// Needs to be be before X11/Intrinsic.h because of qtextstream.h
#include <phonon/MediaObject>
#include <X11/Xmd.h> #include <X11/Xmd.h>
#include "mtstroke.h" #include "mtstroke.h"
#include <X11/Intrinsic.h> /* Intrinsics Definitions*/ #include <X11/Intrinsic.h> /* Intrinsics Definitions*/
...@@ -46,8 +49,6 @@ ...@@ -46,8 +49,6 @@
#include <KSharedConfig> #include <KSharedConfig>
#include <KStandardGuiItem> #include <KStandardGuiItem>
#include <phonon/MediaObject>
int currentXPosition; int currentXPosition;
int currentYPosition; int currentYPosition;
...@@ -384,7 +385,7 @@ void KMouseTool::setAutostart (bool start) ...@@ -384,7 +385,7 @@ void KMouseTool::setAutostart (bool start)
if (fi.exists()) // if it exists, delete it if (fi.exists()) // if it exists, delete it
cmd = QString(QLatin1String( "rm -f %1" )).arg(sym); cmd = QString(QLatin1String( "rm -f %1" )).arg(sym);
} }
system(cmd.toAscii()); system(cmd.toLatin1());
} }
bool KMouseTool::applySettings() bool KMouseTool::applySettings()
......
...@@ -17,50 +17,59 @@ ...@@ -17,50 +17,59 @@
* * * *
***************************************************************************/ ***************************************************************************/
#include <kcmdlineargs.h>
#include <k4aboutdata.h>
#include "kmousetool.h"
#include <KAboutData>
#include <KConfigGroup> #include <KConfigGroup>
#include <KDBusService>
#include <KLocalizedString> #include <KLocalizedString>
#include <KSharedConfig> #include <KSharedConfig>
#include <kuniqueapplication.h> #include <QCommandLineParser>
#include "kmousetool.h"
static const char description[] = I18N_NOOP("KMouseTool"); static const char description[] = I18N_NOOP("KMouseTool");
// INSERT A DESCRIPTION FOR YOUR APPLICATION HERE
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
K4AboutData aboutData( "kmousetool", 0, ki18n("KMouseTool"), QApplication::setApplicationName(QLatin1String("kmousetool"));
KMOUSETOOL_VERSION, ki18n(description), K4AboutData::License_GPL, QApplication::setApplicationVersion(QLatin1String(KMOUSETOOL_VERSION));
ki18n("(c) 2002-2003, Jeff Roush\n(c) 2003, Gunnar Schmidt"), KLocalizedString(), "http://www.mousetool.com", "gunnar@schmi-dt.de"); QApplication::setOrganizationDomain(QLatin1String("kde.org"));
KLocalizedString::setApplicationDomain("kmousetool");
QApplication::setApplicationDisplayName(i18n("kmousetool"));
QApplication app(argc, argv);
aboutData.addAuthor(ki18n("Gunnar Schmidt"), ki18n("Current maintainer"), "gunnar@schmi-dt.de", "http://www.schmi-dt.de"); KAboutData aboutData(QLatin1Literal("kmousetool"),
aboutData.addAuthor(ki18n("Olaf Schmidt"), ki18n("Usability improvements"), "ojschmidt@kde.org"); i18n("KMouseTool"),
aboutData.addAuthor(ki18n("Jeff Roush"), ki18n("Original author"), "jeff@mousetool.com", "http://www.mousetool.com"); QLatin1Literal(KMOUSETOOL_VERSION),
i18n(description),
KAboutLicense::GPL,
i18n("(c) 2002-2003, Jeff Roush\n(c) 2003, Gunnar Schmidt"),
QString(),
QLatin1Literal("http://www.mousetool.com"),
QLatin1Literal("gunnar@schmi-dt.de"));
aboutData.addCredit(ki18n("Joe Betts")); aboutData.addAuthor(i18n("Gunnar Schmidt"), i18n("Current maintainer"), QLatin1String("gunnar@schmi-dt.de"), QLatin1String("http://www.schmi-dt.de"));
aboutData.setOrganizationDomain("kde.org"); aboutData.addAuthor(i18n("Olaf Schmidt"), i18n("Usability improvements"), QLatin1String("ojschmidt@kde.org"));
KCmdLineArgs::init( argc, argv, &aboutData ); aboutData.addAuthor(i18n("Jeff Roush"), i18n("Original author"), QLatin1String("jeff@mousetool.com"), QLatin1String("http://www.mousetool.com"));
KCmdLineOptions options;
KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
KUniqueApplication::addCmdLineOptions();
KUniqueApplication::setApplicationName(QLatin1String( "kmousetool" )); aboutData.addCredit(i18n("Joe Betts"));
aboutData.setOrganizationDomain("kde.org");
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
parser.addVersionOption();
parser.addHelpOption();
//PORTING SCRIPT: adapt aboutdata variable if necessary
aboutData.setupCommandLine(&parser);
parser.process(app);
aboutData.processCommandLine(&parser);
if (!KUniqueApplication::start()) { KDBusService service(KDBusService::Unique, &app);
fprintf(stderr, "KMouseTool is already running !\n");
exit(0);
}
KUniqueApplication a;
KMouseTool *kmousetool = new KMouseTool(); KMouseTool *kmousetool = new KMouseTool();
if (!KSharedConfig::openConfig()->group("UserOptions").readEntry("IsMinimized", false)) if (!KSharedConfig::openConfig()->group("UserOptions").readEntry("IsMinimized", false))
kmousetool->show(); kmousetool->show();
return a.exec(); return app.exec();
} }
...@@ -196,7 +196,7 @@ bool MTStroke::readSequence() ...@@ -196,7 +196,7 @@ bool MTStroke::readSequence()
writeSequence(); writeSequence();
return false; return false;
} }
ifstream infile (strokefilename.toAscii().constData()); ifstream infile (strokefilename.toLatin1().constData());
if (!infile) { if (!infile) {
// make default // make default
if (sequenceMap.size()==0) if (sequenceMap.size()==0)
...@@ -226,7 +226,7 @@ bool MTStroke::writeSequence() ...@@ -226,7 +226,7 @@ bool MTStroke::writeSequence()
QString strokefilename; QString strokefilename;
strokefilename = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1String("/kmousetool_strokes.txt" ); strokefilename = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1String("/kmousetool_strokes.txt" );
ofstream outfile (strokefilename.toAscii(), ios::out); ofstream outfile (strokefilename.toLatin1(), ios::out);
if (!outfile) { if (!outfile) {
return false; return false;
} }
......
# KDE Config File # KDE Config File
[Desktop Entry] [Desktop Entry]
Type=Application Type=Application
Exec=kmousetool -caption %c %i Exec=kmousetool -qwindowtitle %c
Icon=kmousetool Icon=kmousetool
X-DocPath=kmousetool/index.html X-DocPath=kmousetool/index.html
Comment=Clicks the mouse for you, reducing the effects of RSI Comment=Clicks the mouse for you, reducing the effects of RSI
......
kde4_install_icons( ${ICON_INSTALL_DIR} ) ecm_install_icons(ICONS
16-actions-kmousetool_off.png
16-actions-kmousetool_on.png
16-apps-kmousetool.png
32-actions-kmousetool_off.png
32-actions-kmousetool_on.png
32-apps-kmousetool.png
DESTINATION ${ICON_INSTALL_DIR}
THEME hicolor
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment