shsorbom / qt_practicum

Qt independent studies course
0 stars 0 forks source link

kauth function call error #2

Open shsorbom opened 9 years ago

shsorbom commented 9 years ago

/home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp: In member function ‘KAuth::ActionReply UFW::Helper::viewlog(const QVariantMap&)’: /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp:121:14: error: invalid user-defined conversion from ‘const KAuth::ActionReply()’ to ‘const KAuth::ActionReply&’ [-fpermissive] reply=ActionReply::HelperErrorReply; ^ In file included from /usr/include/KF5/KAuth/kauth.h:25:0, from /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.h:29, from /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp:24: /usr/include/KF5/KAuth/kauthactionreply.h:572:5: note: candidate is: KAuth::ActionReply::ActionReply(int) ActionReply(int errorCode); ^ /usr/include/KF5/KAuth/kauthactionreply.h:572:5: note: no known conversion for argument 1 from ‘const KAuth::ActionReply()’ to ‘int’ /home/shawn/Projects/qt_practicum/kcmufw/helper/helper.cpp:121:14: error: invalid conversion from ‘const KAuth::ActionReply ()()’ to ‘int’ [-fpermissive] reply=ActionReply::HelperErrorReply; ^ In file included from /usr/include/KF5/KAuth/kauth.h:25:0, from /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.h:29, from /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp:24: /usr/include/KF5/KAuth/kauthactionreply.h:572:5: note: initializing argument 1 of ‘KAuth::ActionReply::ActionReply(int)’ ActionReply(int errorCode); ^ /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp:122:51: error: no matching function for call to ‘KAuth::ActionReply::setErrorCode(UFW::Helper::Status)’ reply.setErrorCode(STATUS_OPERATION_FAILED); ^ /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp:122:51: note: candidate is: In file included from /usr/include/KF5/KAuth/kauth.h:25:0, from /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.h:29, from /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp:24: /usr/include/KF5/KAuth/kauthactionreply.h:664:10: note: void KAuth::ActionReply::setErrorCode(KAuth::ActionReply::Error) void setErrorCode(Error errorCode); ^ /usr/include/KF5/KAuth/kauthactionreply.h:664:10: note: no known conversion for argument 1 from ‘UFW::Helper::Status’ to ‘KAuth::ActionReply::Error’ /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp: In member function ‘KAuth::ActionReply UFW::Helper::modify(const QVariantMap&)’: /home/shawn/Projects/qt_practicum/kcmufw/helper/helper.cpp:161:36: error: invalid conversion from ‘const KAuth::ActionReply ()()’ to ‘int’ [-fpermissive] ActionReply reply=ActionReply::HelperErrorReply; ^ In file included from /usr/include/KF5/KAuth/kauth.h:25:0, from /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.h:29, from /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp:24: /usr/include/KF5/KAuth/kauthactionreply.h:572:5: note: initializing argument 1 of ‘KAuth::ActionReply::ActionReply(int)’ ActionReply(int errorCode); ^ /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp:162:42: error: no matching function for call to ‘KAuth::ActionReply::setErrorCode(UFW::Helper::Status)’ reply.setErrorCode(STATUS_INVALID_CMD); ^ /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp:162:42: note: candidate is: In file included from /usr/include/KF5/KAuth/kauth.h:25:0, from /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.h:29, from /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp:24: /usr/include/KF5/KAuth/kauthactionreply.h:664:10: note: void KAuth::ActionReply::setErrorCode(KAuth::ActionReply::Error) void setErrorCode(Error errorCode); ^ /usr/include/KF5/KAuth/kauthactionreply.h:664:10: note: no known conversion for argument 1 from ‘UFW::Helper::Status’ to ‘KAuth::ActionReply::Error’ /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp: In member function ‘KAuth::ActionReply UFW::Helper::setProfile(const QVariantMap&, const QString&)’: /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp:209:40: error: invalid conversion from ‘const KAuth::ActionReply (*)()’ to ‘int’ [-fpermissive] ActionReply reply=ActionReply::HelperErrorReply; ^ In file included from /usr/include/KF5/KAuth/kauth.h:25:0, from /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.h:29, from /home/shawn/Projects/qt_practicum/kcm_ufw/helper/helper.cpp:24: /usr/include/KF5/KAuth/kauthactionreply.h:572:5: note: initializing argument 1 of ‘KAuth::ActionReply::ActionReply(int)’ ActionReply(int errorCode); ^

dondi commented 9 years ago

Based on a look at the Qt source code, it appears that you are dealing with factory functions instead of predefined objects. Thus, to assign one to an ActionReply, you need to call the function to actually get an ActionReply instance:

reply=ActionReply::HelperErrorReply();

Give that a shot and let me know how it goes.