Mercurial > hg > easyhg-kdiff3
comparison kdiff3/src-QT4/kreplacements/kreplacements.cpp @ 102:4bac4535ea7f
Corrected handling of unicode arguments, especially filenames
author | joachim99 |
---|---|
date | Thu, 02 Sep 2010 20:27:45 +0000 |
parents | f0c42ddbbda4 |
children | 44fa471eb3c4 |
comparison
equal
deleted
inserted
replaced
101:8463601a34a7 | 102:4bac4535ea7f |
---|---|
910 QString description; | 910 QString description; |
911 int def; | 911 int def; |
912 }; | 912 }; |
913 static QList<KCmdLineOptionsItem> s_options; | 913 static QList<KCmdLineOptionsItem> s_options; |
914 | 914 |
915 static std::vector<QCStringList> s_vOption; | 915 static std::vector<QStringList> s_vOption; |
916 static std::vector<QString> s_vArg; | 916 static std::vector<QString> s_vArg; |
917 | 917 |
918 KCmdLineOptions& KCmdLineOptions::add( const QString& name, const QString& description ) | 918 KCmdLineOptions& KCmdLineOptions::add( const QString& name, const QString& description ) |
919 { | 919 { |
920 KCmdLineOptionsItem i; | 920 KCmdLineOptionsItem i; |
1033 nofOptions++; | 1033 nofOptions++; |
1034 | 1034 |
1035 ++i; | 1035 ++i; |
1036 } | 1036 } |
1037 | 1037 |
1038 QStringList args = QCoreApplication::arguments(); | |
1038 // First find the option "-config" or "--config" to allow loading of options | 1039 // First find the option "-config" or "--config" to allow loading of options |
1039 QString configFileName; | 1040 QString configFileName; |
1040 for( i=1; i<s_argc-1; ++i ) | 1041 for( i=1; i<args.size()-1; ++i ) |
1041 { | 1042 { |
1042 QString arg = s_argv[i]; | 1043 QString arg = args[i]; |
1043 if ( arg == "-config" || arg == "--config" ) | 1044 if ( arg == "-config" || arg == "--config" ) |
1044 { | 1045 { |
1045 configFileName = s_argv[i+1]; | 1046 configFileName = args[i+1]; |
1046 } | 1047 } |
1047 } | 1048 } |
1048 m_config.readConfigFile(configFileName); | 1049 m_config.readConfigFile(configFileName); |
1049 | 1050 |
1050 QStringList ignorableCmdLineOptionsList = m_config.readEntry("IgnorableCmdLineOptions", QStringList("-u;-query;-html;-abort"), '|'); | 1051 QStringList ignorableCmdLineOptionsList = m_config.readEntry("IgnorableCmdLineOptions", QStringList("-u;-query;-html;-abort"), '|'); |
1052 if ( !ignorableCmdLineOptionsList.isEmpty() ) | 1053 if ( !ignorableCmdLineOptionsList.isEmpty() ) |
1053 ignorableCmdLineOptions = ignorableCmdLineOptionsList.front() + ";"; | 1054 ignorableCmdLineOptions = ignorableCmdLineOptionsList.front() + ";"; |
1054 | 1055 |
1055 s_vOption.resize(nofOptions); | 1056 s_vOption.resize(nofOptions); |
1056 | 1057 |
1057 for( i=1; i<s_argc; ++i ) | 1058 for( i=1; i<args.size(); ++i ) |
1058 { | 1059 { |
1059 QString arg = s_argv[i]; | 1060 QString arg = args[i]; |
1060 if ( arg[0]=='-' ) // An option | 1061 if ( arg[0]=='-' ) // An option |
1061 { | 1062 { |
1062 if ( ignorableCmdLineOptions.contains( arg +";") ) | 1063 if ( ignorableCmdLineOptions.contains( arg +";") ) |
1063 continue; | 1064 continue; |
1064 // Find the option | 1065 // Find the option |
1077 { | 1078 { |
1078 ++j; | 1079 ++j; |
1079 optName = s_options[j].name; | 1080 optName = s_options[j].name; |
1080 pos = optName.indexOf( ' ' ); | 1081 pos = optName.indexOf( ' ' ); |
1081 } | 1082 } |
1082 if (pos!=-1){ ++i; s_vOption[j].append( s_argv[i] ); } //use param | 1083 if (pos!=-1){ ++i; s_vOption[j].append( args[i] ); } //use param |
1083 else { s_vOption[j].append("1"); } //set state | 1084 else { s_vOption[j].append("1"); } //set state |
1084 break; | 1085 break; |
1085 } | 1086 } |
1086 } | 1087 } |
1087 if (j==nofOptions) | 1088 if (j==nofOptions) |