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

cfirstinstallwizard.cpp

/****************************************************************************
** Form implementation generated from reading ui file 'first install wizard.ui'
**
** Created: Sat Apr 14 12:20:23 2001
**      by:  The User Interface Compiler (uic)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "cfirstinstallwizard.h"
#include "cchoixfichier.h"
#include "cupdate.h"

#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qlabel.h>
#include <qradiobutton.h>
#include <qwidget.h>
#include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>

#include <kiconloader.h>
#include <klocale.h>

/* 
 *  Constructs a CFirstInstallWizard which is a child of 'parent', with the 
 *  name 'name' and widget flags set to 'f' 
 *
 *  The wizard will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal wizard.
 */
CFirstInstallWizard::CFirstInstallWizard( QWidget* parent,  const char* name, bool modal, WFlags fl )
    : QWizard( parent, name, modal, fl )
{
     if ( !name )
      setName( "CFirstInstallWizard" );

    setFixedSize(620,320);
    setCaption( i18n( "KArchiver First-Install Wizard"  ) );
      KIconLoader icone;
      setIcon(icone.loadIcon("karchiver",KIcon::Small));

    ///Page 1
    page_1 = new QWidget( this, "page_1" );

    QGridLayout* layout_1=new QGridLayout(page_1,2,2);
    
    TextLabel_1 = new QLabel( page_1, "TextLabel_1" );
    TextLabel_1->setText( i18n( "Welcome to the KArchiver Installation Wizard."  ) );
    QFont TextLabel_1_font(  TextLabel_1->font() );
    TextLabel_1_font.setPointSize( 24 );
    TextLabel_1->setFont( TextLabel_1_font );
    layout_1->addMultiCellWidget(TextLabel_1, 0, 0, 0, 2);

    PixmapLabel2 = new QLabel( page_1, "PixmapLabel2" );
    PixmapLabel2->setPixmap( UserIcon("karchiveur_wizard_large")  );
    layout_1->addMultiCellWidget(PixmapLabel2, 1, 2, 0, 0);

    TextLabel1_2 = new QLabel( page_1, "TextLabel1_2" );
    TextLabel1_2->setText( i18n( "This wizard will let you configure the main features \nof KArchiver. Just click on Next unless you know what to answer\n"  ) );
    layout_1->addMultiCellWidget(TextLabel1_2, 1, 1, 1, 2);

    ButtonGroup_sel_mode = new QButtonGroup( page_1, "ButtonGroup_sel_mode" );
    ButtonGroup_sel_mode->setTitle( i18n( "Multi Selection Mode"  ) );
    QVBoxLayout* vblayout_sel_mode=new QVBoxLayout(ButtonGroup_sel_mode, 10, 1);
    layout_1->addMultiCellWidget(ButtonGroup_sel_mode, 2, 2, 1, 2);

    rb_wind_like = new QRadioButton( ButtonGroup_sel_mode, "rb_wind_like" );
    rb_wind_like->setText( i18n( "Windows-like (Ctrl+click to add to selection)"  ) );
    rb_wind_like->setChecked(true);
    vblayout_sel_mode->addWidget(rb_wind_like);

    rb_kde_like = new QRadioButton( ButtonGroup_sel_mode, "rb_kde_like" );
    rb_kde_like->setText( i18n( "KDE-like (click to add to selection)"  ) );
    vblayout_sel_mode->addWidget(rb_kde_like);

    addPage( page_1, i18n( "Page 1" ) );

    ///Page 2
    page_2 = new QWidget( this, "page_2" );
    
    QGridLayout* layout_2=new QGridLayout(page_2,3,1, 12);

    cb_use_karchiver = new QCheckBox( page_2, "cb_use_karchiver" );
    cb_use_karchiver->setText( i18n( "Set KArchiver as the default archiver(will gzip Ark's .desktop files)")+"\n"+i18n("For this feature, you will be prompted for the root password using the \"kdesu\" command"  ) );
    layout_2->addMultiCellWidget(cb_use_karchiver, 0, 0, 0, 1);
    
    /*TextLabel2 = new QLabel( page_2, "TextLabel2" );
    TextLabel2->setGeometry( QRect( 74, 37, 440, 30 ) );
        TextLabel2->setText( i18n( "For this feature, you will be prompted for the root password using the \"kdesu\" command."  ) );*/

    TextLabel3 = new QLabel( page_2, "TextLabel3" );
    TextLabel3->setText( "<qt><b>"+i18n( "Default folders (used when opening and extracting archives)"  )+"</b></qt>" );
    layout_2->addMultiCellWidget(TextLabel3, 2, 2, 0, 1);


    ButtonGroup_open_dir = new QButtonGroup( page_2, "ButtonGroup_open_dir" );
    ButtonGroup_open_dir->setTitle( i18n( "For Opening"  ) );
    layout_2->addMultiCellWidget(ButtonGroup_open_dir, 3, 3, 1, 1);
    QVBoxLayout* layout_2bgo=new QVBoxLayout(ButtonGroup_open_dir, 12, 1);

    rb_open_lastdir = new QRadioButton( ButtonGroup_open_dir, "rb_open_lastdir" );
    rb_open_lastdir->setText( i18n( "Last folder"  ) );
    layout_2bgo->addWidget(rb_open_lastdir);

    rb_open_homedir = new QRadioButton( ButtonGroup_open_dir, "rb_open_homedir" );
    rb_open_homedir->setText( i18n( "Home folder (~/)"  ) );
    rb_open_homedir->setChecked( TRUE );
    layout_2bgo->addWidget(rb_open_homedir);

    rb_open_shelldir = new QRadioButton( ButtonGroup_open_dir, "rb_open_shelldir" );
    rb_open_shelldir->setText( i18n( "Shell's folder"  ) );
    layout_2bgo->addWidget(rb_open_shelldir);

    ButtonGroup_extract_dir = new QButtonGroup( page_2, "ButtonGroup_extract_dir" );
    ButtonGroup_extract_dir->setTitle( i18n( "For Extracting"  ) );
    layout_2->addMultiCellWidget(ButtonGroup_extract_dir, 3, 3, 0, 0);
    QVBoxLayout* layout_2bge=new QVBoxLayout(ButtonGroup_extract_dir, 16, 1);

    rb_extract_lastdir = new QRadioButton( ButtonGroup_extract_dir, "rb_extract_lastdir" );
    rb_extract_lastdir->setText( i18n( "Last folder"  ) );
    layout_2bge->addWidget(rb_extract_lastdir);

    rb_extract_homedir = new QRadioButton( ButtonGroup_extract_dir, "rb_extract_homedir" );
    rb_extract_homedir->setText( i18n( "Home folder (~/)"  ) );
    rb_extract_homedir->setChecked( TRUE );
    layout_2bge->addWidget(rb_extract_homedir);

    rb_extract_shelldir = new QRadioButton( ButtonGroup_extract_dir, "rb_extract_shelldir" );
    rb_extract_shelldir->setText( i18n( "Shell's folder"  ) );
    layout_2bge->addWidget(rb_extract_shelldir);
    
    addPage( page_2, i18n( "Page 2" ) );

    ///Page 3
    setCompressorsOptions();
    
    ///Page 4
    page_4 = new QWidget( this, "page_4" );
    QGridLayout* layout=new QGridLayout(page_4, 2, 2);
    layout->setRowSpacing(2,30);
    QLabel* leupdt= new QLabel(page_4,"leupdt");
    leupdt->setText(i18n("KArchiver is often updated. You can check at any time if you have the latest version in the Preferences menu. You can check for the latest version now"));
    leupdt->setAlignment(Qt::WordBreak);
    layout->addMultiCellWidget(leupdt, 0,0,0,2);
    bupdate=new QPushButton( i18n("&Check for updates"), page_4);
    connect(bupdate, SIGNAL(clicked()), this, SLOT(slotCheckUpdate()));
    layout->addWidget(bupdate,1,1);
    addPage( page_4, i18n( "Page 4 - Check for updates" ) );

    setFinishEnabled (page_4, true);


}

