Logo Search packages:      
Sourcecode: kbear version File versions  Download package

bool KBear::queryClose (  )  [virtual]

reimplemented for MessageBox on exit

Definition at line 193 of file kbear.cpp.

References KBearInfoView::numOfTransfers(), saveProperties(), KBearInfoView::slotLogShowing(), KBearInfoView::slotTransferShowing(), KBearMdiChildView::stop(), and switchToChildframeMode().

                       {
kdDebug()<<"KBear::queryClose()"<<endl;
      kapp->config()->setGroup("General");
      int nOfTransfers = m_infoView->numOfTransfers();
      bool confirm;
      int accept = QDialog::Accepted;
      // do user want to confirm exit on active transfers ?
      if( ( confirm = kapp->config()->readBoolEntry( "Confirm On Exit", true) ) && nOfTransfers > 0 ) {
            KBearQueryExit queryExitDlg( this, "KBearQueryExit", true);
            queryExitDlg.m_numOfTransfers->display( i18n("%1").arg(nOfTransfers) );
            queryExitDlg.m_numOfQueuedTransfers->display( i18n("%1").arg(m_transferQueue.count()));
            queryExitDlg.m_askAgainCheckBox->setChecked( ! confirm );
            accept = queryExitDlg.exec();
            bool confirm = queryExitDlg.m_askAgainCheckBox->isChecked();
            // set 'ask again'  according to users choice
            if ( accept == QDialog::Accepted ) {
                  kapp->config()->writeEntry( "Confirm On Exit", ! confirm );
            }
      }
      if( accept == QDialog::Accepted ) {
            // well I guess if we get here it's not first run anymore ;) so lets save that
            kapp->config()->writeEntry( "First Run", false );
           // we need this inorder to get a valid dock config
            m_infoView->slotLogShowing();
            m_infoView->slotTransferShowing();
            // if user want to save ' run time settings'
            if( kapp->config()->readBoolEntry( "Run Time Settings", true) )
                  KBear::saveProperties(kapp->config());

            kapp->config()->sync();

            KBearMdiChildView* childView;
            for(QextMdiChildView *w = m_pWinList->first();w;w= m_pWinList->next()) {
                  childView = static_cast<KBearMdiChildView*>(w);
                  childView->stop();  // stop any job, listing etc.
            }

             if( m_mdiMode == QextMdi::TabPageMode ) // this is just to prevent crash on shutdown
                  switchToChildframeMode();

#if (KDE_VERSION < 305) || !defined(KDE_VERSION)
            QPtrList<KParts::Plugin> plugins = KParts::Plugin::pluginObjects( this );
            KParts::Plugin* plugin = plugins.last();
            for( ; plugin; plugin = plugins.prev() )
                  guiFactory()->removeClient( plugin );
#endif
            return true;
      }     
      return false;
}


Generated by  Doxygen 1.6.0   Back to index