Subject: [PATCH] x2goclient: Replace deprecated uses of QString::null

From: Nico Roeser <[email-masked]>
Date: Tue, 15 Aug 2023 19:20:35 +0200

Package: x2goclient
Version: 4.1.2.3
Tag: patch

Related to: #864

On one of my Gentoo systems, x2goclient-4.1.2.3 did not build against qtcore-5.15.10. The attached patch changes deprecated occurrences of QString::null into isEmpty calls or construction of new null QStrings, which fixes the build problems.

I have not verified whether everything still functions perfectly. However, the change follows the Qt recommendations, and looks good to me when peeking at the QString documentation. I know that there still are strange constructions in the code, which I have not changed. Reason is that I tried the change to be as minimal as possible.

I do not intend to invest more time/work in this in the nearer future; if this patch is not sufficient, I hope someone else can pick it up and continue from there. Or just throw it away. ☺ Happy coding!

Attachment: 0001-x2goclient-Replace-deprecated-uses-of-QString-null.patch

Thanks
-- 
Nico
>From dbab3da14664cba75c6a8dddaa85ad74185a0ed0 Mon Sep 17 00:00:00 2001
From: Nico Roeser <[email-masked]>
Date: Tue, 15 Aug 2023 19:07:58 +0200
Subject: [PATCH] x2goclient: Replace deprecated uses of QString::null

---
 src/SVGFrame.cpp            |   2 +-
 src/brokerpassdlg.cpp       |   4 +-
 src/configdialog.cpp        |  16 ++---
 src/exportdialog.cpp        |   6 +-
 src/folderexplorer.cpp      |   2 +-
 src/httpbrokerclient.cpp    |   4 +-
 src/onmainwindow.cpp        | 128 ++++++++++++++++++------------------
 src/onmainwindow.h          |   6 +-
 src/printprocess.cpp        |   2 +-
 src/sessionbutton.cpp       |  10 +--
 src/sessionwidget.cpp       |  20 +++---
 src/sharewidget.cpp         |   8 +--
 src/sshmasterconnection.cpp |  20 +++---
 src/sshmasterconnection.h   |   4 +-
 src/sshprocess.cpp          |   2 +-
 src/wapi.cpp                |  18 ++---
 16 files changed, 126 insertions(+), 126 deletions(-)

diff --git a/src/SVGFrame.cpp b/src/SVGFrame.cpp
index 4181e3b..d06808c 100644
--- a/src/SVGFrame.cpp
+++ b/src/SVGFrame.cpp
@@ -33,7 +33,7 @@ SVGFrame::SVGFrame ( QString fname,bool st,QWidget* parent,
 #ifdef Q_OS_WIN
 	parentWidget=0;
 #endif
-	if ( fname==QString::null )
+	if ( fname.isEmpty() )
 		empty=true;
 	if ( !empty )
 	{
diff --git a/src/brokerpassdlg.cpp b/src/brokerpassdlg.cpp
index a92f803..1a1bd31 100644
--- a/src/brokerpassdlg.cpp
+++ b/src/brokerpassdlg.cpp
@@ -21,7 +21,7 @@
 BrokerPassDlg::BrokerPassDlg(QWidget* parent, Qt::WindowFlags f): QDialog(parent, f)
 {
     setupUi(this);
-    statusLabel->setText(QString::null);
+    statusLabel->setText(QString());
     buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
 }
 
@@ -41,7 +41,7 @@ void BrokerPassDlg::slotPassChanged()
     else
     {
         passEq=true;
-        statusLabel->setText(QString::null);
+        statusLabel->setText(QString());
     }
     buttonBox->button(QDialogButtonBox::Ok)->setEnabled(passEq &&
             lePass1->text().size()>0 &&
diff --git a/src/configdialog.cpp b/src/configdialog.cpp
index 6260cbf..66f8390 100644
--- a/src/configdialog.cpp
+++ b/src/configdialog.cpp
@@ -208,7 +208,7 @@ ConfigDialog::ConfigDialog ( QWidget * parent,  Qt::WindowFlags f )
     pbOpenExec=new QPushButton (
         QIcon ( ( ( ONMainWindow* ) parent )->iconsPath (
                     "/32x32/file-open.png" ) ),
-        QString::null,xgb );
+        QString(),xgb );
     xLay->addWidget ( new QLabel ( tr ( "X11 application:" ) ),0,0 );
 
     leCmdOpt=new QLineEdit ( xgb );
@@ -259,11 +259,11 @@ ConfigDialog::ConfigDialog ( QWidget * parent,  Qt::WindowFlags f )
                                           ( ONMainWindow* ) parent )->
                                       getShowAdvOption() );
         advOptionsShown=false;