/** set the widgets for available compressors */
void CFirstInstallWizard::setCompressorsOptions(){
  page_3 = new QWidget( this, "page_3" );
  QGridLayout *gbox = new QGridLayout( page_3, 12, 2, 3 );

  QLabel_5= new QLabel(page_3,"NoName");
  QLabel_5->setText(i18n("The TAR compressor..."));
  gbox->addWidget(QLabel_5, 0, 0);
  lTarDispo= new KLed(page_3,"NoName");
  lTarDispo->setState(KLed::On);
  gbox->addWidget(lTarDispo, 0, 1);

  lGzipDispo= new KLed(page_3,"NoName");
  lGzipDispo->setState(KLed::On);
  gbox->addWidget(lGzipDispo, 1, 1);
  QLabel_7= new QLabel(page_3,"NoName");
  QLabel_7->setText(i18n("The GZIP compressor..."));
  gbox->addWidget(QLabel_7, 1, 0);

  lBzip2Dispo= new KLed(page_3,"NoName");
  lBzip2Dispo->setState(KLed::On);
  gbox->addWidget(lBzip2Dispo, 2, 1);
  QLabel_8= new QLabel(page_3,"NoName");
  QLabel_8->setText(i18n("The BZIP2 compressor..."));
  gbox->addWidget(QLabel_8, 2, 0);

  lRarDispo= new KLed(page_3,"NoName");
  lRarDispo->setState(KLed::On);
  gbox->addWidget(lRarDispo, 3, 1);
  QLabel_9= new QLabel(page_3,"NoName");
  QLabel_9->setText(i18n("The RAR compressor..."));
  gbox->addWidget(QLabel_9, 3, 0);

  KURLLabel* QLabel_getrar= new KURLLabel(page_3,"NoName");
  QLabel_getrar->setURL("http://www.rarlabs.com");
  QLabel_getrar->setText(i18n("download it"));
  gbox->addWidget(QLabel_getrar, 3, 2);
  connect(QLabel_getrar, SIGNAL(leftClickedURL(const QString&)), SLOT(processMyURL(const QString&)));
  
  lUnRarDispo= new KLed(page_3,"NoName");
  lUnRarDispo->setState(KLed::On);
  gbox->addWidget(lUnRarDispo, 4, 1);
  QLabel_un9= new QLabel(page_3,"NoName");
  QLabel_un9->setText(i18n("The RAR reader..."));
  gbox->addWidget(QLabel_un9, 4, 0);

  lLhaDispo= new KLed(page_3,"NoName");
  lLhaDispo->setState(KLed::On);
  gbox->addWidget(lLhaDispo, 5, 1);
  QLabel_10= new QLabel(page_3,"NoName");
  QLabel_10->setText(i18n("The LHA compressor..."));
  gbox->addWidget(QLabel_10, 5, 0);

  QLabel_15= new QLabel(page_3,"NoName");
  QLabel_15->setText(i18n("The Zip reader..."));
  gbox->addWidget(QLabel_15, 6, 0);
  lUnzipDispo= new KLed(page_3,"NoName");
  lUnzipDispo->setState(KLed::On);
  gbox->addWidget(lUnzipDispo, 6, 1);

  lZipDispo= new KLed(page_3,"NoName");
  lZipDispo->setState(KLed::On);
  gbox->addWidget(lZipDispo, 7, 1);
  QLabel_17= new QLabel(page_3,"NoName");
  QLabel_17->setText(i18n("The Zip compressor..."));
  gbox->addWidget(QLabel_17, 7, 0);

  KURLLabel* QLabel_getzip= new KURLLabel(page_3,"NoName");
  QLabel_getzip->setText(i18n("download it"));
  QLabel_getzip->setURL("http://www.info-zip.org");
  gbox->addWidget(QLabel_getzip, 7, 2);
  connect(QLabel_getzip, SIGNAL(leftClickedURL(const QString&)), SLOT(processMyURL(const QString&)));
  
  QLbl_16= new QLabel(page_3,"NoName");
  QLbl_16->setText(i18n("The Arj reader..."));
  gbox->addWidget(QLbl_16, 8, 0);
  lUnarjDispo= new KLed(page_3,"NoName");
  lUnarjDispo->setState(KLed::On);
  gbox->addWidget(lUnarjDispo, 8, 1);

  KURLLabel* QLabel_getarj= new KURLLabel(page_3,"NoName");
  QLabel_getarj->setText(i18n("download it"));
  QLabel_getarj->setURL("http://arj.sourceforge.net");
  gbox->addWidget(QLabel_getarj, 8, 2);
  connect(QLabel_getarj, SIGNAL(leftClickedURL(const QString&)), SLOT(processMyURL(const QString&)));
  
  QLabel* QLbl_18= new QLabel(page_3,"NoName");
  QLbl_18->setText(i18n("The 7z compressor..."));
  gbox->addWidget(QLbl_18, 9, 0);
  l7zDispo= new KLed(page_3,"NoName");
  l7zDispo->setState(KLed::On);
  gbox->addWidget(l7zDispo, 9, 1);

  KURLLabel* QLabel_get7z= new KURLLabel(page_3,"NoName");
  QLabel_get7z->setText(i18n("download it"));
  QLabel_get7z->setURL("http://7-zip.org");
  gbox->addWidget(QLabel_get7z, 9, 2);
  connect(QLabel_get7z, SIGNAL(leftClickedURL(const QString&)), SLOT(processMyURL(const QString&)));
  
  QLabel* QLbl_19= new QLabel(page_3,"NoName");
  QLbl_19->setText(i18n("The ar/deb compressor..."));
  gbox->addWidget(QLbl_19, 10, 0);
  lArDispo= new KLed(page_3,"NoName");
  lArDispo->setState(KLed::On);
  gbox->addWidget(lArDispo, 10, 1);

  QLabel* QLbl_20= new QLabel(page_3,"NoName");
  QLbl_20->setText(i18n("The sit compressor..."));
  gbox->addWidget(QLbl_20, 11, 0);
  lSitDispo= new KLed(page_3,"NoName");
  lSitDispo->setState(KLed::On);
  gbox->addWidget(lSitDispo, 11, 1);

  KURLLabel* QLabel_getSit= new KURLLabel(page_3,"NoName");
  QLabel_getSit->setText(i18n("download it"));
  QLabel_getSit->setURL("http://www.stuffit.com");
  gbox->addWidget(QLabel_getSit, 11, 2);
  connect(QLabel_getSit, SIGNAL(leftClickedURL(const QString&)), SLOT(processMyURL(const QString&)));
  
  compresseursDispo();
  
  addPage( page_3, i18n( "Page 3 - Your system's supported compressor" ) );
  
}

