summaryrefslogtreecommitdiffstats
path: root/abs/core/mythinstall/MythVantage-app/mythinstall/password_manage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/mythinstall/MythVantage-app/mythinstall/password_manage.cpp')
-rwxr-xr-xabs/core/mythinstall/MythVantage-app/mythinstall/password_manage.cpp48
1 files changed, 23 insertions, 25 deletions
diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/password_manage.cpp b/abs/core/mythinstall/MythVantage-app/mythinstall/password_manage.cpp
index ed7d369..11e2974 100755
--- a/abs/core/mythinstall/MythVantage-app/mythinstall/password_manage.cpp
+++ b/abs/core/mythinstall/MythVantage-app/mythinstall/password_manage.cpp
@@ -1,14 +1,14 @@
#include <unistd.h>
#include "password_manage.h"
-//Added by qt3to4:
-#include <Q3TextStream>
+#include <QTextStream>
#include <qapplication.h>
#include "mythmiscutil.h"
#include "mythsystemlegacy.h"
#include <qdir.h>
#include <iostream>
+using namespace std;
/****************************************************************************/
typedef enum {
@@ -17,7 +17,7 @@ typedef enum {
UseraddPopup_DELETE
}
UseraddPopupResult;
-bool passtoggle = TRUE;
+bool passtoggle = true;
QString invalid_chars = "&<>/~`;:!";
class AddUserPopup
@@ -30,7 +30,7 @@ public:
UseraddPopupResult AddUserPopup::showPopup(MythMainWindow *parent,
QString title, QString message, QString& text)
{
- MythPopupBox *popup = new MythPopupBox(parent, title);
+ MythPopupBox *popup = new MythPopupBox(parent, title.toLatin1().constData());
popup->addLabel(message);
MythLineEdit *textEdit = new MythLineEdit(popup, "chooseEdit");
@@ -63,8 +63,8 @@ void UserManagement::user_fillselection()
QFile file("/etc/passwd");
if ( file.open(QIODevice::ReadOnly | QIODevice::Text) )
{
- Q3TextStream t( &file ); // use a text stream
- while ( !t.eof() )
+ QTextStream t( &file ); // use a text stream
+ while ( !t.atEnd() )
{
line = t.readLine();
user = line.section(":",0,0);
@@ -78,7 +78,7 @@ void UserManagement::user_fillselection()
}
-bool UserManagement::user_exisit_check(QString name)
+bool UserManagement::user_exist_check(QString name)
{
QString line;
QString user;
@@ -89,8 +89,8 @@ bool UserManagement::user_exisit_check(QString name)
QFile file("/etc/passwd");
if ( file.open(QIODevice::ReadOnly | QIODevice::Text) )
{
- Q3TextStream t( &file ); // use a text stream
- while ( !t.eof() )
+ QTextStream t( &file ); // use a text stream
+ while ( !t.atEnd() )
{
line = t.readLine();
user = line.section(":",0,0);
@@ -118,13 +118,13 @@ bool UserManagement::user_valid_check(QString check_string)
upperlimit = invalid_chars.length() -1 ;
for(i= 0; i <= upperlimit; i++)
{
- found_char = FALSE;
+ found_char = false;
current_char = invalid_chars.at(i);
- found_char = check_string.contains(current_char,FALSE);
+ found_char = check_string.contains(current_char, Qt::CaseInsensitive);
if ( found_char )
- return FALSE;
+ return false;
}
- return TRUE ;
+ return true ;
}
@@ -142,7 +142,7 @@ UserManagement::UserManagement():
userpass1= new TransLineEditSetting(true);
userpass1->setLabel("Password");
userpass1->SetPasswordEcho(passtoggle);
- userpass1->setHelpText(QObject::tr("The following characters will not be accepted: " + invalid_chars));
+ userpass1->setHelpText("The following characters will not be accepted: " + invalid_chars);
passToggleButton = new TransButtonSetting;
@@ -157,7 +157,7 @@ UserManagement::UserManagement():
usercreateButton = new TransButtonSetting;
usercreateButton->setLabel("Create New User Account");
- usercreateButton->setHelpText(QObject::tr("The following characters will not be accepted: " + invalid_chars));
+ usercreateButton->setHelpText("The following characters will not be accepted: " + invalid_chars);
userdeleteButton = new TransButtonSetting;
userdeleteButton->setLabel("Delete User Account");
@@ -240,8 +240,8 @@ void UserManagement::usercreatepopup()
tr("Enter New User Name"), name);
if (result == UseraddPopup_CANCEL)
return;
- //check if name exisit || add it
- if ( user_exisit_check(name) )
+ //check if name exist || add it
+ if ( user_exist_check(name) )
{
info->setValue("User name " + name + " already exists. Cannot create user.");
userlist->setFocus();
@@ -327,12 +327,12 @@ WebPassword::WebPassword():
webAuth->setValue(false);
webuser = new HostLineEdit("Hostwebuser");
webuser->setLabel("Username");
- webuser->setHelpText(QObject::tr("The following characters will not be accepted: " + invalid_chars));
+ webuser->setHelpText("The following characters will not be accepted: " + invalid_chars);
webpassword = new HostLineEdit("Hostwebpassword");
webpassword->setLabel("Password");
webpassword->SetPasswordEcho(passtoggle);
- webpassword->setHelpText(QObject::tr("The following characters will not be accepted: " + invalid_chars));
+ webpassword->setHelpText("The following characters will not be accepted: " + invalid_chars);
webpassToggleButton = new TransButtonSetting;
webpassToggleButton->setLabel("Toggle Password View");
@@ -374,22 +374,20 @@ void WebPassword::togglepass()
bool WebPassword::valid_check(QString check_string)
{
- // QString invalid_chars;
QChar current_char;
int upperlimit;
bool found_char;
int i ;
- //invalid_chars = "&<>/~`;";
upperlimit = invalid_chars.length() -1 ;
for(i= 0; i <= upperlimit; i++)
{
- found_char = FALSE;
+ found_char = false;
current_char = invalid_chars.at(i);
- found_char = check_string.contains(current_char,FALSE);
+ found_char = check_string.contains(current_char, Qt::CaseInsensitive);
if ( found_char )
- return FALSE;
+ return false;
}
- return TRUE ;
+ return true ;
}