-        conWidg=new ConnectionWidget ( QString::null,
+        conWidg=new ConnectionWidget ( QString(),
                                        ( ONMainWindow* ) parent,this );
-        setWidg=new SettingsWidget ( QString::null,
+        setWidg=new SettingsWidget ( QString(),
                                      ( ONMainWindow* ) parent,this );
-        mediaWidget=new MediaWidget ( QString::null,
+        mediaWidget=new MediaWidget ( QString(),
                                      ( ONMainWindow* ) parent,this );
         conWidg->hide();
         setWidg->hide();
@@ -421,17 +421,17 @@ void ConfigDialog::slot_checkOkStat()
 #ifdef Q_OS_WIN
 QString ConfigDialog::getCygwinDir ( const QString& dir )
 {
-    QString cygdir=QString::null;
+    QString cygdir=QString();
     QSettings lu_st ( "HKEY_CURRENT_USER\\Software"
                       "\\Cygnus Solutions\\Cygwin\\mounts v2\\"+
                       dir,QSettings::NativeFormat );
-    cygdir=lu_st.value ( "native", ( QVariant ) QString::null ).toString();
-    if ( cygdir!= QString::null )
+    cygdir=lu_st.value ( "native", ( QVariant ) QString() ).toString();
+    if ( !cygdir.isEmpty() )
         return cygdir;
     QSettings lm_st ( "HKEY_LOCAL_MACHINE\\SOFTWARE"
                       "\\Cygnus Solutions\\Cygwin\\mounts v2\\"+
                       dir,QSettings::NativeFormat );
-    return lm_st.value ( "native", ( QVariant ) QString::null ).toString();
+    return lm_st.value ( "native", ( QVariant ) QString() ).toString();
 }
 #endif
 
diff --git a/src/exportdialog.cpp b/src/exportdialog.cpp
index ccabd68..d3594a6 100644
--- a/src/exportdialog.cpp
+++ b/src/exportdialog.cpp
@@ -108,7 +108,7 @@ void ExportDialog::loadSessions()

     QString exports=st.setting()->value ( sessionId+"/export",
-                                          ( QVariant ) QString::null ).toString();
+                                          ( QVariant ) QString() ).toString();
 
     QStringList lst=exports.split ( ";",QString::SkipEmptyParts );
     for ( int i=0; i<lst.size(); ++i )
@@ -145,13 +145,13 @@ void ExportDialog::slot_dclicked ( const QModelIndex& )
 
 void ExportDialog::slotNew()
 {
-    directory=QString::null;
+    directory=QString();
     directory= QFileDialog::getExistingDirectory (
                    this,
                    tr ( "Select folder" ),
                    QDir::homePath() );
 
-    if ( directory!=QString::null )
+    if ( !directory.isEmpty() )
         accept();
 
 }
diff --git a/src/folderexplorer.cpp b/src/folderexplorer.cpp
index 41d68d7..20bc067 100644
--- a/src/folderexplorer.cpp
+++ b/src/folderexplorer.cpp
@@ -99,7 +99,7 @@ void FolderExplorer::slotChangeIcon()
                       tr ( "Open picture" ),
                       QDir::homePath(),
                       tr ( "Pictures" ) +" (*.png *.xpm *.jpg)" );
-    if ( path!=QString::null )
+    if ( !path.isEmpty() )
     {
         explorer->setFolderIcon(menuItem->data(0, Qt::UserRole).toString(), path);
         menuItem->setIcon(0, QIcon(path));
diff --git a/src/httpbrokerclient.cpp b/src/httpbrokerclient.cpp
index fda4cf3..ea41d93 100644
--- a/src/httpbrokerclient.cpp
+++ b/src/httpbrokerclient.cpp
@@ -294,7 +294,7 @@ void HttpBrokerClient::getUserSessions()
     x2goDebug<<"Called getUserSessions: brokeruser: "<<brokerUser<<" authid: "<<nextAuthId;
     if(mainWindow->getUsePGPCard())
         brokerUser=mainWindow->getCardLogin();
-    config->sessiondata=QString::null;
+    config->sessiondata=QString();
     if(!sshBroker)
     {
         QString req;
@@ -920,7 +920,7 @@ void HttpBrokerClient::slotSslErrors ( QNetworkReply* netReply, const QList<QSsl
                "not used to seeing a warning for this server.</p>" );
     QMessageBox mb ( QMessageBox::Warning,tr ( "Secure connection failed." ),
                      text );
-    text=QString::null;
+    text=QString();
     QTextStream ( &text ) <<err.join ( "\n" ) <<"\n"<<
                           "------------\n"<<
                           tr ( "Issued to:\n" ) <<
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp
index b66ec92..b067423 100644
--- a/src/onmainwindow.cpp
+++ b/src/onmainwindow.cpp
@@ -212,7 +212,7 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent )
     bBrokerLogout = NULL;
     restartResume=false;
     isPassShown=true;
-    readExportsFrom=QString::null;
+    readExportsFrom=QString();
     spoolTimer=0l;
     brokerAliveTimer=0l;
     brokerSyncTimer=0l;
@@ -361,7 +361,7 @@ void ONMainWindow::initUI()
         useLdap=false;
     }
 
-    if ( readExportsFrom!=QString::null )
+    if ( !readExportsFrom.isEmpty() )
     {
         exportTimer=new QTimer ( this );
         connect ( exportTimer,SIGNAL ( timeout() ),this,
@@ -397,7 +397,7 @@ void ONMainWindow::initUI()
     }

-    //fr=new SVGFrame(QString::null,true,this);
+    //fr=new SVGFrame(QString(),true,this);
     fr=new IMGFrame ( ( QImage* ) 0l,this );
     setCentralWidget ( fr );
 
@@ -505,7 +505,7 @@ void ONMainWindow::initUI()
         QIcon ( iconsPath ( "/32x32/edit_settings.png" ) ),
         tr ( "&Settings ..." ),this );
 
-    if (supportMenuFile!=QString::null)
+    if (!supportMenuFile.isEmpty())
     {
         act_support=new QAction ( tr ( "Support ..." ),this );
         connect ( act_support,SIGNAL ( triggered ( bool ) ),this,
@@ -991,7 +991,7 @@ void ONMainWindow::initWidgetsNormal()
         }
 
         QMenu* menu_help=menuBar()->addMenu ( tr ( "&Help" ) );
-        if (supportMenuFile!=QString::null)
+        if (!supportMenuFile.isEmpty())
             menu_help->addAction ( act_support );
         menu_help->addAction ( act_abclient );
         menu_help->addAction ( act_abqt );
@@ -1049,7 +1049,7 @@ void ONMainWindow::initWidgetsNormal()
 void ONMainWindow::slotPassChanged(const QString& result)
 {
 
-    if (result==QString::null)
+    if (result.isEmpty())
     {
         QMessageBox::critical(this, tr("Error"),tr("Operation failed"));
     }
@@ -1107,7 +1107,7 @@ void ONMainWindow::slotGetBrokerAuth()
     pass->clear();
     login->clear();
     QString pixFile=iconsPath("/128x128/x2gosession.png");
-    if (SPixFile!=QString::null)
+    if (!SPixFile.isEmpty())
         pixFile=SPixFile;
     QPixmap pix(pixFile);
     if ( !miniMode )
@@ -1353,7 +1353,7 @@ void ONMainWindow::removeAppsFromTray()
 
 QString ONMainWindow::findTheme ( QString /*theme*/ )
 {
-    return QString::null;
+    return QString();
 }
 
 QString ONMainWindow::getKdeIconsPath()
@@ -1727,13 +1727,13 @@ void ONMainWindow::loadSettings()
         ldapPort=st1.setting()->value ( "LDAP/port",
                                         ( QVariant ) 389 ).toInt();
         ldapDn=st1.setting()->value ( "LDAP/basedn",
-                                      ( QVariant ) QString::null ).toString();
+                                      ( QVariant ) QString() ).toString();
         ldapServer1=st1.setting()->value ( "LDAP/server1",
-                                           ( QVariant ) QString::null ).toString();
+                                           ( QVariant ) QString() ).toString();
         ldapPort1=st1.setting()->value ( "LDAP/port1",
                                          ( QVariant ) 0 ).toInt();
         ldapServer2=st1.setting()->value ( "LDAP/server2",
-                                           ( QVariant ) QString::null ).toString();
+                                           ( QVariant ) QString() ).toString();
         ldapPort2=st1.setting()->value ( "LDAP/port2",
                                          ( QVariant ) 0 ).toInt();
     }
