@@ -653,10 +653,13 @@ void VPN_Editor::requestFileList(QAbstractButton* button)
653653void  VPN_Editor::processFileList (const  QStringList& sl_conf)
654654{
655655   //  variables
656-    bool  ok;
657656   QString filename = " " 
658657   QList<QVariant> vlist;
659658   QDBusInterface* iface_pfl = new  QDBusInterface (" org.cmst.roothelper" " /" " org.cmst.roothelper" QDBusConnection::systemBus (), this );
659+    QInputDialog* qid = new  QInputDialog (this );
660+       qid->setOption (QInputDialog::UseListViewForComboBoxItems);
661+       qid->setWindowModality (Qt::WindowModality::ApplicationModal);
662+       qid->setInputMode (QInputDialog::TextInput);
660663
661664   //  If we are trying to open and read the file
662665   if  (i_sel & CMST::ProvEd_File_Read) {
@@ -670,23 +673,16 @@ void VPN_Editor::processFileList(const QStringList& sl_conf)
670673               QMessageBox::Ok);
671674            break ;
672675         case  1 :
673-             QMessageBox::information (this ,
674-                tr (" %1 - Information" arg (TranslateStrings::cmtr (" cmst" 
675-                tr (" <center>Reading configuration file: %1" arg (sl_conf.at (0 )),
676-                QMessageBox::Ok,
677-                QMessageBox::Ok);
678676            filename = sl_conf.at (0 );
679677            break ;
680678         default :
681-             QString item = QInputDialog::getItem (this ,
682-                   tr (" %1 - Select File" arg (TranslateStrings::cmtr (" cmst" 
683-                   tr (" Select a file to load." 
684-                   sl_conf,
685-                   0 ,       //  current item 0
686-                   false ,   //  non-editable
687-                   &ok);
688-             if  (ok) filename = item;
689-             break ;
679+              qid->setWindowTitle (tr (" %1 - Select File" arg (TranslateStrings::cmtr (" cmst" 
680+              qid->setLabelText (tr (" Select a file to load." 
681+              qid->setComboBoxItems (sl_conf);
682+              qid->exec ();
683+              if  (qid->result () == QDialog::Accepted)
684+                   filename = qid->textValue ();
685+              break ;
690686         } //  switch
691687
692688   //  if we have a filename try to open the file
@@ -710,16 +706,15 @@ void VPN_Editor::processFileList(const QStringList& sl_conf)
710706               QMessageBox::Ok);
711707            break ;
712708         default :
713-             QString item = QInputDialog::getItem (this ,
714-                   tr (" %1 - Select File" arg (TranslateStrings::cmtr (" cmst" 
715-                   tr (" Select a file to be deleted." 
716-                   sl_conf,
717-                   0 ,       //  current item 0
718-                   false ,   //  non-editable
719-                   &ok);
720-             if  (ok) filename = item;
709+             qid->setWindowTitle (tr (" %1 - Select File" arg (TranslateStrings::cmtr (" cmst" 
710+             qid->setLabelText (tr (" Select a file to be deleted." 
711+             qid->setComboBoxItems (sl_conf);
712+             qid->exec ();
713+             if  (qid->result () == QDialog::Accepted)
714+                filename = qid->textValue ();
721715            break ;
722716         } //  switch
717+ 
723718      //  if we have a filename try to delete the file
724719      if  (! filename.isEmpty () ) {
725720         vlist.clear ();
@@ -731,17 +726,17 @@ void VPN_Editor::processFileList(const QStringList& sl_conf)
731726
732727   //  If we are trying to save the file
733728   else  if  (i_sel & CMST::ProvEd_File_Write) {
734-    QString item = QInputDialog::getItem (this ,
735-          tr (" %1 - Select File" arg (TranslateStrings::cmtr (" cmst" 
736-          tr (" Enter a new file name or select<br>an existing file to overwrite." 
737-          sl_conf,
738-          0 ,    //  current item 0
739-          true , //  editable
740-          &ok);
741-       if  (ok) {
742-          filename = item.simplified ();                //  multiple whitespace to one space
729+       qid->setWindowTitle (tr (" %1 - Select File" arg (TranslateStrings::cmtr (" cmst" 
730+       qid->setLabelText (tr (" Enter a new file name or select<br>an existing file to overwrite." 
731+       qid->setComboBoxEditable (true );
732+       qid->setComboBoxItems (sl_conf);
733+       qid->exec ();
734+       if  (qid->result () == QDialog::Accepted) {
735+          filename = qid->textValue ();
736+          filename = filename.simplified ();      //  multiple whitespace to one space
743737         filename = filename.replace ('  ' ' _' //  replace spaces with underscores
744-       } //  if ok
738+       } //  if accepted
739+ 
745740      //  if we have a filename try to save the file
746741      if  (! filename.isEmpty () ) {
747742         vlist.clear ();
@@ -755,6 +750,8 @@ void VPN_Editor::processFileList(const QStringList& sl_conf)
755750   //  cleanup
756751   i_sel = CMST::ProvEd_No_Selection;
757752   iface_pfl->deleteLater ();
753+    delete  qid;
754+ 
758755   return ;
759756}
760757
0 commit comments