~ubuntu-branches/ubuntu/raring/kdepim/raring-proposed

« back to all changes in this revision

Viewing changes to korganizer/plugins/printing/itemlist/itemlistprint.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-06-07 07:56:38 UTC
  • mfrom: (0.2.27)
  • Revision ID: package-import@ubuntu.com-20120607075638-0luhdq11z7sgvs4m
Tags: 4:4.8.80-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  This file is part of KOrganizer.
 
3
 
 
4
  Copyright (C) 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
 
5
 
 
6
  This program is free software; you can redistribute it and/or modify
 
7
  it under the terms of the GNU General Public License as published by
 
8
  the Free Software Foundation; either version 2 of the License, or
 
9
  (at your option) any later version.
 
10
 
 
11
  This program is distributed in the hope that it will be useful,
 
12
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
14
  GNU General Public License for more details.
 
15
 
 
16
  You should have received a copy of the GNU General Public License along
 
17
  with this program; if not, write to the Free Software Foundation, Inc.,
 
18
  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
19
 
 
20
  As a special exception, permission is given to link this program
 
21
  with any edition of Qt, and distribute the resulting executable,
 
22
  without including the source code for Qt in the source distribution.
 
23
*/
 
24
 
 
25
#include "itemlistprint.h"
 
26
 
 
27
class ItemListPrintFactory : public KOrg::PrintPluginFactory
 
28
{
 
29
  public:
 
30
    KOrg::PrintPlugin *createPluginFactory() { return new CalPrintItemList; }
 
31
};
 
32
 
 
33
K_EXPORT_PLUGIN( ItemListPrintFactory )
 
34
 
 
35
/**************************************************************
 
36
 *           Print Item List
 
37
 **************************************************************/
 
38
 
 
39
QWidget *CalPrintItemList::createConfigWidget( QWidget *w )
 
40
{
 
41
  return new CalPrintItemListConfig( w );
 
42
}
 
43
 
 
44
void CalPrintItemList::readSettingsWidget()
 
45
{
 
46
  CalPrintItemListConfig *cfg =
 
47
      dynamic_cast<CalPrintItemListConfig*>( ( QWidget* )mConfigWidget );
 
48
  if ( cfg ) {
 
49
    mFromDate = cfg->mFromDate->date();
 
50
    mToDate = cfg->mToDate->date();
 
51
  }
 
52
}
 
53
 
 
54
void CalPrintItemList::setSettingsWidget()
 
55
{
 
56
  CalPrintItemListConfig *cfg =
 
57
      dynamic_cast<CalPrintItemListConfig*>( ( QWidget* )mConfigWidget );
 
58
  if ( cfg ) {
 
59
    cfg->mFromDate->setDate( mFromDate );
 
60
    cfg->mToDate->setDate( mToDate );
 
61
  }
 
62
}
 
63
 
 
64
void CalPrintItemList::loadConfig()
 
65
{
 
66
  if ( mConfig ) {
 
67
    KConfigGroup config( mConfig, "Itemlistprint" );
 
68
    //TODO: Read in settings
 
69
  }
 
70
  setSettingsWidget();
 
71
}
 
72
 
 
73
void CalPrintItemList::saveConfig()
 
74
{
 
75
  kDebug();
 
76
 
 
77
  readSettingsWidget();
 
78
  if ( mConfig ) {
 
79
    KConfigGroup config( mConfig, "Itemlistprint" );
 
80
    //TODO: Write out settings
 
81
  }
 
82
}
 
83
 
 
84
void CalPrintItemList::setDateRange( const QDate &from, const QDate &to )
 
85
{
 
86
  CalPrintPluginBase::setDateRange( from, to );
 
87
  CalPrintItemListConfig *cfg =
 
88
      dynamic_cast<CalPrintItemListConfig*>( ( QWidget* )mConfigWidget );
 
89
  if ( cfg ) {
 
90
    cfg->mFromDate->setDate( from );
 
91
    cfg->mToDate->setDate( to );
 
92
  }
 
93
}
 
94
 
 
95
void CalPrintItemList::print( QPainter &p, int width, int height )
 
96
{
 
97
  Q_UNUSED( p );
 
98
  Q_UNUSED( width );
 
99
  Q_UNUSED( height );
 
100
  //TODO: Print something!
 
101
}
 
102