@@ -1952,7 +1952,7 @@ void ONMainWindow::slotPassEnter()
         shadowSession=false;
 #if defined ( Q_OS_WIN ) || defined (Q_OS_DARWIN )
     QString disp=getXDisplay();
-    if ( disp==QString::null )
+    if ( disp.isEmpty() )
         return;
 #endif
 #ifdef USELDAP
@@ -2056,7 +2056,7 @@ void ONMainWindow::slotPassEnter()
 
     QString passwd;
     if ( !extLogin )
-        currentKey=QString::null;
+        currentKey=QString();
     QString user=getCurrentUname();
 //      get x2gogetservers not from ldap server, but from first x2goserver
 // 	QString host=ldapServer;
@@ -2370,9 +2370,9 @@ void ONMainWindow::slotReadSessions()
     {
         if (changeBrokerPass)
             act_changeBrokerPass->setEnabled(true);
-        config.key=QString::null;
-        config.user=QString::null;
-        config.sessiondata=QString::null;
+        config.key=QString();
+        config.user=QString();
+        config.sessiondata=QString();
 
         st=new X2goSettings(config.iniFile,QSettings::IniFormat);
         sessionStatusDlg->hide();
@@ -2834,11 +2834,11 @@ void ONMainWindow::slotSelectedFromList ( SessionButton* session )
                     ( QVariant ) tr ( "KDE" ) ).toString();
 
         server=st->setting()->value ( sid+"/host",
-                                      ( QVariant ) QString::null
+                                      ( QVariant ) QString()
                                     ).toString();
         userName=st->setting()->value (
                      sid+"/user",
-                     ( QVariant ) QString::null ).toString();
+                     ( QVariant ) QString() ).toString();
         if (defaultUser && userName.length()<1)
             userName=defaultUserName;
 
@@ -2853,7 +2853,7 @@ void ONMainWindow::slotSelectedFromList ( SessionButton* session )
                     ( QVariant ) defaultSshPort ).toString();
         currentKey=st->setting()->value (
                        sid+"/key",
-                       ( QVariant ) QString::null ).toString();
+                       ( QVariant ) QString() ).toString();
         currentKey=expandHome(currentKey);
 
         autologin=st->setting()->value (
@@ -2972,7 +2972,7 @@ void ONMainWindow::slotSelectedFromList ( SessionButton* session )
         pass->setText(config.brokerPass);
         slotSessEnter();
     }
-    else if ( currentKey != QString::null && currentKey != "" && nopass )
+    else if ( !currentKey.isEmpty() && currentKey != "" && nopass )
     {
         x2goDebug<<"Starting session with key.";
         slotSessEnter();
@@ -3288,12 +3288,12 @@ void ONMainWindow::slotSshServerAuthChallengeResponse(SshMasterConnection* conne
     message = challenge;
 
     QString phrase = QInputDialog::getText (0, connection->getUser () + "@" + connection->getHost () + ":" + QString::number (connection->getPort ()),
-                                            message, QLineEdit::Password, QString::null, &ok);
+                                            message, QLineEdit::Password, QString(), &ok);
     if (!ok) {
-        phrase = QString::null;
+        phrase = QString();
     }
     else {
-        if (phrase == QString::null) {
+        if (phrase.isEmpty()) {
             phrase = "";
         }
     }
@@ -3498,9 +3498,9 @@ void ONMainWindow::slotSessEnter()
         return;
     }
 
-    resumingSession.sessionId=QString::null;
-    resumingSession.server=QString::null;
-    resumingSession.display=QString::null;
+    resumingSession.sessionId=QString();
+    resumingSession.server=QString();
+    resumingSession.display=QString();
     setStatStatus ( tr ( "connecting" ) );
 
     if(brokerMode)
@@ -3512,7 +3512,7 @@ void ONMainWindow::slotSessEnter()
         X2goSettings* st=new X2goSettings(config.iniFile, QSettings::IniFormat);
         QString sid=sessionExplorer->getLastSession()->id();
         QString cmd=st->setting()->value ( sid+"/command",
-                                           ( QVariant ) QString::null ).toString();
+                                           ( QVariant ) QString() ).toString();
         directRDP=(st->setting()->value ( sid+"/directrdp",
                                                ( QVariant ) false ).toBool() && cmd == "RDP");
 
@@ -3555,7 +3555,7 @@ void ONMainWindow::continueNormalSession()
 
     if (brokerMode && !shadowSession)
     {
-        slotListSessions(true,QString::null,0);
+        slotListSessions(true,QString(),0);
         return;
     }
     if ( !shadowSession )
