Kile – integrated LaTeX environment
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.0KB

  1. /***************************************************************************
  2. date : Jan 22 2004
  3. version : 0.10
  4. copyright : (C) 2004 by Holger Danielsson
  5. email : holger.danielsson@t-online.de
  6. ***************************************************************************/
  7. /***************************************************************************
  8. * *
  9. * This program is free software; you can redistribute it and/or modify *
  10. * it under the terms of the GNU General Public License as published by *
  11. * the Free Software Foundation; either version 2 of the License, or *
  12. * (at your option) any later version. *
  13. * *
  14. ***************************************************************************/
  15. #include "cleandialog.h"
  16. #include <tdelocale.h>
  17. #include <kiconloader.h>
  18. #include <kpushbutton.h>
  19. #include <tdelistview.h>
  20. #include <tqlayout.h>
  21. #include <tqlabel.h>
  22. #include <tqpixmap.h>
  23. #include <tqfileinfo.h>
  24. #include "kiledebug.h"
  25. namespace KileDialog
  26. {
  27. Clean::Clean(TQWidget *parent, const TQString & filename, const TQStringList & extlist) :
  28. KDialogBase( KDialogBase::Plain, i18n("Delete Files"), Ok | Cancel, Ok, parent, 0, true, true),
  29. m_extlist(extlist)
  30. {
  31. // Layout
  32. TQVBoxLayout *vbox = new TQVBoxLayout(plainPage(), 6,6 );
  33. // label widgets
  34. TQWidget *labelwidget = new TQWidget(plainPage());
  35. TQHBoxLayout *labellayout = new TQHBoxLayout(labelwidget);
  36. // line 1: picture and label
  37. TQLabel *picture = new TQLabel("", labelwidget);
  38. picture->setPixmap( TDEGlobal::instance()->iconLoader()->loadIcon("messagebox_warning", TDEIcon::NoGroup, TDEIcon::SizeMedium) );
  39. TQLabel *label = new TQLabel(i18n( "Do you really want to delete these files?" ), labelwidget);
  40. labellayout->addWidget(picture);
  41. labellayout->addSpacing(20);
  42. labellayout->addWidget(label);
  43. // line 2: listview
  44. listview = new TDEListView(plainPage());
  45. listview->addColumn(i18n("Files"));
  46. listview->setSorting(-1);
  47. // insert items into listview
  48. TQString base = TQFileInfo(filename).baseName(true);
  49. for (uint i=0; i < m_extlist.count(); ++i)
  50. {
  51. TQCheckListItem *item = new TQCheckListItem(listview, base + m_extlist[i], TQCheckListItem::CheckBox);
  52. item->setOn(true);
  53. listview->insertItem(item);
  54. }
  55. vbox->addWidget(labelwidget,0,TQt::AlignHCenter);
  56. vbox->addWidget(listview);
  57. }
  58. Clean::~Clean()
  59. {}
  60. // get all selected items
  61. const TQStringList & Clean::getCleanlist()
  62. {
  63. TQStringList templist;
  64. TQCheckListItem *item = (TQCheckListItem *)listview->firstChild();
  65. int i = m_extlist.count() - 1;
  66. while ( item )
  67. {
  68. if ( item->isOn() && item->text(0).endsWith(m_extlist[i]) )
  69. templist.append(m_extlist[i]);
  70. item = (TQCheckListItem *)item->nextSibling();
  71. --i;
  72. }
  73. m_extlist = templist;
  74. return m_extlist;
  75. }
  76. }
  77. #include "cleandialog.moc"