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

kbearsitemanagerbase.cpp

#include <klocale.h>
/****************************************************************************
** Form implementation generated from reading ui file './kbearsitemanagerbase.ui'
**
** Created: Sa Nov 22 17:47:10 2003
**      by: The User Interface Compiler ($Id: qt/main.cpp   3.2.1   edited May 19 14:22 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "kbearsitemanagerbase.h"

#include <qvariant.h>
#include <qpushbutton.h>
#include <kcombobox.h>
#include <kpushbutton.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qtextedit.h>
#include <qcheckbox.h>
#include <klineedit.h>
#include <knuminput.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>

#include "kbearsitemanagertreeview.h"

/*
 *  Constructs a KBearSiteManagerBase which is a child of 'parent', with the
 *  name 'name'.' 
 */
KBearSiteManagerBase::KBearSiteManagerBase( QWidget* parent,  const char* name )
    : KDialog( parent, name )
{
    if ( !name )
      setName( "KBearSiteManagerBase" );
    KBearSiteManagerBaseLayout = new QGridLayout( this, 1, 1, 11, 6, "KBearSiteManagerBaseLayout"); 

    p_encodingComboBox = new KComboBox( FALSE, this, "p_encodingComboBox" );
    p_encodingComboBox->setAutoResize( TRUE );
    p_encodingComboBox->setDuplicatesEnabled( FALSE );

    KBearSiteManagerBaseLayout->addWidget( p_encodingComboBox, 4, 0 );

    Layout7 = new QGridLayout( 0, 1, 1, 0, 6, "Layout7"); 

    saveButton = new KPushButton( this, "saveButton" );
    saveButton->setEnabled( FALSE );
    saveButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, 0, 0, saveButton->sizePolicy().hasHeightForWidth() ) );

    Layout7->addWidget( saveButton, 2, 0 );

    removeButton = new KPushButton( this, "removeButton" );
    removeButton->setEnabled( FALSE );
    removeButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, removeButton->sizePolicy().hasHeightForWidth() ) );

    Layout7->addWidget( removeButton, 1, 0 );

    importButton = new KPushButton( this, "importButton" );
    importButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, importButton->sizePolicy().hasHeightForWidth() ) );
    QFont importButton_font(  importButton->font() );
    importButton_font.setPointSize( 12 );
    importButton_font.setBold( TRUE );
    importButton->setFont( importButton_font ); 

    Layout7->addWidget( importButton, 0, 0 );

    dirButton = new KPushButton( this, "dirButton" );
    dirButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, dirButton->sizePolicy().hasHeightForWidth() ) );

    Layout7->addWidget( dirButton, 0, 1 );

    cancelButton = new KPushButton( this, "cancelButton" );
    cancelButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, cancelButton->sizePolicy().hasHeightForWidth() ) );

    Layout7->addWidget( cancelButton, 1, 1 );

    connectButton = new KPushButton( this, "connectButton" );
    connectButton->setEnabled( FALSE );
    connectButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, 0, 0, connectButton->sizePolicy().hasHeightForWidth() ) );
    QFont connectButton_font(  connectButton->font() );
    connectButton_font.setPointSize( 24 );
    connectButton_font.setBold( TRUE );
    connectButton->setFont( connectButton_font ); 
    connectButton->setDefault( TRUE );

    Layout7->addWidget( connectButton, 2, 1 );

    KBearSiteManagerBaseLayout->addMultiCellLayout( Layout7, 2, 4, 1, 1 );

    groupBox = new QGroupBox( this, "groupBox" );
    groupBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)3, 0, 0, groupBox->sizePolicy().hasHeightForWidth() ) );
    groupBox->setColumnLayout(0, Qt::Vertical );
    groupBox->layout()->setSpacing( 6 );
    groupBox->layout()->setMargin( 11 );
    groupBoxLayout = new QGridLayout( groupBox->layout() );
    groupBoxLayout->setAlignment( Qt::AlignTop );

    Layout7_2 = new QVBoxLayout( 0, 0, 6, "Layout7_2"); 

    descriptionLabel = new QLabel( groupBox, "descriptionLabel" );
    Layout7_2->addWidget( descriptionLabel );

    descriptionEdit = new QTextEdit( groupBox, "descriptionEdit" );
    Layout7_2->addWidget( descriptionEdit );

    groupBoxLayout->addMultiCellLayout( Layout7_2, 8, 8, 0, 1 );

    siteLabel = new QLabel( groupBox, "siteLabel" );
    siteLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)1, 0, 0, siteLabel->sizePolicy().hasHeightForWidth() ) );

    groupBoxLayout->addWidget( siteLabel, 0, 0 );

    hostNameLabel = new QLabel( groupBox, "hostNameLabel" );

    groupBoxLayout->addWidget( hostNameLabel, 1, 0 );

    anonymousCheck = new QCheckBox( groupBox, "anonymousCheck" );

    groupBoxLayout->addWidget( anonymousCheck, 3, 0 );

    userNameLabel = new QLabel( groupBox, "userNameLabel" );

    groupBoxLayout->addWidget( userNameLabel, 4, 0 );

    passwordLabel = new QLabel( groupBox, "passwordLabel" );

    groupBoxLayout->addWidget( passwordLabel, 5, 0 );

    defaultLocalDirLabel = new QLabel( groupBox, "defaultLocalDirLabel" );

    groupBoxLayout->addWidget( defaultLocalDirLabel, 6, 0 );

    defaultRemoteDirLabel = new QLabel( groupBox, "defaultRemoteDirLabel" );

    groupBoxLayout->addWidget( defaultRemoteDirLabel, 7, 0 );

    portLabel = new QLabel( groupBox, "portLabel" );

    groupBoxLayout->addWidget( portLabel, 2, 0 );

    Layout10 = new QVBoxLayout( 0, 0, 6, "Layout10"); 

    siteEdit = new KLineEdit( groupBox, "siteEdit" );
    Layout10->addWidget( siteEdit );

    hostNameEdit = new KLineEdit( groupBox, "hostNameEdit" );
    Layout10->addWidget( hostNameEdit );

    Layout9 = new QHBoxLayout( 0, 0, 6, "Layout9"); 

    p_portSpinBox = new KIntSpinBox( groupBox, "p_portSpinBox" );
    p_portSpinBox->setMaxValue( 65535 );
    p_portSpinBox->setValue( 21 );
    Layout9->addWidget( p_portSpinBox );

    p_protocolLabel = new QLabel( groupBox, "p_protocolLabel" );
    Layout9->addWidget( p_protocolLabel );

    p_protocolComboBox = new KComboBox( FALSE, groupBox, "p_protocolComboBox" );
    p_protocolComboBox->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, 0, 0, p_protocolComboBox->sizePolicy().hasHeightForWidth() ) );
    p_protocolComboBox->setMaxCount( 10 );
    Layout9->addWidget( p_protocolComboBox );
    Layout10->addLayout( Layout9 );

    p_advancedSettingsButton = new KPushButton( groupBox, "p_advancedSettingsButton" );
    p_advancedSettingsButton->setEnabled( FALSE );
    QFont p_advancedSettingsButton_font(  p_advancedSettingsButton->font() );
    p_advancedSettingsButton_font.setPointSize( 12 );
    p_advancedSettingsButton_font.setBold( TRUE );
    p_advancedSettingsButton->setFont( p_advancedSettingsButton_font ); 
    Layout10->addWidget( p_advancedSettingsButton );

    userNameEdit = new KComboBox( FALSE, groupBox, "userNameEdit" );
    userNameEdit->setEditable( TRUE );
    Layout10->addWidget( userNameEdit );

    passwordEdit = new KLineEdit( groupBox, "passwordEdit" );
    passwordEdit->setEchoMode( KLineEdit::Password );
    Layout10->addWidget( passwordEdit );

    defaultLocalDirEdit = new KLineEdit( groupBox, "defaultLocalDirEdit" );
    Layout10->addWidget( defaultLocalDirEdit );

    defaultRemoteDirEdit = new KLineEdit( groupBox, "defaultRemoteDirEdit" );
    Layout10->addWidget( defaultRemoteDirEdit );

    groupBoxLayout->addMultiCellLayout( Layout10, 0, 7, 1, 1 );

    KBearSiteManagerBaseLayout->addWidget( groupBox, 1, 1 );

    p_showSystemTrayCheckBox = new QCheckBox( this, "p_showSystemTrayCheckBox" );
    p_showSystemTrayCheckBox->setChecked( TRUE );

    KBearSiteManagerBaseLayout->addWidget( p_showSystemTrayCheckBox, 0, 0 );

    p_plugInKonqCheckBox = new QCheckBox( this, "p_plugInKonqCheckBox" );
    p_plugInKonqCheckBox->setChecked( TRUE );

    KBearSiteManagerBaseLayout->addWidget( p_plugInKonqCheckBox, 0, 1 );

    siteTreeView = new KBearSiteManagerTreeView( this, "siteTreeView" );
    siteTreeView->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, 0, 0, siteTreeView->sizePolicy().hasHeightForWidth() ) );
    siteTreeView->setResizePolicy( KBearSiteManagerTreeView::Default );

    KBearSiteManagerBaseLayout->addWidget( siteTreeView, 1, 0 );

    p_encodingLabel = new QLabel( this, "p_encodingLabel" );
    p_encodingLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, p_encodingLabel->sizePolicy().hasHeightForWidth() ) );

    KBearSiteManagerBaseLayout->addWidget( p_encodingLabel, 3, 0 );

    p_reloadButton = new KPushButton( this, "p_reloadButton" );
    p_reloadButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, 0, 0, p_reloadButton->sizePolicy().hasHeightForWidth() ) );
    p_reloadButton->setMinimumSize( QSize( 0, 50 ) );
    p_reloadButton->setPixmap( BarIcon("reload") );

    KBearSiteManagerBaseLayout->addWidget( p_reloadButton, 2, 0 );
    languageChange();
    resize( QSize(554, 545).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
    connect( siteEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotSetEdited() ) );
    connect( hostNameEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotSetHostEdited() ) );
    connect( p_portSpinBox, SIGNAL( valueChanged(int) ), this, SLOT( slotSetEdited() ) );
    connect( p_protocolComboBox, SIGNAL( activated(int) ), this, SLOT( slotSetEdited() ) );
    connect( p_protocolComboBox, SIGNAL( activated(const QString&) ), this, SLOT( slotSelectedProtocol(const QString&) ) );
    connect( anonymousCheck, SIGNAL( clicked() ), this, SLOT( slotSetEdited() ) );
    connect( userNameEdit, SIGNAL( activated(int) ), this, SLOT( slotSetEdited() ) );
    connect( passwordEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotSetEdited() ) );
    connect( defaultLocalDirEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotSetEdited() ) );
    connect( defaultRemoteDirEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotSetEdited() ) );
    connect( descriptionEdit, SIGNAL( textChanged() ), this, SLOT( slotSetEdited() ) );
    connect( siteTreeView, SIGNAL( moved( const QString&, const QString&, QListViewItem*,bool) ), this, SLOT( slotMoved(const QString&,const QString&,QListViewItem*,bool) ) );
    connect( siteTreeView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( slotDoubleClicked(QListViewItem*) ) );
    connect( siteTreeView, SIGNAL( selectionChanged(QListViewItem*) ), this, SLOT( slotSelectedSite(QListViewItem*) ) );
    connect( siteTreeView, SIGNAL( pressed(QListViewItem*) ), this, SLOT( slotPressed(QListViewItem*) ) );
    connect( removeButton, SIGNAL( clicked() ), this, SLOT( slotRemove() ) );
    connect( dirButton, SIGNAL( clicked() ), this, SLOT( slotNewGroup() ) );
    connect( saveButton, SIGNAL( clicked() ), this, SLOT( slotSave() ) );
    connect( importButton, SIGNAL( clicked() ), this, SLOT( slotOpenImportDialog() ) );
    connect( connectButton, SIGNAL( clicked() ), this, SLOT( slotConnect() ) );
    connect( p_encodingComboBox, SIGNAL( activated(const QString&) ), this, SLOT( slotSetEncoding(const QString&) ) );
    connect( p_advancedSettingsButton, SIGNAL( clicked() ), this, SLOT( slotAdvancedSettings() ) );
    connect( siteTreeView, SIGNAL( itemRenamed (QListViewItem*, const QString&, int) ), this, SLOT( slotItemRenamed(QListViewItem*,const QString&,int) ) );
    connect( siteTreeView, SIGNAL( contextMenu( KListView*, QListViewItem*, const QPoint& ) ), this, SLOT( slotContextMenu( KListView*, QListViewItem*, const QPoint& ) ) );

    // tab order
    setTabOrder( siteEdit, hostNameEdit );
    setTabOrder( hostNameEdit, p_protocolComboBox );
    setTabOrder( p_protocolComboBox, p_portSpinBox );
    setTabOrder( p_portSpinBox, anonymousCheck );
    setTabOrder( anonymousCheck, p_advancedSettingsButton );
    setTabOrder( p_advancedSettingsButton, userNameEdit );
    setTabOrder( userNameEdit, passwordEdit );
    setTabOrder( passwordEdit, defaultLocalDirEdit );
    setTabOrder( defaultLocalDirEdit, defaultRemoteDirEdit );
    setTabOrder( defaultRemoteDirEdit, descriptionEdit );
    setTabOrder( descriptionEdit, p_encodingComboBox );
    setTabOrder( p_encodingComboBox, importButton );
    setTabOrder( importButton, dirButton );
    setTabOrder( dirButton, removeButton );
    setTabOrder( removeButton, cancelButton );
    setTabOrder( cancelButton, saveButton );
    setTabOrder( saveButton, connectButton );
    setTabOrder( connectButton, p_reloadButton );
}

