Commits

joac...@c8aa9fed-2811-0410-8543-893ada326672  committed ea04b29

Corrected handling of unicode arguments, especially filenames

  • Participants
  • Parent commits cf4c7d0

Comments (0)

Files changed (1)

File src-QT4/kreplacements/kreplacements.cpp

 };
 static QList<KCmdLineOptionsItem> s_options;
 
-static std::vector<QCStringList> s_vOption;
+static std::vector<QStringList> s_vOption;
 static std::vector<QString> s_vArg;
 
 KCmdLineOptions& KCmdLineOptions::add( const QString& name, const QString& description )
       ++i;
    }
 
+   QStringList args = QCoreApplication::arguments();
    // First find the option "-config" or "--config" to allow loading of options
    QString configFileName;
-   for( i=1; i<s_argc-1; ++i )
+   for( i=1; i<args.size()-1; ++i )
    {
-      QString arg = s_argv[i];
+      QString arg = args[i];
       if ( arg == "-config" || arg == "--config" )
       {
-         configFileName = s_argv[i+1];
+         configFileName = args[i+1];
       }
    }
    m_config.readConfigFile(configFileName);
 
    s_vOption.resize(nofOptions);
 
-   for( i=1; i<s_argc; ++i )
+   for( i=1; i<args.size(); ++i )
    {
-      QString arg = s_argv[i];
+      QString arg = args[i];
       if ( arg[0]=='-' )  // An option
       {
          if ( ignorableCmdLineOptions.contains( arg +";") )
                   optName = s_options[j].name;
                   pos = optName.indexOf( ' ' );
                }
-               if (pos!=-1){ ++i; s_vOption[j].append( s_argv[i] ); } //use param
+               if (pos!=-1){ ++i; s_vOption[j].append( args[i] ); } //use param
                else        { s_vOption[j].append("1"); }           //set state
                break;
             }