]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/qt-console/run/run.cpp
Center bat run window on screen
[bacula/bacula] / bacula / src / qt-console / run / run.cpp
index cf3c67cb98b623be50ae15431aebcf2f00682191..9510f56804e18660db123ac684ff0e53ba92c49e 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2007-2009 Free Software Foundation Europe e.V.
+   Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -31,7 +31,6 @@
  *
  *   Kern Sibbald, February MMVII
  *
- *  $Id$
  */ 
 
 #include "bat.h"
@@ -46,6 +45,7 @@ runPage::runPage()
 
 runPage::runPage(const QString &defJob)
 {
+   m_dockOnFirstUse = false;
    init();
    if (defJob != "")
       jobCombo->setCurrentIndex(jobCombo->findText(defJob, Qt::MatchExactly));
@@ -57,6 +57,7 @@ runPage::runPage(const QString &defJob, const QString &level,
                  const QString &pool, const QString &storage,
                  const QString &client, const QString &fileset)
 {
+   m_dockOnFirstUse = false;
    init();
    jobCombo->setCurrentIndex(jobCombo->findText(defJob, Qt::MatchExactly));
    job_name_change(0);
@@ -80,10 +81,16 @@ runPage::runPage(const QString &defJob, const QString &level,
 void runPage::init()
 {
    QDateTime dt;
+   QDesktopWidget *desk = QApplication::desktop(); 
+   QRect scrn;
 
    m_name = tr("Run");
    pgInitialize();
    setupUi(this);
+   /* Get screen rectangle */
+   scrn = desk->screenGeometry(desk->primaryScreen());
+   /* Position this window in the middle of the screen */
+   this->move((scrn.width()-this->width())/2, (scrn.height()-this->height())/2);
    QTreeWidgetItem* thisitem = mainWin->getFromHash(this);
    thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/run.png")));
    m_conn = m_console->notifyOff();
@@ -109,7 +116,7 @@ void runPage::init()
    connect(cancelButton, SIGNAL(pressed()), this, SLOT(cancelButtonPushed()));
 
    // find a way to place the new window at the cursor position
-   // or in the midle of the page
+   // or in the middle of the page
 //   dockPage();
    setCurrent();
 }