• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdefile
 

tdeio/tdefile

  • tdeio
  • tdefile
kicondialog.cpp
1/*
2 *
3 * This file is part of the KDE project, module tdefile.
4 * Copyright (C) 2000 Geert Jansen <jansen@kde.org>
5 * (C) 2000 Kurt Granroth <granroth@kde.org>
6 * (C) 1997 Christoph Neerfeld <chris@kde.org>
7 * (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
8 *
9 * This is free software; it comes under the GNU Library General
10 * Public License, version 2. See the file "COPYING.LIB" for the
11 * exact licensing terms.
12 */
13
14#include "kicondialog.h"
15
16#include <config.h>
17
18#include <assert.h>
19
20#include <kiconviewsearchline.h>
21
22#include <tdeapplication.h>
23#include <tdelocale.h>
24#include <tdeglobal.h>
25#include <kstandarddirs.h>
26#include <kiconloader.h>
27#include <kprogress.h>
28#include <kiconview.h>
29#include <tdefiledialog.h>
30#include <kimagefilepreview.h>
31
32#include <tqlayout.h>
33#include <tqstring.h>
34#include <tqstringlist.h>
35#include <tqsortedlist.h>
36#include <tqimage.h>
37#include <tqpixmap.h>
38#include <tqlabel.h>
39#include <tqcombobox.h>
40#include <tqtimer.h>
41#include <tqbuttongroup.h>
42#include <tqradiobutton.h>
43#include <tqfileinfo.h>
44#include <tqtoolbutton.h>
45#include <tqwhatsthis.h>
46
47#ifdef HAVE_LIBART
48#include <svgicons/ksvgiconengine.h>
49#include <svgicons/ksvgiconpainter.h>
50#endif
51
52class TDEIconCanvas::TDEIconCanvasPrivate
53{
54 public:
55 TDEIconCanvasPrivate() { m_bLoading = false; }
56 ~TDEIconCanvasPrivate() {}
57 bool m_bLoading;
58};
59
63class IconPath : public TQString
64{
65protected:
66 TQString m_iconName;
67
68public:
69 IconPath(const TQString &ip) : TQString (ip)
70 {
71 int n = findRev('/');
72 m_iconName = (n==-1) ? static_cast<TQString>(*this) : mid(n+1);
73 }
74
75
76 IconPath() : TQString ()
77 { }
78
79 bool operator== (const IconPath &ip) const
80 { return m_iconName == ip.m_iconName; }
81
82 bool operator< (const IconPath &ip) const
83 { return m_iconName < ip.m_iconName; }
84
85};
86
87/*
88 * TDEIconCanvas: Iconview for the iconloader dialog.
89 */
90
91TDEIconCanvas::TDEIconCanvas(TQWidget *parent, const char *name)
92 : TDEIconView(parent, name)
93{
94 d = new TDEIconCanvasPrivate;
95 mpTimer = new TQTimer(this);
96 connect(mpTimer, TQ_SIGNAL(timeout()), TQ_SLOT(slotLoadFiles()));
97 connect(this, TQ_SIGNAL(currentChanged(TQIconViewItem *)),
98 TQ_SLOT(slotCurrentChanged(TQIconViewItem *)));
99 setGridX(80);
100 setWordWrapIconText(false);
101 setShowToolTips(true);
102}
103
104TDEIconCanvas::~TDEIconCanvas()
105{
106 delete mpTimer;
107 delete d;
108}
109
110void TDEIconCanvas::loadFiles(const TQStringList& files)
111{
112 clear();
113 mFiles = files;
114 emit startLoading(mFiles.count());
115 mpTimer->start(10, true); // #86680
116 d->m_bLoading = false;
117}
118
119void TDEIconCanvas::slotLoadFiles()
120{
121 setResizeMode(Fixed);
122 TQApplication::setOverrideCursor(TQt::waitCursor);
123
124 // disable updates to not trigger paint events when adding child items
125 setUpdatesEnabled( false );
126
127#ifdef HAVE_LIBART
128 KSVGIconEngine *svgEngine = new KSVGIconEngine();
129#endif
130
131 d->m_bLoading = true;
132 int i;
133 TQStringList::ConstIterator it;
134 uint emitProgress = 10; // so we will emit it once in the beginning
135 TQStringList::ConstIterator end(mFiles.end());
136 for (it=mFiles.begin(), i=0; it!=end; ++it, i++)
137 {
138 // Calling kapp->processEvents() makes the iconview flicker like hell
139 // (it's being repainted once for every new item), so we don't do this.
140 // Instead, we directly repaint the progress bar without going through
141 // the event-loop. We do that just once for every 10th item so that
142 // the progress bar doesn't flicker in turn. (pfeiffer)
143 if ( emitProgress >= 10 ) {
144 emit progress(i);
145 emitProgress = 0;
146 }
147
148 emitProgress++;
149// kapp->processEvents();
150 if ( !d->m_bLoading ) // user clicked on a button that will load another set of icons
151 break;
152 TQImage img;
153
154 // Use the extension as the format. Works for XPM and PNG, but not for SVG
155 TQString path= *it;
156 TQString ext = path.right(3).upper();
157
158 if (ext != "SVG" && ext != "VGZ")
159 img.load(*it);
160#ifdef HAVE_LIBART
161 else
162 if (svgEngine->load(60, 60, *it))
163 img = *svgEngine->painter()->image();
164#endif
165
166 if (img.isNull())
167 continue;
168 if (img.width() > 60 || img.height() > 60)
169 {
170 if (img.width() > img.height())
171 {
172 int height = (int) ((60.0 / img.width()) * img.height());
173 img = img.smoothScale(60, height);
174 } else
175 {
176 int width = (int) ((60.0 / img.height()) * img.width());
177 img = img.smoothScale(width, 60);
178 }
179 }
180 TQPixmap pm;
181 pm.convertFromImage(img);
182 TQFileInfo fi(*it);
183 TQIconViewItem *item = new TQIconViewItem(this, fi.baseName(true), pm);
184 item->setKey(*it);
185 item->setDragEnabled(false);
186 item->setDropEnabled(false);
187 }
188
189#ifdef HAVE_LIBART
190 delete svgEngine;
191#endif
192
193 // enable updates since we have to draw the whole view now
194 setUpdatesEnabled( true );
195
196 TQApplication::restoreOverrideCursor();
197 d->m_bLoading = false;
198 emit finished();
199 setResizeMode(Adjust);
200}
201
202TQString TDEIconCanvas::getCurrent() const
203{
204 if (!currentItem())
205 return TQString::null;
206 return currentItem()->key();
207}
208
209void TDEIconCanvas::stopLoading()
210{
211 d->m_bLoading = false;
212}
213
214void TDEIconCanvas::slotCurrentChanged(TQIconViewItem *item)
215{
216 emit nameChanged((item != 0L) ? item->text() : TQString::null);
217}
218
219class TDEIconDialog::TDEIconDialogPrivate
220{
221 public:
222 TDEIconDialogPrivate() {
223 m_bStrictIconSize = true;
224 m_bLockUser = false;
225 m_bLockCustomDir = false;
226 searchLine = 0;
227 }
228 ~TDEIconDialogPrivate() {}
229 bool m_bStrictIconSize, m_bLockUser, m_bLockCustomDir;
230 TQString custom;
231 TQString customLocation;
232 TDEIconViewSearchLine *searchLine;
233};
234
235/*
236 * TDEIconDialog: Dialog for selecting icons. Both system and user
237 * specified icons can be chosen.
238 */
239
240TDEIconDialog::TDEIconDialog(TQWidget *parent, const char *name)
241 : KDialogBase(parent, name, true, i18n("Select Icon"), Ok|Cancel, Ok)
242{
243 d = new TDEIconDialogPrivate;
244 mpLoader = TDEGlobal::iconLoader();
245 init();
246}
247
248TDEIconDialog::TDEIconDialog(TDEIconLoader *loader, TQWidget *parent,
249 const char *name)
250 : KDialogBase(parent, name, true, i18n("Select Icon"), Ok|Cancel, Ok)
251{
252 d = new TDEIconDialogPrivate;
253 mpLoader = loader;
254 init();
255}
256
257void TDEIconDialog::init()
258{
259 mGroupOrSize = TDEIcon::Desktop;
260 mContext = TDEIcon::Any;
261 mType = 0;
262 mFileList = TDEGlobal::dirs()->findAllResources("appicon", TQString::fromLatin1("*.png"));
263
264 TQWidget *main = new TQWidget( this );
265 setMainWidget(main);
266
267 TQVBoxLayout *top = new TQVBoxLayout(main);
268 top->setSpacing( spacingHint() );
269
270 TQButtonGroup *bgroup = new TQButtonGroup(0, TQt::Vertical, i18n("Icon Source"), main);
271 bgroup->layout()->setSpacing(KDialog::spacingHint());
272 bgroup->layout()->setMargin(KDialog::marginHint());
273 top->addWidget(bgroup);
274 connect(bgroup, TQ_SIGNAL(clicked(int)), TQ_SLOT(slotButtonClicked(int)));
275 TQGridLayout *grid = new TQGridLayout(bgroup->layout(), 3, 2);
276 mpRb1 = new TQRadioButton(i18n("S&ystem icons:"), bgroup);
277 grid->addWidget(mpRb1, 1, 0);
278 mpCombo = new TQComboBox(bgroup);
279 connect(mpCombo, TQ_SIGNAL(activated(int)), TQ_SLOT(slotContext(int)));
280 grid->addWidget(mpCombo, 1, 1);
281 mpRb2 = new TQRadioButton(i18n("O&ther icons:"), bgroup);
282 grid->addWidget(mpRb2, 2, 0);
283 mpBrowseBut = new TQPushButton(i18n("&Browse..."), bgroup);
284 grid->addWidget(mpBrowseBut, 2, 1);
285
286 //
287 // ADD SEARCHLINE
288 //
289 TQHBoxLayout *searchLayout = new TQHBoxLayout(0, 0, KDialog::spacingHint());
290 top->addLayout(searchLayout);
291
292 TQToolButton *clearSearch = new TQToolButton(main);
293 clearSearch->setTextLabel(i18n("Clear Search"), true);
294 clearSearch->setIconSet(SmallIconSet(TQApplication::reverseLayout() ? "clear_left" :"locationbar_erase"));
295 searchLayout->addWidget(clearSearch);
296
297 TQLabel *searchLabel = new TQLabel(i18n("&Search:"), main);
298 searchLayout->addWidget(searchLabel);
299
300 d->searchLine = new TDEIconViewSearchLine(main, "searchLine");
301 searchLayout->addWidget(d->searchLine);
302 searchLabel->setBuddy(d->searchLine);
303
304
305 // signals and slots connections
306 connect(clearSearch, TQ_SIGNAL(clicked()), d->searchLine, TQ_SLOT(clear()));
307
308 TQString wtstr = i18n("Search interactively for icon names (e.g. folder).");
309 TQWhatsThis::add(searchLabel, wtstr);
310 TQWhatsThis::add(d->searchLine, wtstr);
311
312
313 mpCanvas = new TDEIconCanvas(main);
314 connect(mpCanvas, TQ_SIGNAL(executed(TQIconViewItem *)), TQ_SLOT(slotAcceptIcons()));
315 connect(mpCanvas, TQ_SIGNAL(returnPressed(TQIconViewItem *)), TQ_SLOT(slotAcceptIcons()));
316 mpCanvas->setMinimumSize(400, 125);
317 top->addWidget(mpCanvas);
318 d->searchLine->setIconView(mpCanvas);
319
320 mpProgress = new KProgress(main);
321 top->addWidget(mpProgress);
322 connect(mpCanvas, TQ_SIGNAL(startLoading(int)), TQ_SLOT(slotStartLoading(int)));
323 connect(mpCanvas, TQ_SIGNAL(progress(int)), TQ_SLOT(slotProgress(int)));
324 connect(mpCanvas, TQ_SIGNAL(finished()), TQ_SLOT(slotFinished()));
325
326 // When pressing Ok or Cancel, stop loading icons
327 connect(this, TQ_SIGNAL(hidden()), mpCanvas, TQ_SLOT(stopLoading()));
328
329 static const char* const context_text[] = {
330 I18N_NOOP( "Actions" ),
331 I18N_NOOP( "Animations" ),
332 I18N_NOOP( "Applications" ),
333 I18N_NOOP( "Categories" ),
334 I18N_NOOP( "Devices" ),
335 I18N_NOOP( "Emblems" ),
336 I18N_NOOP( "Emotes" ),
337 I18N_NOOP( "Filesystems" ),
338 I18N_NOOP( "International" ),
339 I18N_NOOP( "Mimetypes" ),
340 I18N_NOOP( "Places" ),
341 I18N_NOOP( "Status" ) };
342 static const TDEIcon::Context context_id[] = {
343 TDEIcon::Action,
344 TDEIcon::Animation,
345 TDEIcon::Application,
346 TDEIcon::Category,
347 TDEIcon::Device,
348 TDEIcon::Emblem,
349 TDEIcon::Emote,
350 TDEIcon::FileSystem,
351 TDEIcon::International,
352 TDEIcon::MimeType,
353 TDEIcon::Place,
354 TDEIcon::StatusIcon };
355 mNumContext = 0;
356 int cnt = sizeof( context_text ) / sizeof( context_text[ 0 ] );
357 // check all 3 arrays have same sizes
358 assert( cnt == sizeof( context_id ) / sizeof( context_id[ 0 ] )
359 && cnt == sizeof( mContextMap ) / sizeof( mContextMap[ 0 ] ));
360 for( int i = 0;
361 i < cnt;
362 ++i )
363 {
364 if( mpLoader->hasContext( context_id[ i ] ))
365 {
366 mpCombo->insertItem(i18n( context_text[ i ] ));
367 mContextMap[ mNumContext++ ] = context_id[ i ];
368 }
369 }
370 mpCombo->setFixedSize(mpCombo->sizeHint());
371
372 mpBrowseBut->setFixedWidth(mpCombo->width());
373
374 // Make the dialog a little taller
375 incInitialSize(TQSize(0,100));
376}
377
378
379TDEIconDialog::~TDEIconDialog()
380{
381 delete d;
382}
383
384void TDEIconDialog::slotAcceptIcons()
385{
386 d->custom=TQString::null;
387 slotOk();
388}
389
390void TDEIconDialog::showIcons()
391{
392 mpCanvas->clear();
393 TQStringList filelist;
394 if (mType == 0)
395 if (d->m_bStrictIconSize)
396 filelist=mpLoader->queryIcons(mGroupOrSize, mContext);
397 else
398 filelist=mpLoader->queryIconsByContext(mGroupOrSize, mContext);
399 else if ( !d->customLocation.isNull() )
400 filelist=mpLoader->queryIconsByDir( d->customLocation );
401 else
402 filelist=mFileList;
403
404 TQSortedList <IconPath>iconlist;
405 iconlist.setAutoDelete(true);
406 TQStringList::Iterator it;
407 for( it = filelist.begin(); it != filelist.end(); ++it )
408 iconlist.append(new IconPath(*it));
409
410 iconlist.sort();
411 filelist.clear();
412
413 for ( IconPath *ip=iconlist.first(); ip != 0; ip=iconlist.next() )
414 filelist.append(*ip);
415
416 d->searchLine->clear();
417 mpCanvas->loadFiles(filelist);
418}
419
420void TDEIconDialog::setStrictIconSize(bool b)
421{
422 d->m_bStrictIconSize=b;
423}
424
425bool TDEIconDialog::strictIconSize() const
426{
427 return d->m_bStrictIconSize;
428}
429
430void TDEIconDialog::setIconSize( int size )
431{
432 // see TDEIconLoader, if you think this is weird
433 if ( size == 0 )
434 mGroupOrSize = TDEIcon::Desktop; // default Group
435 else
436 mGroupOrSize = -size; // yes, TDEIconLoader::queryIconsByContext is weird
437}
438
439int TDEIconDialog::iconSize() const
440{
441 // 0 or any other value ==> mGroupOrSize is a group, so we return 0
442 return (mGroupOrSize < 0) ? -mGroupOrSize : 0;
443}
444
445#ifndef KDE_NO_COMPAT
446TQString TDEIconDialog::selectIcon(TDEIcon::Group group, TDEIcon::Context context, bool user)
447{
448 setup( group, context, false, 0, user );
449 return openDialog();
450}
451#endif
452
453void TDEIconDialog::setup(TDEIcon::Group group, TDEIcon::Context context,
454 bool strictIconSize, int iconSize, bool user )
455{
456 d->m_bStrictIconSize = strictIconSize;
457 mGroupOrSize = (iconSize == 0) ? group : -iconSize;
458 mType = user ? 1 : 0;
459 mpRb1->setChecked(!user);
460 mpRb2->setChecked(user);
461 mpCombo->setEnabled(!user);
462 mpBrowseBut->setEnabled(user);
463 setContext( context );
464}
465
466void TDEIconDialog::setup(TDEIcon::Group group, TDEIcon::Context context,
467 bool strictIconSize, int iconSize, bool user,
468 bool lockUser, bool lockCustomDir )
469{
470 d->m_bStrictIconSize = strictIconSize;
471 d->m_bLockUser = lockUser;
472 d->m_bLockCustomDir = lockCustomDir;
473 mGroupOrSize = (iconSize == 0) ? group : -iconSize;
474 mType = user ? 1 : 0;
475 mpRb1->setChecked(!user);
476 mpRb1->setEnabled( !lockUser || !user );
477 mpRb2->setChecked(user);
478 mpRb2->setEnabled( !lockUser || user );
479 mpCombo->setEnabled(!user);
480 mpBrowseBut->setEnabled( user && !lockCustomDir );
481 setContext( context );
482}
483
484void TDEIconDialog::setContext( TDEIcon::Context context )
485{
486 mContext = context;
487 for( int i = 0;
488 i < mNumContext;
489 ++i )
490 if( mContextMap[ i ] == context )
491 {
492 mpCombo->setCurrentItem( i );
493 return;
494 }
495}
496
497void TDEIconDialog::setCustomLocation( const TQString& location )
498{
499 d->customLocation = location;
500}
501
502TQString TDEIconDialog::openDialog()
503{
504 showIcons();
505
506 if ( exec() == Accepted )
507 {
508 if (!d->custom.isNull())
509 return d->custom;
510 TQString name = mpCanvas->getCurrent();
511 if (name.isEmpty() || (mType == 1))
512 return name;
513 TQFileInfo fi(name);
514 return fi.baseName(true);
515 }
516 return TQString::null;
517}
518
519void TDEIconDialog::showDialog()
520{
521 setModal(false);
522 showIcons();
523 show();
524}
525
526void TDEIconDialog::slotOk()
527{
528 TQString name;
529 if (!d->custom.isNull())
530 {
531 name = d->custom;
532 }
533 else
534 {
535 name = mpCanvas->getCurrent();
536 if (!name.isEmpty() && (mType != 1))
537 {
538 TQFileInfo fi(name);
539 name = fi.baseName(true);
540 }
541 }
542
543 emit newIconName(name);
544 KDialogBase::slotOk();
545}
546
547TQString TDEIconDialog::getIcon(TDEIcon::Group group, TDEIcon::Context context,
548 bool strictIconSize, int iconSize, bool user,
549 TQWidget *parent, const TQString &caption)
550{
551 TDEIconDialog dlg(parent, "icon dialog");
552 dlg.setup( group, context, strictIconSize, iconSize, user );
553 if (!caption.isNull())
554 dlg.setCaption(caption);
555
556 return dlg.openDialog();
557}
558
559void TDEIconDialog::slotButtonClicked(int id)
560{
561 TQString file;
562
563 switch (id)
564 {
565 case 0:
566 if(mType!=0)
567 {
568 mType = 0;
569 mpBrowseBut->setEnabled(false);
570 mpCombo->setEnabled(true);
571 showIcons();
572 }
573 break;
574
575 case 1:
576 if(mType!=1)
577 {
578 mType = 1;
579 mpBrowseBut->setEnabled( !d->m_bLockCustomDir );
580 mpCombo->setEnabled(false);
581 showIcons();
582 }
583 break;
584 case 2:
585 {
586 // Create a file dialog to select a PNG, XPM or SVG file,
587 // with the image previewer shown.
588 // KFileDialog::getImageOpenURL doesn't allow svg.
589 KFileDialog dlg(TQString::null, i18n("*.png *.xpm *.svg *.svgz|Icon Files (*.png *.xpm *.svg *.svgz)"),
590 this, "filedialog", true);
591 dlg.setOperationMode( KFileDialog::Opening );
592 dlg.setCaption( i18n("Open") );
593 dlg.setMode( KFile::File );
594
595 KImageFilePreview *ip = new KImageFilePreview( &dlg );
596 dlg.setPreviewWidget( ip );
597 dlg.exec();
598
599 file = dlg.selectedFile();
600 if (!file.isEmpty())
601 {
602 d->custom = file;
603 if ( mType == 1 )
604 d->customLocation = TQFileInfo( file ).dirPath( true );
605 slotOk();
606 }
607 }
608 break;
609 }
610}
611
612void TDEIconDialog::slotContext(int id)
613{
614 mContext = static_cast<TDEIcon::Context>( mContextMap[ id ] );
615 showIcons();
616}
617
618void TDEIconDialog::slotStartLoading(int steps)
619{
620 if (steps < 10)
621 mpProgress->hide();
622 else
623 {
624 mpProgress->setTotalSteps(steps);
625 mpProgress->setProgress(0);
626 mpProgress->show();
627 }
628}
629
630void TDEIconDialog::slotProgress(int p)
631{
632 mpProgress->setProgress(p);
633 // commented out the following since setProgress already paints ther
634 // progress bar. ->repaint() only makes it flicker
635 //mpProgress->repaint();
636}
637
638void TDEIconDialog::slotFinished()
639{
640 mpProgress->hide();
641}
642
643class TDEIconButton::TDEIconButtonPrivate
644{
645 public:
646 TDEIconButtonPrivate() {
647 m_bStrictIconSize = false;
648 iconSize = 0; // let TDEIconLoader choose the default
649 }
650 ~TDEIconButtonPrivate() {}
651 bool m_bStrictIconSize;
652 int iconSize;
653};
654
655
656/*
657 * TDEIconButton: A "choose icon" pushbutton.
658 */
659
660TDEIconButton::TDEIconButton(TQWidget *parent, const char *name)
661 : TQPushButton(parent, name)
662{
663 init( TDEGlobal::iconLoader() );
664}
665
666TDEIconButton::TDEIconButton(TDEIconLoader *loader,
667 TQWidget *parent, const char *name)
668 : TQPushButton(parent, name)
669{
670 init( loader );
671}
672
673void TDEIconButton::init( TDEIconLoader *loader )
674{
675 d = new TDEIconButtonPrivate;
676 mGroup = TDEIcon::Desktop;
677 mContext = TDEIcon::Application;
678 mbUser = false;
679
680 mpLoader = loader;
681 mpDialog = 0L;
682 connect(this, TQ_SIGNAL(clicked()), TQ_SLOT(slotChangeIcon()));
683}
684
685TDEIconButton::~TDEIconButton()
686{
687 delete mpDialog;
688 delete d;
689}
690
691void TDEIconButton::setStrictIconSize(bool b)
692{
693 d->m_bStrictIconSize=b;
694}
695
696bool TDEIconButton::strictIconSize() const
697{
698 return d->m_bStrictIconSize;
699}
700
701void TDEIconButton::setIconSize( int size )
702{
703 d->iconSize = size;
704}
705
706int TDEIconButton::iconSize() const
707{
708 return d->iconSize;
709}
710
711void TDEIconButton::setIconType(TDEIcon::Group group, TDEIcon::Context context, bool user)
712{
713 mGroup = group;
714 mContext = context;
715 mbUser = user;
716}
717
718void TDEIconButton::setIcon(const TQString& icon)
719{
720 mIcon = icon;
721 setIconSet(mpLoader->loadIconSet(mIcon, mGroup, d->iconSize));
722
723 if (!mpDialog)
724 {
725 mpDialog = new TDEIconDialog(mpLoader, this);
726 connect(mpDialog, TQ_SIGNAL(newIconName(const TQString&)), TQ_SLOT(newIconName(const TQString&)));
727 }
728
729 if ( mbUser )
730 mpDialog->setCustomLocation( TQFileInfo( mpLoader->iconPath(mIcon, mGroup, true) ).dirPath( true ) );
731}
732
733void TDEIconButton::resetIcon()
734{
735 mIcon = TQString::null;
736 setIconSet(TQIconSet());
737}
738
739void TDEIconButton::slotChangeIcon()
740{
741 if (!mpDialog)
742 {
743 mpDialog = new TDEIconDialog(mpLoader, this);
744 connect(mpDialog, TQ_SIGNAL(newIconName(const TQString&)), TQ_SLOT(newIconName(const TQString&)));
745 }
746
747 mpDialog->setup( mGroup, mContext, d->m_bStrictIconSize, d->iconSize, mbUser );
748 mpDialog->showDialog();
749}
750
751void TDEIconButton::newIconName(const TQString& name)
752{
753 if (name.isEmpty())
754 return;
755
756 TQIconSet iconset = mpLoader->loadIconSet(name, mGroup, d->iconSize);
757 setIconSet(iconset);
758 mIcon = name;
759
760 if ( mbUser )
761 mpDialog->setCustomLocation( TQFileInfo( mpLoader->iconPath(mIcon, mGroup, true) ).dirPath( true ) );
762
763 emit iconChanged(name);
764}
765
766void TDEIconCanvas::virtual_hook( int id, void* data )
767{ TDEIconView::virtual_hook( id, data ); }
768
769void TDEIconDialog::virtual_hook( int id, void* data )
770{ KDialogBase::virtual_hook( id, data ); }
771
772#include "kicondialog.moc"
KFileDialog
Provides a user (and developer) friendly way to select files and directories.
Definition: tdefiledialog.h:77
KImageFilePreview
Image preview widget for the file dialog.
Definition: kimagefilepreview.h:32
TDEIconButton::strictIconSize
bool strictIconSize() const
Returns true if a strict icon size policy is set.
Definition: kicondialog.cpp:696
TDEIconButton::setStrictIconSize
void setStrictIconSize(bool b)
Sets a strict icon size policy for allowed icons.
Definition: kicondialog.cpp:691
TDEIconButton::icon
TQString icon() const
Returns the name of the selected icon.
Definition: kicondialog.h:309
TDEIconButton::setIconSize
void setIconSize(int size)
Sets the size of the icon to be shown / selected.
Definition: kicondialog.cpp:701
TDEIconButton::TDEIconButton
TDEIconButton(TQWidget *parent=0L, const char *name=0L)
Constructs a TDEIconButton using the global iconloader.
Definition: kicondialog.cpp:660
TDEIconButton::~TDEIconButton
~TDEIconButton()
Destructs the button.
Definition: kicondialog.cpp:685
TDEIconButton::setIcon
void setIcon(const TQString &icon)
Sets the button's initial icon.
Definition: kicondialog.cpp:718
TDEIconButton::iconSize
int iconSize() const
Returns the iconsize set via setIconSize() or 0, if the default iconsize will be used.
Definition: kicondialog.cpp:706
TDEIconButton::setIconType
void setIconType(TDEIcon::Group group, TDEIcon::Context context, bool user=false)
Sets the icon group and context.
Definition: kicondialog.cpp:711
TDEIconButton::resetIcon
void resetIcon()
Resets the icon (reverts to an empty button).
Definition: kicondialog.cpp:733
TDEIconButton::iconChanged
void iconChanged(TQString icon)
Emitted when the icon has changed.
TDEIconCanvas
Icon canvas for TDEIconDialog.
Definition: kicondialog.h:36
TDEIconCanvas::loadFiles
void loadFiles(const TQStringList &files)
Load icons into the canvas.
Definition: kicondialog.cpp:110
TDEIconCanvas::nameChanged
void nameChanged(TQString)
Emitted when the current icon has changed.
TDEIconCanvas::getCurrent
TQString getCurrent() const
Returns the current icon.
Definition: kicondialog.cpp:202
TDEIconDialog
Dialog for interactive selection of icons.
Definition: kicondialog.h:92
TDEIconDialog::iconSize
int iconSize() const
Returns the iconsize set via setIconSize() or 0, if the default iconsize will be used.
Definition: kicondialog.cpp:439
TDEIconDialog::TDEIconDialog
TDEIconDialog(TQWidget *parent=0L, const char *name=0L)
Constructs an icon selection dialog using the global iconloader.
Definition: kicondialog.cpp:240
TDEIconDialog::openDialog
TQString openDialog()
exec()utes this modal dialog and returns the name of the selected icon, or TQString::null if the dial...
Definition: kicondialog.cpp:502
TDEIconDialog::setIconSize
void setIconSize(int size)
Sets the size of the icons to be shown / selected.
Definition: kicondialog.cpp:430
TDEIconDialog::setup
void setup(TDEIcon::Group group, TDEIcon::Context context=TDEIcon::Application, bool strictIconSize=false, int iconSize=0, bool user=false)
Allows you to set the same parameters as in the class method getIcon().
Definition: kicondialog.cpp:453
TDEIconDialog::showDialog
void showDialog()
show()es this dialog and emits a newIcon(const TQString&) signal when successful.
Definition: kicondialog.cpp:519
TDEIconDialog::selectIcon
TQString selectIcon(TDEIcon::Group group=TDEIcon::Desktop, TDEIcon::Context context=TDEIcon::Application, bool user=false)
Definition: kicondialog.cpp:446
TDEIconDialog::setStrictIconSize
void setStrictIconSize(bool b)
Sets a strict icon size policy for allowed icons.
Definition: kicondialog.cpp:420
TDEIconDialog::~TDEIconDialog
~TDEIconDialog()
Destructs the dialog.
Definition: kicondialog.cpp:379
TDEIconDialog::strictIconSize
bool strictIconSize() const
Returns true if a strict icon size policy is set.
Definition: kicondialog.cpp:425
TDEIconDialog::getIcon
static TQString getIcon(TDEIcon::Group group=TDEIcon::Desktop, TDEIcon::Context context=TDEIcon::Application, bool strictIconSize=false, int iconSize=0, bool user=false, TQWidget *parent=0, const TQString &caption=TQString::null)
Pops up the dialog an lets the user select an icon.
Definition: kicondialog.cpp:547
TDEIconDialog::setCustomLocation
void setCustomLocation(const TQString &location)
sets a custom icon directory
Definition: kicondialog.cpp:497

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdefile by doxygen 1.9.4
This website is maintained by Timothy Pearson.