コード例 #1
0
void MainWindow::initWidgets()
{
  // includes sidebar and part stack
  mTopWidget = new QHBox( this );
  mTopWidget->setFrameStyle( QFrame::Panel | QFrame::Sunken );
  setCentralWidget( mTopWidget );

  QHBox *mBox = 0;
  mSplitter = new QSplitter( mTopWidget );
  mBox = new QHBox( mTopWidget );
  mSidePane = new IconSidePane( this, mSplitter );
  mSidePane->setSizePolicy( QSizePolicy( QSizePolicy::Maximum,
                                         QSizePolicy::Preferred ) );
  // donÄt occupy screen estate on load
  QValueList<int> sizes;
  sizes << 0;
  mSplitter->setSizes(sizes);

  mSidePane->setActionCollection( actionCollection() );

  connect( mSidePane, SIGNAL( pluginSelected( Kontact::Plugin * ) ),
           SLOT( selectPlugin( Kontact::Plugin * ) ) );

  QVBox *vBox;
  if ( mSplitter ) {
    vBox = new QVBox( mSplitter );
  } else {
    vBox = new QVBox( mBox );
  }

  vBox->setSpacing( 0 );

  mPartsStack = new QWidgetStack( vBox );
  initAboutScreen();

  QString loading = i18n( "<h2 style='text-align:center; margin-top: 0px; margin-bottom: 0px'>%1</h2>" )
                    .arg( i18n("Loading Kontact...") );

  paintAboutScreen( loading );

  /* Create a progress dialog and hide it. */
  KPIM::ProgressDialog *progressDialog = new KPIM::ProgressDialog( statusBar(), this );
  progressDialog->hide();

  mLittleProgress = new KPIM::StatusbarProgressWidget( progressDialog, statusBar() );

  mStatusMsgLabel = new KRSqueezedTextLabel( i18n( " Initializing..." ), statusBar() );
  mStatusMsgLabel->setAlignment( AlignLeft | AlignVCenter );

  statusBar()->addWidget( mStatusMsgLabel, 10 , false );
  statusBar()->addWidget( mLittleProgress, 0 , true );
  mLittleProgress->show();
}
コード例 #2
0
KAddressBookMain::KAddressBookMain( const QString &file )
    : KXmlGuiWindow( 0 )
{
    // Set this to be the group leader for all subdialogs - this means
    // modal subdialogs will only affect this dialog, not the other windows
    setAttribute( Qt::WA_GroupLeader );

    setCaption( i18n( "Address Book Browser" ) );

    mCore = new KABCore( this, true, this, file );
    mCore->restoreSettings();

    initActions();

    setCentralWidget( mCore->widget() );

    statusBar()->show();
    statusBar()->insertItem( "", 1 );

    KPIM::ProgressDialog *progressDialog = new KPIM::ProgressDialog( statusBar(),
            this );
    progressDialog->hide();

    KPIM::StatusbarProgressWidget *progressWidget;
    progressWidget = new KPIM::StatusbarProgressWidget( progressDialog,
            statusBar() );
    progressWidget->show();

    statusBar()->addPermanentWidget( progressWidget, 0 );

    mCore->setStatusBar( statusBar() );

    setStandardToolBarMenuEnabled( true );

    createGUI( "kaddressbookui.rc" );

    resize( 400, 300 ); // initial size
    setAutoSaveSettings();

    new CoreAdaptor( this );
    QDBusConnection::sessionBus().registerObject("/KAddressBook", this, QDBusConnection::ExportAdaptors);
}