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

korganizer

importdialog.cpp

Go to the documentation of this file.
00001 /*
00002     This file is part of KOrganizer.
00003 
00004     Copyright (c) 2003,2004 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 
00021     As a special exception, permission is given to link this program
00022     with any edition of Qt, and distribute the resulting executable,
00023     without including the source code for Qt in the source distribution.
00024 */
00025 
00026 #include "importdialog.h"
00027 
00028 #include "koprefs.h"
00029 #include "stdcalendar.h"
00030 
00031 #include <KLocale>
00032 #include <KSqueezedTextLabel>
00033 
00034 #include <QLabel>
00035 #include <QLayout>
00036 #include <QRadioButton>
00037 #include <QGroupBox>
00038 
00039 //Added by qt3to4:
00040 #include <QVBoxLayout>
00041 #include <QFrame>
00042 
00043 using namespace KCal;
00044 
00045 ImportDialog::ImportDialog( const KUrl &url, QWidget *parent )
00046   : KDialog( parent),
00047     mUrl( url )
00048 {
00049   setCaption( i18n("Import Calendar") );
00050   setButtons( Ok | Cancel );
00051   setDefaultButton( Ok );
00052   setModal( true );
00053   showButtonSeparator( true );
00054   QFrame *topFrame = new QFrame(this );
00055   setMainWidget( topFrame );
00056   QVBoxLayout *topLayout = new QVBoxLayout( topFrame );
00057   topLayout->setSpacing( spacingHint() );
00058   topLayout->setMargin( 0 );
00059 
00060   QString txt = i18n( "Please select import method for calendar at\n\n%1.",
00061                   mUrl.prettyUrl() );
00062   KSqueezedTextLabel *lbl = new KSqueezedTextLabel( txt, topFrame );
00063   lbl->setTextElideMode( Qt::ElideMiddle );
00064   topLayout->addWidget( lbl );
00065 
00066   QGroupBox *radioBox = new QGroupBox( topFrame );
00067   QBoxLayout *boxLayout = new QVBoxLayout( radioBox );
00068   radioBox->setFlat( true );
00069   topLayout->addWidget( radioBox );
00070 
00071   mAddButton = new QRadioButton( i18n("Add as new calendar"), radioBox );
00072   boxLayout->addWidget( mAddButton );
00073 
00074   mMergeButton = new QRadioButton( i18n("Merge into existing calendar"),
00075                                    radioBox );
00076   boxLayout->addWidget( mMergeButton );
00077 
00078   mOpenButton = new QRadioButton( i18n("Open in separate window"), radioBox );
00079   boxLayout->addWidget( mOpenButton );
00080 
00081   mAddButton->setChecked( true );
00082   connect(this,SIGNAL(okClicked()),SLOT(slotOk()));
00083 }
00084 
00085 ImportDialog::~ImportDialog()
00086 {
00087 }
00088 
00089 void ImportDialog::slotOk()
00090 {
00091   kDebug() << "Adding resource for url '" << mUrl <<"'";
00092 
00093   if ( mAddButton->isChecked() ) {
00094     emit addResource( mUrl );
00095   } else if ( mMergeButton->isChecked() ) {
00096     // emit a signal to action manager to merge mUrl into the current calendar
00097     emit openURL( mUrl, true );
00098   } else if ( mOpenButton->isChecked() ) {
00099     // emit a signal to the action manager to open mUrl in a separate window
00100     emit newWindow( mUrl );
00101   } else {
00102     kError() <<"ImportDialog: internal error.";
00103   }
00104 
00105   emit dialogFinished( this );
00106   accept();
00107 }
00108 
00109 
00110 #include "importdialog.moc"

korganizer

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

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim 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