void ActionManagerImpl::initTabWidget(TabWidget* tabWidget)
{
    if (d->tabWidget)
        return;
    else
        d->tabWidget = tabWidget;

    KActionCollection *coll = actionCollection();

    KAction *action = coll->addAction("select_next_tab");
    action->setText(i18n("Select Next Tab"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotNextTab()));
    action->setShortcuts(KShortcut( "Ctrl+Period" ));

    action = coll->addAction("select_previous_tab");
    action->setText(i18n("Select Previous Tab"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotPreviousTab()));
    action->setShortcuts(KShortcut( "Ctrl+Comma" ));

    action = coll->addAction("tab_detach");
    action->setIcon(KIcon("tab-detach"));
    action->setText(i18n("Detach Tab"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotDetachTab()));
    action->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_B));

    action = coll->addAction("tab_copylinkaddress");
    action->setText(i18n("Copy Link Address"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotCopyLinkAddress()));

    action = coll->addAction("tab_remove");
    action->setIcon(KIcon("tab-close"));
    action->setText(i18n("Close Tab"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotCloseTab()));
    action->setShortcuts(KStandardShortcut::close());

    action = coll->addAction("inc_font_sizes");
    action->setIcon(KIcon("format-font-size-more"));
    action->setText(i18n("Enlarge Font"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotFrameZoomIn()));
    action->setShortcut( QKeySequence::ZoomIn );

    action = coll->addAction("dec_font_sizes");
    action->setIcon(KIcon("format-font-size-less"));
    action->setText(i18n("Shrink Font"));
    connect(action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotFrameZoomOut()));
    action->setShortcut( QKeySequence::ZoomOut );

    QString actionname;
    for (int i=1;i<10;i++) {
      actionname.sprintf("activate_tab_%02d", i);
      action = new KAction( i18n("Activate Tab %1", i),this );
      action->setShortcut( QKeySequence( QString::fromLatin1( "Alt+%1" ).arg( i ) ) );
      coll->addAction( actionname, action );
      connect( action, SIGNAL(triggered(bool)), d->tabWidget, SLOT(slotActivateTab()) );
    }


}
KJotsPlugin::KJotsPlugin( KontactInterface::Core *core, const QVariantList & )
  : KontactInterface::Plugin( core, core, "kjots" ), m_interface( 0 )
{
  setComponentData( KontactPluginFactory::componentData() );

  KAction *action =
    new KAction( KIcon( "document-new" ),
                 i18nc( "@action:inmenu", "New KJots Page" ), this );
  actionCollection()->addAction( "new_kjots_page", action );
  action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_P ) );
  action->setHelpText(
    i18nc( "@info:status", "Create a new jots page" ) );
  action->setWhatsThis(
    i18nc( "@info:whatsthis",
           "You will be presented with a dialog where you can create a new jots page." ) );
  connect( action, SIGNAL(triggered(bool)), SLOT( newPage()) );
  insertNewAction( action );

  action = new KAction( KIcon( "address-book-new" ),
                        i18nc( "@action:inmenu", "New KJots Book" ), this );
  actionCollection()->addAction( "new_kjots_book", action );
  action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_B ) );
  action->setHelpText(
    i18nc( "@info:status", "Create a new jots book" ) );
  action->setWhatsThis(
    i18nc( "@info:whatsthis",
           "You will be presented with a dialog where you can create a new jots book." ) );
  connect( action, SIGNAL(triggered(bool)), SLOT( newBook()) );
  insertNewAction( action );

  mUniqueAppWatcher = new KontactInterface::UniqueAppWatcher(
    new KontactInterface::UniqueAppHandlerFactory<KJotsUniqueAppHandler>(), this );
}
Beispiel #3
0
void MainWindow::setupActions()
{
	KStandardAction::quit(KApplication::instance(), SLOT(quit()), actionCollection());

// commit
	KAction *commitAction = actionCollection()->addAction("commit", ui->stageWidget, SLOT(commit()));
	commitAction->setText(i18n("Commit"));
	commitAction->setIcon(KIcon("git-commit"));
	commitAction->setShortcut(Qt::CTRL + Qt::Key_Return);

	KAction *stageFileAction = actionCollection()->addAction("file_stage", ui->stageWidget, SLOT(stageFile()));
	stageFileAction->setText(i18n("Stage File to Commit"));
	stageFileAction->setIcon(KIcon("git-file-stage"));
	stageFileAction->setShortcut(Qt::CTRL + Qt::Key_S);

	KAction *unstageFileAction = actionCollection()->addAction("file_unstage", ui->stageWidget, SLOT(unstageFile()));
	unstageFileAction->setText(i18n("Unstage File from Commit"));
	unstageFileAction->setIcon(KIcon("git-file-unstage"));
	unstageFileAction->setShortcut(Qt::CTRL + Qt::Key_U);

// repository
	KAction *openRepoAction = actionCollection()->addAction("repository_open", this, SLOT(open()));
	openRepoAction->setText(i18n("Open repository"));
	openRepoAction->setIcon(KIcon("git-repo-open"));
	openRepoAction->setShortcut(Qt::CTRL + Qt::Key_O);

	KAction *reloadRepoAction = actionCollection()->addAction("repository_reload", this, SLOT(reload()));
	reloadRepoAction->setText(i18n("Reload repository"));
	reloadRepoAction->setIcon(KIcon("git-repo-reload"));
	reloadRepoAction->setShortcut(Qt::Key_F5);
}
Beispiel #4
0
KFindTreeView::KFindTreeView( QWidget *parent,  KfindDlg * findDialog )
    : QTreeView( parent ) ,
    m_contextMenu(0),
    m_kfindDialog(findDialog)
{
    //Configure model and proxy model
    m_model = new KFindItemModel( this );
    m_proxyModel = new KFindSortFilterProxyModel();
    m_proxyModel->setSourceModel( m_model );
    setModel( m_proxyModel );
    
    //Configure QTreeView
    setRootIsDecorated( false );
    setSelectionMode( QAbstractItemView::ExtendedSelection );
    setSortingEnabled( true );
    setDragEnabled( true );
    setContextMenuPolicy( Qt::CustomContextMenu );

    connect( this, SIGNAL(customContextMenuRequested(QPoint)),
                 this, SLOT(contextMenuRequested(QPoint)));
           
    //Mouse single/double click settings
    connect( KGlobalSettings::self(), SIGNAL(settingsChanged(int)), this, SLOT(reconfigureMouseSettings()) );
    reconfigureMouseSettings();
    
    // TODO: this is a workaround until  Qt-issue 176832 has been fixed (from Dolphin)
    connect(this, SIGNAL(pressed(QModelIndex)), this, SLOT(updateMouseButtons()));
                
    //Generate popup menu actions
    m_actionCollection = new KActionCollection( this );
    m_actionCollection->addAssociatedWidget(this);

    KAction * open = KStandardAction::open(this, SLOT(slotExecuteSelected()), this);
    m_actionCollection->addAction( "file_open", open );
    
    KAction * copy = KStandardAction::copy(this, SLOT(copySelection()), this);
    m_actionCollection->addAction( "edit_copy", copy );
    
    KAction * openFolder = new KAction( KIcon("window-new"), i18n("&Open containing folder(s)"), this );
    connect( openFolder, SIGNAL(triggered()), this, SLOT(openContainingFolder()) );
    m_actionCollection->addAction( "openfolder", openFolder );
    
    KAction * del = new KAction( KIcon("edit-delete"), i18n("&Delete"), this );
    connect( del, SIGNAL(triggered()), this, SLOT(deleteSelectedFiles()) );
    del->setShortcut(Qt::SHIFT + Qt::Key_Delete);
    m_actionCollection->addAction( "del", del );
   
    KAction * trash = new KAction( KIcon("user-trash"), i18n("&Move to Trash"), this );
    connect( trash, SIGNAL(triggered()), this, SLOT(moveToTrashSelectedFiles()) );
    trash->setShortcut(Qt::Key_Delete);
    m_actionCollection->addAction( "trash", trash );
    
    header()->setStretchLastSection( true );
    
    sortByColumn( 0, Qt::AscendingOrder );
}
Beispiel #5
0
void KNotesApp::updateGlobalAccels()
{
    if ( m_globalAccel->isEnabled() )
    {
        KAction *action = actionCollection()->action( "new_note" );
        if ( action )
            action->setShortcut( m_globalAccel->shortcut( "global_new_note" ) );
        action = actionCollection()->action( "new_note_clipboard" );
        if ( action )
            action->setShortcut( m_globalAccel->shortcut( "global_new_note_clipboard" ) );
        action = actionCollection()->action( "hide_all_notes" );
        if ( action )
            action->setShortcut( m_globalAccel->shortcut( "global_hide_all_notes" ) );
        action = actionCollection()->action( "show_all_notes" );
        if ( action )
            action->setShortcut( m_globalAccel->shortcut( "global_show_all_notes" ) );

        m_globalAccel->updateConnections();
    }
    else
    {
        KAction *action = actionCollection()->action( "new_note" );
        if ( action )
            action->setShortcut( 0 );
        action = actionCollection()->action( "new_note_clipboard" );
        if ( action )
            action->setShortcut( 0 );
        action = actionCollection()->action( "hide_all_notes" );
        if ( action )
            action->setShortcut( 0 );
        action = actionCollection()->action( "show_all_notes" );
        if ( action )
            action->setShortcut( 0 );
    }
}
Beispiel #6
0
void KNotesApp::slotConfigureAccels()
{
    KNotesKeyDialog keys( m_globalAccel, this );
    QDictIterator<KNote> notes( m_noteList );
    if ( !m_noteList.isEmpty() )
        keys.insert( (*notes)->actionCollection() );
    keys.configure();

    m_globalAccel->writeSettings();
    updateGlobalAccels();

    // update GUI doc for new notes
    m_noteGUI.setContent(
        KXMLGUIFactory::readConfigFile( instance()->instanceName() + "ui.rc", instance() )
    );

    if ( m_noteList.isEmpty() )
        return;

    notes.toFirst();
    QValueList<KAction *> list = (*notes)->actionCollection()->actions();
    for ( QValueList<KAction *>::iterator it = list.begin(); it != list.end(); ++it )
    {
        notes.toFirst();
        for ( ++notes; *notes; ++notes )
        {
            KAction *toChange = (*notes)->actionCollection()->action( (*it)->name() );
            if ( toChange->shortcut() != (*it)->shortcut() )
                toChange->setShortcut( (*it)->shortcut() );
        }
    }
}
KNotesPlugin::KNotesPlugin( KontactInterface::Core *core, const QVariantList & )
  : KontactInterface::Plugin( core, core, "knotes" ), mAboutData( 0 )
{
  setComponentData( KontactPluginFactory::componentData() );

  KAction *action =
    new KAction( KIcon( "knotes" ),
                 i18nc( "@action:inmenu", "New Popup Note..." ), this );
  actionCollection()->addAction( "new_note", action );
  connect( action, SIGNAL(triggered(bool)), SLOT(slotNewNote()) );
  action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_N ) );
  action->setHelpText(
    i18nc( "@info:status", "Create new popup note" ) );
  action->setWhatsThis(
    i18nc( "@info:whatsthis",
           "You will be presented with a dialog where you can create a new popup note." ) );
  insertNewAction( action );

  KAction *syncAction =
    new KAction( KIcon( "view-refresh" ),
                 i18nc( "@action:inmenu", "Sync Popup Notes" ), this );
  actionCollection()->addAction( "knotes_sync", syncAction );
  connect( syncAction, SIGNAL(triggered(bool)), SLOT(slotSyncNotes()) );
  syncAction->setHelpText(
    i18nc( "@info:status", "Synchronize groupware notes" ) );
  syncAction->setWhatsThis(
    i18nc( "@info:whatsthis",
           "Choose this option to synchronize your groupware notes." ) );
  insertSyncAction( syncAction );
}
Beispiel #8
0
void MainWindow::setupActions()
{
    actQuit         = KStandardAction::quit(this, SLOT(quit()), actionCollection());
    KAction *a = NULL;
    a = actionCollection()->addAction("minimizeRestore", this,
                                      SLOT(minimizeRestore()));
    a->setText(i18n("Minimize"));
    a->setIcon(KIcon(""));
    a->setShortcut(0);

    /** Settings : ************************************************************/
//  m_actShowToolbar   = KStandardAction::showToolbar(   this, SLOT(toggleToolBar()),   actionCollection());
    m_actShowStatusbar = KStandardAction::showStatusbar(this, SLOT(toggleStatusBar()), actionCollection());

//  m_actShowToolbar->setCheckedState( KGuiItem(i18n("Hide &Toolbar")) );

    (void) KStandardAction::keyBindings(this, SLOT(showShortcutsSettingsDialog()), actionCollection());

    (void) KStandardAction::configureToolbars(this, SLOT(configureToolbars()), actionCollection());

    //KAction *actCfgNotifs = KStandardAction::configureNotifications(this, SLOT(configureNotifications()), actionCollection() );
    //actCfgNotifs->setEnabled(false); // Not yet implemented !

    actAppConfig = KStandardAction::preferences(this, SLOT(showSettingsDialog()), actionCollection());
}
TodoPlugin::TodoPlugin( KontactInterface::Core *core, const QVariantList & )
  : KontactInterface::Plugin( core, core, "korganizer", "todo" ), mIface( 0 )
{
  setComponentData( KontactPluginFactory::componentData() );
  KIconLoader::global()->addAppDir( "korganizer" );
  KIconLoader::global()->addAppDir( "kdepim" );

  KAction *action =
    new KAction( KIcon( "task-new" ),
                 i18nc( "@action:inmenu", "New To-do..." ), this );
  actionCollection()->addAction( "new_todo", action );
  action->setShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_T ) );
  action->setHelpText(
    i18nc( "@info:status", "Create a new to-do" ) );
  action->setWhatsThis(
    i18nc( "@info:whatsthis",
           "You will be presented with a dialog where you can create a new to-do item." ) );
  connect( action, SIGNAL(triggered(bool)), SLOT(slotNewTodo()) );
  insertNewAction( action );

  KAction *syncAction =
    new KAction( KIcon( "view-refresh" ),
                 i18nc( "@action:inmenu", "Sync To-do List" ), this );
  syncAction->setHelpText(
    i18nc( "@info:status", "Synchronize groupware to-do list" ) );
  syncAction->setWhatsThis(
    i18nc( "@info:whatsthis",
           "Choose this option to synchronize your groupware to-do list." ) );
  connect( syncAction, SIGNAL(triggered(bool)), SLOT(slotSyncTodos()) );
  insertSyncAction( syncAction );

  mUniqueAppWatcher = new KontactInterface::UniqueAppWatcher(
    new KontactInterface::UniqueAppHandlerFactory<KOrganizerUniqueAppHandler>(), this );
}
Beispiel #10
0
void SimonView::setupActions()
{
  connectAction = new KAction(this);
  connectAction->setText(i18n("Connect"));
  connectAction->setCheckable(true);
  connectAction->setIcon(KIcon("network-disconnect"));
  connect(connectAction, SIGNAL(triggered(bool)),
    this, SLOT(toggleConnection()));
  actionCollection()->addAction("connect", connectAction);
  this->trayManager->addAction("connect", connectAction);

  activateAction = new KAction(this);
  activateAction->setText(i18n("Activate"));
  activateAction->setIcon(KIcon("media-playback-start"));
  activateAction->setCheckable(true);
  connect(activateAction, SIGNAL(triggered(bool)),
    this, SLOT(toggleActivation()));
  this->trayManager->addAction("activate", activateAction);
  activateAction->setEnabled(false);
  actionCollection()->addAction("activate", activateAction);
  //must be set after addAction() because of the unique name set in addAction(name,...)
  // deactivated because of KDE bug #307225
  //activateAction->setGlobalShortcut(KShortcut(Qt::SHIFT + Qt::Key_Pause));

  disconnectAction = new KAction(this);
  disconnectAction->setText(i18n("Disconnect"));
  disconnectAction->setIcon(KIcon("network-disconnect"));
  connect(disconnectAction, SIGNAL(triggered(bool)),
    control, SLOT(disconnectFromServer()));

  KToolBarPopupAction* connectActivate = new KToolBarPopupAction(KIcon("network-disconnect"), i18n("Connect"), this);
  connectActivate->setCheckable(true);
  connectActivate->setShortcut(Qt::CTRL + Qt::Key_C);

  actionCollection()->addAction("connectActivate", connectActivate);
  connect(connectActivate, SIGNAL(triggered(bool)),
    this, SLOT(toggleConnection()));

  
  KAction* recompile = new KAction(this);
  recompile->setEnabled(control->getStatus() != SimonControl::Disconnected);
  recompile->setText(i18n("Synchronize"));
  recompile->setIcon(KIcon("view-refresh"));
  recompile->setShortcut(Qt::CTRL + Qt::Key_F5);
  actionCollection()->addAction("compileModel", recompile);
  connect(recompile, SIGNAL(triggered(bool)),
    control, SLOT(compileModel()));

  KAction* sendSampleShareAction = new KAction(this);
  sendSampleShareAction->setText(i18n("Contribute samples"));
  sendSampleShareAction->setIcon(KIcon("repository"));
  actionCollection()->addAction("sampleShare", sendSampleShareAction);
  connect(sendSampleShareAction, SIGNAL(triggered(bool)),this, SLOT(showSampleShare()));
  
  actionCollection()->addAction(KStandardAction::Preferences, "configuration",
    this, SLOT(showSystemDialog()));

  KStandardAction::quit(this, SLOT(closeSimon()),
    actionCollection());
}
KAction *create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
{
    KAction *pAction = 0;
    const Info* pInfo = infoPtr(id);

    if (pInfo) {
        pAction = new KAction(parent);
        pAction->setObjectName(pInfo->psName);
        KShortcut cut(pInfo->shortcut);
        if (!cut.isEmpty())
            pAction->setShortcut(cut);
        pAction->setText(i18n(pInfo->psText));
        pAction->setToolTip(i18n(pInfo->psToolTip));
        pAction->setWhatsThis(i18n(pInfo->psWhatsThis));
        if (pInfo->psIconName)
            pAction->setIcon(KIcon(QLatin1String(pInfo->psIconName)));
    }

    if (recvr && slot)
        QObject::connect(pAction, SIGNAL(triggered(bool)), recvr, slot);

    if (pAction) {
        KActionCollection *collection = qobject_cast<KActionCollection *>(parent);
        if (collection)
            collection->addAction(pAction->objectName(), pAction);
    }
    return pAction;
}
Beispiel #12
0
void TextTool::setupActions()
{
    KAction *pencil = new KAction(QIcon(THEME_DIR + "icons/text.png"), tr("Text"), this);
    pencil->setShortcut(QKeySequence(tr("T")));
    pencil->setCursor(QCursor(THEME_DIR + "cursors/text.png"));

    m_actions.insert(tr("Text"), pencil);
}
Beispiel #13
0
void KateViewManager::setupActions ()
{
  KAction *a;

  /**
   * view splitting
   */
  a = m_mainWindow->actionCollection()->addAction("view_split_vert");
  a->setIcon( KIcon("view-split-left-right") );
  a->setText( i18n("Split Ve&rtical") );
  a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_L );
  connect(a, SIGNAL(triggered()), this, SLOT(slotSplitViewSpaceVert()));

  a->setWhatsThis(i18n("Split the currently active view vertically into two views."));

  a = m_mainWindow->actionCollection()->addAction("view_split_horiz");
  a->setIcon( KIcon("view-split-top-bottom") );
  a->setText( i18n("Split &Horizontal") );
  a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_T );
  connect(a, SIGNAL(triggered()), this, SLOT(slotSplitViewSpaceHoriz()));

  a->setWhatsThis(i18n("Split the currently active view horizontally into two views."));

  m_closeView = m_mainWindow->actionCollection()->addAction("view_close_current_space");
  m_closeView->setIcon( KIcon("view-close") );
  m_closeView->setText( i18n("Cl&ose Current View") );
  m_closeView->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_R );
  connect(m_closeView, SIGNAL(triggered()), this, SLOT(slotCloseCurrentViewSpace()));

  m_closeView->setWhatsThis(i18n("Close the currently active splitted view"));

  goNext = m_mainWindow->actionCollection()->addAction( "go_next_split_view" );
  goNext->setText( i18n("Next Split View") );
  goNext->setShortcut( Qt::Key_F8 );
  connect(goNext, SIGNAL(triggered()), this, SLOT(activateNextView()));

  goNext->setWhatsThis(i18n("Make the next split view the active one."));

  goPrev = m_mainWindow->actionCollection()->addAction( "go_prev_split_view" );
  goPrev->setText( i18n("Previous Split View") );
  goPrev->setShortcut( Qt::SHIFT + Qt::Key_F8 );
  connect(goPrev, SIGNAL(triggered()), this, SLOT(activatePrevView()));

  goPrev->setWhatsThis(i18n("Make the previous split view the active one."));
}
Beispiel #14
0
void App::initGlobalShortcuts()
{
    EngineController* const ec = EngineController::instance();

    m_pGlobalAccel->insert( "play", i18n( "Play" ), 0, KKey("WIN+x"), 0,
                            ec, SLOT( play() ), true, true );
    m_pGlobalAccel->insert( "pause", i18n( "Pause" ), 0, KKey("WIN+c"), 0,
                            ec, SLOT( pause() ), true, true );
    m_pGlobalAccel->insert( "play_pause", i18n( "Play/Pause" ), 0, 0, 0,
                            ec, SLOT( playPause() ), true, true );
    m_pGlobalAccel->insert( "stop", i18n( "Stop" ), 0, KKey("WIN+v"), 0,
                            ec, SLOT( stop() ), true, true );
    m_pGlobalAccel->insert( "next", i18n( "Next Track" ), 0, KKey("WIN+b"), 0,
                            ec, SLOT( next() ), true, true );
    m_pGlobalAccel->insert( "prev", i18n( "Previous Track" ), 0, KKey("WIN+z"), 0,
                            ec, SLOT( previous() ), true, true );
    m_pGlobalAccel->insert( "volup", i18n( "Increase Volume" ), 0, KKey("WIN+KP_Add"), 0,
                            ec, SLOT( increaseVolume() ), true, true );
    m_pGlobalAccel->insert( "voldn", i18n( "Decrease Volume" ), 0, KKey("WIN+KP_Subtract"), 0,
                            ec, SLOT( decreaseVolume() ), true, true );
    m_pGlobalAccel->insert( "seekforward", i18n( "Seek Forward" ), 0, KKey("WIN+Shift+KP_Add"), 0,
                            ec, SLOT( seekForward() ), true, true );
    m_pGlobalAccel->insert( "seekbackward", i18n( "Seek Backward" ), 0, KKey("WIN+Shift+KP_Subtract"), 0,
                            ec, SLOT( seekBackward() ), true, true );
    m_pGlobalAccel->insert( "playlist_add", i18n( "Add Media..." ), 0, KKey("WIN+a"), 0,
                            m_pPlaylistWindow, SLOT( slotAddLocation() ), true, true );
    m_pGlobalAccel->insert( "show", i18n( "Toggle Playlist Window" ), 0, KKey("WIN+p"), 0,
                            m_pPlaylistWindow, SLOT( showHide() ), true, true );
    m_pGlobalAccel->insert( "osd", i18n( "Show OSD" ), 0, KKey("WIN+o"), 0,
                            amaroK::OSD::instance(), SLOT( forceToggleOSD() ), true, true );
    m_pGlobalAccel->insert( "mute", i18n( "Mute Volume" ), 0, KKey("WIN+m"), 0,
                            ec, SLOT( mute() ), true, true );

    m_pGlobalAccel->setConfigGroup( "Shortcuts" );
    m_pGlobalAccel->readSettings( kapp->config() );
    m_pGlobalAccel->updateConnections();

    //TODO fix kde accel system so that kactions find appropriate global shortcuts
    //     and there is only one configure shortcuts dialog

    KActionCollection* const ac = amaroK::actionCollection();
    KAccelShortcutList list( m_pGlobalAccel );

    for( uint i = 0; i < list.count(); ++i )
    {
        KAction *action = ac->action( list.name( i ).latin1() );

        if( action )
        {
            //this is a hack really, also it means there may be two calls to the slot for the shortcut
            action->setShortcutConfigurable( false );
            action->setShortcut( list.shortcut( i ) );
        }
    }
}
Beispiel #15
0
QAction* DebuggerMainWnd::createAction(const QString& text,
			int shortcut, const QObject* receiver,
			const char* slot, const char* name)
{
    KAction* a = actionCollection()->addAction(name);
    a->setText(text);
    if (shortcut)
	a->setShortcut(KShortcut(shortcut));
    connect(a, SIGNAL(triggered()), receiver, slot);
    return a;
}
Beispiel #16
0
KateWordCompletionView::KateWordCompletionView( KTextEditor::View *view, KActionCollection* ac )
  : QObject( view ),
    m_view( view ),
    m_dWCompletionModel( KateGlobal::self()->wordCompletionModel() ),
    d( new KateWordCompletionViewPrivate )
{
  d->isCompleting = false;
  d->dcRange = KTextEditor::Range::invalid();

  d->liRange = static_cast<KateDocument*>(m_view->document())->newMovingRange(KTextEditor::Range::invalid(), KTextEditor::MovingRange::DoNotExpand);

  KColorScheme colors(QPalette::Active);
  KTextEditor::Attribute::Ptr a = KTextEditor::Attribute::Ptr( new KTextEditor::Attribute() );
  a->setBackground( colors.background(KColorScheme::ActiveBackground) );
  a->setForeground( colors.foreground(KColorScheme::ActiveText) ); // ### this does 0
  d->liRange->setAttribute( a );

  KTextEditor::CodeCompletionInterface *cci = qobject_cast<KTextEditor::CodeCompletionInterface *>(view);

  KAction *action;

  if (cci)
  {
    cci->registerCompletionModel( m_dWCompletionModel );

    action = new KAction( i18n("Shell Completion"), this );
    ac->addAction( "doccomplete_sh", action );
    connect( action, SIGNAL(triggered()), this, SLOT(shellComplete()) );
  }


  action = new KAction( i18n("Reuse Word Above"), this );
  ac->addAction( "doccomplete_bw", action );
  action->setShortcut( Qt::CTRL+Qt::Key_8 );
  connect( action, SIGNAL(triggered()), this, SLOT(completeBackwards()) );

  action = new KAction( i18n("Reuse Word Below"), this );
  ac->addAction( "doccomplete_fw", action );
  action->setShortcut( Qt::CTRL+Qt::Key_9 );
  connect( action, SIGNAL(triggered()), this, SLOT(completeForwards()) );
}
KShellCmdPlugin::KShellCmdPlugin( QObject* parent, const QVariantList & )
    : KParts::Plugin( parent )
{
    if (!KAuthorized::authorizeKAction("shell_access"))
       return;

    KAction *action = actionCollection()->addAction("executeshellcommand");
    action->setIcon(KIcon("system-run"));
    action->setText(i18n( "&Execute Shell Command..." ));
    connect(action, SIGNAL(triggered(bool)), SLOT( slotExecuteShellCommand() ));
    action->setShortcut(Qt::CTRL+Qt::Key_E);
}
TranslatorGUIClient::TranslatorGUIClient( Kopete::ChatSession *parent )
: QObject( parent ), KXMLGUIClient( parent )
{
	setComponentData( TranslatorPlugin::plugin()->componentData() );
	connect( TranslatorPlugin::plugin(), SIGNAL(destroyed(QObject*)), this, SLOT(deleteLater()) );

	m_manager = parent;

	KAction *translate = new KAction( KIcon("preferences-desktop-locale"), i18n( "Translate" ), this );
        actionCollection()->addAction( "translateCurrentMessage", translate );
	connect( translate, SIGNAL(triggered(bool)), this, SLOT(slotTranslateChat()) );
	translate->setShortcut( KShortcut(Qt::CTRL + Qt::Key_T) );

	setXMLFile( "translatorchatui.rc" );
}
void CLexiconReadWindow::insertKeyboardActions( KActionCollection* const a )
{
	qDebug("CLexiconReadWindow::insertKeyboardActions");
	KAction* kaction;
	kaction = new KAction( tr("Next entry"), a);
	kaction->setShortcut(CResMgr::displaywindows::lexiconWindow::nextEntry::accel);
	a->addAction("nextEntry", kaction);

	kaction = new KAction( tr("Previous entry"), a);
	kaction->setShortcut( CResMgr::displaywindows::lexiconWindow::previousEntry::accel);
	a->addAction("previousEntry", kaction);
	
	kaction = new KAction(tr("Copy reference only"), a);
	a->addAction("copyReferenceOnly", kaction);

	kaction = new KAction(tr("Copy selected text"), a);
	a->addAction("copySelectedText", kaction);

	kaction = new KAction(tr("Save entry as HTML"), a);
	a->addAction("saveHtml", kaction);

	kaction = new KAction(tr("Print reference only"), a);
	a->addAction("printReferenceOnly", kaction);
}
Beispiel #20
0
void KMilion::setupActions()
{
  //akcja uruchomienia gry
  KAction* runAction = new KAction(this);
  runAction->setText(i18n("&Run Quiz"));
  runAction->setIcon(KIcon("system-run"));
  runAction->setShortcut(Qt::CTRL + Qt::Key_R);
  actionCollection()->addAction("run", runAction);
  connect(runAction, SIGNAL(triggered(bool)), this, SLOT(runGame()));
  
//     KStandardAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); 
    KStandardAction::quit(qApp, SLOT(closeAllWindows()), actionCollection());
    
    KStandardAction::open(editorWidget,SLOT(loadTestFile()),actionCollection());
    KStandardAction::save(editorWidget,SLOT(saveTestFileOld()),actionCollection());
    KStandardAction::saveAs(editorWidget,SLOT(saveTestFileNew()),actionCollection());      
    KStandardAction::openNew(editorWidget, SLOT(createTestFileNew()), actionCollection());
}
	void MediaPlayerActivity::setupActions()
	{
		play_action = new KAction(KIcon("media-playback-start"),i18n("Play"),this);
		connect(play_action,SIGNAL(triggered()),this,SLOT(play()));
		ac->addAction("media_play",play_action);
		
		pause_action = new KAction(KIcon("media-playback-pause"),i18n("Pause"),this);
		connect(pause_action,SIGNAL(triggered()),this,SLOT(pause()));
		ac->addAction("media_pause",pause_action);
		
		stop_action = new KAction(KIcon("media-playback-stop"),i18n("Stop"),this);
		connect(stop_action,SIGNAL(triggered()),this,SLOT(stop()));
		ac->addAction("media_stop",stop_action);
		
		prev_action = new KAction(KIcon("media-skip-backward"),i18n("Previous"),this);
		connect(prev_action,SIGNAL(triggered()),this,SLOT(prev()));
		ac->addAction("media_prev",prev_action);
		
		next_action = new KAction(KIcon("media-skip-forward"),i18n("Next"),this);
		connect(next_action,SIGNAL(triggered()),this,SLOT(next()));
		ac->addAction("media_next",next_action);
		
		show_video_action = new KToggleAction(KIcon("video-x-generic"),i18n("Show Video"),this);
		connect(show_video_action,SIGNAL(toggled(bool)),this,SLOT(showVideo(bool)));
		ac->addAction("show_video",show_video_action);
		
		add_media_action = new KAction(KIcon("document-open"),i18n("Add Media"),this);
		connect(add_media_action,SIGNAL(triggered()),play_list,SLOT(addMedia()));
		ac->addAction("add_media",add_media_action); 
		
		clear_action = new KAction(KIcon("edit-clear-list"),i18n("Clear Playlist"),this);
		connect(clear_action,SIGNAL(triggered()),play_list,SLOT(clearPlayList()));
		ac->addAction("clear_play_list",clear_action);
		
		volume = new KAction(this);
		volume->setDefaultWidget(new Phonon::VolumeSlider(media_player->output(),this));
		ac->addAction("volume",volume);
		
		KAction* tfs = new KAction(KIcon("view-fullscreen"),i18n("Toggle Fullscreen"),this);
		tfs->setShortcut(Qt::Key_F);
		tfs->setCheckable(true);
		ac->addAction("video_fullscreen", tfs);
	}