@@ -3825,7 +3825,7 @@ QString ONMainWindow::findSshKeyForServer(QString user, QString server, QString
         if(key.server.length()<=0 && key.user.length()<=0 && key.port.length()<=0)
             return key.key;
     }
-    return QString::null;
+    return QString();
 }

@@ -3868,7 +3868,7 @@ bool ONMainWindow::startSession ( const QString& sid, CONTYPE conType )
 
     if ( managedMode )
     {
-        slotListSessions ( true, QString::null,0 );
+        slotListSessions ( true, QString(),0 );
         return true;
     }
 
@@ -3914,11 +3914,11 @@ bool ONMainWindow::startSession ( const QString& sid, CONTYPE conType )
     else
     {
         host=st->setting()->value ( sid+"/host",
-                                    ( QVariant ) QString::null ).toString();
+                                    ( QVariant ) QString() ).toString();
     }
 
     QString cmd=st->setting()->value ( sid+"/command",
-                                       ( QVariant ) QString::null ).toString();
+                                       ( QVariant ) QString() ).toString();
     autologin=st->setting()->value ( sid+"/autologin",
                                      ( QVariant ) false ).toBool();
     krblogin=st->setting()->value ( sid+"/krblogin",
@@ -4054,7 +4054,7 @@ bool ONMainWindow::startSession ( const QString& sid, CONTYPE conType )
                 proxypassword=config.brokerPass;
             else
                 proxypassword=QInputDialog::getText(0,proxylogin+"@"+proxyserver+":"+QString::number(proxyport),
-                                                    tr("Enter password for SSH proxy"),QLineEdit::Password,QString::null, &ok);
+                                                    tr("Enter password for SSH proxy"),QLineEdit::Password,QString(), &ok);
         }
     }
 
@@ -4101,7 +4101,7 @@ void ONMainWindow::slotListSessions ( bool result,QString output,
         }

-// 		currentKey=QString::null;
+// 		currentKey=QString();
         setEnabled ( true );
         passForm->setEnabled ( true );
         slotShowPassForm();
@@ -4366,7 +4366,7 @@ void ONMainWindow::startNewSession()
     QString clipMode=defaultClipboardMode;
     QString xdmcpServer;
     runRemoteCommand=true;
-    QString host=QString::null;
+    QString host=QString();
     runStartApp=true;
     removeAppsFromTray();
     if ( useLdap )
@@ -4391,7 +4391,7 @@ void ONMainWindow::startNewSession()
                 break;
             }
         }
