SHOW:
|
|
- or go back to the newest paste.
| 1 | void App::startUp() {
| |
| 2 | - | QString home = QDir::homePath(); |
| 2 | + | QFileInfo desktopFile("/usr/share/applications/app.desktop");
|
| 3 | - | QDir::setCurrent("~/.config/autostart");
|
| 3 | + | QFileInfo autostartFile(QDir::homePath()+"/.config/autostart/app.desktop"); |
| 4 | if ( ui->checkBox->isChecked() ) {
| |
| 5 | - | if (QFileInfo::exists("app.desktop")) { ; }
|
| 5 | + | if (autostartFile.exists()) ; |
| 6 | - | else {
|
| 6 | + | else QFile::copy(desktopFile.absoluteFilePath() , autostartFile.absoluteFilePath()); |
| 7 | - | QString command = "cp /usr/share/applications/app.desktop "+home+"/.config/autostart/app.desktop"; |
| 7 | + | |
| 8 | - | const char *out = command.toStdString().c_str(); |
| 8 | + | if (autostartFile.exists()) QFile::remove(autostartFile.absoluteFilePath()); |
| 9 | - | system(out); |
| 9 | + | else ; |
| 10 | - | } |
| 10 | + | |
| 11 | } |