Beispiel #22
0
void BrowserDock::polish()
{
    m_categoryList.data()->setIcon( KIcon( "user-home" ) );

    m_categoryList.data()->setMinimumSize( 100, 300 );

    connect( m_breadcrumbWidget, SIGNAL(toHome()), this, SLOT(home()) );

    // Keyboard shortcut for going back one level
    KAction *action = new KAction( KIcon( "go-up" ), i18n( "Go Up in Media Sources Pane" ),
                                  m_mainWidget );
    Amarok::actionCollection()->addAction( "browser_previous", action );
    connect( action, SIGNAL(triggered(bool)), m_categoryList.data(), SLOT(back()) );
    action->setShortcut( KShortcut( Qt::Key_Backspace ) );

    paletteChanged( palette() );

    connect( The::paletteHandler(), SIGNAL(newPalette(QPalette)), SLOT(paletteChanged(QPalette)) );
}
Beispiel #23
0
void KMarkNote::setupAction()
{
    KStandardAction::openNew(this, SLOT(newNote()), actionCollection());
    KStandardAction::close(this, SLOT(close()), actionCollection());

    KAction* oneColAction = actionCollection()->addAction("win_onecol", m_view, SLOT(oneColView()));
    KAction* twoColAction = actionCollection()->addAction("win_twocol", m_view, SLOT(twoColView()));
    KAction* threeColAction = actionCollection()->addAction("win_threecol", m_view, SLOT(threeColView()));

    oneColAction->setText(i18n("One Column View"));
    twoColAction->setText(i18n("Two Column View"));
    threeColAction->setText(i18n("Three Column View"));

    oneColAction->setIcon(KIcon("view-split-top-bottom"));
    twoColAction->setIcon(KIcon("view-split-left-right"));
    threeColAction->setIcon(KIcon("view-file-columns"));

    KAction* terminalAction = actionCollection()->addAction("toggle_terminal", m_view, SLOT(toggleTerminal()));
    KShortcut terminalShortcut = terminalAction->shortcut();
    terminalShortcut.setPrimary(QKeySequence("F4"));
    terminalAction->setShortcut(terminalShortcut);
}
HistoryGUIClient::HistoryGUIClient ( Kopete::ChatSession *parent )
		: QObject ( parent ), KXMLGUIClient ( parent )
{
	setComponentData ( KGenericFactory<HistoryPlugin>::componentData() );

	m_manager = parent;

	// Refuse to build this client, it is based on wrong parameters
	if ( !m_manager || m_manager->members().isEmpty() )
		deleteLater();

	QList<Kopete::Contact*> mb=m_manager->members();
	m_logger=new HistoryLogger ( mb.first() , this );

	actionLast = new KAction ( KIcon ( "go-last" ), i18n ( "Latest History" ), this );
	actionCollection()->addAction ( "historyLast", actionLast );
	connect ( actionLast, SIGNAL (triggered(bool)), this, SLOT (slotLast()) );
	actionPrev = KStandardAction::back ( this, SLOT (slotPrevious()), this );
	actionCollection()->addAction ( "historyPrevious", actionPrev );
	actionNext = KStandardAction::forward ( this, SLOT (slotNext()), this );
	actionCollection()->addAction ( "historyNext", actionNext );

	KAction *viewChatHistory = new KAction( KIcon("view-history"), i18n("View &History" ), this );
	actionCollection()->addAction( "viewChatHistory", viewChatHistory );
	viewChatHistory->setShortcut(KShortcut (Qt::CTRL + Qt::Key_H));
	connect(viewChatHistory, SIGNAL(triggered(bool)), this, SLOT(slotViewHistory()));

	KAction *actionQuote = new KAction ( KIcon ( "go-last" ),i18n ( "Quote Last Message" ), this );
	actionCollection()->addAction ( "historyQuote",actionQuote );
	connect ( actionQuote,SIGNAL (triggered(bool)),this,SLOT (slotQuote()) );

	// we are generally at last when beginning
	actionPrev->setEnabled ( true );
	actionNext->setEnabled ( false );
	actionLast->setEnabled ( false );

	setXMLFile ( "historychatui.rc" );
}
//moved from KFormDesigner::FormManager
void KexiFormManager::createActions(KActionCollection* collection)
{
    d->collection = collection;
//    KXMLGUIClient* client = (KXMLGUIClient*)d->collection->parentGUIClient();

    d->lib->createWidgetActions(d->widgetActionGroup);
//! @todo insertWidget() slot?
//2.0    d->lib->createWidgetActions(client, d->collection,
//2.0                                this, SLOT(insertWidget(const QByteArray &)));

#ifdef KFD_SIGSLOTS
    if (d->features & KFormDesigner::Form::EnableConnections) {
        // nothing
    }
    else {
        d->dragConnectionAction = new KToggleAction(
            KIcon("signalslot"), i18n("Connect Signals/Slots"), d->collection);
        d->dragConnectionAction->setObjectName("drag_connection");
//        d->widgetActionGroup->addAction(d->dragConnectionAction);
        connect(d->dragConnectionAction, SIGNAL(triggered()),
                this, SLOT(startCreatingConnection()));
        d->dragConnectionAction->setChecked(false);
    }
#endif

    d->pointerAction = new KToggleAction(
        KIcon("mouse_pointer"), i18n("Pointer"), d->collection);
    d->pointerAction->setObjectName("edit_pointer");
    d->widgetActionGroup->addAction(d->pointerAction);
    connect(d->pointerAction, SIGNAL(triggered()),
            this, SLOT(slotPointerClicked()));
    d->pointerAction->setChecked(true);

    d->snapToGridAction = new KToggleAction(
        i18n("Snap to Grid"), d->collection);
    d->snapToGridAction->setObjectName("snap_to_grid");
//    d->widgetActionGroup->addAction(d->snapToGridAction);
//    d->snapToGridAction->setChecked(true);

#if 0 // 2.0: todo
    // Create the Style selection action (with a combo box in toolbar and submenu items)
    KSelectAction *styleAction = new KSelectAction(
        i18n("Style"), d->collection);
    styleAction->setObjectName("change_style");
    connect(styleAction, SIGNAL(triggered()),
            this, SLOT(slotStyle()));
    styleAction->setEditable(false);

//js: unused? KGlobalGroup cg = KGlobal::config()->group("General");
    QString currentStyle(kapp->style()->objectName().toLower());
    const QStringList styles = QStyleFactory::keys();
    styleAction->setItems(styles);
    styleAction->setCurrentItem(0);

    QStringList::ConstIterator endIt = styles.constEnd();
    int idx = 0;
    for (QStringList::ConstIterator it = styles.constBegin(); it != endIt; ++it, ++idx) {
        if ((*it).toLower() == currentStyle) {
            styleAction->setCurrentItem(idx);
            break;
        }
    }
    styleAction->setToolTip(i18n("Set the current view style."));
    styleAction->setMenuAccelsEnabled(true);
#endif

    d->lib->addCustomWidgetActions(d->collection);

#ifdef KEXI_DEBUG_GUI
    KConfigGroup generalGroup(KGlobal::config()->group("General"));
    if (generalGroup.readEntry("ShowInternalDebugger", false)) {
        KAction *a = new KAction(KIcon("run-build-file"), i18n("Show Form UI Code"), this);
        d->collection->addAction("show_form_ui", a);
        a->setShortcut(Qt::CTRL + Qt::Key_U);
        connect(a, SIGNAL(triggered()), this, SLOT(showFormUICode()));
    }
#endif

//! @todo move elsewhere
    {
        // (from obsolete kexiformpartinstui.rc)
        QStringList formActions;
        formActions
            << "edit_pointer"
            << QString() //sep
#ifndef KEXI_NO_AUTOFIELD_WIDGET
            << ":library_widget_KexiDBAutoField"
#endif
            << ":library_widget_KexiDBLabel"
            << ":library_widget_KexiDBImageBox"
            << ":library_widget_KexiDBLineEdit"
            << ":library_widget_KexiDBTextEdit"
            << ":library_widget_KPushButton"
            << ":library_widget_KexiDBComboBox"
            << ":library_widget_KexiDBCheckBox"
#ifndef KEXI_NO_FORM_LAYOUTS
            << ":library_widget_Spacer"
#endif
            << ":library_widget_Line"
            << ":library_widget_KexiFrame"
            << ":library_widget_QGroupBox"
            << ":library_widget_KFDTabWidget"
#ifndef KEXI_NO_FORM_SPRING_ELEMENT
            << ":library_widget_Spring"
#endif
            << QString() //sep
            ;
        KexiMainWindowIface *win = KexiMainWindowIface::global();
        foreach( const QString& actionName_, formActions ) {
            QAction *a;
            const QString actionName(actionName_.startsWith(':') ? actionName_.mid(1) : actionName_);
            if (actionName.isEmpty()) {
                a = new QAction(this);
                a->setSeparator(true);
            }
            else {
                a = d->widgetActionGroup->action(actionName);
            }
            if (actionName_.startsWith(':')) {  // icon only
                KexiSmallToolButton *btn = new KexiSmallToolButton(a, win->toolBar("form"));
                btn->setToolButtonStyle(Qt::ToolButtonIconOnly);
                win->appendWidgetToToolbar("form", btn);
            }
            else {
                win->addToolBarAction("form", a);
            }
        }

        QSet<QString> iconOnlyActions;
        iconOnlyActions << "widget_assign_action" << "show_form_ui";
        const QList<QAction*> actions( d->collection->actions() );
        foreach( QAction *a, actions ) {
            if (iconOnlyActions.contains(a->objectName())) { // icon only
                KexiSmallToolButton *btn = new KexiSmallToolButton(a, win->toolBar("form"));
                btn->setToolButtonStyle(Qt::ToolButtonIconOnly);
                win->appendWidgetToToolbar("form", btn);
            }
            else {
                win->addToolBarAction("form", a);
            }
        }
    }
QList<QWidget *> KarbonCalligraphyTool::createOptionWidgets()
{
    // if the widget don't exists yet create it
    QList<QWidget *> widgets;

    KoFillConfigWidget *fillWidget = new KoFillConfigWidget(0);
    fillWidget->setWindowTitle(i18n("Fill"));
    fillWidget->setCanvas(canvas());
    widgets.append(fillWidget);

    KarbonCalligraphyOptionWidget *widget = new KarbonCalligraphyOptionWidget;
    connect(widget, SIGNAL(usePathChanged(bool)),
            this, SLOT(setUsePath(bool)));

    connect(widget, SIGNAL(usePressureChanged(bool)),
            this, SLOT(setUsePressure(bool)));

    connect(widget, SIGNAL(useAngleChanged(bool)),
            this, SLOT(setUseAngle(bool)));

    connect(widget, SIGNAL(widthChanged(double)),
            this, SLOT(setStrokeWidth(double)));

    connect(widget, SIGNAL(thinningChanged(double)),
            this, SLOT(setThinning(double)));

    connect(widget, SIGNAL(angleChanged(int)),
            this, SLOT(setAngle(int)));

    connect(widget, SIGNAL(fixationChanged(double)),
            this, SLOT(setFixation(double)));

    connect(widget, SIGNAL(capsChanged(double)),
            this, SLOT(setCaps(double)));

    connect(widget, SIGNAL(massChanged(double)),
            this, SLOT(setMass(double)));

    connect(widget, SIGNAL(dragChanged(double)),
            this, SLOT(setDrag(double)));

    connect(this, SIGNAL(pathSelectedChanged(bool)),
            widget, SLOT(setUsePathEnabled(bool)));

    // add shortcuts
    KAction *action = new KAction(i18n("Calligraphy: increase width"), this);
    action->setShortcut(Qt::Key_Right);
    connect(action, SIGNAL(triggered()), widget, SLOT(increaseWidth()));
    addAction("calligraphy_increase_width", action);

    action = new KAction(i18n("Calligraphy: decrease width"), this);
    action->setShortcut(Qt::Key_Left);
    connect(action, SIGNAL(triggered()), widget, SLOT(decreaseWidth()));
    addAction("calligraphy_decrease_width", action);

    action = new KAction(i18n("Calligraphy: increase angle"), this);
    action->setShortcut(Qt::Key_Up);
    connect(action, SIGNAL(triggered()), widget, SLOT(increaseAngle()));
    addAction("calligraphy_increase_angle", action);

    action = new KAction(i18n("Calligraphy: decrease angle"), this);
    action->setShortcut(Qt::Key_Down);
    connect(action, SIGNAL(triggered()), widget, SLOT(decreaseAngle()));
    addAction("calligraphy_decrease_angle", action);

    // sync all parameters with the loaded profile
    widget->emitAll();
    widget->setObjectName(i18n("Calligraphy"));
    widget->setWindowTitle(i18n("Calligraphy"));
    widgets.append(widget);

    return widgets;
}
Beispiel #27
0
KDirSelectDialog::KDirSelectDialog(const KUrl &startDir, bool localOnly,
                                   QWidget *parent)
    : KDialog( parent ),
      d( new Private( localOnly, this ) )
{
    setCaption( i18nc("@title:window","Select Folder") );
    setButtons( Ok | Cancel | User1 );
    setButtonGuiItem( User1, KGuiItem( i18nc("@action:button","New Folder..."), "folder-new" ) );
    setDefaultButton(Ok);
    button(Ok)->setFocus();

    QFrame *page = new QFrame(this);
    setMainWidget(page);
    QHBoxLayout *hlay = new QHBoxLayout( page);
    hlay->setMargin(0);
    QVBoxLayout *mainLayout = new QVBoxLayout();
    d->m_actions=new KActionCollection(this);
    d->m_actions->addAssociatedWidget(this);
    d->m_placesView = new KFilePlacesView( page );
    d->m_placesView->setModel(new KFilePlacesModel(d->m_placesView));
    d->m_placesView->setObjectName( QLatin1String( "speedbar" ) );
    d->m_placesView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
    d->m_placesView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    connect( d->m_placesView, SIGNAL(urlChanged(KUrl)),
             SLOT(setCurrentUrl(KUrl)) );
    hlay->addWidget( d->m_placesView );
    hlay->addLayout( mainLayout );

    d->m_treeView = new KFileTreeView(page);
    d->m_treeView->setDirOnlyMode(true);
    d->m_treeView->setContextMenuPolicy(Qt::CustomContextMenu);

    for (int i = 1; i < d->m_treeView->model()->columnCount(); ++i)
        d->m_treeView->hideColumn(i);

    d->m_urlCombo = new KHistoryComboBox( page);
    d->m_urlCombo->setLayoutDirection( Qt::LeftToRight );
    d->m_urlCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
    d->m_urlCombo->setTrapReturnKey( true );
    KUrlCompletion *comp = new KUrlCompletion();
    comp->setMode( KUrlCompletion::DirCompletion );
    d->m_urlCombo->setCompletionObject( comp, true );
    d->m_urlCombo->setAutoDeleteCompletionObject( true );
    d->m_urlCombo->setDuplicatesEnabled( false );

    d->m_contextMenu = new KMenu( this );

    KAction* newFolder = new KAction( i18nc("@action:inmenu","New Folder..."), this);
    d->m_actions->addAction( newFolder->objectName(), newFolder );
    newFolder->setIcon( KIcon( "folder-new" ) );
    newFolder->setShortcut( Qt::Key_F10);
    connect( newFolder, SIGNAL(triggered(bool)), this, SLOT(slotNewFolder()) );
    d->m_contextMenu->addAction( newFolder );

    d->moveToTrash = new KAction( i18nc( "@action:inmenu","Move to Trash" ), this );
    d->m_actions->addAction( d->moveToTrash->objectName(), d->moveToTrash );
    d->moveToTrash->setIcon( KIcon( "user-trash" ) );
    d->moveToTrash->setShortcut(KShortcut(Qt::Key_Delete));
    connect( d->moveToTrash, SIGNAL(triggered(bool)), this, SLOT(slotMoveToTrash()) );
    d->m_contextMenu->addAction( d->moveToTrash );

    d->deleteAction = new KAction( i18nc("@action:inmenu","Delete"), this );
    d->m_actions->addAction( d->deleteAction->objectName(), d->deleteAction );
    d->deleteAction->setIcon( KIcon( "edit-delete" ) );
    d->deleteAction->setShortcut( KShortcut( Qt::SHIFT + Qt::Key_Delete ) );
    connect( d->deleteAction, SIGNAL(triggered(bool)), this, SLOT(slotDelete()) );
    d->m_contextMenu->addAction( d->deleteAction );

    d->m_contextMenu->addSeparator();

    d->showHiddenFoldersAction = new KToggleAction( i18nc("@option:check", "Show Hidden Folders"), this );
    d->m_actions->addAction( d->showHiddenFoldersAction->objectName(), d->showHiddenFoldersAction );
    d->showHiddenFoldersAction->setShortcut( Qt::Key_F8 );
    connect( d->showHiddenFoldersAction, SIGNAL(triggered(bool)), d->m_treeView, SLOT(setShowHiddenFiles(bool)) );
    d->m_contextMenu->addAction( d->showHiddenFoldersAction );
    d->m_contextMenu->addSeparator();

    KAction* propertiesAction = new KAction( i18nc("@action:inmenu","Properties"), this);
    d->m_actions->addAction(propertiesAction->objectName(), propertiesAction);
    propertiesAction->setIcon(KIcon("document-properties"));
    propertiesAction->setShortcut(KShortcut(Qt::ALT + Qt::Key_Return));
    connect( propertiesAction, SIGNAL(triggered(bool)), this, SLOT(slotProperties()) );
    d->m_contextMenu->addAction( propertiesAction );

    d->m_startURL = KFileDialog::getStartUrl( startDir, d->m_recentDirClass );
    if ( localOnly && !d->m_startURL.isLocalFile() )
    {
        d->m_startURL = KUrl();
        QString docPath = KGlobalSettings::documentPath();
        if (QDir(docPath).exists())
            d->m_startURL.setPath( docPath );
        else
            d->m_startURL.setPath( QDir::homePath() );
    }

    d->m_startDir = d->m_startURL;
    d->m_rootUrl = d->m_treeView->rootUrl();

    d->readConfig( KGlobal::config(), "DirSelect Dialog" );

    mainLayout->addWidget( d->m_treeView, 1 );
    mainLayout->addWidget( d->m_urlCombo, 0 );

    connect( d->m_treeView, SIGNAL(currentChanged(KUrl)),
             SLOT(slotCurrentChanged()));
    connect( d->m_treeView, SIGNAL(activated(QModelIndex)),
             SLOT(slotExpand(QModelIndex)));
    connect( d->m_treeView, SIGNAL(customContextMenuRequested(QPoint)),
             SLOT(slotContextMenuRequested(QPoint)));

    connect( d->m_urlCombo, SIGNAL(editTextChanged(QString)),
             SLOT(slotComboTextChanged(QString)));
    connect( d->m_urlCombo, SIGNAL(activated(QString)),
             SLOT(slotUrlActivated(QString)));
    connect( d->m_urlCombo, SIGNAL(returnPressed(QString)),
             SLOT(slotUrlActivated(QString)));

    connect(this, SIGNAL(user1Clicked()), this, SLOT(slotNewFolder()));

    setCurrentUrl(d->m_startURL);
}
Beispiel #28
0
void InlineEditors::initToolBars(KActionCollection *ac)
{
    QFont defaultFont;
    QColor textColor = (Global::bnpView && Global::bnpView->currentBasket() ?
                        Global::bnpView->currentBasket()->textColor() :
                        palette().color(QPalette::Text));

    // Init the RichTextEditor Toolbar:
    richTextFont = new QFontComboBox(Global::mainWindow());
    focusWidgetFilter = new FocusWidgetFilter(richTextFont);
    richTextFont->setFixedWidth(richTextFont->sizeHint().width() * 2 / 3);
    richTextFont->setCurrentFont(defaultFont.family());

    KAction *action = ac->addAction("richtext_font");
    action->setDefaultWidget(richTextFont);
    action->setText(i18n("Font"));
    action->setShortcut(Qt::Key_F6);

    richTextFontSize = new FontSizeCombo(/*rw=*/true, Global::mainWindow());
    richTextFontSize->setFontSize(defaultFont.pointSize());
    action = ac->addAction("richtext_font_size");
    action->setDefaultWidget(richTextFontSize);
    action->setText(i18n("Font Size"));
    action->setShortcut(Qt::Key_F7);

    richTextColor = new KColorCombo(Global::mainWindow());
    richTextColor->installEventFilter(focusWidgetFilter);
    richTextColor->setFixedWidth(richTextColor->sizeHint().height() * 2);
    richTextColor->setColor(textColor);
    action = ac->addAction("richtext_color");
    action->setDefaultWidget(richTextColor);
    action->setText(i18n("Color"));

    KToggleAction *ta = NULL;
    ta = new KToggleAction(ac);
    ac->addAction("richtext_bold", ta);
    ta->setText(i18n("Bold"));
    ta->setIcon(KIcon("format-text-bold"));
    ta->setShortcut(KShortcut("Ctrl+B"));
    richTextBold = ta;

    ta = new KToggleAction(ac);
    ac->addAction("richtext_italic", ta);
    ta->setText(i18n("Italic"));
    ta->setIcon(KIcon("format-text-italic"));
    ta->setShortcut(KShortcut("Ctrl+I"));
    richTextItalic = ta;

    ta = new KToggleAction(ac);
    ac->addAction("richtext_underline", ta);
    ta->setText(i18n("Underline"));
    ta->setIcon(KIcon("format-text-underline"));
    ta->setShortcut(KShortcut("Ctrl+U"));
    richTextUnderline = ta;

#if 0
    ta = new KToggleAction(ac);
    ac->addAction("richtext_super", ta);
    ta->setText(i18n("Superscript"));
    ta->setIcon(KIcon("text_super"));
    richTextSuper = ta;

    ta = new KToggleAction(ac);
    ac->addAction("richtext_sub", ta);
    ta->setText(i18n("Subscript"));
    ta->setIcon(KIcon("text_sub"));
    richTextSub = ta;
#endif

    ta = new KToggleAction(ac);
    ac->addAction("richtext_left", ta);
    ta->setText(i18n("Align Left"));
    ta->setIcon(KIcon("format-justify-left"));
    richTextLeft = ta;

    ta = new KToggleAction(ac);
    ac->addAction("richtext_center", ta);
    ta->setText(i18n("Centered"));
    ta->setIcon(KIcon("format-justify-center"));
    richTextCenter = ta;

    ta = new KToggleAction(ac);
    ac->addAction("richtext_right", ta);
    ta->setText(i18n("Align Right"));
    ta->setIcon(KIcon("format-justify-right"));
    richTextRight = ta;

    ta = new KToggleAction(ac);
    ac->addAction("richtext_block", ta);
    ta->setText(i18n("Justified"));
    ta->setIcon(KIcon("format-justify-fill"));
    richTextJustified = ta;

    QActionGroup *alignmentGroup = new QActionGroup(this);
    alignmentGroup->addAction(richTextLeft);
    alignmentGroup->addAction(richTextCenter);
    alignmentGroup->addAction(richTextRight);
    alignmentGroup->addAction(richTextJustified);

    ta = new KToggleAction(ac);
    ac->addAction("richtext_undo", ta);
    ta->setText(i18n("Undo"));
    ta->setIcon(KIcon("edit-undo"));
    richTextUndo = ta;

    ta = new KToggleAction(ac);
    ac->addAction("richtext_redo", ta);
    ta->setText(i18n("Redo"));
    ta->setIcon(KIcon("edit-redo"));
    richTextRedo = ta;

    disableRichTextToolBar();
}
Beispiel #29
0
MediaWidget::MediaWidget(KMenu *menu_, KToolBar *toolBar, KActionCollection *collection,
	QWidget *parent) : QWidget(parent), menu(menu_), displayMode(NormalMode),
	automaticResize(ResizeOff), blockBackendUpdates(false), muted(false),
	screenSaverSuspended(false), showElapsedTime(true)
{
	dummySource.reset(new MediaSource());
	source = dummySource.data();

	QBoxLayout *layout = new QVBoxLayout(this);
	layout->setMargin(0);

	QPalette palette = QWidget::palette();
	palette.setColor(backgroundRole(), Qt::black);
	setPalette(palette);
	setAutoFillBackground(true);

	setAcceptDrops(true);
	setFocusPolicy(Qt::StrongFocus);

	backend = VlcMediaWidget::createVlcMediaWidget(this);

	if (backend == NULL) {
		backend = new DummyMediaWidget(this);
	}

	backend->connectToMediaWidget(this);
	layout->addWidget(backend);
	osdWidget = new OsdWidget(this);

	actionPrevious = new KAction(KIcon(QLatin1String("media-skip-backward")), i18n("Previous"), this);
	actionPrevious->setShortcut(KShortcut(Qt::Key_PageUp, Qt::Key_MediaPrevious));
	connect(actionPrevious, SIGNAL(triggered()), this, SLOT(previous()));
	toolBar->addAction(collection->addAction(QLatin1String("controls_previous"), actionPrevious));
	menu->addAction(actionPrevious);

	actionPlayPause = new KAction(this);
	actionPlayPause->setShortcut(KShortcut(Qt::Key_Space, Qt::Key_MediaPlay));
	textPlay = i18n("Play");
	textPause = i18n("Pause");
	iconPlay = KIcon(QLatin1String("media-playback-start"));
	iconPause = KIcon(QLatin1String("media-playback-pause"));
	connect(actionPlayPause, SIGNAL(triggered(bool)), this, SLOT(pausedChanged(bool)));
	toolBar->addAction(collection->addAction(QLatin1String("controls_play_pause"), actionPlayPause));
	menu->addAction(actionPlayPause);

	actionStop = new KAction(KIcon(QLatin1String("media-playback-stop")), i18n("Stop"), this);
	actionStop->setShortcut(KShortcut(Qt::Key_Backspace, Qt::Key_MediaStop));
	connect(actionStop, SIGNAL(triggered()), this, SLOT(stop()));
	toolBar->addAction(collection->addAction(QLatin1String("controls_stop"), actionStop));
	menu->addAction(actionStop);

	actionNext = new KAction(KIcon(QLatin1String("media-skip-forward")), i18n("Next"), this);
	actionNext->setShortcut(KShortcut(Qt::Key_PageDown, Qt::Key_MediaNext));
	connect(actionNext, SIGNAL(triggered()), this, SLOT(next()));
	toolBar->addAction(collection->addAction(QLatin1String("controls_next"), actionNext));
	menu->addAction(actionNext);
	menu->addSeparator();

    fullScreenAction = new KAction(KIcon(QLatin1String("view-fullscreen")),
		i18nc("'Playback' menu", "Full Screen Mode"), this);
	fullScreenAction->setShortcut(Qt::Key_F);
	connect(fullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
	menu->addAction(collection->addAction(QLatin1String("view_fullscreen"), fullScreenAction));

	minimalModeAction = new KAction(KIcon(QLatin1String("view-fullscreen")),
		i18nc("'Playback' menu", "Minimal Mode"), this);
	minimalModeAction->setShortcut(Qt::Key_Period);
	connect(minimalModeAction, SIGNAL(triggered()), this, SLOT(toggleMinimalMode()));
	menu->addAction(collection->addAction(QLatin1String("view_minimal_mode"), minimalModeAction));

	audioStreamBox = new KComboBox(toolBar);
	connect(audioStreamBox, SIGNAL(currentIndexChanged(int)),
		this, SLOT(currentAudioStreamChanged(int)));
	toolBar->addWidget(audioStreamBox);

	audioStreamModel = new QStringListModel(toolBar);
	audioStreamBox->setModel(audioStreamModel);

	subtitleBox = new KComboBox(toolBar);
	textSubtitlesOff = i18nc("subtitle selection entry", "off");
	connect(subtitleBox, SIGNAL(currentIndexChanged(int)),
		this, SLOT(currentSubtitleChanged(int)));
	toolBar->addWidget(subtitleBox);

	subtitleModel = new QStringListModel(toolBar);
	subtitleBox->setModel(subtitleModel);

	KMenu *audioMenu = new KMenu(i18nc("'Playback' menu", "Audio"), this);

	KAction *action = new KAction(KIcon(QLatin1String("audio-volume-high")),
		i18nc("'Audio' menu", "Increase Volume"), this);
	action->setShortcut(KShortcut(Qt::Key_Plus, Qt::Key_VolumeUp));
	connect(action, SIGNAL(triggered()), this, SLOT(increaseVolume()));
	audioMenu->addAction(collection->addAction(QLatin1String("controls_increase_volume"), action));

	action = new KAction(KIcon(QLatin1String("audio-volume-low")),
		i18nc("'Audio' menu", "Decrease Volume"), this);
	action->setShortcut(KShortcut(Qt::Key_Minus, Qt::Key_VolumeDown));
	connect(action, SIGNAL(triggered()), this, SLOT(decreaseVolume()));
	audioMenu->addAction(collection->addAction(QLatin1String("controls_decrease_volume"), action));

	muteAction = new KAction(i18nc("'Audio' menu", "Mute Volume"), this);
	mutedIcon = KIcon(QLatin1String("audio-volume-muted"));
	unmutedIcon = KIcon(QLatin1String("audio-volume-medium"));
	muteAction->setIcon(unmutedIcon);
	muteAction->setShortcut(KShortcut(Qt::Key_M, Qt::Key_VolumeMute));
	connect(muteAction, SIGNAL(triggered()), this, SLOT(mutedChanged()));
	toolBar->addAction(collection->addAction(QLatin1String("controls_mute_volume"), muteAction));
	audioMenu->addAction(muteAction);
	menu->addMenu(audioMenu);

	KMenu *videoMenu = new KMenu(i18nc("'Playback' menu", "Video"), this);
	menu->addMenu(videoMenu);
	menu->addSeparator();

	deinterlaceAction = new KAction(KIcon(QLatin1String("format-justify-center")),
		i18nc("'Video' menu", "Deinterlace"), this);
	deinterlaceAction->setCheckable(true);
	deinterlaceAction->setChecked(
		KGlobal::config()->group("MediaObject").readEntry("Deinterlace", true));
	deinterlaceAction->setShortcut(Qt::Key_I);
	connect(deinterlaceAction, SIGNAL(toggled(bool)), this, SLOT(deinterlacingChanged(bool)));
	backend->setDeinterlacing(deinterlaceAction->isChecked());
	videoMenu->addAction(collection->addAction(QLatin1String("controls_deinterlace"), deinterlaceAction));

	KMenu *aspectMenu = new KMenu(i18nc("'Video' menu", "Aspect Ratio"), this);
	QActionGroup *aspectGroup = new QActionGroup(this);
	connect(aspectGroup, SIGNAL(triggered(QAction*)),
		this, SLOT(aspectRatioChanged(QAction*)));

	action = new KAction(i18nc("'Aspect Ratio' menu", "Automatic"), aspectGroup);
	action->setCheckable(true);
	action->setChecked(true);
	action->setData(AspectRatioAuto);
	aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_auto"), action));

	action = new KAction(i18nc("'Aspect Ratio' menu", "Fit to Window"), aspectGroup);
	action->setCheckable(true);
	action->setData(AspectRatioWidget);
	aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_widget"), action));

	action = new KAction(i18nc("'Aspect Ratio' menu", "4:3"), aspectGroup);
	action->setCheckable(true);
	action->setData(AspectRatio4_3);
	aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_4_3"), action));

	action = new KAction(i18nc("'Aspect Ratio' menu", "16:9"), aspectGroup);
	action->setCheckable(true);
	action->setData(AspectRatio16_9);
	aspectMenu->addAction(collection->addAction(QLatin1String("controls_aspect_16_9"), action));

    // Changes aspect ratio "a la VLC"
    currentAspectRatio=AspectRatioAuto;
    action = new KAction(KIcon(QLatin1String("chainAspectRatio")),
        i18nc("'Aspect Ratio' menu", "Chain ratio"), this);
    action->setShortcut(Qt::CTRL+Qt::Key_A);
    connect(action, SIGNAL(triggered()), this, SLOT(chainAspectRatio()));
    aspectMenu->addAction(collection->addAction(QLatin1String("chainAspectRatio"), action));
    // Switches scale "a la VLC"
    currentAspectRatio=AspectRatioAuto;
    action = new KAction(KIcon(QLatin1String("switchScale")),
        i18nc("'Aspect Ratio' menu", "Switch scale"), this);
    action->setShortcut(Qt::SHIFT+Qt::Key_O);
    connect(action, SIGNAL(triggered()), this, SLOT(switchScale()));
    aspectMenu->addAction(collection->addAction(QLatin1String("switchScale"), action));

    videoMenu->addMenu(aspectMenu);

	KMenu *autoResizeMenu = new KMenu(i18n("Automatic Resize"), this);
	QActionGroup *autoResizeGroup = new QActionGroup(this);
	// we need an event even if you select the currently selected item
	autoResizeGroup->setExclusive(false);
	connect(autoResizeGroup, SIGNAL(triggered(QAction*)),
		this, SLOT(autoResizeTriggered(QAction*)));

	action = new KAction(i18nc("automatic resize", "Off"), autoResizeGroup);
	action->setCheckable(true);
	action->setData(0);
	autoResizeMenu->addAction(collection->addAction(QLatin1String("controls_autoresize_off"), action));

	action = new KAction(i18nc("automatic resize", "Original Size"), autoResizeGroup);
	action->setCheckable(true);
	action->setData(1);
	autoResizeMenu->addAction(collection->addAction(QLatin1String("controls_autoresize_original"), action));

	action = new KAction(i18nc("automatic resize", "Double Size"), autoResizeGroup);
	action->setCheckable(true);
	action->setData(2);
	autoResizeMenu->addAction(collection->addAction(QLatin1String("controls_autoresize_double"), action));

	int autoResizeFactor =
		KGlobal::config()->group("MediaObject").readEntry("AutoResizeFactor", 0);

	switch (autoResizeFactor) {
	case 1:
		automaticResize = OriginalSize;
		autoResizeGroup->actions().at(1)->setChecked(true);
		break;
	case 2:
		automaticResize = DoubleSize;
		autoResizeGroup->actions().at(2)->setChecked(true);
		break;
	default:
		automaticResize = ResizeOff;
		autoResizeGroup->actions().at(0)->setChecked(true);
		break;
	}

	videoMenu->addMenu(autoResizeMenu);

    action = new KAction(i18n("Volume Slider"), this);
	volumeSlider = new QSlider(toolBar);
	volumeSlider->setFocusPolicy(Qt::NoFocus);
	volumeSlider->setOrientation(Qt::Horizontal);
    volumeSlider->setRange(0, 100);
	volumeSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
	volumeSlider->setToolTip(action->text());
    volumeSlider->setValue(KGlobal::config()->group("MediaObject").readEntry("Volume", 100));
	connect(volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
	backend->setVolume(volumeSlider->value());
	action->setDefaultWidget(volumeSlider);
	toolBar->addAction(collection->addAction(QLatin1String("controls_volume_slider"), action));

	jumpToPositionAction = new KAction(KIcon(QLatin1String("go-jump")),
		i18nc("@action:inmenu", "Jump to Position..."), this);
	jumpToPositionAction->setShortcut(Qt::CTRL + Qt::Key_J);
	connect(jumpToPositionAction, SIGNAL(triggered()), this, SLOT(jumpToPosition()));
	menu->addAction(collection->addAction(QLatin1String("controls_jump_to_position"), jumpToPositionAction));

	navigationMenu = new KMenu(i18nc("playback menu", "Skip"), this);
	menu->addMenu(navigationMenu);
	menu->addSeparator();

	int shortSkipDuration = Configuration::instance()->getShortSkipDuration();
	int longSkipDuration = Configuration::instance()->getLongSkipDuration();
	connect(Configuration::instance(), SIGNAL(shortSkipDurationChanged(int)),
		this, SLOT(shortSkipDurationChanged(int)));
	connect(Configuration::instance(), SIGNAL(longSkipDurationChanged(int)),
		this, SLOT(longSkipDurationChanged(int)));

	longSkipBackwardAction = new KAction(KIcon(QLatin1String("media-skip-backward")),
		i18nc("submenu of 'Skip'", "Skip %1s Backward", longSkipDuration), this);
	longSkipBackwardAction->setShortcut(Qt::SHIFT + Qt::Key_Left);
	connect(longSkipBackwardAction, SIGNAL(triggered()), this, SLOT(longSkipBackward()));
	navigationMenu->addAction(
		collection->addAction(QLatin1String("controls_long_skip_backward"), longSkipBackwardAction));

	shortSkipBackwardAction = new KAction(KIcon(QLatin1String("media-skip-backward")),
		i18nc("submenu of 'Skip'", "Skip %1s Backward", shortSkipDuration), this);
	shortSkipBackwardAction->setShortcut(Qt::Key_Left);
	connect(shortSkipBackwardAction, SIGNAL(triggered()), this, SLOT(shortSkipBackward()));
	navigationMenu->addAction(
		collection->addAction(QLatin1String("controls_skip_backward"), shortSkipBackwardAction));

	shortSkipForwardAction = new KAction(KIcon(QLatin1String("media-skip-forward")),
		i18nc("submenu of 'Skip'", "Skip %1s Forward", shortSkipDuration), this);
	shortSkipForwardAction->setShortcut(Qt::Key_Right);
	connect(shortSkipForwardAction, SIGNAL(triggered()), this, SLOT(shortSkipForward()));
	navigationMenu->addAction(
		collection->addAction(QLatin1String("controls_skip_forward"), shortSkipForwardAction));

	longSkipForwardAction = new KAction(KIcon(QLatin1String("media-skip-forward")),
		i18nc("submenu of 'Skip'", "Skip %1s Forward", longSkipDuration), this);
	longSkipForwardAction->setShortcut(Qt::SHIFT + Qt::Key_Right);
	connect(longSkipForwardAction, SIGNAL(triggered()), this, SLOT(longSkipForward()));
	navigationMenu->addAction(
		collection->addAction(QLatin1String("controls_long_skip_forward"), longSkipForwardAction));

	toolBar->addAction(KIcon(QLatin1String("player-time")), i18n("Seek Slider"))->setEnabled(false);

	action = new KAction(i18n("Seek Slider"), this);
	seekSlider = new SeekSlider(toolBar);
	seekSlider->setFocusPolicy(Qt::NoFocus);
	seekSlider->setOrientation(Qt::Horizontal);
	seekSlider->setToolTip(action->text());
	connect(seekSlider, SIGNAL(valueChanged(int)), this, SLOT(seek(int)));
	action->setDefaultWidget(seekSlider);
	toolBar->addAction(collection->addAction(QLatin1String("controls_position_slider"), action));

	menuAction = new KAction(KIcon(QLatin1String("media-optical-video")),
		i18nc("dvd navigation", "DVD Menu"), this);
	connect(menuAction, SIGNAL(triggered()), this, SLOT(toggleMenu()));
	menu->addAction(collection->addAction(QLatin1String("controls_toggle_menu"), menuAction));

	titleMenu = new KMenu(i18nc("dvd navigation", "Title"), this);
	titleGroup = new QActionGroup(this);
	connect(titleGroup, SIGNAL(triggered(QAction*)),
		this, SLOT(currentTitleChanged(QAction*)));
	menu->addMenu(titleMenu);

	chapterMenu = new KMenu(i18nc("dvd navigation", "Chapter"), this);
	chapterGroup = new QActionGroup(this);
	connect(chapterGroup, SIGNAL(triggered(QAction*)),
		this, SLOT(currentChapterChanged(QAction*)));
	menu->addMenu(chapterMenu);

	angleMenu = new KMenu(i18nc("dvd navigation", "Angle"), this);
	angleGroup = new QActionGroup(this);
	connect(angleGroup, SIGNAL(triggered(QAction*)), this,
		SLOT(currentAngleChanged(QAction*)));
	menu->addMenu(angleMenu);

	action = new KAction(i18n("Switch between elapsed and remaining time display"), this);
	timeButton = new QPushButton(toolBar);
	timeButton->setFocusPolicy(Qt::NoFocus);
	timeButton->setToolTip(action->text());
	connect(timeButton, SIGNAL(clicked(bool)), this, SLOT(timeButtonClicked()));
	action->setDefaultWidget(timeButton);
	toolBar->addAction(collection->addAction(QLatin1String("controls_time_button"), action));

	QTimer *timer = new QTimer(this);
	timer->start(50000);
	connect(timer, SIGNAL(timeout()), this, SLOT(checkScreenSaver()));
}
Beispiel #30
0
void IconView::init()
{
    KConfig config;
    KConfigGroup generalGroup( &config, "General" );
    m_wallpaper = generalGroup.readEntry( "Wallpaper", DEFAULT_WALLPAPER );

    delete m_pixmap;
    m_pixmap = new QPixmap( m_wallpaper );
    QPalette p;
    p.setBrush( QPalette::Base, QBrush( *m_pixmap ) );
    setPalette( p );

    m_model = new KDirModel( this );
    KDirLister* lister = new KDirLister( this );
    lister->openUrl( KUrl( QDir::homePath() ) );
    m_model->setDirLister( lister );

    m_delegate = new KFileItemDelegate( this );
    m_delegate->setMaximumSize( QSize( 64, 64 ) );
    m_delegate->setShadowOffset( QPointF( 1, 1 ) );
    m_delegate->setShadowColor( QColor( 0xff, 0xff, 0xff ) );
    m_delegate->setShadowBlur( 1 );
    m_delegate->setWrapMode( QTextOption::WrapAtWordBoundaryOrAnywhere );

    m_proxyModel = new KDirSortFilterProxyModel( this );
    m_proxyModel->setSourceModel( m_model );

    setModel( m_proxyModel );
    setItemDelegate( m_delegate );

    m_selectionModel = new QItemSelectionModel( m_proxyModel );
    setSelectionModel( m_selectionModel );

    /// create actions
    KAction* cut = KStandardAction::cut( this, SLOT(cut()), this );
    KAction* copy = KStandardAction::copy( this, SLOT(copy()), this );

    KIO::FileUndoManager* manager = KIO::FileUndoManager::self();
    KAction* undo = KStandardAction::undo( manager, SLOT(undo()), this );
    connect( manager, SIGNAL(undoAvailable(bool)), undo, SLOT(setEnabled(bool)) );
    connect( manager, SIGNAL(undoTextChanged(const QString&)), SLOT(undoTextChanged(const QString&)) );
    undo->setEnabled( manager->undoAvailable() );

    KAction* paste = KStandardAction::paste( this, SLOT(paste()), this );
    KAction* pasteTo = KStandardAction::paste( this, SLOT(pasteTo()), this );
    pasteTo->setEnabled( false ); // Only enabled during popupMenu()

    QString actionText = KIO::pasteActionText();
    if ( !actionText.isEmpty() )
        paste->setText( actionText );
    else
        paste->setEnabled( false );

    KAction* refresh = new KAction(KIcon("user-desktop"), i18n("&Refresh Desktop"), this);
    connect( refresh, SIGNAL(triggered()), this, SLOT(refresh()) );

    KAction* wallpaper = new KAction(KIcon("tools-wizard"), i18n("&Change Wallpaper..."), this);
    connect( wallpaper, SIGNAL(triggered()), this, SLOT(changeWallpaper()) );

    KAction* rename = new KAction(KIcon("edit-rename"), i18n("&Rename"), this);
    rename->setShortcut( Qt::Key_F2 );
    connect( rename, SIGNAL(triggered()), SLOT(rename()) );

    KAction* trash = new KAction(KIcon("user-trash"), i18n("&Move to Trash"), this);
    trash->setShortcut( Qt::Key_Delete );
    connect( trash, SIGNAL(triggered(Qt::MouseButtons, Qt::KeyboardModifiers)),
             this, SLOT(moveToTrash(Qt::MouseButtons, Qt::KeyboardModifiers)) );

    KAction* del = new KAction(KIcon("edit-delete"), i18n("&Delete"), this);
    del->setShortcut( Qt::SHIFT + Qt::Key_Delete );
    connect( del, SIGNAL(triggered()), this, SLOT(deleteSelectedItems()) );

    KAction* emptyTrash = new KAction(KIcon("trash-empty"), i18n("&Empty Trash Bin"), this);
    KConfig trashConfig( "trashrc", KConfig::SimpleConfig );
    emptyTrash->setEnabled( !trashConfig.group( "Status" ).readEntry( "Empty", true ) );
    connect( emptyTrash, SIGNAL(triggered()), this, SLOT(emptyTrashBin()) );

    // Create the new menu
    m_newMenu = new KNewFileMenu(&m_actionCollection, "new_menu", this);
    connect( m_newMenu->menu(), SIGNAL(aboutToShow()), this, SLOT(aboutToShowCreateNew()) );

    m_actionCollection.addAction( "undo", undo );
    m_actionCollection.addAction( "cut", cut );
    m_actionCollection.addAction( "copy", copy );
    m_actionCollection.addAction( "paste", paste );
    m_actionCollection.addAction( "pasteto", pasteTo );
    m_actionCollection.addAction( "refresh", refresh );
    m_actionCollection.addAction( "wallpaper", wallpaper );
    m_actionCollection.addAction( "rename", rename );
    m_actionCollection.addAction( "trash", trash );
    m_actionCollection.addAction( "del", del );
    m_actionCollection.addAction( "empty_trash", emptyTrash );
}