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

void KBearFileSysPart::setup (  )  [private]

Definition at line 507 of file kbearfilesyspart.cpp.

References KBearChildViewPart::dropped(), Connection::remotePath(), KBearDirView::setHomeURL(), slotPathActivated(), slotSetupPopupMenu(), and Connection::url().

Referenced by KBearFileSysPart().

                            {
      m_progressDelayTimer = new QTimer( this, "progress delay timer" );
      connect( m_progressDelayTimer, SIGNAL( timeout() ), SLOT( slotShowProgress() ));

      ////////////////////////////////////////////////////////////////////////
      // Setup the GUI
      QVBoxLayout* m_layout = new QVBoxLayout( widget() );
      m_toolBarUpper = new KToolBar( widget(), "ToolBarUpper", false, false );
      m_toolBarLower = new KToolBar( widget(), "ToolBarLower", false, false );

      m_splitter = new QSplitter( widget() );
      m_splitter->setOpaqueResize( true );
      m_splitter->setSizePolicy( QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding));
      QValueList<int> lst;
      int w = QApplication::desktop()->width( ) / 5;
      lst.append( w<100?100:w );
      m_splitter->setSizes( lst );
            
      KURL u = m_connection.url();
      u.setPath( m_connection.remotePath() );
      u.adjustPath( +1 );
      m_leftView = new KBearDirView(  m_splitter, "DirView", m_connection );
      m_leftView->setHomeURL( u );