/*
 *  Destroys the object and frees any allocated resources
 */
KBearSiteManagerBase::~KBearSiteManagerBase()
{
    // no need to delete child widgets, Qt does it all for us
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void KBearSiteManagerBase::languageChange()
{
    setCaption( tr2i18n( "KBearSiteManagerBase" ) );
    QToolTip::add( p_encodingComboBox, tr2i18n( "Use this to select the encoding for the Sitemanagerdatabase. Can be important for some languages in order to save certain characters." ) );
    QWhatsThis::add( p_encodingComboBox, tr2i18n( "Use this to select the encoding for the Sitemanagerdatabase. Can be important for some languages in order to save certain characters." ) );
    saveButton->setText( tr2i18n( "&Save" ) );
    QToolTip::add( saveButton, tr2i18n( "Save the edited site. This will overwrite the old information unless you change the label." ) );
    QWhatsThis::add( saveButton, tr2i18n( "Save the edited site. This will overwrite the old information. If you change the label it will be saved as a new site." ) );
    removeButton->setText( tr2i18n( "&Remove" ) );
    QToolTip::add( removeButton, tr2i18n( "Remove selected site from site list" ) );
    QWhatsThis::add( removeButton, tr2i18n( "Remove selected site from site list" ) );
    importButton->setText( tr2i18n( "&Import..." ) );
    QToolTip::add( importButton, tr2i18n( "Open site import dialog." ) );
    QWhatsThis::add( importButton, tr2i18n( "Open site import dialog." ) );
    dirButton->setText( tr2i18n( "&New group" ) );
    QToolTip::add( dirButton, tr2i18n( "Adds a new group to the site list" ) );
    QWhatsThis::add( dirButton, tr2i18n( "Adds a new group to the site list" ) );
    cancelButton->setText( tr2i18n( "&Close" ) );
    QToolTip::add( cancelButton, tr2i18n( "Cancel without saving and exit the SiteManager" ) );
    QWhatsThis::add( cancelButton, tr2i18n( "Cancel without saving and exit the SiteManager" ) );
    connectButton->setText( tr2i18n( "C&onnect" ) );
    QToolTip::add( connectButton, tr2i18n( "Connect to selected site" ) );
    QWhatsThis::add( connectButton, tr2i18n( "Connect to selected site" ) );
    groupBox->setTitle( QString::null );
    descriptionLabel->setText( tr2i18n( "Description:" ) );
    QToolTip::add( descriptionEdit, tr2i18n( "Enter a short descripton of the site" ) );
    QWhatsThis::add( descriptionEdit, tr2i18n( "Enter a short descripton of the site" ) );
    siteLabel->setText( tr2i18n( "Site Label:" ) );
    hostNameLabel->setText( tr2i18n( "Hostname:" ) );
    anonymousCheck->setText( tr2i18n( "Anonymous Login" ) );
    QToolTip::add( anonymousCheck, tr2i18n( "Check this if you want anonymous login" ) );
    QWhatsThis::add( anonymousCheck, tr2i18n( "Check this if you want anonymous login" ) );
    userNameLabel->setText( tr2i18n( "User name:" ) );
    passwordLabel->setText( tr2i18n( "Password:" ) );
    defaultLocalDirLabel->setText( tr2i18n( "Local Directory:" ) );
    defaultRemoteDirLabel->setText( tr2i18n( "Remote Directory:" ) );
    portLabel->setText( tr2i18n( "Port:" ) );
    QToolTip::add( siteEdit, tr2i18n( "Enter your label for the site here. This name has to be unique within the group." ) );
    QWhatsThis::add( siteEdit, tr2i18n( "Enter your label for the site here. This name has to be unique within the group. If it's not unique it will be renamed automatically." ) );
    QToolTip::add( hostNameEdit, tr2i18n( "Enter the address for the site here. Something like 'ftp.kde.org' or '127.0.0.1" ) );
    QWhatsThis::add( hostNameEdit, tr2i18n( "Enter the address for the site here. Something like 'ftp.kde.org' or '127.0.0.1" ) );
    QToolTip::add( p_portSpinBox, tr2i18n( "Select port number here. Standard port for FTP is 21." ) );
    QWhatsThis::add( p_portSpinBox, tr2i18n( "Select port number here. Standard port for FTP is 21." ) );
    p_protocolLabel->setText( tr2i18n( "Protocol:" ) );
    p_advancedSettingsButton->setText( tr2i18n( "A&dvanced..." ) );
    QToolTip::add( p_advancedSettingsButton, tr2i18n( "Push this button to set the more advanced settings for this site." ) );
    QWhatsThis::add( p_advancedSettingsButton, tr2i18n( "Push this button to set the more advanced settings for this site.\n"
"Don't use these options unless you really know what you're doing." ) );
    userNameEdit->clear();
    userNameEdit->insertItem( tr2i18n( "anonymous" ) );
    QToolTip::add( userNameEdit, tr2i18n( "Enter your username here or select anonymous" ) );
    QWhatsThis::add( userNameEdit, tr2i18n( "Enter your username here or select anonymous" ) );
    QToolTip::add( passwordEdit, tr2i18n( "Enter your password here" ) );
    QWhatsThis::add( passwordEdit, tr2i18n( "Enter your password here" ) );
    QToolTip::add( defaultLocalDirEdit, tr2i18n( "Enter the default directory for your local filesystem here" ) );
    QWhatsThis::add( defaultLocalDirEdit, tr2i18n( "Enter the default directory for your local filesystem here" ) );
    QToolTip::add( defaultRemoteDirEdit, tr2i18n( "Enter the default directory for the remote host here" ) );
    QWhatsThis::add( defaultRemoteDirEdit, tr2i18n( "Enter the default directory for the remote host here" ) );
    p_showSystemTrayCheckBox->setText( tr2i18n( "Show system tray icon for database daemon" ) );
    QToolTip::add( p_showSystemTrayCheckBox, tr2i18n( "Check this if you want the system tray icon for the database daemon to be visible. " ) );
    QWhatsThis::add( p_showSystemTrayCheckBox, tr2i18n( "Check this if you want the system tray icon for the database daemon to be visible. " ) );
    p_plugInKonqCheckBox->setText( tr2i18n( "Plug into Konqueror" ) );
    QToolTip::add( p_plugInKonqCheckBox, tr2i18n( "Check this if you want the Sitemanager to plug into Konqueror." ) );
    QWhatsThis::add( p_plugInKonqCheckBox, tr2i18n( "Check this if you want the Sitemanager to plug into Konqueror." ) );
    QToolTip::add( siteTreeView, tr2i18n( "Treeview over all sites in site list. Here you can rename or remove the sites, you can also move them with drag and drop." ) );
    QWhatsThis::add( siteTreeView, tr2i18n( "Treeview over all sites in site list. Here you can rename or remove the sites, you can also move them with drag and drop." ) );
    p_encodingLabel->setText( tr2i18n( "Set encoding for database:" ) );
    p_reloadButton->setText( QString::null );
    QToolTip::add( p_reloadButton, tr2i18n( "Push this button to update the treeview." ) );
    QWhatsThis::add( p_reloadButton, tr2i18n( "Push this button to update the treeview. This will call the database and retreive a new content" ) );
}

#include "kbearsitemanagerbase.moc"

Generated by  Doxygen 1.6.0   Back to index