[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-cli-tools] /: Use KDEFrameworkCompilerSettings
From:       Laurent Montel <null () kde ! org>
Date:       2018-09-21 19:22:48
Message-ID: E1g3R0q-00062p-4G () code ! kde ! org
[Download RAW message or body]

Git commit 09fb16323969f5881fba943865e5b483b13c7600 by Laurent Montel.
Committed on 21/09/2018 at 19:22.
Pushed by mlaurent into branch 'master'.

Use KDEFrameworkCompilerSettings

M  +1    -2    CMakeLists.txt
M  +6    -6    kdesu/kdesu.cpp
M  +1    -1    kdesu/sudlg.cpp
M  +1    -1    kdesu/sudlg.h
M  +21   -21   kioclient/kioclient.cpp

https://commits.kde.org/kde-cli-tools/09fb16323969f5881fba943865e5b483b13c7600

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7b26491..7b415aa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
 
 include(KDEInstallDirs)
 include(KDECMakeSettings)
-include(KDECompilerSettings NO_POLICY_SCOPE)
+include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
 include(ECMMarkAsTest)
 include(ECMMarkNonGuiExecutable)
 include(FeatureSummary)
@@ -51,7 +51,6 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
     Su
     QUIET
 )
-add_definitions("-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII")
 add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT)
 add_definitions(-DQT_NO_URL_CAST_FROM_STRING)
 find_package(LibKWorkspace ${PROJECT_VERSION} REQUIRED)
diff --git a/kdesu/kdesu.cpp b/kdesu/kdesu.cpp
index f359b3e..d652a07 100644
--- a/kdesu/kdesu.cpp
+++ b/kdesu/kdesu.cpp
@@ -196,9 +196,9 @@ static int startApp(QCommandLineParser& p)
         prompt = false;
 
     // Get target uid
-    QByteArray user = p.value(QStringLiteral("u")).toLocal8Bit();
+    const QByteArray user = p.value(QStringLiteral("u")).toLocal8Bit();
     QByteArray auth_user = user;
-    struct passwd *pw = getpwnam(user);
+    struct passwd *pw = getpwnam(user.constData());
     if (pw == nullptr)
     {
         qCCritical(category) << "User " << user << " does not exist\n";
@@ -279,7 +279,7 @@ static int startApp(QCommandLineParser& p)
     // Don't change uid if we're don't need to.
     if (!change_uid)
     {
-        int result = system(command);
+        int result = system(command.constData());
         result = WEXITSTATUS(result);
         return result;
     }
@@ -450,13 +450,13 @@ static int startApp(QCommandLineParser& p)
     // Run command
     if (!change_uid)
     {
-        int result = system(command);
+        int result = system(command.constData());
         result = WEXITSTATUS(result);
         return result;
     }
     else if (keep && have_daemon)
     {
-        client.setPass(password.toLocal8Bit(), timeout);
+        client.setPass(password.toLocal8Bit().constData(), timeout);
         client.setPriority(priority);
         client.setScheduler(scheduler);
         int result = client.exec(command, user, options, env);
@@ -475,7 +475,7 @@ static int startApp(QCommandLineParser& p)
         proc.setPriority(priority);
         proc.setScheduler(scheduler);
         proc.setCommand(command);
-        int result = proc.exec(password.toLocal8Bit());
+        int result = proc.exec(password.toLocal8Bit().constData());
         return result;
     }
     return -1;
diff --git a/kdesu/sudlg.cpp b/kdesu/sudlg.cpp
index fbbf5db..a0c7c5b 100644
--- a/kdesu/sudlg.cpp
+++ b/kdesu/sudlg.cpp
@@ -68,7 +68,7 @@ KDEsuDialog::~KDEsuDialog()
 
 bool KDEsuDialog::checkPassword()
 {
-    int status = proc.checkInstall(password().toLocal8Bit());
+    int status = proc.checkInstall(password().toLocal8Bit().constData());
     switch (status)
     {
     case -1:
diff --git a/kdesu/sudlg.h b/kdesu/sudlg.h
index 8a665db..b9f5587 100644
--- a/kdesu/sudlg.h
+++ b/kdesu/sudlg.h
@@ -25,7 +25,7 @@ public:
 
     enum ResultCodes { AsUser = 10 };
 
-private slots:
+private Q_SLOTS:
     void slotUser1();
 protected:
     bool checkPassword() override;
diff --git a/kioclient/kioclient.cpp b/kioclient/kioclient.cpp
index ee89561..8c06939 100644
--- a/kioclient/kioclient.cpp
+++ b/kioclient/kioclient.cpp
@@ -59,51 +59,51 @@ static QList<QUrl> makeUrls(const QStringList& urlArgs)
 #ifdef KIOCLIENT_AS_KIOCLIENT5
 static void usage()
 {
-    puts(i18n("\nSyntax:\n").toLocal8Bit());
+    puts(i18n("\nSyntax:\n").toLocal8Bit().constData());
     puts(i18n("  kioclient openProperties 'url'\n"
-              "            # Opens a properties menu\n\n").toLocal8Bit());
+              "            # Opens a properties \
menu\n\n").toLocal8Bit().constData());  puts(i18n("  kioclient exec 'url' \
                ['mimetype']\n"
               "            # Tries to open the document pointed to by 'url', in the \
                application\n"
               "            #   associated with it in KDE. You may omit \
'mimetype'.\n"  "            #   In this case the mimetype is determined\n"
               "            #   automatically. Of course URL may be the URL of a\n"
               "            #   document, or it may be a *.desktop file.\n"
-              "            #   'url' can be an executable, too.\n").toLocal8Bit());
+              "            #   'url' can be an executable, \
too.\n").toLocal8Bit().constData());  puts(i18n("  kioclient move 'src' 'dest'\n"
               "            # Moves the URL 'src' to 'dest'.\n"
-              "            #   'src' may be a list of URLs.\n").toLocal8Bit());
+              "            #   'src' may be a list of \
                URLs.\n").toLocal8Bit().constData());
     puts(i18n("            #   'dest' may be \"trash:/\" to move the files\n"
-              "            #   to the trash.\n").toLocal8Bit());
+              "            #   to the trash.\n").toLocal8Bit().constData());
     puts(i18n("            #   the short version kioclient mv\n"
-              "            #   is also available.\n\n").toLocal8Bit());
+              "            #   is also available.\n\n").toLocal8Bit().constData());
     puts(i18n("  kioclient download ['src']\n"
               "            # Copies the URL 'src' to a user-specified location'.\n"
               "            #   'src' may be a list of URLs, if not present then\n"
-              "            #   a URL will be requested.\n\n").toLocal8Bit());
+              "            #   a URL will be \
requested.\n\n").toLocal8Bit().constData());  puts(i18n("  kioclient copy 'src' \
'dest'\n"  "            # Copies the URL 'src' to 'dest'.\n"
-              "            #   'src' may be a list of URLs.\n").toLocal8Bit());
+              "            #   'src' may be a list of \
URLs.\n").toLocal8Bit().constData());  puts(i18n("            #   the short version \
                kioclient cp\n"
-              "            #   is also available.\n\n").toLocal8Bit());
+              "            #   is also available.\n\n").toLocal8Bit().constData());
     puts(i18n("  kioclient cat 'url'\n"
-              "            # Writes out the contents of 'url' to \
stdout\n\n").toLocal8Bit()); +              "            # Writes out the contents of \
'url' to stdout\n\n").toLocal8Bit().constData());  puts(i18n("  kioclient ls 'url'\n"
-              "            # Lists the contents of the directory 'url' to \
stdout\n\n").toLocal8Bit()); +              "            # Lists the contents of the \
directory 'url' to stdout\n\n").toLocal8Bit().constData());  puts(i18n("  kioclient \
remove 'url'\n"  "            # Removes the URL\n"
-              "            #   'url' may be a list of URLs.\n").toLocal8Bit());
+              "            #   'url' may be a list of \
URLs.\n").toLocal8Bit().constData());  puts(i18n("            #   the short version \
                kioclient rm\n"
-              "            #   is also available.\n\n").toLocal8Bit());
+              "            #   is also available.\n\n").toLocal8Bit().constData());
 
-    puts(i18n("*** Examples:\n").toLocal8Bit());
+    puts(i18n("*** Examples:\n").toLocal8Bit().constData());
     puts(i18n("  kioclient exec file:/home/weis/data/test.html\n"
-              "             // Opens the file with default \
binding\n\n").toLocal8Bit()); +              "             // Opens the file with \
default binding\n\n").toLocal8Bit().constData());  puts(i18n("  kioclient exec \
                ftp://localhost/\n"
-              "             // Opens new window with URL\n\n").toLocal8Bit());
+              "             // Opens new window with \
URL\n\n").toLocal8Bit().constData());  puts(i18n("  kioclient exec \
                file:/root/Desktop/emacs.desktop\n"
-              "             // Starts emacs\n\n").toLocal8Bit());
+              "             // Starts emacs\n\n").toLocal8Bit().constData());
     puts(i18n("  kioclient exec .\n"
-              "             // Opens the current directory. Very \
convenient.\n\n").toLocal8Bit()); +              "             // Opens the current \
directory. Very convenient.\n\n").toLocal8Bit().constData());  }
 #endif
 
@@ -155,7 +155,7 @@ int main( int argc, char **argv )
 #ifdef KIOCLIENT_AS_KIOCLIENT5
   if ( argc == 1 || parser.isSet(QStringLiteral("commands")) )
   {
-    puts(parser.helpText().toLocal8Bit());
+    puts(parser.helpText().toLocal8Bit().constData());
     puts("\n\n");
     usage();
     return 0;
@@ -181,12 +181,12 @@ static void checkArgumentCount(int count, int min, int max)
 {
     if (count < min)
     {
-        fputs( i18nc("@info:shell", "%1: Syntax error, not enough arguments\n", \
qAppName()).toLocal8Bit(), stderr ); +        fputs( i18nc("@info:shell", "%1: Syntax \
error, not enough arguments\n", qAppName()).toLocal8Bit().constData(), stderr );  \
::exit(1);  }
     if (max && (count > max))
     {
-        fputs( i18nc("@info:shell", "%1: Syntax error, too many arguments\n", \
qAppName()).toLocal8Bit(), stderr ); +        fputs( i18nc("@info:shell", "%1: Syntax \
error, too many arguments\n", qAppName()).toLocal8Bit().constData(), stderr );  \
::exit(1);  }
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic