summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp2
-rw-r--r--korganizer/kowhatsnextview.cpp42
-rw-r--r--korganizer/kowhatsnextview.h5
3 files changed, 33 insertions, 16 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index cee0466..5de667e 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -78,25 +78,25 @@ void KOEventViewer::setSource(const QString& n)
KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true );
KABC::AddressBook::Iterator it;
for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) {
// LR I do not understand, why the uid string is different on zaurus and desktop
QString uid = "uid://"+(*it).uid();
//qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1());
if (n == uid ) {
//qDebug("found %s ",(*it).mobileHomePhone().latin1() );
QDialog dia( this,"dia123", true );
dia.setCaption( i18n("Details of attendee") );
QVBoxLayout lay ( &dia );
- KPIM::AddresseeView av ( &dia );
+ KABC::AddresseeView av ( &dia );
av.setAddressee( (*it) );
lay.addWidget( &av );
if ( QApplication::desktop()->width() < 480 )
dia.resize( 220, 240);
else {
dia.resize( 400,400);
}
dia.exec();
break;
}
}
return;
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index 219f7c3..7166a01 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -15,25 +15,27 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <qlayout.h>
#include <qtextbrowser.h>
#include <qtextcodec.h>
#include <qfileinfo.h>
#include <qlabel.h>
#include <qapplication.h>
-
+#ifdef DESKTOP_VERSION
+#include <qpaintdevicemetrics.h>
+#endif
#include <kglobal.h>
#include <klocale.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <kmessagebox.h>
#include <libkcal/calendar.h>
#ifndef KORG_NOPRINTER
#include "calprinter.h"
#endif
#include "koglobals.h"
@@ -47,24 +49,49 @@ void WhatsNextTextBrowser::setSource(const QString& n)
{
if (n.startsWith("event:")) {
emit showIncidence(n);
return;
} else if (n.startsWith("todo:")) {
emit showIncidence(n);
return;
} else {
QTextBrowser::setSource(n);
}
}
+void WhatsNextTextBrowser::printMe()
+{
+#ifdef DESKTOP_VERSION
+ QPrinter printer;
+ if (!printer.setup() )
+ return;
+ QPainter p;
+ p.begin ( &printer );
+ QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
+ float dx, dy;
+ int wid = (m.width() * 9)/10;
+ dx = (float) wid/(float)contentsWidth ();
+ dy = (float)(m.height()) / (float)contentsHeight ();
+ float scale;
+ // scale to fit the width or height of the paper
+ if ( dx < dy )
+ scale = dx;
+ else
+ scale = dy;
+ p.translate( m.width()/10,0 );
+ p.scale( scale, scale );
+ drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
+ p.end();
+#endif
+}
KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
const char *name)
: KOrg::BaseView(calendar, parent, name)
{
// mDateLabel =
// new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
// mDateLabel->setMargin(2);
// mDateLabel->setAlignment(AlignCenter);
setFont( KOPrefs::instance()->mWhatsNextFont );
mView = new WhatsNextTextBrowser(this);
connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
@@ -105,36 +132,25 @@ int KOWhatsNextView::currentDateCount()
}
QPtrList<Incidence> KOWhatsNextView::selectedIncidences()
{
QPtrList<Incidence> eventList;
return eventList;
}
void KOWhatsNextView::printMe()
{
#ifdef DESKTOP_VERSION
- QPrinter printer;
- if (!printer.setup() )
- return;
- QTextBrowser tb;
- tb.setFixedSize( 600, 4000 );
- QPainter::redirect ( tb.viewport(), &printer );
- updateView();
- tb.setText( mText );
- tb.show();
- tb.repaint();
- tb.hide();
- KMessageBox::information( this, i18n("Printing What's Next View!\n\nPlease close after\nprinting is finished."));
+ mView->printMe();
#endif
}
void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd,
const QDate &td)
{
#ifndef KORG_NOPRINTER
calPrinter->preview(CalPrinter::Day, fd, td);
#endif
}
void KOWhatsNextView::updateConfig()
{
setFont( KOPrefs::instance()->mWhatsNextFont );
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index 0231cf2..715037f 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -25,27 +25,28 @@
#include <korganizer/baseview.h>
class QListView;
class QLabel;
class KOEventViewerDialog;
#include <qpainter.h>
#include <qwidget.h>
class WhatsNextTextBrowser : public QTextBrowser {
Q_OBJECT
public:
- WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {}
+ WhatsNextTextBrowser(QWidget *parent) : QTextBrowser(parent) {};
void setSource(const QString &);
+ void printMe();
signals:
void showIncidence(const QString &uid);
};
/**
This class provides a view of the next events and todos
*/
class KOWhatsNextView : public KOrg::BaseView
{
Q_OBJECT
@@ -79,21 +80,21 @@ class KOWhatsNextView : public KOrg::BaseView
QDate mEventDate;
virtual void showEvent ( QShowEvent * );
virtual void hideEvent ( QHideEvent * );
private slots:
void showIncidence(const QString &);
void restartTimer();
private:
//void createEventViewer();
QTimer* mTimer;
- QTextBrowser *mView;
+ WhatsNextTextBrowser *mView;
QString mText;
// QLabel *mDateLabel;
KOEventViewerDialog *mEventViewer;
QValueList<Incidence *> mTodos;
};
#endif