/** check which compressors are available */
void CFirstInstallWizard::compresseursDispo(){
  int installedcompressors=CArchiveChoice::getInstalledCompressors();
  
  if((installedcompressors&TAR)==0)
    lTarDispo->setState(KLed::Off);
  if((installedcompressors&GZIP)==0)
    lGzipDispo->setState(KLed::Off);
  if((installedcompressors&BZIP2)==0)
    lBzip2Dispo->setState(KLed::Off);
  if((installedcompressors&LHA)==0)
    lLhaDispo->setState(KLed::Off);
  if((installedcompressors&RAR)==0)
    lRarDispo->setState(KLed::Off);
  if(KStandardDirs::findExe("unrar")==NULL)
    lUnRarDispo->setState(KLed::Off);
  if((installedcompressors&ZIP)==0)
    lUnzipDispo->setState(KLed::Off);
  if(KStandardDirs::findExe("zip")==NULL)
    lZipDispo->setState(KLed::Off);
  if((installedcompressors&ARJ)==0)
    lUnarjDispo->setState(KLed::Off);
  if((installedcompressors&SEVENZ)==0)
    l7zDispo->setState(KLed::Off);
  if((installedcompressors&AR)==0)
    lArDispo->setState(KLed::Off);
  if((installedcompressors&SIT)==0)
    lSitDispo->setState(KLed::Off);
}

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

/*  
 *  Main event handler. Reimplemented to handle application
 *  font changes
 */
bool CFirstInstallWizard::event( QEvent* ev )
{
    bool ret = QWizard::event( ev ); 
    if ( ev->type() == QEvent::ApplicationFontChange ) {
      QFont TextLabel_1_font(  TextLabel_1->font() );
      TextLabel_1_font.setPointSize( 24 );
      TextLabel_1->setFont( TextLabel_1_font ); 
      QFont TextLabel3_font(  TextLabel3->font() );
      TextLabel3_font.setBold( TRUE );
      TextLabel3->setFont( TextLabel3_font ); 
    }
    return ret;
}

void CFirstInstallWizard::processMyURL(const QString& adr)
{
  KProcess proc;
  proc << "konqueror" << adr;
  proc.start(KProcess::DontCare);
}

void CFirstInstallWizard::slotCheckUpdate()
{
  CUpdate update;
  update.checkUpdate();
}

#include "cfirstinstallwizard.moc"

Generated by  Doxygen 1.6.0   Back to index