Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix the diagnostic sheet generation to save the file in the users dir

with correct permissions
  • Loading branch information...
commit d5dc95613ae7570fc590f2223054c472440d18b2 1 parent 08ef1fc
Kris Moore kmoore134 authored
41 src-qt4/pc-sysmanager/pbsystemtab.cpp
View
@@ -25,7 +25,7 @@
void PBSystemTab::ProgramInit()
{
//Grab the username
- username = QString::fromLocal8Bit(getenv("LOGNAME"));
+ username = QString::fromLocal8Bit(getenv("SUDO_USER"));
// Set the Uname on the General Tab
CheckUname();
@@ -120,29 +120,27 @@ void PBSystemTab::ReadUname()
void PBSystemTab::startGenerateSheet()
{
SheetFileName="";
- SheetFileName = QFileDialog::getSaveFileName(
+ qDebug() << "/usr/home/" + username + "/Desktop/pcbsd-diagnostic.txt",
+ SheetFileName = QFileDialog::getSaveFileName(
this,
- "save file dialog",
- "/home/" + username + "/Desktop",
+ tr("Create diagnostic sheet"),
+ "/usr/home/" + username + "/Desktop/pcbsd-diagnostic.txt",
"Text File (*.txt)");
- if ( ! SheetFileName.isEmpty() )
- {
- if ( SheetFileName.indexOf(".txt", 0) == -1)
- {
- SheetFileName.append(".txt");
- }
- if ( QFile::exists(SheetFileName ) )
- {
- int answer = QMessageBox::warning( this, "Overwrite File", "Overwrite " + SheetFileName + "?", "&Yes", "&No", QString::null, 1, 1 );
- if ( answer == 0 ) {
- CreateSheetFile();
- }
+ if ( SheetFileName.isEmpty() )
+ return;
+
+ if ( SheetFileName.indexOf(".txt", 0) == -1)
+ SheetFileName.append(".txt");
+
+ if ( QFile::exists(SheetFileName ) )
+ {
+ int answer = QMessageBox::warning( this, "Overwrite File", "Overwrite " + SheetFileName + "?", "&Yes", "&No", QString::null, 1, 1 );
+ if ( answer != 0 )
+ return;
+ }
- } else {
- CreateSheetFile();
- }
- }
+ CreateSheetFile();
}
@@ -151,10 +149,11 @@ void PBSystemTab::startGenerateSheet()
void PBSystemTab::CreateSheetFile()
{
+ qDebug() << "Creating diagnostic sheet";
SheetGenScript = new QProcess( this );
QString prog = PREFIX + "/share/pcbsd/scripts/GenDiagSheet.sh";
QStringList args;
- args << SheetFileName;
+ args << SheetFileName << username;
connect( SheetGenScript, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(finishedSheet()) );
SheetGenScript->start(prog, args);
2  src-qt4/pc-sysmanager/scripts/GenDiagSheet.sh
View
@@ -42,4 +42,4 @@ Generated: $DATE
" > ${1}
-
+chown ${2}:${2} ${1}
Please sign in to comment.
Something went wrong with that request. Please try again.