mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 10:22:49 +00:00
konsole: partial fix for some command line options
QCoreApplication::quit() stops event loops, it does not call ::exit() and as the application (konsole application) instance is constructed there is no even loop to quit (someone derped there, see the TODO too) Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
95f7fc2cd4
commit
8353b43b36
3 changed files with 21 additions and 33 deletions
|
@ -51,11 +51,6 @@ Application::Application()
|
|||
|
||||
// handle session management
|
||||
if ((args->count() != 0) || !firstInstance || !isSessionRestored()) {
|
||||
// check for arguments to print help or other information to the
|
||||
// terminal, quit if such an argument was found
|
||||
if (processHelpArgs(args))
|
||||
return;
|
||||
|
||||
// create a new window or use an existing one
|
||||
MainWindow* window = processWindowArgs(args);
|
||||
|
||||
|
@ -166,6 +161,7 @@ void Application::processTabsFromFileArgs(KCmdLineArgs* args,
|
|||
if (!tabsFile.open(QFile::ReadOnly)) {
|
||||
kWarning() << "ERROR: Cannot open tabs file "
|
||||
<< tabsFileName.toLocal8Bit().data();
|
||||
// TODO: this will not quit, exit code?
|
||||
quit();
|
||||
}
|
||||
|
||||
|
@ -329,39 +325,25 @@ Profile::Ptr Application::processProfileSelectArgs(KCmdLineArgs* args)
|
|||
bool Application::processHelpArgs(KCmdLineArgs* args)
|
||||
{
|
||||
if (args->isSet("list-profiles")) {
|
||||
listAvailableProfiles();
|
||||
QStringList paths = ProfileManager::instance()->availableProfilePaths();
|
||||
foreach(const QString& path, paths) {
|
||||
QFileInfo info(path);
|
||||
const QByteArray base = info.completeBaseName().toLocal8Bit();
|
||||
printf("%s\n", base.constData());
|
||||
}
|
||||
return true;
|
||||
} else if (args->isSet("list-profile-properties")) {
|
||||
listProfilePropertyInfo();
|
||||
Profile::Ptr tempProfile = ProfileManager::instance()->defaultProfile();
|
||||
const QStringList names = tempProfile->propertiesInfoList();
|
||||
foreach(const QString& name, names) {
|
||||
const QByteArray namebytes = name.toLocal8Bit();
|
||||
printf("%s\n", namebytes.constData());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Application::listAvailableProfiles()
|
||||
{
|
||||
QStringList paths = ProfileManager::instance()->availableProfilePaths();
|
||||
|
||||
foreach(const QString& path, paths) {
|
||||
QFileInfo info(path);
|
||||
printf("%s\n", info.completeBaseName().toLocal8Bit().constData());
|
||||
}
|
||||
|
||||
quit();
|
||||
}
|
||||
|
||||
void Application::listProfilePropertyInfo()
|
||||
{
|
||||
Profile::Ptr tempProfile = ProfileManager::instance()->defaultProfile();
|
||||
const QStringList names = tempProfile->propertiesInfoList();
|
||||
|
||||
foreach(const QString& name, names) {
|
||||
printf("%s\n", name.toLocal8Bit().constData());
|
||||
}
|
||||
|
||||
quit();
|
||||
}
|
||||
|
||||
Profile::Ptr Application::processProfileChangeArgs(KCmdLineArgs* args, Profile::Ptr baseProfile)
|
||||
{
|
||||
bool shouldUseNewProfile = false;
|
||||
|
|
|
@ -62,6 +62,8 @@ public:
|
|||
*/
|
||||
MainWindow* newMainWindow();
|
||||
|
||||
static bool processHelpArgs(KCmdLineArgs* args);
|
||||
|
||||
private slots:
|
||||
void createWindow(Profile::Ptr profile , const QString& directory);
|
||||
void detachView(Session* session);
|
||||
|
@ -69,11 +71,9 @@ private slots:
|
|||
void toggleBackgroundInstance();
|
||||
|
||||
private:
|
||||
void init();
|
||||
void listAvailableProfiles();
|
||||
void listProfilePropertyInfo();
|
||||
void startBackgroundMode(MainWindow* window);
|
||||
bool processHelpArgs(KCmdLineArgs* args);
|
||||
MainWindow* processWindowArgs(KCmdLineArgs* args);
|
||||
Profile::Ptr processProfileSelectArgs(KCmdLineArgs* args);
|
||||
Profile::Ptr processProfileChangeArgs(KCmdLineArgs* args, Profile::Ptr baseProfile);
|
||||
|
|
|
@ -63,6 +63,12 @@ int main(int argc, char** argv)
|
|||
fillCommandLineOptions(konsoleOptions);
|
||||
KCmdLineArgs::addCmdLineOptions(konsoleOptions);
|
||||
|
||||
// check for arguments to print help or other information to the
|
||||
// terminal, quit if such an argument was found
|
||||
if (Application::processHelpArgs(KCmdLineArgs::parsedArgs())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// create a new application instance
|
||||
Application app;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue