KShowMail – show mails on a POP3 server
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.

122 lines
4.3KB

  1. //
  2. // C++ Implementation: filterlogview
  3. //
  4. // Description:
  5. //
  6. //
  7. // Author: Ulrich Weigelt <ulrich.weigelt@gmx.de>, (C) 2007
  8. //
  9. // Copyright: See COPYING file that comes with this distribution
  10. //
  11. //
  12. #include "filterlogview.h"
  13. FilterLogView::FilterLogView( TQWidget *parent, FilterLog* log )
  14. : KDialogBase( parent, "FilterLogView", true, TQString::null, Ok, Ok, true )
  15. {
  16. //save the log pointer
  17. this->log = log;
  18. //set caption
  19. setCaption( i18n( "Filter Log View" ) );
  20. //main widget
  21. TQWidget* pgMain = new TQWidget( this );
  22. setMainWidget( pgMain );
  23. //basic layout
  24. TQVBoxLayout* layMain = new TQVBoxLayout( pgMain, 0, spacingHint() );
  25. //view of deleted views
  26. TQLabel* lblDeletedMails = new TQLabel( i18n( "Deleted Mails:"), pgMain, "lblDeletedMails" );
  27. layMain->addWidget( lblDeletedMails );
  28. lstViewDeleted = new TDEListView( pgMain, "lstViewDeleted" );
  29. lstViewDeleted->addColumn( i18n( "Date" ) );
  30. lstViewDeleted->addColumn( i18n( "Sender" ) );
  31. lstViewDeleted->addColumn( i18n( "Account" ) );
  32. lstViewDeleted->addColumn( i18n( "Subject" ) );
  33. lstViewDeleted->setColumnWidthMode( 0, TQListView::Maximum );
  34. lstViewDeleted->setColumnWidthMode( 1, TQListView::Maximum );
  35. lstViewDeleted->setColumnWidthMode( 2, TQListView::Maximum );
  36. lstViewDeleted->setColumnWidthMode( 3, TQListView::Maximum );
  37. lstViewDeleted->setResizeMode( TQListView::NoColumn );
  38. lstViewDeleted->setSortColumn( 0 );
  39. lstViewDeleted->setSortOrder( TQt::Ascending );
  40. layMain->addWidget( lstViewDeleted );
  41. KPushButton* btnClearDeleted = new KPushButton( KStdGuiItem::clear(), pgMain, "btnClearDeleted" );
  42. TQToolTip::add( btnClearDeleted, i18n( "Clear the list of deleted mails" ) );
  43. connect( btnClearDeleted, SIGNAL( clicked() ), this, SLOT( slotClearDeletedMails() ) );
  44. btnClearDeleted->setSizePolicy( TQSizePolicy::Maximum, TQSizePolicy::Fixed );
  45. layMain->addWidget( btnClearDeleted );
  46. //create a seperator
  47. layMain->addWidget( new KSeparator( pgMain ) );
  48. //view of deleted views
  49. TQLabel* lblMovedMails = new TQLabel( i18n( "Moved Mails:"), pgMain, "lblMovedMails" );
  50. layMain->addWidget( lblMovedMails );
  51. lstViewMoved = new TDEListView( pgMain, "lstViewMoved" );
  52. lstViewMoved->addColumn( i18n( "Date" ) );
  53. lstViewMoved->addColumn( i18n( "Sender" ) );
  54. lstViewMoved->addColumn( i18n( "Account" ) );
  55. lstViewMoved->addColumn( i18n( "Moved To" ) );
  56. lstViewMoved->addColumn( i18n( "Subject" ) );
  57. lstViewMoved->setColumnWidthMode( 0, TQListView::Maximum );
  58. lstViewMoved->setColumnWidthMode( 1, TQListView::Maximum );
  59. lstViewMoved->setColumnWidthMode( 2, TQListView::Maximum );
  60. lstViewMoved->setColumnWidthMode( 3, TQListView::Maximum );
  61. lstViewMoved->setColumnWidthMode( 4, TQListView::Maximum );
  62. lstViewMoved->setResizeMode( TQListView::NoColumn );
  63. lstViewMoved->setSortColumn( 0 );
  64. lstViewMoved->setSortOrder( TQt::Ascending );
  65. layMain->addWidget( lstViewMoved );
  66. KPushButton* btnClearMoved = new KPushButton( KStdGuiItem::clear(), pgMain, "btnClearMoved" );
  67. TQToolTip::add( btnClearMoved, i18n( "Clear the list of moved mails" ) );
  68. connect( btnClearMoved, SIGNAL( clicked() ), this, SLOT( slotClearMovedMails() ) );
  69. btnClearMoved->setSizePolicy( TQSizePolicy::Maximum, TQSizePolicy::Fixed );
  70. layMain->addWidget( btnClearMoved );
  71. //now we load the content for the list views
  72. LogEntryList listDeletedMails = log->getDeletedMails();
  73. LogEntryList::iterator it;
  74. for( it = listDeletedMails.begin(); it != listDeletedMails.end(); it++ )
  75. {
  76. //create a new list view item
  77. FilterLogViewDeletedItem* item = new FilterLogViewDeletedItem( lstViewDeleted );
  78. item->setValues( (*it).getDate(), (*it).getSender(), (*it).getAccount(), (*it).getSubject() );
  79. }
  80. LogEntryList listMovedMails = log->getMovedMails();
  81. for( it = listMovedMails.begin(); it != listMovedMails.end(); it++ )
  82. {
  83. //create a new list view item
  84. FilterLogViewMovedItem* item = new FilterLogViewMovedItem( lstViewMoved );
  85. item->setValues( (*it).getDate(), (*it).getSender(), (*it).getAccount(), (*it).getMailbox(), (*it).getSubject() );
  86. }
  87. }
  88. FilterLogView::~FilterLogView()
  89. {
  90. }
  91. void FilterLogView::slotClearDeletedMails( )
  92. {
  93. log->clearDeletedMailsLog();
  94. lstViewDeleted->clear();
  95. }
  96. void FilterLogView::slotClearMovedMails( )
  97. {
  98. log->clearMovedMailsLog();
  99. lstViewMoved->clear();
  100. }
  101. #include "filterlogview.moc"