diff options
| -rw-r--r-- | starter/starter.cpp | 61 | ||||
| -rw-r--r-- | starter/starterconfig.ui | 17 |
2 files changed, 49 insertions, 29 deletions
diff --git a/starter/starter.cpp b/starter/starter.cpp index 29bdd65..80bf175 100644 --- a/starter/starter.cpp +++ b/starter/starter.cpp @@ -53,6 +53,7 @@ starter::starter(const TQString& configFile, Type type, int actions, TQWidget *p configDialog->DownURL->setURL(config.readEntry("DownImage", "" )); configDialog->useKTTS->setChecked(config.readBoolEntry("useKTTS", false )); + configDialog->centerPopup->setChecked(config.readBoolEntry("CenterPopup", false )); configDialog->customPopupSize->setChecked(config.readBoolEntry("CustomPopupSize", false )); configDialog->customDialogSize->setChecked(config.readBoolEntry("CustomDialogSize", false )); configDialog->customDialogPos->setChecked(config.readBoolEntry("CustomDialogPos", false )); @@ -182,6 +183,7 @@ void starter::updateSettings() config->writeEntry("HoverImage", configDialog->HoverURL->url()); config->writeEntry("DownImage", configDialog->DownURL->url()); config->writeEntry("useKTTS", configDialog->useKTTS->isChecked()); + config->writeEntry("CenterPopup", configDialog->centerPopup->isChecked()); config->writeEntry("CustomPopupSize", configDialog->customPopupSize->isChecked()); config->writeEntry("CustomDialogSize", configDialog->customDialogSize->isChecked()); config->writeEntry("CustomDialogPos", configDialog->customDialogPos->isChecked()); @@ -342,35 +344,42 @@ void starter::popupMenu() } TQPoint pt = mapToGlobal(pos()); - TQRect desktop = TQDesktopWidget().availableGeometry( startMenu ); + TQRect desktop; int x = pt.x(); int y = pt.y(); - switch(position()) - { - case pTop: - y += height() + 1; - if (x + startMenu->width() > desktop.right()) - x = desktop.right() - startMenu->width(); - if (x < 0) x = 0; - break; - case pLeft: - x += width() + 1; - if (y + startMenu->height() > desktop.bottom()) - y = desktop.bottom() - startMenu->height(); - if (y < 0) y = 0; - break; - case pBottom: - y -= startMenu->height() - 1; - if (x + startMenu->width() > desktop.right()) - x = desktop.right() - startMenu->width(); - if (x < 0) x = 0; - break; - case pRight: - x -= startMenu->width() - 1; - if (y + startMenu->height() > desktop.bottom()) - y = desktop.bottom() - startMenu->height(); - if (y < 0) y = 0; + if (configDialog->centerPopup->isChecked()) { + desktop = TQDesktopWidget().availableGeometry( TQCursor().pos() ); + x = desktop.x() + desktop.width() / 2 - startMenu->width() / 2; + y = desktop.y() + desktop.height() / 2 - startMenu->height() / 2; + } else { + desktop = TQDesktopWidget().availableGeometry( startMenu ); + switch(position()) + { + case pTop: + y += height() + 1; + if (x + startMenu->width() > desktop.right()) + x = desktop.right() - startMenu->width(); + if (x < 0) x = 0; + break; + case pLeft: + x += width() + 1; + if (y + startMenu->height() > desktop.bottom()) + y = desktop.bottom() - startMenu->height(); + if (y < 0) y = 0; + break; + case pBottom: + y -= startMenu->height() - 1; + if (x + startMenu->width() > desktop.right()) + x = desktop.right() - startMenu->width(); + if (x < 0) x = 0; + break; + case pRight: + x -= startMenu->width() - 1; + if (y + startMenu->height() > desktop.bottom()) + y = desktop.bottom() - startMenu->height(); + if (y < 0) y = 0; + } } pt = TQPoint(x, y); diff --git a/starter/starterconfig.ui b/starter/starterconfig.ui index d86df9f..0249142 100644 --- a/starter/starterconfig.ui +++ b/starter/starterconfig.ui @@ -494,7 +494,18 @@ </spacer> </hbox> </widget> - <widget class="Line" row="1" column="0"> + <widget class="TQCheckBox" row="1" column="0"> + <property name="name"> + <cstring>centerPopup</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Center popup</string> + </property> + </widget> + <widget class="Line" row="2" column="0"> <property name="name"> <cstring>line2_2</cstring> </property> @@ -508,7 +519,7 @@ <enum>Horizontal</enum> </property> </widget> - <widget class="TQLayoutWidget" row="2" column="0"> + <widget class="TQLayoutWidget" row="3" column="0"> <property name="name"> <cstring>layout6_2</cstring> </property> @@ -656,7 +667,7 @@ <cstring>textLabel1_4</cstring> </property> <property name="text"> - <string>Icon SIze</string> + <string>Icon Size</string> </property> </widget> <widget class="TQComboBox"> |
