Permalink
Browse files

Fix up PCDM compilation on 10.x

  • Loading branch information...
1 parent 2aa342f commit 72c9698862e4db48bae970dcd511556d8de82b11 Ken Moore committed Nov 7, 2013
@@ -68,7 +68,7 @@ void widgetKeyboard::slotUpdateKbOnSys()
{
QString model, layout, variant;
- if ( ! comboBoxKeyboardModel->currentIndex() == -1 )
+ if ( ! (comboBoxKeyboardModel->currentIndex() == -1) )
return;
if ( ! listKbLayouts->currentItem() )
return;
@@ -67,8 +67,8 @@ LoginWidget::LoginWidget(QWidget* parent) : QGroupBox(parent)
//Setup the Signals/Slots
connect(pushLogin,SIGNAL(clicked()),this,SLOT(slotTryLogin()));
- connect(pushUserIcon,SIGNAL(triggered(QAction*)), this, SLOT(slotUserActivated(QAction*)));
- connect(userIcon,SIGNAL(triggered(QAction*)), this, SLOT(slotUserActivated(QAction*)));
+ connect(pushUserIcon,SIGNAL(triggered(QAction*)), this, SLOT(slotUserActivated()));
+ connect(userIcon,SIGNAL(triggered(QAction*)), this, SLOT(slotUserActivated()));
connect(listUsers,SIGNAL(activated(int)),this,SLOT(slotChooseUser(int)));
connect(listUserBig,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(slotUserSelected()) );
connect(listUserBig,SIGNAL(currentRowChanged(int)),this,SLOT(slotUserHighlighted(int)) );
@@ -135,7 +135,7 @@ void LoginWidget::keyPressEvent(QKeyEvent *e){
//-------------------------------------
// PRIVATE SLOTS
//-------------------------------------
-void LoginWidget::slotUserActivated(QAction* act){
+void LoginWidget::slotUserActivated(){
//Toggle the user box as to what is visible
if(!userSelected){
slotUserSelected();
@@ -73,7 +73,7 @@ class LoginWidget : public QGroupBox
void updateWidget();
private slots:
- void slotUserActivated(QAction*);
+ void slotUserActivated();
//void slotUserClicked(QListWidgetItem*);
void slotUserHighlighted(int);
void slotUserSelected();
@@ -28,7 +28,7 @@ XProcess::XProcess() : QProcess(0) {
pam_started = FALSE;
pam_session_open = FALSE;
//Setup the finished signal/slot
- connect( this, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotCleanup(int, QProcess::ExitStatus)) );
+ connect( this, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotCleanup()) );
}
XProcess::~XProcess(){
@@ -156,7 +156,7 @@ bool XProcess::startXSession(){
return TRUE;
}
-void XProcess::slotCleanup(int exitCode, QProcess::ExitStatus status){
+void XProcess::slotCleanup(){
pam_shutdown(); //make sure that PAM shuts down properly
//Now remove this user's access to the Xserver
QString xhostcmd = "xhost -si:localuser:"+xuser;
@@ -186,119 +186,6 @@ void XProcess::setupSessionEnvironment(){
this->setProcessEnvironment(environ);
this->setWorkingDirectory(xhome); //set the current directory to the user's home directory
}
-/*
-//Start the desktop in the current process with C functions
-void XProcess::startDesktop(){
- //Check for PAM username/password validity
- if( !pam_checkPW() ){ qDebug() << "Invalid username/password"; pam_shutdown(); return; }
- //Startup the PAM session
- if( !pam_startSession() ){ qDebug() << "Unable to open PAM session"; pam_shutdown(); return; }
- pam_session_open = TRUE; //flag that pam has an open session
-
- //Save the current user/desktop as the last login
- Backend::saveLoginInfo(Backend::getDisplayNameFromUsername(xuser),xde);
-
- // We will now fork off, so the child can drop root perms and do its thing
- int pid = fork();
- if(pid < 0){
- Backend::log("Error: Could not fork for user permissions");
- return;
- }else if( pid !=0 ){
- //Parent (calling) process
- int status;
- sleep(2);
- waitpid(pid,&status,0); //wait for the child (session) to finish
-
- // Child is all done, lets close down the pam session and cleanup
- pam_shutdown();
- exit(0);
- }
-
- // Get the users uid/gid information
- struct passwd *pw;
- int uid;
- char *ok;
-
- if (!(pw = getpwnam(xuser.toLatin1()))) {
- uid = strtol(xuser.toLatin1(), &ok, 10);
- if (!(pw = getpwuid(uid))) {
- emit InvalidLogin(); //Make sure the GUI knows that it was a failure
- return;
- }
- }
-
- if (setgid(pw->pw_gid) < 0) {
- qDebug() << "setgid() failed!";
- emit InvalidLogin(); //Make sure the GUI knows that it was a failure
- return;
- }
-
- // Setup our other groups
- if (initgroups(xuser.toLatin1(), pw->pw_gid) < 0) {
- qDebug() << "initgroups() failed!";
- emit InvalidLogin(); //Make sure the GUI knows that it was a failure
- setgid(0);
- return;
- }
-
- // Lets drop to user privs
- if (setuid(pw->pw_uid) < 0) {
- qDebug() << "setuid() failed!";
- emit InvalidLogin(); //Make sure the GUI knows that it was a failure
- return;
- }
-
- QString cmd;
- // Configure the DE startup command
- // - Setup to run the user's <home-dir>/.xprofile startup script
- if(QFile::exists(xhome+"/.xprofile")){
- cmd.append(". "+xhome+"/.xprofile; "); //make sure to start it in parallel
- }
- // - Add the DE startup command to the end
- cmd.append("dbus-launch --exit-with-session "+xcmd);
-
- // Get the current locale code
- QLocale mylocale;
- QString langCode = mylocale.name();
-
- //Alternate way of starting a process using c library functions
-
- //setup the environment variables
- setenv("LOGNAME",xuser.toUtf8(),1);
- setenv("USERNAME",xuser.toUtf8(),1);
- QString pth = QString(getenv("PATH"))+":"+xhome+"/bin";
- setenv("PATH",pth.toUtf8(),1);
- if(langCode.toLower()=="c"){}
- else if(QString(getenv("MM_CHARSET")).isEmpty() ){ langCode.append("."+QString(getenv("MM_CHARSET"))); }
- else{ langCode.append(".UTF-8"); }
- setenv("LANG",langCode.toUtf8(),1);
- setenv("MAIL",QString("/var/mail/"+xuser).toUtf8(),1);
- setenv("GROUP",xuser.toUtf8(),1);
- setenv("HOME",xhome.toUtf8(),1);
- setenv("SHELL",pw->pw_shell,1);
- setenv("SHLVL","0",1);
- chdir(xhome.toUtf8()); //move to home dir
-
- //Now start the process
- system(cmd.toLatin1());
-}
-*/
-
-/*void XProcess::setupDesktop(QString user, QString pwd, QString desktop){
- //Setup internal variables
- xuser = Backend::getUsernameFromDisplayname(user);
- xpwd = pwd;
- xhome = Backend::getUserHomeDir(xuser);
- xcmd = Backend::getDesktopBinary(desktop);
- xde = desktop;
- //Also check password validity
- bool ok = pam_checkPW();
- pam_shutdown();
- if(ok){ emit ValidLogin(); }
- else{ emit InvalidLogin(); }
-}
- */
-
//Stand-alone function to check a username/password combination for validity
void XProcess::checkPW(QString user, QString pwd){
@@ -60,7 +60,7 @@ class XProcess : public QProcess
private slots:
- void slotCleanup(int, QProcess::ExitStatus);
+ void slotCleanup();
signals:
void ValidLogin();
@@ -90,7 +90,7 @@ void ThemeStruct::loadThemeFile(QString filePath){
//special instructions for this item
items[index].icon = val; //should be [icononly | textonly | textbesideicon | textundericon ]
}else if(itemCat == "LOCATION"){
- val.remove("[").remove("]").simplified(); //remove the brackets
+ val = val.remove("[").remove("]").simplified(); //remove the brackets
QString x = val.section(",",0,0);
QString y = val.section(",",1,1);
if(x.indexOf("-") == -1){ items[index].x1 = x.toInt(); items[index].x2 = -1;}

0 comments on commit 72c9698

Please sign in to comment.