diff options
Diffstat (limited to 'starter/starter.cpp')
| -rw-r--r-- | starter/starter.cpp | 61 |
1 files changed, 35 insertions, 26 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); |
