diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-12-28 14:24:43 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2024-12-28 14:32:04 +0900 |
commit | 988a55785b3f7afa934eb7d5c7c4debd2fba8d0a (patch) | |
tree | b46c523fba5aabefde641cd3920142501289a515 | |
parent | 029a0e14328ba5f146cea9c1e91e5994071f3b95 (diff) | |
download | knowit-988a55785b3f7afa934eb7d5c7c4debd2fba8d0a.tar.gz knowit-988a55785b3f7afa934eb7d5c7c4debd2fba8d0a.zip |
Add dockOnStart option to control window show status on startup.
Knowit could already be docked, but on startup the window would
annoyingly show up minimized in the taskbar instead of being fully docked.
The new option allows to choose the window status when starting up in
docked mode: either the window shows in normal state or is fully docked.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r-- | src/knowit.cpp | 5 | ||||
-rw-r--r-- | src/knowit.h | 1 | ||||
-rw-r--r-- | src/knowitpref.cpp | 25 | ||||
-rw-r--r-- | src/knowitpref.h | 6 |
4 files changed, 25 insertions, 12 deletions
diff --git a/src/knowit.cpp b/src/knowit.cpp index 57665ce..a973872 100644 --- a/src/knowit.cpp +++ b/src/knowit.cpp @@ -281,8 +281,8 @@ Knowit::Knowit(TQWidget*, const char *name) : TDEMainWindow(0, name), config = kapp->config(); readOptions(); - if (runMinimized) - showMinimized(); + if (Options.docked && Options.dockOnStart) + hide(); else show(); @@ -518,7 +518,6 @@ void Knowit::readOptions() Layout->setSizes(sizes); Options.read(config); config->setGroup("General"); - runMinimized = config->readBoolEntry("Minimized", false); TQString oldfile = config->readEntry("LastFile"); TQSize defSize = size(); resize(config->readSizeEntry("Geometry", &defSize)); diff --git a/src/knowit.h b/src/knowit.h index 1c4953d..c862759 100644 --- a/src/knowit.h +++ b/src/knowit.h @@ -69,7 +69,6 @@ class Knowit : public TDEMainWindow KnowitTray* systray; /* data items */ TNotesCollection Notes; - bool runMinimized; TQListViewItem* lastSought; TQString soughtText; TQTimer* AutosaveTimer; diff --git a/src/knowitpref.cpp b/src/knowitpref.cpp index e698bb8..4ce1725 100644 --- a/src/knowitpref.cpp +++ b/src/knowitpref.cpp @@ -46,6 +46,7 @@ void KnowitOptions::save(TDEConfig* config) const config->writeEntry("MultipleInstances", multipleInstances); config->setGroup("General"); config->writeEntry("Docked", docked); + config->writeEntry("DockOnStart", dockOnStart); config->writeEntry("Autosave", autosave); config->writeEntry("Reopen", reopen); config->writeEntry("HorizontalSplit", horizontalSplit); @@ -90,6 +91,7 @@ void KnowitOptions::read(TDEConfig* config) multipleInstances = config->readBoolEntry("MultipleInstances", true); config->setGroup("General"); docked = config->readBoolEntry("Docked", false); + dockOnStart = config->readBoolEntry("DockOnStart", false); autosave = config->readNumEntry("Autosave", 0); reopen = config->readBoolEntry("Reopen", true); horizontalSplit = config->readNumEntry("HorizontalSplit", true); @@ -139,8 +141,10 @@ KnowitPreferences::KnowitPreferences() TDEGlobal::iconLoader()->loadIcon(TQString("configure"), TDEIcon::Toolbar, TDEIcon::SizeMedium)); layout = new TQVBoxLayout(page, 0, spacingHint()); layout->addWidget(docked = new TQCheckBox(i18n("&Dock in System tray"), page, "Dock")); + layout->addWidget(dockOnStart = new TQCheckBox(i18n("&Dock on start"), page, "DockOnStart")); layout->addWidget(reopen = new TQCheckBox(i18n("Open &last file on startup"), page, "Reopen")); - + connect(docked, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(slotUpdateOptions())); + TQHBox* autosaveBox = new TQHBox(page); layout->addWidget(autosaveBox); new TQLabel(i18n("Autosave:"), autosaveBox); @@ -288,12 +292,20 @@ KnowitPreferences::KnowitPreferences() insertDateFormatEdit->setMinimumWidth(6*insertDateBoldButton->sizeHint().width()); layout->addStretch(1); + connect(insertDateColorButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotUpdateDatePreview())); + connect(insertDateFormatEdit, TQ_SIGNAL(textChanged (const TQString &)), this, TQ_SLOT(slotUpdateDatePreview())); + connect(insertDateItalicButton, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(slotUpdateDatePreview())); + connect(insertDateBoldButton, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(slotUpdateDatePreview())); + connect(insertDateUnderlineButton, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(slotUpdateDatePreview())); + setIconListAllVisible(true); } void KnowitPreferences::setOptions(const KnowitOptions& Options) { docked->setChecked(Options.docked); + dockOnStart->setEnabled(Options.docked); + dockOnStart->setChecked(Options.dockOnStart); reopen->setChecked(Options.reopen); autosave->setValue(Options.autosave); unconditionalSave->setChecked(Options.unconditionalSave); @@ -323,11 +335,6 @@ void KnowitPreferences::setOptions(const KnowitOptions& Options) insertDateItalicButton->setOn(Options.insertDateItalic); insertDateUnderlineButton->setOn(Options.insertDateUnderline); slotUpdateDatePreview(); - connect(insertDateColorButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotUpdateDatePreview())); - connect(insertDateFormatEdit, TQ_SIGNAL(textChanged (const TQString &)), this, TQ_SLOT(slotUpdateDatePreview())); - connect(insertDateItalicButton, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(slotUpdateDatePreview())); - connect(insertDateBoldButton, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(slotUpdateDatePreview())); - connect(insertDateUnderlineButton, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(slotUpdateDatePreview())); /* non-GUI options */ firstLink = Options.firstLink; @@ -338,6 +345,7 @@ KnowitOptions KnowitPreferences::getOptions() const { KnowitOptions Options; Options.docked = docked->isChecked(); + Options.dockOnStart = dockOnStart->isChecked(); Options.reopen = reopen->isChecked(); Options.autosave = autosave->value(); Options.unconditionalSave = unconditionalSave->isChecked(); @@ -372,6 +380,11 @@ KnowitOptions KnowitPreferences::getOptions() const return Options; } +void KnowitPreferences::slotUpdateOptions() +{ + dockOnStart->setEnabled(docked->isChecked()); +} + void KnowitPreferences::slotUpdateDatePreview() { TQString str = "<html><p align=\"center\">"; diff --git a/src/knowitpref.h b/src/knowitpref.h index c5ca0d1..21f3345 100644 --- a/src/knowitpref.h +++ b/src/knowitpref.h @@ -35,6 +35,7 @@ class KnowitOptions public: /* General */ bool docked; + bool dockOnStart; bool reopen; int autosave; bool unconditionalSave; @@ -74,7 +75,7 @@ class KnowitPreferences : public KDialogBase TQ_OBJECT private: - TQCheckBox *docked, *reopen, *horizontalSplit, *multipleInstances, *backup; + TQCheckBox *docked, *dockOnStart, *reopen, *horizontalSplit, *multipleInstances, *backup; TQCheckBox *unconditionalSave; TQCheckBox *wordwrap, *tabfocus, *customColors; KDualColorButton* editColors; @@ -97,7 +98,8 @@ public: KnowitPreferences(); void setOptions(const KnowitOptions& Options); KnowitOptions getOptions() const; - public slots: +public slots: + void slotUpdateOptions(); void slotUpdateDatePreview(); }; |