//    m_splitter->setResizeMode( m_leftView, QSplitter::KeepSize );

      m_toolBarUpper->setEnableContextMenu( false );
      m_toolBarUpper->setMovingEnabled( false );
      m_toolBarLower->setEnableContextMenu( false );
      m_toolBarLower->setMovingEnabled( false );
      m_toolBarUpper->setFullSize(true);
      m_toolBarLower->setFullSize(true);

      // insert a path label
      QLabel* pathLabel = new QLabel( i18n( "Path: " ), m_toolBarLower );
      m_toolBarLower->insertWidget( 0, 35, pathLabel, 0 );

      m_toolBarLower->insertCombo( m_url.path(1),1,true, SIGNAL( activated( int ) ),
                                    this, SLOT( slotPathActivated( int ) ),true,i18n("This field displays the current path."), -1,1 );
      m_pathCombo = m_toolBarLower->getCombo( 1 );
      m_pathCombo->setMaxCount( 25 );
      m_pathCombo->setSizeLimit( 10 );
      m_pathCombo->setDuplicatesEnabled( false );
      m_pathCombo->setSizePolicy( QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
      QWhatsThis::add( m_pathCombo, i18n("This field displays the current path.\n"
                                          "You can use this to select a new path.") );

      // insert a filter label
      QLabel* filterLabel = new QLabel( m_toolBarLower );
      filterLabel->setPixmap( BarIcon("filter") );
      m_toolBarLower->insertWidget( 2, 32, filterLabel, 2 );
      // insert a combobox for displaying current filter
      m_filterCombo = new KHistoryCombo(m_toolBarLower, "Filter");
      m_filterCombo->setDuplicatesEnabled( false );
      m_toolBarLower->insertWidget( 3, 120, m_filterCombo, 3 );
      QToolTip::add( m_filterCombo, i18n("This field displays the current filter.") );
      QWhatsThis::add( m_filterCombo, i18n("This field displays the current filter. "
                                          "By changing the filter you can change what is shown in the view.\n"
                                          "You can use wildcards here to filter the view") );
      m_filterCombo->setFixedWidth( 120 );
      m_filterCombo->addToHistory( "*" );

      m_toolBarLower->alignItemRight( 2, true );      
      m_toolBarLower->alignItemRight( 3, true );

      m_toolBarLower->setItemAutoSized( 1, true );    
      m_toolBarLower->setStretchableWidget(m_pathCombo);

      m_toolBarUpper->updateRects(true);
      m_toolBarLower->updateRects(true);

            //    plug the actions to the toolbar
      upAction->plug( m_toolBarUpper );
      backAction->plug( m_toolBarUpper );
      forwardAction->plug( m_toolBarUpper );
      homeAction->plug( m_toolBarUpper );
      actionSeparator->plug( m_toolBarUpper );
      reloadAction->plug( m_toolBarUpper );
      actionSeparator->plug( m_toolBarUpper );
      stopAction->plug( m_toolBarUpper );
      actionSeparator->plug( m_toolBarUpper );
      mkdirAction->plug( m_toolBarUpper );
      actionSeparator->plug( m_toolBarUpper );
      treeAction->plug( m_toolBarUpper );
      actionSeparator->plug( m_toolBarUpper );
      shortAction->plug( m_toolBarUpper );
      detailedAction->plug( m_toolBarUpper );

      m_layout->addWidget( m_toolBarUpper );                
      m_layout->addWidget( m_toolBarLower );                
      m_layout->addWidget( m_splitter,10 );                 

      m_statusBarUpper = new QLabel( widget(), "StatusLabel" );
      QWhatsThis::add( m_statusBarUpper,
                              i18n("This field displays current state of the connection as well as some other useful information.") );
      m_layout->addWidget( m_statusBarUpper );              
      m_statusBarUpper->setSizePolicy( QSizePolicy(QSizePolicy::Preferred,QSizePolicy::Preferred) );
      m_statusBarUpper->setFrameStyle ( QFrame::StyledPanel | QFrame::Sunken );

      m_statusBarLower = new QHBox( widget(), "StatusBarLower"  );
      m_statusBarLower->setFrameStyle ( QFrame::StyledPanel | QFrame::Sunken );
      // insert a progress bar
      m_progress = new KProgress( m_statusBarLower, "progress" );
      m_speedLabel = new QLabel( m_statusBarLower, "SpeedLabel");
      m_speedLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter | Qt::ExpandTabs );
      m_speedLabel->setFrameStyle ( QFrame::StyledPanel | QFrame::Sunken );

      // insert labels for displaying numbers of dirs and files in current path
      m_directoryLabel = new QLabel( m_statusBarLower, "DirectoryLabel");
      QWhatsThis::add( m_directoryLabel, i18n("This field displays the number of sub directories in current directory.") );
      m_directoryLabel->setFrameStyle ( QFrame::StyledPanel | QFrame::Sunken );
      m_directoryLabel->setText( i18n("Directories: ") );

      m_fileLabel = new QLabel( m_statusBarLower, "FileLabel");
      QWhatsThis::add( m_fileLabel, i18n("This field displays the number of files in current directory.") );
      m_fileLabel->setFrameStyle ( QFrame::StyledPanel | QFrame::Sunken );
      m_fileLabel->setText( i18n("Files: ") );

      m_endLabel = new QLabel( m_statusBarLower, "EndLabel");
      m_endLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter | Qt::ExpandTabs );
      m_endLabel->setFrameStyle ( QFrame::StyledPanel | QFrame::Sunken );
      m_endLabel->setText( i18n("Connected: %1").arg( i18n("Not connected") ) );
      QTimer* t = new QTimer( this );
      t->start( 1000 );
      connect( t, SIGNAL( timeout() ), this, SLOT( slotUpdateTime() ) );

      m_statusBarLower->setStretchFactor( m_progress, 7 );
      m_statusBarLower->setStretchFactor( m_speedLabel, 10 );
      m_statusBarLower->setStretchFactor( m_directoryLabel, 0 );
      m_statusBarLower->setStretchFactor( m_fileLabel, 0 );
      m_statusBarLower->setStretchFactor( m_endLabel, 10 );
      m_layout->addWidget( m_statusBarLower );

      // add 'wheel' animation
      m_toolBarUpper->insertAnimatedWidget(1, widget(),"",QString("kde"));
      m_toolBarUpper->alignItemRight( 1, true );      
      QWhatsThis::add( m_toolBarUpper->animatedWidget(1),
                  i18n("This animation is active during directory loading and will stop as soon as the directory is completely loaded.") );
      
      connect( m_leftView, SIGNAL( folderSelected( const KFileItem* ) ), this,SLOT( slotDirSelected( const KFileItem* ) ) );
      connect( m_leftView, SIGNAL(dropped( QMimeSource*, const QPoint& )),
                              this,SIGNAL(dropped( QMimeSource*, const QPoint& )));

      connect( m_filterCombo, SIGNAL( activated( const QString& ) ), this, SLOT( slotFilterChanged(const QString&) ) );
      connect( m_filterCombo, SIGNAL( returnPressed(const QString&) ), m_filterCombo, SLOT( addToHistory(const QString&) ) );

      connect( treeAction, SIGNAL( toggled(bool)), this, SLOT( slotToggleTreeView(bool)));
      connect( showHiddenAction, SIGNAL( toggled( bool ) ), m_leftView, SLOT( slotToggleShowHidden( bool ) ) );

      connect( actionMenu->popupMenu(), SIGNAL( aboutToShow()), this, SLOT( slotSetupPopupMenu()));
}


Generated by  Doxygen 1.6.0   Back to index