Back to index

kdeartwork  4.3.2
Public Member Functions | Protected Slots
SaverConfig Class Reference

#include <kpartsaver.h>

Inheritance diagram for SaverConfig:
Inheritance graph
[legend]
Collaboration diagram for SaverConfig:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SaverConfig (QWidget *parent=0)
 ~SaverConfig ()

Protected Slots

void apply ()
void add ()
void remove ()
void select ()
void up ()
void down ()

Detailed Description

Definition at line 39 of file kpartsaver.h.


Constructor & Destructor Documentation

SaverConfig::SaverConfig ( QWidget *  parent = 0)

Definition at line 266 of file kpartsaver.cpp.

    : ConfigWidget( parent )
{
    setModal(true);
    connect( m_ok, SIGNAL(clicked()), SLOT(apply()) );
    connect( m_ok, SIGNAL(clicked()), SLOT(accept()) );
    connect( m_cancel, SIGNAL(clicked()), SLOT(reject()) );

    connect( m_multiple, SIGNAL(toggled(bool)), m_delayLabel, SLOT(setEnabled(bool)) );
    connect( m_multiple, SIGNAL(toggled(bool)), m_delay, SLOT(setEnabled(bool)) );
    connect( m_multiple, SIGNAL(toggled(bool)), m_secondsLabel, SLOT(setEnabled(bool)) );
    connect( m_multiple, SIGNAL(toggled(bool)), m_random, SLOT(setEnabled(bool)) );

    connect( m_files, SIGNAL(itemSelectionChanged()), SLOT(select()) );
    connect( m_add, SIGNAL(clicked()), SLOT(add()) );
    connect( m_remove, SIGNAL(clicked()), SLOT(remove()) );
    connect( m_up, SIGNAL(clicked()), SLOT(up()) );
    connect( m_down, SIGNAL(clicked()), SLOT(down()) );

    m_up->setIcon( KIcon("go-up") );
    m_down->setIcon( KIcon("go-down") );

    // load config
    KConfigGroup cfg(KGlobal::config(), "Misc");

    bool single = cfg.readEntry( "Single", true );
    m_single->setChecked( single );
    m_multiple->setChecked( !single );
    m_delay->setMinimum( 1 );
    m_delay->setMaximum( 10000 );
    m_delay->setValue( cfg.readEntry( "Delay", 60 ) );
    m_random->setChecked( cfg.readEntry( "Random", false ) );
    m_files->addItems( cfg.readEntry( "Files",QStringList() ) );

    // update buttons
    select();
}

Here is the call graph for this function:

Definition at line 305 of file kpartsaver.cpp.

{
}

Member Function Documentation

void SaverConfig::add ( ) [protected, slot]

Definition at line 331 of file kpartsaver.cpp.

{
    KUrl::List files = KFileDialog::getOpenUrls( KUrl(), QString(),
                                                 this, i18n("Select Media Files") );
    for( int n=0; n<files.count(); n++ )
        m_files->addItem( files[n].prettyUrl() );
}

Here is the caller graph for this function:

void SaverConfig::apply ( ) [protected, slot]

Definition at line 310 of file kpartsaver.cpp.

{
    kDebug() << "apply";

    KConfigGroup cfg(KGlobal::config(), "Misc");

    cfg.writeEntry( "Single", m_single->isChecked() );
    cfg.writeEntry( "Delay", m_delay->value() );
    cfg.writeEntry( "Random", m_random->isChecked() );

    int num = m_files->count();
    QStringList files;
    for( int n=0; n<num; n++ )
        files << m_files->item(n)->text();

    cfg.writeEntry( "Files", files );

    cfg.sync();
}

Here is the caller graph for this function:

void SaverConfig::down ( ) [protected, slot]

Definition at line 369 of file kpartsaver.cpp.

{
    int current = m_files->currentRow();
    if ( current!=-1 && current<(int)m_files->count()-1 ) {
        QString txt = m_files->currentItem()->text();
        m_files->takeItem( current );
        m_files->insertItem( current+1, txt );
        m_files->setCurrentRow( current+1 );
    }
}

Here is the caller graph for this function:

void SaverConfig::remove ( ) [protected, slot]

Definition at line 340 of file kpartsaver.cpp.

{
    int current = m_files->currentRow();
    if( current!=-1 )
        m_files->takeItem( current );
}
void SaverConfig::select ( ) [protected, slot]

Definition at line 348 of file kpartsaver.cpp.

{
    bool enabled = m_files->currentRow()!=-1;
    m_remove->setEnabled( enabled );
    m_up->setEnabled( enabled && m_files->currentRow()!=0 );
    m_down->setEnabled( enabled && m_files->currentRow()!=(int)m_files->count()-1 );
}

Here is the caller graph for this function:

void SaverConfig::up ( ) [protected, slot]

Definition at line 357 of file kpartsaver.cpp.

{
    int current = m_files->currentRow();
    if ( current>0 ) {
        QString txt = m_files->currentItem()->text();
        m_files->takeItem( current );
        m_files->insertItem( current-1, txt );
        m_files->setCurrentRow( current-1 );
    }
}

Here is the caller graph for this function:


The documentation for this class was generated from the following files: