Hello,
Attached is a patch for X2Go Client so to support Qt5. It compiles and executes fine on Debian. I attempted to retain Qt4 compatibility using #ifdefs. -- Sébastien
diff --git a/src/SVGFrame.cpp b/src/SVGFrame.cpp index cb17930..268b037 100644 --- a/src/SVGFrame.cpp +++ b/src/SVGFrame.cpp @@ -26,7 +26,7 @@ SVGFrame::SVGFrame ( QString fname,bool st,QWidget* parent, - Qt::WFlags f ) :QFrame ( parent,f ) + Qt::WindowFlags f ) :QFrame ( parent,f ) { empty=false; #ifdef Q_OS_WIN @@ -66,7 +66,7 @@ SVGFrame::SVGFrame ( QString fname,bool st,QWidget* parent, } SVGFrame::SVGFrame ( QWidget* parent, - Qt::WFlags f ) :QFrame ( parent,f ) + Qt::WindowFlags f ) :QFrame ( parent,f ) { repaint=false; empty=true; diff --git a/src/SVGFrame.h b/src/SVGFrame.h index 1c6fe18..f9d9998 100644 --- a/src/SVGFrame.h +++ b/src/SVGFrame.h @@ -28,8 +28,8 @@ class SVGFrame: public QFrame Q_OBJECT public: - SVGFrame ( QString fname, bool st, QWidget* parent=0, Qt::WFlags f=0 ); - SVGFrame ( QWidget* parent=0, Qt::WFlags f=0 ); + SVGFrame ( QString fname, bool st, QWidget* parent=0, Qt::WindowFlags f=0 ); + SVGFrame ( QWidget* parent=0, Qt::WindowFlags f=0 ); void setRepaintable ( bool val ) { repaint=val; diff --git a/src/configdialog.cpp b/src/configdialog.cpp index 99cb7ef..2f70a13 100644 --- a/src/configdialog.cpp +++ b/src/configdialog.cpp @@ -46,7 +46,7 @@ #endif -ConfigDialog::ConfigDialog ( QWidget * parent, Qt::WFlags f ) +ConfigDialog::ConfigDialog ( QWidget * parent, Qt::WindowFlags f ) : QDialog ( parent,f ) { diff --git a/src/configdialog.h b/src/configdialog.h index 717f709..e9b6582 100644 --- a/src/configdialog.h +++ b/src/configdialog.h @@ -44,7 +44,7 @@ class ConfigDialog : public QDialog Q_OBJECT public: ConfigDialog ( QWidget * parent, - Qt::WFlags f = 0 ); + Qt::WindowFlags f = 0 ); ~ConfigDialog(); #ifdef Q_OS_DARWIN static QString findXDarwin ( QString& version, diff --git a/src/cupsprint.cpp b/src/cupsprint.cpp index 0354bfc..9f42970 100644 --- a/src/cupsprint.cpp +++ b/src/cupsprint.cpp @@ -53,7 +53,7 @@ QString CUPSPrint::getDefaultUserPrinter() "CUPS/defaultprinter","" ). toString(); if ( defPrint.length() >0 ) { - cups_dest_t *dest = cupsGetDest ( defPrint.toAscii(), + cups_dest_t *dest = cupsGetDest ( defPrint.toUtf8(), 0l, num_dests, dests ); if ( dest ) return defPrint; @@ -77,7 +77,7 @@ bool CUPSPrint::getPrinterInfo ( const QString& printerName, QString& info, QString& model, printState& state, QString& stateReason ) { - cups_dest_t *dest = cupsGetDest ( printerName.toAscii(), 0l, + cups_dest_t *dest = cupsGetDest ( printerName.toUtf8(), 0l, num_dests, dests ); if ( !dest ) @@ -114,15 +114,15 @@ bool CUPSPrint::getPrinterInfo ( const QString& printerName, QString& info, bool CUPSPrint::setCurrentPrinter ( QString prn ) { currentPrinter=prn; - QString fl=cupsGetPPD ( prn.toAscii() ); + QString fl=cupsGetPPD ( prn.toUtf8() ); if ( fl.length() <=0 ) return false; if ( ppd ) ppdClose ( ppd ); ppd=0l; - ppd=ppdOpenFile ( fl.toAscii() ); - unlink ( fl.toAscii() ); + ppd=ppdOpenFile ( fl.toUtf8() ); + unlink ( fl.toUtf8() ); if ( ppd==0l ) return false; ppdMarkDefaults ( ppd ); @@ -141,10 +141,10 @@ bool CUPSPrint::getOptionValue ( const QString& option, { if ( !ppd ) return false; - ppd_choice_t* choice=ppdFindMarkedChoice ( ppd,option.toAscii() ); + ppd_choice_t* choice=ppdFindMarkedChoice ( ppd,option.toUtf8() ); if ( !choice ) { - ppd_option_t* opt=ppdFindOption ( ppd,option.toAscii() ); + ppd_option_t* opt=ppdFindOption ( ppd,option.toUtf8() ); if ( !opt ) return false; choice=ppdFindChoice ( opt,opt->defchoice ); @@ -168,7 +168,7 @@ int CUPSPrint::getOptionValues ( const QString& option, int cur_val=-1; values.clear(); descriptions.clear(); - ppd_option_t* opt=ppdFindOption ( ppd,option.toAscii() ); + ppd_option_t* opt=ppdFindOption ( ppd,option.toUtf8() ); if ( !opt ) return -1; for ( int k=0;k<opt->num_choices;++k ) @@ -241,7 +241,7 @@ bool CUPSPrint::setValue ( const QString& option, const QString& value, QString valueBefore, textBefore; if ( !getOptionValue ( option,valueBefore,textBefore ) ) return false; - ppdMarkOption ( ppd,option.toAscii(),value.toAscii() ); + ppdMarkOption ( ppd,option.toUtf8(),value.toUtf8() ); if ( conflictsBefore==ppdConflicts ( ppd ) ) { @@ -281,7 +281,7 @@ bool CUPSPrint::setValue ( const QString& option, const QString& value, //set previous value - ppdMarkOption ( ppd,option.toAscii(),valueBefore.toAscii() ); + ppdMarkOption ( ppd,option.toUtf8(),valueBefore.toUtf8() ); return false; } @@ -290,7 +290,7 @@ bool CUPSPrint::getOptionText ( const QString& option, QString& text ) { if ( !ppd ) return false; - ppd_option_t* opt=ppdFindOption ( ppd,option .toAscii() ); + ppd_option_t* opt=ppdFindOption ( ppd,option .toUtf8() ); if ( !opt ) return false; text=QString::fromLocal8Bit ( opt->text ); @@ -355,7 +355,7 @@ void CUPSPrint::loadUserOptions() for ( int i=0;i<options.size();++i ) { QStringList opt=options[i].split ( "=" ); - ppdMarkOption ( ppd,opt[0].toAscii(),opt[1].toAscii() ); + ppdMarkOption ( ppd,opt[0].toUtf8(),opt[1].toUtf8() ); } } @@ -381,14 +381,14 @@ void CUPSPrint::print ( const QString& file, QString title ) if ( val!=option->defchoice ) { num_options = cupsAddOption ( option->keyword, - val.toAscii(), + val.toUtf8(), num_options, &options ); } } } - cupsPrintFile ( currentPrinter.toAscii(),file.toAscii(), - title.toAscii(), num_options,options ); + cupsPrintFile ( currentPrinter.toUtf8(),file.toUtf8(), + title.toUtf8(), num_options,options ); cupsFreeOptions ( num_options, options ); } #endif diff --git a/src/cupsprintersettingsdialog.cpp b/src/cupsprintersettingsdialog.cpp index 6219567..9874f2f 100644 --- a/src/cupsprintersettingsdialog.cpp +++ b/src/cupsprintersettingsdialog.cpp @@ -27,7 +27,7 @@ CUPSPrinterSettingsDialog::CUPSPrinterSettingsDialog ( QString prnName, CUPSPrint* cupsObject, QWidget * parent, - Qt::WFlags flags + Qt::WindowFlags flags ) :QDialog ( parent, flags ) { m_cups=cupsObject; diff --git a/src/cupsprintersettingsdialog.h b/src/cupsprintersettingsdialog.h index 2b676c9..14fbe07 100644 --- a/src/cupsprintersettingsdialog.h +++ b/src/cupsprintersettingsdialog.h @@ -34,7 +34,7 @@ class CUPSPrinterSettingsDialog : public QDialog CUPSPrinterSettingsDialog ( QString prnName, CUPSPrint* cupsObject, QWidget * parent=0l, - Qt::WFlags flags =0 ); + Qt::WindowFlags flags =0 ); ~CUPSPrinterSettingsDialog(); private: CUPSPrint* m_cups; diff --git a/src/editconnectiondialog.cpp b/src/editconnectiondialog.cpp index 6301def..1a1f513 100644 --- a/src/editconnectiondialog.cpp +++ b/src/editconnectiondialog.cpp @@ -30,7 +30,7 @@ #include "mediawidget.h" EditConnectionDialog::EditConnectionDialog ( bool newSession, QString id, QWidget * par, - int ind,Qt::WFlags f ) + int ind,Qt::WindowFlags f ) : QDialog ( par,f ) { QVBoxLayout* ml=new QVBoxLayout ( this ); diff --git a/src/editconnectiondialog.h b/src/editconnectiondialog.h index 43448fd..ee8f95a 100644 --- a/src/editconnectiondialog.h +++ b/src/editconnectiondialog.h @@ -49,7 +49,7 @@ class EditConnectionDialog : public QDialog Q_OBJECT public: EditConnectionDialog ( bool newSession, QString id, QWidget * par, int ind=0, - Qt::WFlags f = 0 ); + Qt::WindowFlags f = 0 ); ~EditConnectionDialog(); private: QTabWidget *fr; diff --git a/src/exportdialog.cpp b/src/exportdialog.cpp index 5820c23..ad95beb 100644 --- a/src/exportdialog.cpp +++ b/src/exportdialog.cpp @@ -32,7 +32,7 @@ #include <QFileDialog> #include "sessionexplorer.h" -ExportDialog::ExportDialog ( QString sid,QWidget * par, Qt::WFlags f ) +ExportDialog::ExportDialog ( QString sid,QWidget * par, Qt::WindowFlags f ) : QDialog ( par,f ) { sessionId=sid; diff --git a/src/exportdialog.h b/src/exportdialog.h index 3a9e667..b971fe9 100644 --- a/src/exportdialog.h +++ b/src/exportdialog.h @@ -33,7 +33,7 @@ class ExportDialog : public QDialog { Q_OBJECT public: - ExportDialog(QString sid,QWidget * par, Qt::WFlags f = 0); + ExportDialog(QString sid,QWidget * par, Qt::WindowFlags f = 0); ~ExportDialog(); QString getExport(){return directory;} diff --git a/src/httpbrokerclient.cpp b/src/httpbrokerclient.cpp index 2a1c43c..bcb7ef7 100644 --- a/src/httpbrokerclient.cpp +++ b/src/httpbrokerclient.cpp @@ -598,25 +598,49 @@ void HttpBrokerClient::slotSslErrors ( QNetworkReply* netReply, const QList<QSsl "------------\n"<< tr ( "Issued to:\n" ) << tr ( "Common Name(CN)\t" ) << + #if QT_VERSION >= 0x050000 + cert.issuerInfo ( QSslCertificate::CommonName ).join("; ") + #else cert.issuerInfo ( QSslCertificate::CommonName ) + #endif <<endl<< tr ( "Organization(O)\t" ) << + #if QT_VERSION >= 0x050000 + cert.issuerInfo ( QSslCertificate::Organization ).join("; ") + #else cert.issuerInfo ( QSslCertificate::Organization ) + #endif <<endl<< tr ( "Organizational Unit(OU)\t" ) << + #if QT_VERSION >= 0x050000 + cert.issuerInfo ( QSslCertificate::OrganizationalUnitName ).join("; ") + #else cert.issuerInfo ( QSslCertificate::OrganizationalUnitName ) + #endif <<endl<< tr ( "Serial Number\t" ) <<getHexVal ( cert.serialNumber() ) <<endl<<endl<< tr ( "Issued by:\n" ) << tr ( "Common Name(CN)\t" ) << + #if QT_VERSION >= 0x050000 + cert.subjectInfo ( QSslCertificate::CommonName ).join("; ") + #else cert.subjectInfo ( QSslCertificate::CommonName ) + #endif <<endl<< tr ( "Organization(O)\t" ) << + #if QT_VERSION >= 0x050000 + cert.subjectInfo ( QSslCertificate::Organization ).join("; ") + #else cert.subjectInfo ( QSslCertificate::Organization ) + #endif <<endl<< tr ( "Organizational Unit(OU)\t" ) << + #if QT_VERSION >= 0x050000 + cert.subjectInfo ( QSslCertificate::OrganizationalUnitName ).join("; ") + #else cert.subjectInfo ( QSslCertificate::OrganizationalUnitName ) + #endif <<endl<<endl<< tr ( "Validity:\n" ) << diff --git a/src/imgframe.cpp b/src/imgframe.cpp index 4bca5f8..708de17 100644 --- a/src/imgframe.cpp +++ b/src/imgframe.cpp @@ -20,7 +20,7 @@ #include "x2goclientconfig.h" #include <QResizeEvent> -IMGFrame::IMGFrame(QImage* ,QWidget* parent, Qt::WFlags f) :QFrame(parent,f) +IMGFrame::IMGFrame(QImage* ,QWidget* parent, Qt::WindowFlags f) :QFrame(parent,f) { //setBg(img); } diff --git a/src/imgframe.h b/src/imgframe.h index d894059..1da2fac 100644 --- a/src/imgframe.h +++ b/src/imgframe.h @@ -31,7 +31,7 @@ class IMGFrame : public QFrame { Q_OBJECT public: - IMGFrame(QImage* img,QWidget* parent=0, Qt::WFlags f=0); + IMGFrame(QImage* img,QWidget* parent=0, Qt::WindowFlags f=0); ~IMGFrame(); void setBg(QImage* img); virtual void resizeEvent(QResizeEvent* event); diff --git a/src/ongetpass.cpp b/src/ongetpass.cpp index 932db73..fd53a67 100644 --- a/src/ongetpass.cpp +++ b/src/ongetpass.cpp @@ -35,7 +35,9 @@ #include <signal.h> #endif +#if QT_VERSION < 0x050000 #include <QPlastiqueStyle> +#endif #include <QMessageBox> #include <iostream> #include <QFile> @@ -50,10 +52,12 @@ int x2goMain ( int argc, char *argv[] ) QApplication app ( argc,argv ); #ifndef Q_WS_HILDON +#if QT_VERSION < 0x050000 #ifdef Q_OS_LINUX app.setStyle ( new QPlastiqueStyle() ); #endif #endif +#endif QStringList args; if ( argc > 1 ) args=app.arguments(); diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index be4de32..19f081f 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -510,7 +510,7 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent ) connect( xineramaTimer, SIGNAL(timeout()), this, SLOT(slotConfigXinerama())); x2goInfof(3)<<tr("Started X2Go Client."); - x2goDebug<<"$HOME=" + homeDir.toAscii(); + x2goDebug<<"$HOME=" + homeDir.toUtf8(); if (thinMode) { x2goDebug<<"Thin Mode is active."; @@ -589,11 +589,11 @@ bool ONMainWindow::get_translator (QString file_name_start, QTranslator **transl #if QT_VERSION < 0x040800 if (tmp_translator->load (filename)) { *translator = tmp_translator; - x2goInfof (4) << tr ("Translator: ") + filename.toAscii () + tr (" found."); + x2goInfof (4) << tr ("Translator: ") + filename.toUtf8 () + tr (" found."); return (true); } else { - x2goWarningf (1) << tr ("Can't load translator: ") + filename.toAscii (); + x2goWarningf (1) << tr ("Can't load translator: ") + filename.toUtf8 (); return (false); } #else /* QT_VERSION < 0x040800 */ @@ -617,13 +617,13 @@ bool ONMainWindow::get_translator (QString file_name_start, QTranslator **transl if (tmp_translator->load (load_filename)) { /* Some translation successfully loaded. That's good enough. */ - x2goInfof (4) << tr ("Translator: ") + load_filename.toAscii () + tr (" found."); + x2goInfof (4) << tr ("Translator: ") + load_filename.toUtf8 () + tr (" found."); translator_found = true; *translator = tmp_translator; break; } else { - x2goWarningf (1) << tr ("Non-fatal: can't load translator: ") + load_filename.toAscii (); + x2goWarningf (1) << tr ("Non-fatal: can't load translator: ") + load_filename.toUtf8 (); x2goWarningf (1) << tr ("Trying to load language with lower preference, if existent."); } } @@ -2787,11 +2787,11 @@ SshMasterConnection* ONMainWindow::startSshConnection ( QString host, QString po #ifndef Q_OS_WIN QStringList args=sshEnv[i].split ( "=" ); x2goDebug<<"Setting ENV " + args[0] + tr(" to ") + args[1]; - setenv ( args[0].toAscii(),args[1].toAscii(),1 ); + setenv ( args[0].toUtf8(),args[1].toUtf8(),1 ); #else x2goDebug<<"Set ENV: "<<sshEnv[i]; - _putenv ( sshEnv[i].toAscii() ); + _putenv ( sshEnv[i].toUtf8() ); #endif } @@ -3566,7 +3566,7 @@ void ONMainWindow::slotListSessions ( bool result,QString output, } else { - QString printout = tr( "Connection failed: ") + output.toAscii(); + QString printout = tr( "Connection failed: ") + output.toUtf8(); if ( output.indexOf ( "publickey,password" ) !=-1 ) x2goErrorf(4)<< tr( "Connection failed: ") + output + tr(" - Wrong password."); @@ -6709,7 +6709,7 @@ void ONMainWindow::slotReadApplications(bool result, QString output, QString line=lines[i]; if (line.indexOf("Name["+localshort+"]=")!=-1 || line.indexOf("Name["+locallong+"]=")!=-1) { - app.name=QString::fromUtf8(line.split("=")[1].toAscii()); + app.name=QString::fromUtf8(line.split("=")[1].toUtf8()); // x2goDebug<<"local name: "<<app.name<<endl; @@ -6717,7 +6717,7 @@ void ONMainWindow::slotReadApplications(bool result, QString output, } if (line.indexOf("Comment["+localshort+"]=")!=-1 || line.indexOf("Comment["+locallong+"]=")!=-1) { - app.comment=QString::fromUtf8(line.split("=")[1].toAscii()); + app.comment=QString::fromUtf8(line.split("=")[1].toUtf8()); // x2goDebug<<"local comment: "<<app.comment<<endl; localcomment=true; } @@ -6780,9 +6780,9 @@ void ONMainWindow::slotReadApplications(bool result, QString output, QByteArray pic; while (line.indexOf("</icon>")==-1) { - pic+=QByteArray::fromBase64(line.toAscii()); + pic+=QByteArray::fromBase64(line.toUtf8()); line=lines[++i]; - if (QString(QByteArray::fromBase64(line.toAscii())).indexOf("</svg>",Qt::CaseInsensitive)!=-1) + if (QString(QByteArray::fromBase64(line.toUtf8())).indexOf("</svg>",Qt::CaseInsensitive)!=-1) { isSvg=true; } @@ -8071,7 +8071,7 @@ void ONMainWindow::slotCopyKey ( bool result, QString output, int pid) } else { - QString printout = tr( "Connection failed: ") + output.toAscii(); + QString printout = tr( "Connection failed: ") + output.toUtf8(); if ( output.indexOf ( "publickey,password" ) !=-1 ) x2goErrorf(11)<< tr( "Connection failed: ") + output + tr(" - Wrong password."); @@ -11904,7 +11904,7 @@ void ONMainWindow::printSshDError_noHostPubKey() "<ul>" "<li>Open a <b>Terminal Window</b> (Applications -> Utilities -> Terminal)</li>" - "<li>Run this command: <b>ssh -p " + clientSshPort.toAscii () + "<li>Run this command: <b>ssh -p " + clientSshPort.toUtf8 () + " localhost</b></li>" "<li>You do not need to login. Just quit the Terminal application " "via Cmd + Q</li>" @@ -12392,13 +12392,13 @@ void ONMainWindow::doPluginInit() QString path=getenv ( "PATH" ); path=clientDir+":"+pluginDir+":"+path; - setenv ( "PATH",path.toAscii (),1 ); + setenv ( "PATH",path.toUtf8 (),1 ); path=getenv ( "LD_LIBRARY_PATH" ); path=clientDir+":"+pluginDir+":"+path; - setenv ( "LD_LIBRARY_PATH",path.toAscii () ,1 ); + setenv ( "LD_LIBRARY_PATH",path.toUtf8 () ,1 ); - setenv ( "X2GO_LIB",clientDir.toAscii () ,1 ); + setenv ( "X2GO_LIB",clientDir.toUtf8 () ,1 ); QFile::setPermissions ( clientDir+"/x2goclient", diff --git a/src/onmainwindow_privat.h b/src/onmainwindow_privat.h index 3a0f087..d36e4be 100644 --- a/src/onmainwindow_privat.h +++ b/src/onmainwindow_privat.h @@ -67,10 +67,14 @@ #include <QCheckBox> #include <QTemporaryFile> #include <QFileDialog> +#if QT_VERSION < 0x050000 #include <QHttp> +#endif #include <QUrl> #include <QLocalSocket> +#if QT_VERSION < 0x050000 #include <QPlastiqueStyle> +#endif #include "imgframe.h" #include <QToolTip> #include "clicklineedit.h" @@ -149,7 +153,11 @@ #endif #ifdef Q_OS_LINUX +#if QT_VERSION < 0x050000 #include <QX11Info> +#else +#include <QtX11Extras/QX11Info> +#endif #include <X11/Xlib.h> #include <X11/Xutil.h> #endif diff --git a/src/sessionbutton.cpp b/src/sessionbutton.cpp index 92771fb..710a9dd 100644 --- a/src/sessionbutton.cpp +++ b/src/sessionbutton.cpp @@ -322,13 +322,13 @@ void SessionButton::redraw() sessIcon = expandHome(sessIcon); QPixmap* pix; - x2goDebug << "Creating QPixmap with session icon: " << sessIcon.toAscii () << "."; + x2goDebug << "Creating QPixmap with session icon: " << sessIcon.toUtf8 () << "."; if (!par->brokerMode || sessIcon == ":/img/icons/128x128/x2gosession.png") pix=new QPixmap( sessIcon ); else { pix=new QPixmap; - pix->loadFromData(QByteArray::fromBase64(sessIcon.toAscii())); + pix->loadFromData(QByteArray::fromBase64(sessIcon.toUtf8())); } if ( !par->retMiniMode() ) icon->setPixmap ( pix->scaled ( 64,64,Qt::IgnoreAspectRatio, diff --git a/src/sessionexplorer.cpp b/src/sessionexplorer.cpp index 219234f..973d8bf 100644 --- a/src/sessionexplorer.cpp +++ b/src/sessionexplorer.cpp @@ -189,8 +189,13 @@ void SessionExplorer::slotCreateDesktopIcon ( SessionButton* bt ) #ifndef Q_OS_WIN QFile file ( +#if QT_VERSION < 0x050000 QDesktopServices::storageLocation ( QDesktopServices::DesktopLocation ) +"/"+name+".desktop" ); +#else + QStandardPaths::writableLocation( + QStandardPaths::DesktopLocation) +"/"+name+".desktop" ); +#endif if ( !file.open ( QIODevice::WriteOnly | QIODevice::Text ) ) return; diff --git a/src/sessionmanagedialog.cpp b/src/sessionmanagedialog.cpp index 8b39316..0f7d44b 100644 --- a/src/sessionmanagedialog.cpp +++ b/src/sessionmanagedialog.cpp @@ -35,7 +35,7 @@ #define SESSIONIDROLE Qt::UserRole+2 SessionManageDialog::SessionManageDialog ( QWidget * parent, - bool onlyCreateIcon, Qt::WFlags f ) + bool onlyCreateIcon, Qt::WindowFlags f ) : QDialog ( parent, f ) { QVBoxLayout* ml=new QVBoxLayout ( this ); diff --git a/src/sessionmanagedialog.h b/src/sessionmanagedialog.h index 0428797..3ce7cd7 100644 --- a/src/sessionmanagedialog.h +++ b/src/sessionmanagedialog.h @@ -35,7 +35,7 @@ class SessionManageDialog : public QDialog public: SessionManageDialog ( QWidget * parent, bool onlyCreateIcon=false, - Qt::WFlags f=0 ); + Qt::WindowFlags f=0 ); ~SessionManageDialog(); void loadSessions(); private: diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp index bb69047..cd07806 100644 --- a/src/sshmasterconnection.cpp +++ b/src/sshmasterconnection.cpp @@ -99,7 +99,7 @@ void SshMasterConnection::parseKnownHosts() QString keyName=type+"@"+port+":"+hostParts[0]; - QByteArray bytes=QByteArray::fromBase64(parts[2].toAscii()); + QByteArray bytes=QByteArray::fromBase64(parts[2].toUtf8()); QStringList fields; //key is a set of data fields: @@ -332,10 +332,10 @@ void SshMasterConnection::checkReverseTunnelConnections() x2goDebug<<"Connecting to "<<req.localHost<<":"<<req.localPort<<endl; #endif #ifndef Q_OS_WIN - inet_aton ( req.localHost.toAscii(), &address.sin_addr ); + inet_aton ( req.localHost.toUtf8(), &address.sin_addr ); #else address.sin_addr.s_addr=inet_addr ( - req.localHost.toAscii() ); + req.localHost.toUtf8() ); #endif if ( ::connect ( sock, ( struct sockaddr * ) &address,sizeof ( address ) ) !=0 ) @@ -639,7 +639,7 @@ void SshMasterConnection::run() #ifdef Q_OS_WIN ssh_options_set ( my_ssh_session, SSH_OPTIONS_USER, user.toLocal8Bit() ); #else - ssh_options_set ( my_ssh_session, SSH_OPTIONS_USER, user.toAscii() ); + ssh_options_set ( my_ssh_session, SSH_OPTIONS_USER, user.toUtf8() ); #endif #ifdef Q_OS_WIN @@ -876,7 +876,7 @@ bool SshMasterConnection::userChallengeAuth() #ifdef DEBUG x2goDebug<<"Password request"<<endl; #endif - ssh_userauth_kbdint_setanswer(my_ssh_session,0,pass.toAscii()); + ssh_userauth_kbdint_setanswer(my_ssh_session,0,pass.toUtf8()); return userChallengeAuth(); } @@ -920,7 +920,7 @@ bool SshMasterConnection::userChallengeAuth() return false; } } - ssh_userauth_kbdint_setanswer(my_ssh_session,0,challengeAuthVerificationCode.toAscii()); + ssh_userauth_kbdint_setanswer(my_ssh_session,0,challengeAuthVerificationCode.toUtf8()); return userChallengeAuth(); } QString err=ssh_get_error ( my_ssh_session ); @@ -992,7 +992,7 @@ bool SshMasterConnection::userAuthWithPass() #ifdef DEBUG x2goDebug<<"Password authentication requested."<<endl; #endif - int rc = ssh_userauth_password ( my_ssh_session, NULL, pass.toAscii() ); + int rc = ssh_userauth_password ( my_ssh_session, NULL, pass.toUtf8() ); if ( rc != SSH_AUTH_SUCCESS ) { QString err=ssh_get_error ( my_ssh_session ); @@ -1031,7 +1031,7 @@ bool SshMasterConnection::userAuthAuto() } if(keyPhrase==QString::null) break; - rc = ssh_userauth_autopubkey ( my_ssh_session, keyPhrase.toAscii() ); + rc = ssh_userauth_autopubkey ( my_ssh_session, keyPhrase.toUtf8() ); if(i++==2) { break; @@ -1084,7 +1084,7 @@ bool SshMasterConnection::userAuthWithKey() #endif } - ssh_private_key prkey=privatekey_from_file(my_ssh_session, keyName.toAscii(), 0,""); + ssh_private_key prkey=privatekey_from_file(my_ssh_session, keyName.toUtf8(), 0,""); int i=0; while(!prkey) { @@ -1103,7 +1103,7 @@ bool SshMasterConnection::userAuthWithKey() } if(keyPhrase==QString::null) break; - prkey=privatekey_from_file(my_ssh_session, keyName.toAscii(), 0,keyPhrase.toAscii()); + prkey=privatekey_from_file(my_ssh_session, keyName.toUtf8(), 0,keyPhrase.toUtf8()); if(i++==2) { break; @@ -1135,8 +1135,8 @@ bool SshMasterConnection::userAuthWithKey() //not implemented before libssh 0.5 /* int rc = ssh_userauth_privatekey_file ( my_ssh_session,NULL, - keyName.toAscii(), - pass.toAscii() );*/ + keyName.toUtf8(), + pass.toUtf8() );*/ int rc=ssh_userauth_pubkey(my_ssh_session, NULL, pubkeyStr, prkey); privatekey_free(prkey); @@ -1342,7 +1342,7 @@ void SshMasterConnection::copy() #ifdef DEBUG x2goDebug<<"SSH Master Connection copy - dst path:"<<dstPath<<" file:"<<dstFile<<endl; #endif - ssh_scp scp=ssh_scp_new ( my_ssh_session, SSH_SCP_WRITE|SSH_SCP_RECURSIVE, dstPath.toAscii() ); + ssh_scp scp=ssh_scp_new ( my_ssh_session, SSH_SCP_WRITE|SSH_SCP_RECURSIVE, dstPath.toUtf8() ); if ( scp == NULL ) { #ifdef DEBUG @@ -1371,7 +1371,7 @@ void SshMasterConnection::copy() } QByteArray arr=file.readAll(); file.close(); - rc=ssh_scp_push_file ( scp,dstFile.toAscii(),arr.size(), 0600 ); + rc=ssh_scp_push_file ( scp,dstFile.toUtf8(),arr.size(), 0600 ); if ( rc != SSH_OK ) { QString errMsg=tr ( "Cannot create remote file " ) +copyRequests[i].dst; @@ -1514,9 +1514,9 @@ void SshMasterConnection::channelLoop() x2goDebug<<"Forwarding new channel, local port: "<<channelConnections.at ( i ).localPort<<endl; #endif if ( channel_open_forward ( channel, - channelConnections.at ( i ).forwardHost.toAscii(), + channelConnections.at ( i ).forwardHost.toUtf8(), channelConnections.at ( i ).forwardPort, - channelConnections.at ( i ).localHost.toAscii(), + channelConnections.at ( i ).localHost.toUtf8(), channelConnections.at ( i ).localPort ) != SSH_OK ) { QString err=ssh_get_error ( my_ssh_session ); @@ -1547,7 +1547,7 @@ void SshMasterConnection::channelLoop() x2goDebug<<errorMsg<<": "<<err<<endl; #endif } - else if ( channel_request_exec ( channel, channelConnections[i].command.toAscii() ) != SSH_OK ) + else if ( channel_request_exec ( channel, channelConnections[i].command.toUtf8() ) != SSH_OK ) { QString err=ssh_get_error ( my_ssh_session ); QString errorMsg=tr ( "channel_request_exec failed" ); diff --git a/x2goclient.pro b/x2goclient.pro index 07290ab..febffb9 100644 --- a/x2goclient.pro +++ b/x2goclient.pro @@ -234,6 +234,7 @@ win32-* { CONFIG += static release } QT += svg network +greaterThan(QT_MAJOR_VERSION, 4): QT += x11extras QMAKE_CXXFLAGS_DEBUG -= -g QMAKE_CXXFLAGS_DEBUG += -O2 -g3 -ggdb3 -gdwarf-4
_______________________________________________ x2go-dev mailing list x2go-dev@lists.x2go.org http://lists.x2go.org/listinfo/x2go-dev