• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdeutils
  • Sitemap
  • Contact Us
 

ark

extractiondialog.cpp

Go to the documentation of this file.
00001 /*
00002  * ark -- archiver for the KDE project
00003  *
00004  * Copyright (C) 2007 Henrique Pinto <henrique.pinto@kdemail.net>
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019  *
00020  */
00021 #include "extractiondialog.h"
00022 
00023 #include <KLocale>
00024 #include <KIconLoader>
00025 
00026 #include <QDir>
00027 
00028 #include "ui_extractiondialog.h"
00029 
00030 namespace Kerfuffle
00031 {
00032 
00033     class ExtractionDialogUI: public QFrame, public Ui::ExtractionDialog
00034     {
00035         public:
00036             ExtractionDialogUI( QWidget *parent = 0 )
00037                 : QFrame( parent )
00038             {
00039                 setupUi( this );
00040             }
00041     };
00042 
00043     ExtractionDialog::ExtractionDialog(QWidget *parent )
00044         : KDirSelectDialog()
00045     {
00046         //TODO: send the parent pointer to superclass
00047         Q_UNUSED(parent  );
00048 
00049         m_ui = new ExtractionDialogUI( this );
00050         //setMainWidget( m_ui );
00051 
00052         //m_ui->information->setText(QString("The root has %1 files.").arg(model.rowCount()));
00053 
00054         mainWidget()->layout()->addWidget(m_ui);
00055         setButtons( Ok | Cancel );
00056         setCaption( i18n( "Extract" ) );
00057         m_ui->iconLabel->setPixmap( DesktopIcon( "archive-extract" ) );
00058         m_ui->iconLabel->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum );
00059 
00060         m_ui->filesToExtractGroupBox->hide();
00061         m_ui->allFilesButton->setChecked( true );
00062         m_ui->extractAllLabel->show();
00063 
00064         //m_ui->recentFolders->addItems( ArkSettings::recentExtractionFolders() );
00065 
00066         setSingleFolderArchive(false);
00067 
00068         m_ui->autoSubfolders->hide();
00069 
00070         //we want the warning text to show through even if the groupbox is disabled
00071         QPalette warningPalette = m_ui->singleFolder->palette();
00072         warningPalette.setColor(QPalette::Disabled, QPalette::Text, warningPalette.color(QPalette::Active, QPalette::Text));
00073         m_ui->singleFolder->setPalette(warningPalette);
00074 
00075     }
00076 
00077     void ExtractionDialog::setSingleFolderArchive(bool value)
00078     {
00079         if (value) {
00080             m_ui->singleFolderGroup->setChecked(false);
00081             m_ui->singleFolder->show();
00082         } else {
00083             m_ui->singleFolderGroup->setChecked(true);
00084             m_ui->singleFolder->hide();
00085         }
00086     }
00087 
00088     void ExtractionDialog::batchModeOption()
00089     {
00090         m_ui->autoSubfolders->show();
00091         m_ui->autoSubfolders->setEnabled(true);
00092         m_ui->singleFolderGroup->hide();
00093         m_ui->extractAllLabel->setText(i18n("Extract multiple archives"));
00094     }
00095 
00096     void ExtractionDialog::setCurrentUrl(const QString& url)
00097     {
00098         KDirSelectDialog::setCurrentUrl(url);
00099     }
00100 
00101     void ExtractionDialog::setSubfolder(QString subfolder)
00102     {
00103         m_ui->subfolder->setText(subfolder);
00104     }
00105 
00106     QString ExtractionDialog::subfolder() const
00107     {
00108         return m_ui->subfolder->text();
00109     }
00110 
00111     ExtractionDialog::~ExtractionDialog()
00112     {
00113         delete m_ui;
00114         m_ui = 0;
00115     }
00116 
00117     void ExtractionDialog::setShowSelectedFiles(bool value)
00118     {
00119         if (value) {
00120             m_ui->filesToExtractGroupBox->show();
00121             m_ui->selectedFilesButton->setChecked( true );
00122             m_ui->extractAllLabel->hide();
00123         } else  {
00124             m_ui->filesToExtractGroupBox->hide();
00125             m_ui->selectedFilesButton->setChecked( false );
00126             m_ui->extractAllLabel->show();
00127         }
00128     }
00129 
00130     bool ExtractionDialog::extractAllFiles()
00131     {
00132         return m_ui->allFilesButton->isChecked();
00133     }
00134 
00135     void ExtractionDialog::setAutoSubfolder(bool value)
00136     {
00137         m_ui->autoSubfolders->setChecked(value);
00138     }
00139 
00140     bool ExtractionDialog::autoSubfolders()
00141     {
00142         return m_ui->autoSubfolders->isChecked();
00143     }
00144 
00145     bool ExtractionDialog::extractToSubfolder()
00146     {
00147         return m_ui->singleFolderGroup->isChecked();
00148     }
00149 
00150     void ExtractionDialog::setOpenDestinationFolderAfterExtraction(bool value)
00151     {
00152         m_ui->openFolderCheckBox->setChecked(value);
00153     }
00154 
00155     void ExtractionDialog::setPreservePaths(bool value)
00156     {
00157         m_ui->preservePaths->setChecked(value);
00158     }
00159 
00160     bool ExtractionDialog::preservePaths()
00161     {
00162         return m_ui->preservePaths->isChecked();
00163     }
00164 
00165 
00166     bool ExtractionDialog::openDestinationAfterExtraction()
00167     {
00168         return m_ui->openFolderCheckBox->isChecked();
00169     }
00170 
00171     KUrl ExtractionDialog::destinationDirectory()
00172     {
00173         return url().path();
00174     }
00175 
00176 }
00177 
00178 #include "extractiondialog.moc"

ark

Skip menu "ark"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdeutils

Skip menu "kdeutils"
  • ark
  • kcalc
  • kcharselect
  • kdessh
  • kdf
  • kfloppy
  • kgpg
  • ktimer
  • kwallet
  • okteta
  • printer-applet
  • superkaramba
  • sweeper
Generated for kdeutils by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal