summaryrefslogtreecommitdiffstats
path: root/korganizer/koeditorattachments.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /korganizer/koeditorattachments.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'korganizer/koeditorattachments.cpp')
-rw-r--r--korganizer/koeditorattachments.cpp168
1 files changed, 84 insertions, 84 deletions
diff --git a/korganizer/koeditorattachments.cpp b/korganizer/koeditorattachments.cpp
index 51dd63044..adcd871e6 100644
--- a/korganizer/koeditorattachments.cpp
+++ b/korganizer/koeditorattachments.cpp
@@ -46,16 +46,16 @@
#include <kactioncollection.h>
#include <kpopupmenu.h>
-#include <qfile.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qlistview.h>
-#include <qpushbutton.h>
-#include <qdragobject.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qapplication.h>
-#include <qclipboard.h>
+#include <tqfile.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqlistview.h>
+#include <tqpushbutton.h>
+#include <tqdragobject.h>
+#include <tqtooltip.h>
+#include <tqwhatsthis.h>
+#include <tqapplication.h>
+#include <tqclipboard.h>
#include <cassert>
#include <set>
@@ -63,13 +63,13 @@
class AttachmentListItem : public KIconViewItem
{
public:
- AttachmentListItem( KCal::Attachment*att, QIconView *parent ) :
+ AttachmentListItem( KCal::Attachment*att, TQIconView *parent ) :
KIconViewItem( parent )
{
if ( att ) {
mAttachment = new KCal::Attachment( *att );
} else {
- mAttachment = new KCal::Attachment( QString::null );
+ mAttachment = new KCal::Attachment( TQString::null );
}
readAttachment();
setDragEnabled( true );
@@ -77,7 +77,7 @@ class AttachmentListItem : public KIconViewItem
~AttachmentListItem() { delete mAttachment; }
KCal::Attachment *attachment() const { return mAttachment; }
- void setUri( const QString &uri )
+ void setUri( const TQString &uri )
{
mAttachment->setUri( uri );
readAttachment();
@@ -87,12 +87,12 @@ class AttachmentListItem : public KIconViewItem
mAttachment->setData( base64 );
readAttachment();
}
- void setMimeType( const QString &mime )
+ void setMimeType( const TQString &mime )
{
mAttachment->setMimeType( mime );
readAttachment();
}
- void setLabel( const QString &label )
+ void setLabel( const TQString &label )
{
mAttachment->setLabel( label );
readAttachment();
@@ -110,8 +110,8 @@ class AttachmentListItem : public KIconViewItem
}
KMimeType::Ptr mt = KMimeType::mimeType( mAttachment->mimeType() );
if ( mt ) {
- const QString iconName( mt->icon( QString(), false ) );
- QPixmap pix = KGlobal::iconLoader( )->loadIcon( iconName, KIcon::Small );
+ const TQString iconName( mt->icon( TQString(), false ) );
+ TQPixmap pix = KGlobal::iconLoader( )->loadIcon( iconName, KIcon::Small );
if ( pix.isNull() )
pix = KGlobal::iconLoader( )->loadIcon( "unknown", KIcon::Small );
if ( !pix.isNull() )
@@ -132,10 +132,10 @@ class AttachmentIconView : public KIconView
mParent( parent )
{
setAcceptDrops( true );
- setSelectionMode( QIconView::Extended );
+ setSelectionMode( TQIconView::Extended );
setMode( KIconView::Select );
- setItemTextPos( QIconView::Right );
- setArrangement( QIconView::LeftToRight );
+ setItemTextPos( TQIconView::Right );
+ setArrangement( TQIconView::LeftToRight );
setMaxItemWidth( QMAX(maxItemWidth(), 250) );
setMinimumHeight( QMAX(fontMetrics().height(), 16) + 12 );
}
@@ -146,10 +146,10 @@ class AttachmentIconView : public KIconView
}
}
protected:
- QDragObject * dragObject()
+ TQDragObject * dragObject()
{
KURL::List urls;
- for ( QIconViewItem *it = firstItem( ); it; it = it->nextItem( ) ) {
+ for ( TQIconViewItem *it = firstItem( ); it; it = it->nextItem( ) ) {
if ( !it->isSelected() ) continue;
AttachmentListItem * item = dynamic_cast<AttachmentListItem*>( it );
if ( !item ) return 0;
@@ -162,11 +162,11 @@ class AttachmentIconView : public KIconView
KTempDir * tempDir = new KTempDir(); // will be deleted on editor close
tempDir->setAutoDelete( true );
mTempDirs.insert( tempDir );
- QByteArray encoded;
+ TQByteArray encoded;
encoded.duplicate( att->data(), strlen(att->data()) );
- QByteArray decoded;
+ TQByteArray decoded;
KCodecs::base64Decode( encoded, decoded );
- const QString fileName = tempDir->name( ) + "/" + att->label();
+ const TQString fileName = tempDir->name( ) + "/" + att->label();
KPIM::kByteArrayToFile( decoded, fileName, false, false, false );
url.setPath( fileName );
}
@@ -175,7 +175,7 @@ class AttachmentIconView : public KIconView
KURLDrag *drag = new KURLDrag( urls, this );
return drag;
}
- void contentsDropEvent( QDropEvent* event )
+ void contentsDropEvent( TQDropEvent* event )
{
mParent->handlePasteOrDrop( event );
}
@@ -184,66 +184,66 @@ class AttachmentIconView : public KIconView
KOEditorAttachments* mParent;
};
-KOEditorAttachments::KOEditorAttachments( int spacing, QWidget *parent,
+KOEditorAttachments::KOEditorAttachments( int spacing, TQWidget *parent,
const char *name )
- : QWidget( parent, name )
+ : TQWidget( parent, name )
{
- QBoxLayout *topLayout = new QHBoxLayout( this );
+ TQBoxLayout *topLayout = new TQHBoxLayout( this );
topLayout->setSpacing( spacing );
- QLabel *label = new QLabel( i18n("Attachments:"), this );
+ TQLabel *label = new TQLabel( i18n("Attachments:"), this );
topLayout->addWidget( label );
mAttachments = new AttachmentIconView( this );
- QWhatsThis::add( mAttachments,
+ TQWhatsThis::add( mAttachments,
i18n("Displays a list of current items (files, mail, etc.) "
"that have been associated with this event or to-do. ") );
topLayout->addWidget( mAttachments );
- connect( mAttachments, SIGNAL( doubleClicked( QIconViewItem * ) ),
- SLOT( showAttachment( QIconViewItem * ) ) );
- connect( mAttachments, SIGNAL(selectionChanged()),
- SLOT(selectionChanged()) );
- connect( mAttachments, SIGNAL(contextMenuRequested(QIconViewItem*,const QPoint&)),
- SLOT(contextMenu(QIconViewItem*,const QPoint&)) );
+ connect( mAttachments, TQT_SIGNAL( doubleClicked( TQIconViewItem * ) ),
+ TQT_SLOT( showAttachment( TQIconViewItem * ) ) );
+ connect( mAttachments, TQT_SIGNAL(selectionChanged()),
+ TQT_SLOT(selectionChanged()) );
+ connect( mAttachments, TQT_SIGNAL(contextMenuRequested(TQIconViewItem*,const TQPoint&)),
+ TQT_SLOT(contextMenu(TQIconViewItem*,const TQPoint&)) );
mAddMenu = new KPopupMenu( this );
mContextMenu = new KPopupMenu( this );
KActionCollection* ac = new KActionCollection( this, this );
- mOpenAction = new KAction( i18n("View"), 0, this, SLOT(slotShow()), ac );
+ mOpenAction = new KAction( i18n("View"), 0, this, TQT_SLOT(slotShow()), ac );
mOpenAction->plug( mContextMenu );
mContextMenu->insertSeparator();
- mCopyAction = KStdAction::copy(this, SLOT(slotCopy( ) ), ac );
+ mCopyAction = KStdAction::copy(this, TQT_SLOT(slotCopy( ) ), ac );
mCopyAction->plug( mContextMenu );
- mCutAction = KStdAction::cut(this, SLOT(slotCut( ) ), ac );
+ mCutAction = KStdAction::cut(this, TQT_SLOT(slotCut( ) ), ac );
mCutAction->plug( mContextMenu );
- KAction *action = KStdAction::paste(this, SLOT(slotPaste( ) ), ac );
+ KAction *action = KStdAction::paste(this, TQT_SLOT(slotPaste( ) ), ac );
action->plug( mContextMenu );
- action = new KAction( i18n("&Attach File..."), 0, this, SLOT(slotAddData()), ac );
+ action = new KAction( i18n("&Attach File..."), 0, this, TQT_SLOT(slotAddData()), ac );
action->setWhatsThis( i18n("Shows a dialog used to select an attachment "
"to add to this event or to-do as link as inline data.") );
action->plug( mAddMenu );
- action = new KAction( i18n("Attach &Link..."), 0, this, SLOT(slotAdd()), ac );
+ action = new KAction( i18n("Attach &Link..."), 0, this, TQT_SLOT(slotAdd()), ac );
action->setWhatsThis( i18n("Shows a dialog used to select an attachment "
"to add to this event or to-do as link.") );
action->plug( mAddMenu );
- QPushButton *addButton = new QPushButton( this );
+ TQPushButton *addButton = new TQPushButton( this );
addButton->setIconSet( SmallIconSet( "add" ) );
addButton->setPopup( mAddMenu );
topLayout->addWidget( addButton );
- mRemoveBtn = new QPushButton( this );
+ mRemoveBtn = new TQPushButton( this );
mRemoveBtn->setIconSet( SmallIconSet( "remove" ) );
- QToolTip::add( mRemoveBtn, i18n("&Remove") );
- QWhatsThis::add( mRemoveBtn,
+ TQToolTip::add( mRemoveBtn, i18n("&Remove") );
+ TQWhatsThis::add( mRemoveBtn,
i18n("Removes the attachment selected in the list above "
"from this event or to-do.") );
topLayout->addWidget( mRemoveBtn );
- connect( mRemoveBtn, SIGNAL( clicked() ), SLOT( slotRemove() ) );
+ connect( mRemoveBtn, TQT_SIGNAL( clicked() ), TQT_SLOT( slotRemove() ) );
selectionChanged();
setAcceptDrops( true );
@@ -258,36 +258,36 @@ bool KOEditorAttachments::hasAttachments()
return mAttachments->count() != 0;
}
-void KOEditorAttachments::dragEnterEvent( QDragEnterEvent* event )
+void KOEditorAttachments::dragEnterEvent( TQDragEnterEvent* event )
{
- event->accept( KURLDrag::canDecode( event ) | QTextDrag::canDecode( event ) );
+ event->accept( KURLDrag::canDecode( event ) | TQTextDrag::canDecode( event ) );
}
-void KOEditorAttachments::handlePasteOrDrop( QMimeSource* source )
+void KOEditorAttachments::handlePasteOrDrop( TQMimeSource* source )
{
KURL::List urls;
- QString text;
+ TQString text;
if ( KURLDrag::decode( source, urls ) ) {
const bool asUri = KMessageBox::questionYesNo( this,
i18n("Do you want to link to the attachments, or include them in the event?"),
i18n("Attach as link?"), i18n("As Link"), i18n("As File") ) == KMessageBox::Yes;
for ( KURL::List::ConstIterator it = urls.begin(); it != urls.end(); ++it ) {
- addAttachment( (*it).url(), QString::null, asUri );
+ addAttachment( (*it).url(), TQString::null, asUri );
}
- } else if ( QTextDrag::decode( source, text ) ) {
- QStringList lst = QStringList::split( '\n', text );
- for ( QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
+ } else if ( TQTextDrag::decode( source, text ) ) {
+ TQStringList lst = TQStringList::split( '\n', text );
+ for ( TQStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it ) {
addAttachment( (*it) );
}
}
}
-void KOEditorAttachments::dropEvent( QDropEvent* event )
+void KOEditorAttachments::dropEvent( TQDropEvent* event )
{
handlePasteOrDrop( event );
}
-void KOEditorAttachments::showAttachment( QIconViewItem *item )
+void KOEditorAttachments::showAttachment( TQIconViewItem *item )
{
AttachmentListItem *attitem = static_cast<AttachmentListItem*>(item);
if ( !attitem || !attitem->attachment() ) return;
@@ -299,9 +299,9 @@ void KOEditorAttachments::showAttachment( QIconViewItem *item )
KTempFile f;
if ( !f.file() )
return;
- QByteArray encoded;
+ TQByteArray encoded;
encoded.duplicate( att->data(), strlen(att->data()) );
- QByteArray decoded;
+ TQByteArray decoded;
KCodecs::base64Decode( encoded, decoded );
f.file()->writeBlock( decoded );
f.file()->close();
@@ -311,7 +311,7 @@ void KOEditorAttachments::showAttachment( QIconViewItem *item )
void KOEditorAttachments::slotAdd()
{
- KURL uri = KPimURLRequesterDlg::getURL( QString::null, i18n(
+ KURL uri = KPimURLRequesterDlg::getURL( TQString::null, i18n(
"URL (e.g. a web page) or file to be attached (only "
"the link will be attached, not the file itself):"), this,
i18n("Add Attachment") );
@@ -322,15 +322,15 @@ void KOEditorAttachments::slotAdd()
void KOEditorAttachments::slotAddData()
{
- KURL uri = KFileDialog::getOpenFileName( QString(), QString(), this, i18n("Add Attachment") );
+ KURL uri = KFileDialog::getOpenFileName( TQString(), TQString(), this, i18n("Add Attachment") );
if ( !uri.isEmpty() ) {
- addAttachment( uri, QString::null, false );
+ addAttachment( uri, TQString::null, false );
}
}
void KOEditorAttachments::slotEdit()
{
- QIconViewItem *item = mAttachments->currentItem();
+ TQIconViewItem *item = mAttachments->currentItem();
AttachmentListItem *attitem = static_cast<AttachmentListItem*>(item);
if ( !attitem || !attitem->attachment() ) return;
@@ -344,19 +344,19 @@ void KOEditorAttachments::slotEdit()
if ( !uri.isEmpty() )
attitem->setUri( uri.url() );
} else {
- KURL uri = KPimURLRequesterDlg::getURL( QString::null, i18n(
+ KURL uri = KPimURLRequesterDlg::getURL( TQString::null, i18n(
"File to be attached:"), this, i18n("Add Attachment") );
if ( !uri.isEmpty() ) {
- QString tmpFile;
+ TQString tmpFile;
if ( KIO::NetAccess::download( uri, tmpFile, this ) ) {
- QFile f( tmpFile );
+ TQFile f( tmpFile );
if ( !f.open( IO_ReadOnly ) )
return;
- QByteArray data = f.readAll();
+ TQByteArray data = f.readAll();
f.close();
attitem->setData( KCodecs::base64Encode( data ) );
attitem->setMimeType( KIO::NetAccess::mimetype( uri, this ) );
- QString label = uri.fileName();
+ TQString label = uri.fileName();
if ( label.isEmpty() )
label = uri.prettyURL();
attitem->setLabel( label );
@@ -368,8 +368,8 @@ void KOEditorAttachments::slotEdit()
void KOEditorAttachments::slotRemove()
{
- QValueList<QIconViewItem*> selected;
- for ( QIconViewItem *it = mAttachments->firstItem( ); it; it = it->nextItem( ) ) {
+ TQValueList<TQIconViewItem*> selected;
+ for ( TQIconViewItem *it = mAttachments->firstItem( ); it; it = it->nextItem( ) ) {
if ( !it->isSelected() ) continue;
selected << it;
}
@@ -379,14 +379,14 @@ void KOEditorAttachments::slotRemove()
i18n("KOrganizer Confirmation"),KStdGuiItem::del()) != KMessageBox::Continue )
return;
- for ( QValueList<QIconViewItem*>::iterator it( selected.begin() ), end( selected.end() ); it != end ; ++it ) {
+ for ( TQValueList<TQIconViewItem*>::iterator it( selected.begin() ), end( selected.end() ); it != end ; ++it ) {
delete *it;
}
}
void KOEditorAttachments::slotShow()
{
- for ( QIconViewItem *it = mAttachments->firstItem(); it; it = it->nextItem() ) {
+ for ( TQIconViewItem *it = mAttachments->firstItem(); it; it = it->nextItem() ) {
if ( !it->isSelected() )
continue;
showAttachment( it );
@@ -399,26 +399,26 @@ void KOEditorAttachments::setDefaults()
}
void KOEditorAttachments::addAttachment( const KURL &uri,
- const QString &mimeType, bool asUri )
+ const TQString &mimeType, bool asUri )
{
AttachmentListItem *item = new AttachmentListItem( 0, mAttachments );
if ( asUri ) {
item->setUri( uri.url() );
if ( !mimeType.isEmpty() ) item->setMimeType( mimeType );
} else {
- QString tmpFile;
+ TQString tmpFile;
if ( KIO::NetAccess::download( uri, tmpFile, this ) ) {
- QFile f( tmpFile );
+ TQFile f( tmpFile );
if ( !f.open( IO_ReadOnly ) )
return;
- QByteArray data = f.readAll();
+ TQByteArray data = f.readAll();
f.close();
item->setData( KCodecs::base64Encode( data ) );
if ( !mimeType.isEmpty() )
item->setMimeType( mimeType );
else
item->setMimeType( KIO::NetAccess::mimetype( uri, this ) );
- QString label = uri.fileName();
+ TQString label = uri.fileName();
if ( label.isEmpty() )
label = uri.prettyURL();
item->setLabel( label );
@@ -443,7 +443,7 @@ void KOEditorAttachments::readIncidence( KCal::Incidence *i )
addAttachment( (*it) );
}
if ( mAttachments->count() > 0 ) {
- QTimer::singleShot( 0, mAttachments, SLOT(arrangeItemsInGrid()) );
+ TQTimer::singleShot( 0, mAttachments, TQT_SLOT(arrangeItemsInGrid()) );
}
}
@@ -451,7 +451,7 @@ void KOEditorAttachments::writeIncidence( KCal::Incidence *i )
{
i->clearAttachments();
- QIconViewItem *item;
+ TQIconViewItem *item;
AttachmentListItem *attitem;
for( item = mAttachments->firstItem(); item; item = item->nextItem() ) {
attitem = static_cast<AttachmentListItem*>(item);
@@ -463,7 +463,7 @@ void KOEditorAttachments::writeIncidence( KCal::Incidence *i )
void KOEditorAttachments::slotCopy()
{
- QApplication::clipboard()->setData( mAttachments->dragObject(), QClipboard::Clipboard );
+ TQApplication::clipboard()->setData( mAttachments->dragObject(), QClipboard::Clipboard );
}
void KOEditorAttachments::slotCut()
@@ -474,13 +474,13 @@ void KOEditorAttachments::slotCut()
void KOEditorAttachments::slotPaste()
{
- handlePasteOrDrop( QApplication::clipboard()->data() );
+ handlePasteOrDrop( TQApplication::clipboard()->data() );
}
void KOEditorAttachments::selectionChanged()
{
bool selected = false;
- for ( QIconViewItem *item = mAttachments->firstItem(); item; item = item->nextItem() ) {
+ for ( TQIconViewItem *item = mAttachments->firstItem(); item; item = item->nextItem() ) {
if ( item->isSelected() ) {
selected = true;
break;
@@ -489,7 +489,7 @@ void KOEditorAttachments::selectionChanged()
mRemoveBtn->setEnabled( selected );
}
-void KOEditorAttachments::contextMenu(QIconViewItem * item, const QPoint & pos)
+void KOEditorAttachments::contextMenu(TQIconViewItem * item, const TQPoint & pos)
{
const bool enable = item != 0;
mOpenAction->setEnabled( enable );