-        if ( host==QString::null )
+        if ( host.isEmpty() )
         {
             QMessageBox::critical ( 0l,tr ( "Error" ),
                                     tr ( "No server available." ),
@@ -5260,13 +5260,13 @@ void ONMainWindow::selectSession ( QStringList& sessions )
                 st=new X2goSettings( "sessions" );
 
                 QString sid=sessionExplorer->getLastSession()->id();
-                QString suser = st->setting()->value(sid + "/shadowuser", (QVariant) QString::null).toString();
-                QString sdisplay = st->setting()->value(sid + "/shadowdisplay", (QVariant) QString::null).toString();
+                QString suser = st->setting()->value(sid + "/shadowuser", (QVariant) QString()).toString();
+                QString sdisplay = st->setting()->value(sid + "/shadowdisplay", (QVariant) QString()).toString();
                 bool fullAccess= st->setting()->value(sid + "/shadowfullaccess", (QVariant) false).toBool();
 
                 delete (st);
 
-                if(suser != QString::null && sdisplay != QString::null)
+                if(!suser.isEmpty() && !sdisplay.isEmpty())
                 {
                     shadowUser=suser;
                     shadowDisplay=sdisplay;
@@ -5323,7 +5323,7 @@ void ONMainWindow::slotActivated ( const QModelIndex& index )
             running_label->hide ();
         }
         bTerm->setEnabled ( true );
-        if ( status==QString::null )
+        if ( status.isEmpty() )
         {
             sOk->setEnabled ( false );
             bTerm->setEnabled ( false );
@@ -6296,7 +6296,7 @@ void ONMainWindow::slotTunnelOk(int)
     if(resumingSession.sessionType!= x2goSession::KDRIVE && resumingSession.sessionType!= x2goSession::ROOTLESSKDRIVE)
     {
         disp=getXDisplay();
-        if ( disp==QString::null )
+        if ( disp.isEmpty() )
         {
             //slotProxyerror ( QProcess::FailedToStart );
             return;
@@ -6890,12 +6890,12 @@ void ONMainWindow::slotProxyFinished ( int,QProcess::ExitStatus )
         }
     }
 
-    if ( readExportsFrom!=QString::null )
+    if ( !readExportsFrom.isEmpty() )
     {
         exportTimer->stop();
         if ( extLogin )
         {
-            currentKey=QString::null;
+            currentKey=QString();
         }
     }
     if ( printSupport )
@@ -7014,7 +7014,7 @@ void ONMainWindow::slotProxyStderr()
               SLOT ( slot_exportDirectory() ) );*/
             sbExp->setEnabled ( true );
             exportDefaultDirs();
-            if ( readExportsFrom!=QString::null )
+            if ( !readExportsFrom.isEmpty() )
             {
                 exportTimer->start ( 2000 );
             }
@@ -7282,14 +7282,14 @@ void ONMainWindow::setStatStatus ( QString status )
     setEnabled ( true );
     passForm->hide();
     selectSessionDlg->hide();
-    if ( status == QString::null )
+    if ( status.isEmpty() )
         status=statusString;
     else
         statusString=status;
     QString tstr;
     if ( statusLabel )
-        statusLabel->setText ( QString::null );
-    if ( resumingSession.sessionId!=QString::null )
+        statusLabel->setText ( QString() );
+    if ( !resumingSession.sessionId.isEmpty() )
     {
         QDateTime dt=QDateTime::fromString ( resumingSession.crTime, Qt::ISODate );
         tstr=dt.toString();
@@ -8947,7 +8947,7 @@ void ONMainWindow::slotExportDirectory()
     else
 
         path= QFileDialog::getExistingDirectory (
-                  this,QString::null,
+                  this,QString(),
                   homeDir );
     if (hide_after)
         hide();
@@ -8960,7 +8960,7 @@ void ONMainWindow::slotExportDirectory()
 
     path=cygwinPath ( wapiShortFileName ( path ) );
 #endif
-    if ( path!=QString::null )
+    if ( !path.isEmpty() )
         exportDirs ( path );
 }
 
@@ -9064,7 +9064,7 @@ void ONMainWindow::exportDefaultDirs()
 
             QString exd=st->setting()->value (
                             sessionExplorer->getLastSession()->id() +"/export",
-                            ( QVariant ) QString::null ).toString();
+                            ( QVariant ) QString() ).toString();
             QStringList lst=exd.split ( ";",
                                         QString::SkipEmptyParts );
             for ( int i=0; i<lst.size(); ++i )
@@ -9375,7 +9375,7 @@ void ONMainWindow::slotExtTimer()
     }
     if ( exportTimer->isActive() ) //running session
     {
-        if ( logoutDir != QString::null )
+        if ( !logoutDir.isEmpty() )
         {
             x2goDebug<<"External logout received";
             externalLogout ( logoutDir );
@@ -9383,7 +9383,7 @@ void ONMainWindow::slotExtTimer()
     }
     else
     {
-        if ( loginDir != QString::null )
+        if ( !loginDir.isEmpty() )
         {
             x2goDebug<<"External login.";
             externalLogin ( loginDir );
@@ -9720,7 +9720,7 @@ void ONMainWindow::externalLogout ( const QString& )
     if ( extStarted )
     {
         extStarted=false;
-        currentKey=QString::null;
+        currentKey=QString();
         if ( nxproxy )
             if ( nxproxy->state() ==QProcess::Running )
                 nxproxy->terminate();
@@ -10125,7 +10125,7 @@ QString ONMainWindow::getXDisplay()
     // And if not, error out.
     show_XQuartz_start_error ();
     slotConfig();
-    return QString::null;
+    return QString();
 }
 #endif
 
@@ -10135,7 +10135,7 @@ QString ONMainWindow::getXDisplay()
     if ( !isServerRunning ( 6000+xDisplay ) )
     {
         QMessageBox::critical (
-            this,QString::null,
+            this,QString(),
             tr (
                 "Can't start X.Org Server.\nPlease check your installation." )
         );
@@ -10844,7 +10844,7 @@ void ONMainWindow::startXOrg (std::size_t start_offset)
     if ( !xorg->waitForStarted ( 3000 ) )
     {
         QMessageBox::critical (
-            0,QString::null,
+            0,QString(),
             tr ( "Can't start X.Org Server." )
             + "\n"
             + tr ( "Please check your installation." ) );
@@ -10875,7 +10875,7 @@ void ONMainWindow::slotCheckXOrgConnection()
         if ((x_start_limit_) && (x_start_limit_ < x_start_tries_)) {
             x2goDebug << "Unable to start X.Org Server for " << x_start_limit_ << " times, terminating.";
 
-            QMessageBox::critical (NULL, QString::null,
+            QMessageBox::critical (NULL, QString(),
                                    tr ("X.Org Server did not launch correctly after %n tries.", "%n will be substituted with the current number of tries", x_start_tries_)
                                    + "\n"
                                    + tr ("Please check your installation."));
@@ -10927,7 +10927,7 @@ void ONMainWindow::slotCheckXOrgConnection()
                 return;
             }
             else {
-                QMessageBox::critical (NULL, QString::null,
+                QMessageBox::critical (NULL, QString(),
                                        tr ("Can't start X.Org Server.")
                                        + "\n"
                                        + tr ("Please check your installation."));
@@ -11526,17 +11526,17 @@ QString ONMainWindow::createKeyBundle (key_types key_type) {
     rsa.setFileName (tmp_file_name + ".pub");
     if (!(rsa.open (QIODevice::ReadOnly | QIODevice::Text))) {
       x2goErrorf (9) << tr ("Unable to open newly generated %1 public host key file.").arg (stringified_key_type.toUpper ());
-      return (QString::null);
+      return (QString());
     }
 #else
     printSshDError_noHostPubKey ();
-    return (QString::null);
+    return (QString());
 #endif
   }
 
   if (!(startSshd (key_type))) {
     x2goDebug << "Failed to start OpenSSH Server pro-actively.";
-    return (QString::null);
+    return (QString());
   }
 
   QByteArray rsa_pub;
@@ -11546,7 +11546,7 @@ QString ONMainWindow::createKeyBundle (key_types key_type) {
   }
   else {
     x2goErrorf (9) << tr ("%1 public host key file empty.").arg (stringified_key_type.toUpper ());
-    return (QString::null);
+    return (QString());
   }
 
   QFile file (user_key);
@@ -13605,7 +13605,7 @@ QString ONMainWindow::u3DataPath()
         portableDataPath=dpath;
         return dpath;
     }
-    return QString::null;
+    return QString();
 }
 
 #endif
@@ -13796,7 +13796,7 @@ bool ONMainWindow::parseResourceUrl(const QString& url)
     QDir d(resourceDir);
     if(!d.exists())
     {
-        resourceDir=QString::null;
+        resourceDir=QString();
         printError(tr("Directory not exists:")+" "+url+". "+tr("Using built in resources"));
     }
     else
diff --git a/src/onmainwindow.h b/src/onmainwindow.h
index 9b4a0bd..17f01a8 100644
--- a/src/onmainwindow.h
+++ b/src/onmainwindow.h
@@ -336,7 +336,7 @@ public:
     {
       return interDlg;
     }
-    void setStatStatus ( QString status=QString::null );
+    void setStatStatus ( QString status=QString() );
     x2goSession getNewSessionFromString ( const QString& string );
     void runCommand();
     long findWindow ( QString text );
@@ -996,8 +996,8 @@ private:
             bool acceptUnknownHosts, QString login,
             QString password, bool autologin, bool krbLogin, bool getSrv=false, bool useproxy=false,
             SshMasterConnection::ProxyType type=SshMasterConnection::PROXYSSH,
-            QString proxyserver=QString::null, quint16 proxyport=0,
-            QString proxylogin=QString::null, QString proxypassword=QString::null, QString proxyKey=QString::null,
+            QString proxyserver=QString(), quint16 proxyport=0,
+            QString proxylogin=QString(), QString proxypassword=QString(), QString proxyKey=QString(),
             bool proxyAutologin=false, bool proxyKrbLogin=false );
     void setProxyWinTitle();
     QRect proxyWinGeometry();
diff --git a/src/printprocess.cpp b/src/printprocess.cpp
index 8d9ba7b..c9b38cd 100644
--- a/src/printprocess.cpp
+++ b/src/printprocess.cpp
@@ -143,7 +143,7 @@ void PrintProcess::openPdf()
 #else
 		wapiShellExecute ( "open",
 		                   wapiShortFileName ( pdfFile ),
-		                   QString::null,
+		                   QString(),
 		                   wapiShortFileName ( QDir::homePath() ) );
 #endif
 	}
diff --git a/src/sessionbutton.cpp b/src/sessionbutton.cpp
index 1d1f8c9..011ce1d 100644
--- a/src/sessionbutton.cpp
+++ b/src/sessionbutton.cpp
@@ -403,7 +403,7 @@ void SessionButton::redraw()
 
     sessStatus->setText("");
     QString status=st->setting()->value ( sid+"/status",
-                                          ( QVariant ) QString::null ).toString();
+                                          ( QVariant ) QString() ).toString();
     if (status == "R")
     {
         sessStatus->setText("("+tr("running")+")");
@@ -414,10 +414,10 @@ void SessionButton::redraw()
     }
 
     suspended=st->setting()->value ( sid+"/suspended",
-                                         ( QVariant ) QString::null ).toUInt();
+                                         ( QVariant ) QString() ).toUInt();
 
     running=st->setting()->value ( sid+"/running",
-                                         ( QVariant ) QString::null ).toUInt();
+                                         ( QVariant ) QString() ).toUInt();
     if(suspended || running)
     {
         QStringList parts;
@@ -470,9 +470,9 @@ void SessionButton::redraw()
 
     delete pix;
     QString sv=st->setting()->value ( sid+"/host", ( QVariant )
-                                      QString::null ).toString();
+                                      QString() ).toString();
     QString uname=st->setting()->value ( sid+"/user", ( QVariant )
-                                         QString::null ).toString();
+                                         QString() ).toString();
     server->setText ( uname+"@"+sv );
 
     QString command=st->setting()->value ( sid+"/command",
diff --git a/src/sessionwidget.cpp b/src/sessionwidget.cpp
index e599174..1ae5ac8 100644
--- a/src/sessionwidget.cpp
+++ b/src/sessionwidget.cpp
@@ -47,7 +47,7 @@ SessionWidget::SessionWidget ( bool newSession, QString id, ONMainWindow * mw,
     this->newSession=newSession;
 
     sessName=new QLineEdit ( this );
-    icon=new QPushButton ( QString::null,this );
+    icon=new QPushButton ( QString(),this );
     if ( !miniMode )
     {
         icon->setIconSize ( QSize ( 100,100 ) );
@@ -100,7 +100,7 @@ SessionWidget::SessionWidget ( bool newSession, QString id, ONMainWindow * mw,
     openKey=new QPushButton (
         QIcon ( mainWindow->iconsPath (
                     "/32x32/file-open.png" ) ),
-        QString::null,sgb );
+        QString(),sgb );
     QVBoxLayout *sgbLay = new QVBoxLayout ( sgb );
     QHBoxLayout *suLay =new QHBoxLayout();
     QVBoxLayout *slLay =new QVBoxLayout();
@@ -158,7 +158,7 @@ SessionWidget::SessionWidget ( bool newSession, QString id, ONMainWindow * mw,
     proxyKey=new QLineEdit(proxyBox);
     pbOpenProxyKey=new QPushButton (
         QIcon ( mainWindow->iconsPath ( "/16x16/file-open.png" ) ),
-        QString::null,proxyBox );
+        QString(),proxyBox );
     cbProxyAutologin=new QCheckBox(tr("SSH Agent or default SSH key"),proxyBox);
     cbProxyKrbLogin=new QCheckBox(tr("Kerberos 5 (GSSAPI) authentication"),proxyBox);
 
@@ -284,7 +284,7 @@ void SessionWidget::slot_proxyGetKey()
                tr ( "Open key file" ),
                startDir,
                tr ( "All files" ) +" (*)" );
-    if ( path!=QString::null )
+    if ( !path.isEmpty() )
     {
 #ifdef Q_OS_WIN
         if ( ONMainWindow::getPortable() &&
@@ -391,7 +391,7 @@ void SessionWidget::slot_getIcon()
                       tr ( "Open picture" ),
                       QDir::homePath(),
                       tr ( "Pictures" ) +" (*.png *.xpm *.jpg)" );
-    if ( path!=QString::null )
+    if ( !path.isEmpty() )
     {
         sessIcon = wrap_legacy_resource_URIs (path);
         icon->setIcon ( QIcon ( sessIcon ) );
@@ -414,7 +414,7 @@ void SessionWidget::slot_getKey()
                tr ( "Open key file" ),
                startDir,
                tr ( "All files" ) +" (*)" );
-    if ( path!=QString::null )
+    if ( !path.isEmpty() )
     {
 #ifdef Q_OS_WIN
         if ( ONMainWindow::getPortable() &&
@@ -548,13 +548,13 @@ void SessionWidget::readConfig()
 
     server->setText ( st.setting()->value (
                           sessionId+"/host",
-                          ( QVariant ) QString::null ).toString().trimmed() );
+                          ( QVariant ) QString() ).toString().trimmed() );
     uname->setText ( st.setting()->value (
                          sessionId+"/user",
-                         ( QVariant ) QString::null ).toString().trimmed() );
+                         ( QVariant ) QString() ).toString().trimmed() );
     key->setText ( st.setting()->value (
                        sessionId+"/key",
-                       ( QVariant ) QString::null ).toString().trimmed() );
+                       ( QVariant ) QString() ).toString().trimmed() );
     cbAutoLogin->setChecked(st.setting()->value (
                                 sessionId+"/autologin",
                                 ( QVariant ) false ).toBool());
