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

void KBearFileSysPart::setupActions (  )  [private]

Definition at line 351 of file kbearfilesyspart.cpp.

References back(), cdUp(), forward(), home(), reload(), slotClearSelection(), slotClearStatusBar(), slotClearSynch(), slotClipboardDataChanged(), slotCopy(), slotCut(), slotDelete(), slotFind(), slotInvertSelection(), slotNewSynch(), slotOpen(), slotOpenWith(), slotPaste(), slotSelectAll(), slotSetupViewMenu(), slotShred(), slotToggleHidden(), and stop().

Referenced by KBearFileSysPart().

      // First we set up the private actions
    m_privateActionCollection = new KActionCollection( 0L, this, "PrivateActionCollection" );
    actionMenu = new KActionMenu( i18n("Menu"), m_privateActionCollection, "popupMenu" );

    actionSeparator = new KActionSeparator( m_privateActionCollection, "separator" );

      new KAction( i18n("&Open"), 0, this, SLOT( slotOpen() ), m_privateActionCollection, "open" );
      new KAction( i18n("&Other..."), 0, this, SLOT( slotOpenWith() ), m_privateActionCollection, "open with" );
      openWithMenu = new KActionMenu( i18n("Open With..."), m_privateActionCollection, "openWithMenu" );

    new KAction( i18n("Properties..."), ALT+Key_Return, this,
                 SLOT(slotProperties()), m_privateActionCollection, "properties" );

    // Warning: adjust slotViewActionAdded() and slotViewActionRemoved()
    // when you add/remove actions here!

      // Now it's time for the public actions
      actionCollection()->setHighlightingEnabled( true );

      new KAction( i18n("S&ynchronize current directory"), "dirsynch_new", 0, this, SLOT( slotNewSynch() ), actionCollection(), "synch_new" );
      new KAction( i18n("&Clear List"), 0, this, SLOT( slotClearSynch() ), actionCollection(), "clear_synch" );

      mkdirAction = new KAction( i18n("New Directory..."), 0,
                                          this, SLOT( mkdir() ), actionCollection(), "edit_mkdir" );
      mkdirAction->setIcon( QString::fromLatin1("folder_new") );
      deleteAction = new KAction( i18n( "Delete" ), "editdelete", SHIFT+Key_Delete, this,
                                          SLOT( slotDelete() ), actionCollection(), "edit_delete" );
      deleteAction->setEnabled( false );
      shredAction = new KAction( i18n("&Shred"), "shredder", CTRL+SHIFT+Key_Delete, this, SLOT( slotShred() ), actionCollection(), "edit_shred" );
      shredAction->setEnabled( false );

      stopAction = new KAction( i18n("S&top"),"stop", 0, this, SLOT( stop() ), actionCollection(), "view_stop" );
      stopAction->setToolTip( i18n("Stop loading directory.") );
      stopAction->setEnabled( false );

      upAction = KStdAction::up( this, SLOT( cdUp() ), actionCollection(), KStdAction::stdName(KStdAction::Up) );
      upAction->setText( i18n("Parent Directory") );
      backAction = KStdAction::back( this, SLOT( back() ), actionCollection(), KStdAction::stdName(KStdAction::Back) );
      forwardAction = KStdAction::forward( this, SLOT(forward()), actionCollection(), KStdAction::stdName(KStdAction::Forward));
      homeAction = KStdAction::home( this, SLOT( home() ), actionCollection(), KStdAction::stdName(KStdAction::Home) );
      homeAction->setText(i18n("Home Directory"));
      reloadAction = KStdAction::redisplay( this, SLOT(reload()), actionCollection(), KStdAction::stdName(KStdAction::Redisplay) );
      reloadAction->setShortcut( Key_F5 );
      reloadAction->setText( i18n("Reload") );
      KStdAction::cut( this, SLOT( slotCut() ), actionCollection(), KStdAction::stdName(KStdAction::Cut) );
      KStdAction::copy( this, SLOT( slotCopy() ), actionCollection(), KStdAction::stdName(KStdAction::Copy));
      KStdAction::paste( this, SLOT( slotPaste() ), actionCollection(), KStdAction::stdName(KStdAction::Paste));
      KStdAction::find( this, SLOT( slotFind() ), actionCollection(), KStdAction::stdName(KStdAction::Find) );
      KStdAction::selectAll( this, SLOT( slotSelectAll() ), actionCollection(), KStdAction::stdName(KStdAction::SelectAll) );
      KStdAction::deselect( this, SLOT( slotClearSelection() ), actionCollection(), KStdAction::stdName(KStdAction::Deselect) );
      new KAction( i18n("&Invert Selection"),CTRL+Key_I, this, SLOT( slotInvertSelection() ), actionCollection(), "edit_invert_selection" );

      //Now we set up the view and sort menu
      // Note: the popupMenu is setup in runtime in slotSetupPopupMenu

      // the view menu actions
      viewActionMenu = new KActionMenu( i18n("View" ), actionCollection(), "view_view_menu" );
      shortAction = new KRadioAction( i18n("Short View"), "view_icon",
                                          0, actionCollection(), "short view" );
      detailedAction = new KRadioAction( i18n("Detailed View"), "view_detailed",
                                       0, actionCollection(), "detailed view" );
      treeAction = new KToggleAction( i18n("Directory &tree"), "view_tree",0, this, 0, actionCollection(), "tree view"  );

      showHiddenAction = new KToggleAction( i18n("Show Hidden Files"), 0,
                                                      actionCollection(), "show hidden" );
      QString viewGroup = QString::fromLatin1("view");
      shortAction->setExclusiveGroup( viewGroup );
      detailedAction->setExclusiveGroup( viewGroup );

      connect( shortAction, SIGNAL( toggled( bool ) ), SLOT( slotSimpleView() ));
      connect( detailedAction, SIGNAL( toggled( bool ) ), SLOT( slotDetailedView() ));
      connect( showHiddenAction, SIGNAL( toggled( bool ) ), SLOT( slotToggleHidden( bool ) ));
      viewActionMenu->insert( showHiddenAction );
      viewActionMenu->insert( new KActionSeparator( m_privateActionCollection, "separator1" ) );
      viewActionMenu->insert( shortAction );
      viewActionMenu->insert( detailedAction );
      viewActionMenu->insert( m_privateActionCollection->action("separator1") );
      viewActionMenu->insert( treeAction );
      connect( viewActionMenu->popupMenu(), SIGNAL( aboutToShow() ), this, SLOT( slotSetupViewMenu() ) );
      // the sort menu actions
      sortActionMenu = new KActionMenu( i18n("Sorting"), actionCollection(), "view_sorting_menu");
      byNameAction = new KRadioAction( i18n("By Name"), 0, this,
                                                SLOT( slotSortByName() ), actionCollection(), "by name" );
      byDateAction = new KRadioAction( i18n("By Date"), 0, this,
                                                SLOT( slotSortByDate() ), actionCollection(), "by date" );
      bySizeAction = new KRadioAction( i18n("By Size"), 0, this,
                                    SLOT( slotSortBySize() ), actionCollection(), "by size" );
      reverseAction = new KToggleAction( i18n("Reverse"), 0, this,
                                    SLOT( slotSortReversed() ), actionCollection(), "reversed" );

      QString sortGroup = QString::fromLatin1("sort");
      byNameAction->setExclusiveGroup( sortGroup );
      byDateAction->setExclusiveGroup( sortGroup );
      bySizeAction->setExclusiveGroup( sortGroup );

      dirsFirstAction = new KToggleAction( i18n("Directories First"), 0, actionCollection(), "dirs first");
      caseInsensitiveAction = new KToggleAction(i18n("Case Insensitive"), 0, actionCollection(), "case insensitive" );

      connect( dirsFirstAction, SIGNAL( toggled( bool ) ), SLOT( slotToggleDirsFirst() ));
      connect( caseInsensitiveAction, SIGNAL( toggled( bool ) ), SLOT( slotToggleIgnoreCase() ));

      sortActionMenu->insert( byNameAction );
      sortActionMenu->insert( byDateAction );
      sortActionMenu->insert( bySizeAction );
      sortActionMenu->insert( reverseAction );
      sortActionMenu->insert( actionSeparator );
      sortActionMenu->insert( dirsFirstAction );
      sortActionMenu->insert( caseInsensitiveAction );

      upAction->setWhatsThis( i18n("This button moves you up one step in the directory tree.") );
      backAction->setWhatsThis( i18n("This button moves you one step back in history list.") );
      forwardAction->setWhatsThis( i18n("This button moves you one step forward in history list.") );
      reloadAction->setWhatsThis( i18n("This button reloads current directory.") );
      mkdirAction->setWhatsThis( i18n("This button creates a new directory in current directory.") );
      stopAction->setWhatsThis( i18n("This button stops loading the directory.") );
      detailedAction->setWhatsThis( i18n("This button change the view to detailed list mode.") );
      shortAction->setWhatsThis( i18n("This button change the view to icon mode.") );
      homeAction->setWhatsThis( i18n("This button moves you to your home directory\n"
                                                                                    "On a remote system this will be your startup directory.") );
      treeAction->setToolTip( i18n("This button toggles the directory tree.") );
      treeAction->setWhatsThis( i18n("This button toggles the directory tree.") );
      action( KStdAction::stdName(KStdAction::Cut) )->setToolTip( i18n("Cut current selection from the active view into the clipboard.") );
      action( KStdAction::stdName(KStdAction::Copy) )->setToolTip( i18n("Copy current selection from the active view into the clipboard.") );
      action( KStdAction::stdName(KStdAction::Paste) )->setToolTip( i18n("Paste clipboard contents into the active view.") );
      action( KStdAction::stdName(KStdAction::Find) )->setToolTip( i18n("Open the Find dialog.") );
      action( KStdAction::stdName(KStdAction::SelectAll) )->setToolTip( i18n("Select all items in the active view.") );
      action( KStdAction::stdName(KStdAction::Deselect) )->setToolTip( i18n("Deselect all items in the active view.") );
      action( "edit_invert_selection" )->setToolTip( i18n("Invert selection in the active view.") );

      action( KStdAction::stdName(KStdAction::Cut) )->setWhatsThis( i18n("Cut current selection from the active view into the clipboard.\n"
                        "You can also select the 'Cut' command from the 'Edit' menu.") );
      action( KStdAction::stdName(KStdAction::Copy) )->setWhatsThis( i18n("Copy current selection from the active view into the clipboard.\n"
                        "You can also select the 'Copy' command from the 'Edit' menu.") );
      action( KStdAction::stdName(KStdAction::Paste) )->setWhatsThis( i18n("Paste clipboard contents into the active view.\n"
                        "You can also select the 'Paste' command from the 'Edit' menu.") );
      action( KStdAction::stdName(KStdAction::Find) )->setWhatsThis( i18n("Open the 'Find' dialog\n"
                        "You can also select the 'Find' command from the 'Edit' menu.") );

      action( KStdAction::stdName(KStdAction::Cut) )->setEnabled( false );
      action( KStdAction::stdName(KStdAction::Copy) )->setEnabled( false );
      action( KStdAction::stdName(KStdAction::Paste) )->setEnabled( false );

      connect( QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(slotClipboardDataChanged()) );
      // we need to call this first to initialize

      connect( actionCollection(), SIGNAL( actionStatusText(const QString &) ),
                        SIGNAL( setStatusBarText( const QString& ) ) );
      connect( actionCollection(), SIGNAL( clearStatusText() ), this, SLOT( slotClearStatusBar() ) );


Generated by  Doxygen 1.6.0   Back to index