@@ -799,7 +799,7 @@ void SessionWidget::setDefaults()
     rbSshProxy->setChecked(true);

-    proxyKey->setText(QString::null);
+    proxyKey->setText(QString());

     proxyPort->setValue(22);
diff --git a/src/sharewidget.cpp b/src/sharewidget.cpp
index 342aea1..4819a19 100644
--- a/src/sharewidget.cpp
+++ b/src/sharewidget.cpp
@@ -59,7 +59,7 @@ ShareWidget::ShareWidget ( QString id, ONMainWindow * mw,
 
     QPushButton* openDir=new QPushButton (
         QIcon ( mainWindow->iconsPath ( "/16x16/file-open.png" ) ),
-        QString::null,egb );
+        QString(),egb );
 
     QPushButton* addDir=new QPushButton ( tr ( "Add" ),egb );
     QPushButton* delDir=new QPushButton ( tr ( "Delete" ),egb );
@@ -155,7 +155,7 @@ void ShareWidget::slot_openDir()
                       this,
                       tr ( "Select folder" ),
                       startDir );
-    if ( path!=QString::null )
+    if ( !path.isEmpty() )
     {
 #ifdef Q_OS_WIN
         if ( ONMainWindow::getPortable() &&
@@ -197,7 +197,7 @@ void ShareWidget::slot_addDir()
     item= new QStandardItem();
     item->setCheckable ( true );
     model->setItem ( model->rowCount()-1,1,item );
-    ldir->setText ( QString::null );
+    ldir->setText ( QString() );
 }

@@ -213,7 +213,7 @@ void ShareWidget::readConfig()
     X2goSettings st ( "sessions" );
 
     QString exportDir=st.setting()->value ( sessionId+"/export",
-                                            ( QVariant ) QString::null ).toString();
+                                            ( QVariant ) QString() ).toString();
 
     cbFsSshTun->setChecked ( st.setting()->value ( sessionId+"/fstunnel",
                              true ).toBool() );
diff --git a/src/sshmasterconnection.cpp b/src/sshmasterconnection.cpp
index 41ded56..5e66ffa 100644
--- a/src/sshmasterconnection.cpp
+++ b/src/sshmasterconnection.cpp
@@ -196,7 +196,7 @@ SshMasterConnection::SshMasterConnection (QObject* parent, QString host, int por
     this->proxyKrbLogin=proxyKrbLogin;
     mainWnd=(ONMainWindow*) parent;
     kerberos=krblogin;
-    challengeAuthVerificationCode=QString::null;
+    challengeAuthVerificationCode=QString();
 
 #if LIBSSH_VERSION_INT >= SSH_VERSION_INT (0, 6, 0)
     if (this->user.isEmpty ()) {
@@ -986,7 +986,7 @@ bool SshMasterConnection::userAuthKeyboardInteractive(QString prompt)
     x2goDebug<<"Open Interaction dialog to complete authentication";
     emit startInteraction(this, prompt);
     interactionInterrupt=false;
-    interactionInputText=QString::null;
+    interactionInputText=QString();
     int rez=SSH_AUTH_INFO;
     bool firstLoop=true;
     int prompts=1;
@@ -1018,7 +1018,7 @@ bool SshMasterConnection::userAuthKeyboardInteractive(QString prompt)
                 interactionInputMutex.lock();
                 interrupt=interactionInterrupt;
                 QString textToSend=interactionInputText;
-                interactionInputText=QString::null;
+                interactionInputText=QString();
                 interactionInputMutex.unlock();
                 if(textToSend.length()>0)
                 {
@@ -1128,7 +1128,7 @@ bool SshMasterConnection::userChallengeAuth()
                 x2goDebug<<"Verification code request"<<endl;
 
                 challengeAuthPasswordAccepted=true;
-                if(challengeAuthVerificationCode == QString::null)
+                if(challengeAuthVerificationCode.isEmpty())
                 {
                     keyPhraseReady=false;
                     if (need_to_display_auth_code_prompt) {
@@ -1148,7 +1148,7 @@ bool SshMasterConnection::userChallengeAuth()
                             break;
                     }
                     challengeAuthVerificationCode=keyPhrase;
-                    if(challengeAuthVerificationCode==QString::null)
+                    if(challengeAuthVerificationCode.isEmpty())
                     {
                         authErrors<<tr("Authentication failed.");
                         return false;
@@ -1178,7 +1178,7 @@ bool SshMasterConnection::userChallengeAuth()
         }
         else
         {
-            challengeAuthVerificationCode=QString::null;
+            challengeAuthVerificationCode=QString();
             //try with another verification code
             return userChallengeAuth();
         }
@@ -1290,7 +1290,7 @@ bool SshMasterConnection::userAuthAuto()
             if(ready)
                 break;
         }
-        if(keyPhrase==QString::null)
+        if(keyPhrase.isEmpty())
             break;
         rc = ssh_userauth_autopubkey ( my_ssh_session, keyPhrase.toLatin1() );
         if(i++==2)
@@ -1405,7 +1405,7 @@ bool SshMasterConnection::userAuthWithKey()
             if(ready)
                 break;
         }
-        if(keyPhrase==QString::null)
+        if(keyPhrase.isEmpty())
             break;
 
         QByteArray tmp_ba_passphrase = keyPhrase.toLocal8Bit ();
@@ -1643,7 +1643,7 @@ void SshMasterConnection::interactionInterruptSlot()
 bool SshMasterConnection::checkLogin()
 {
     interactionInterrupt=false;
-    interactionInputText=QString::null;
+    interactionInputText=QString();

     ssh_channel channel = ssh_channel_new ( my_ssh_session );
@@ -1727,7 +1727,7 @@ bool SshMasterConnection::checkLogin()
             interactionInputMutex.lock();
 	    interrupt=interactionInterrupt;
 	    QString textToSend=interactionInputText;
-	    interactionInputText=QString::null;
+	    interactionInputText=QString();
 	    interactionInputMutex.unlock();
 	    if(textToSend.length()>0)
 	    {
diff --git a/src/sshmasterconnection.h b/src/sshmasterconnection.h
index 92e7a0c..56c8a08 100644
--- a/src/sshmasterconnection.h
+++ b/src/sshmasterconnection.h
@@ -85,8 +85,8 @@ public:
     void run();
     SshMasterConnection(QObject* parent, QString host, int port, bool acceptUnknownServers, QString user,
                         QString pass, QString key, bool autologin, bool krblogin=false,
-                        bool useproxy=false, ProxyType type=PROXYSSH, QString proxyserver=QString::null, quint16 proxyport=0,
-                        QString proxylogin=QString::null, QString proxypassword=QString::null, QString proxyKey=QString::null,
+                        bool useproxy=false, ProxyType type=PROXYSSH, QString proxyserver=QString(), quint16 proxyport=0,
+                        QString proxylogin=QString(), QString proxypassword=QString(), QString proxyKey=QString(),
                         bool proxyAutologin=false, bool proxyKrbLogin=false);
     ~SshMasterConnection();
     void addChannelConnection(SshProcess* creator, int sock, QString forwardHost,
diff --git a/src/sshprocess.cpp b/src/sshprocess.cpp
index 97d862e..8ec6d3b 100644
--- a/src/sshprocess.cpp
+++ b/src/sshprocess.cpp
@@ -403,7 +403,7 @@ void SshProcess::startTunnel(const QString& forwardHost, uint forwardPort, const
 #ifdef Q_OS_WIN
         QString sshString="plink -batch -P "+
 #else
-        QString sshString=QString::null+"ssh"+ KEEPALIVE_OPTION +"-o GSSApiAuthentication=yes -o PasswordAuthentication=no -o PubkeyAuthentication=no -p "+
+        QString sshString=QString()+"ssh"+ KEEPALIVE_OPTION +"-o GSSApiAuthentication=yes -o PasswordAuthentication=no -o PubkeyAuthentication=no -p "+
 #endif
                           QString::number(masterCon->getPort())+" "+
                           masterCon->getUser()+"@"+
diff --git a/src/wapi.cpp b/src/wapi.cpp
index 9c3db32..74bc26f 100644
--- a/src/wapi.cpp
+++ b/src/wapi.cpp
@@ -263,7 +263,7 @@ QString wapiShortFileName ( const QString& longName )
     length = GetShortPathName ( ( LPCTSTR ) longName.utf16(), NULL, 0 );
     if ( !length )
     {
-        return QString::null;
+        return QString();
     }
 
     buffer = new TCHAR[length];
@@ -272,7 +272,7 @@ QString wapiShortFileName ( const QString& longName )
     if ( !length )
     {
         delete []buffer;
-        return QString::null;
+        return QString();
     }
     QString spath=QString::fromUtf16 ( ( const ushort* ) buffer );
     delete []buffer;
@@ -324,7 +324,7 @@ QString getNameFromSid ( PSID psid, QString* systemName )
                        name,&length,sysName,&dlength,&eUse );
     if ( !length )
     {
-        return QString::null;
+        return QString();
     }
 
     name=new TCHAR[length];
@@ -336,7 +336,7 @@ QString getNameFromSid ( PSID psid, QString* systemName )
     {
         delete []name;
         delete []sysName;
-        return QString::null;
+        return QString();
     }
 
     QString strName=QString::fromUtf16 (
@@ -464,7 +464,7 @@ void wapiShellExecute ( const QString& operation, const QString& file,
                         const QString& parameters,
                         const QString& dir, HWND win )
 {
-    if ( parameters==QString::null )
+    if ( parameters.isEmpty() )
         ShellExecute ( win, ( LPCTSTR ) ( operation.utf16() ),
                        ( LPCTSTR ) ( file.utf16() ),0,
                        ( LPCTSTR ) ( dir.utf16() ),SW_SHOWNORMAL );
@@ -481,13 +481,13 @@ QString wapiGetDefaultPrinter()
     DWORD length;
     GetDefaultPrinter ( 0,&length );
     if ( !length )
-        return QString::null;
+        return QString();
     prName=new TCHAR[length];
     GetDefaultPrinter ( prName,&length );
     if ( !length )
     {
         delete []prName;
-        return QString::null;
+        return QString();
     }
     QString printer=QString::fromUtf16 ( ( const ushort* ) prName );
     delete []prName;
@@ -534,7 +534,7 @@ QString wapiGetUserName()
     TCHAR  infoBuf[INFO_BUFFER_SIZE];
     DWORD bufCharCount=INFO_BUFFER_SIZE;
     if( !GetUserName( infoBuf, &bufCharCount ) )
-        return QString::null;
+        return QString();
     return QString::fromUtf16 ( ( const ushort* ) infoBuf);
 }
 
@@ -612,7 +612,7 @@ QString wapiGetKeyboardLayout()
     QStringList l=QString::fromUtf16((char16_t*)nm).split("-");
     if(l.count()==2)
         return l[1].toLower();
-    return QString::null;
+    return QString();
 }
 
 void wapiSetWinNotResizable(HWND wnd)
-- 
2.41.0