summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-26 23:12:59 (UTC)
committer zautrix <zautrix>2005-01-26 23:12:59 (UTC)
commitf20b5e71f9ae61b18f0ced792508b40432ad50b6 (patch) (side-by-side diff)
tree3dde48c6dcecf2e5c19d3e7a62aba57c385e92df
parent15351333eff09beadb6e691e9f0aab2aaf0a95a0 (diff)
downloadkdepimpi-f20b5e71f9ae61b18f0ced792508b40432ad50b6.zip
kdepimpi-f20b5e71f9ae61b18f0ced792508b40432ad50b6.tar.gz
kdepimpi-f20b5e71f9ae61b18f0ced792508b40432ad50b6.tar.bz2
fixes
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp2
-rw-r--r--korganizer/koagendaview.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp
index b5596d9..05216a7 100644
--- a/korganizer/koagendaview.cpp
+++ b/korganizer/koagendaview.cpp
@@ -160,114 +160,116 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch)
/**
Calculates the minimum width.
*/
int TimeLabels::minimumWidth() const
{
QFontMetrics fm = fontMetrics();
//TODO: calculate this value
int borderWidth = 4;
// the maximum width possible
int width = fm.width("88:88x") + borderWidth;
return width;
}
/** updates widget's internal state */
void TimeLabels::updateConfig()
{
// set the font
// config->setGroup("Fonts");
// QFont font = config->readFontEntry("TimeBar Font");
setFont(KOPrefs::instance()->mTimeBarFont);
// update geometry restrictions based on new settings
setFixedWidth(minimumWidth());
// update HourSize
mCellHeight = KOPrefs::instance()->mHourSize*4;
resizeContents(50,mRows * mCellHeight);
}
/** update time label positions */
void TimeLabels::positionChanged()
{
int adjustment = mAgenda->contentsY();
setContentsPos(0, adjustment);
}
/** */
void TimeLabels::setAgenda(KOAgenda* agenda)
{
mAgenda = agenda;
}
void TimeLabels::contentsMousePressEvent ( QMouseEvent * e)
{
mMouseDownY = e->pos().y();
+ mOrgCap = topLevelWidget()->caption();
}
void TimeLabels::contentsMouseMoveEvent ( QMouseEvent * e )
{
int diff = mMouseDownY - e->pos().y();
if ( diff < 10 && diff > -10 )
return;
int tSize = KOPrefs::instance()->mHourSize + (diff/10) ;
if ( tSize < 4 )
tSize = 4;
if ( tSize > 18 )
tSize = 18;
tSize = (tSize-2)/2;
topLevelWidget()->setCaption(i18n("New Agendasize: %1").arg(tSize));
}
void TimeLabels::contentsMouseReleaseEvent ( QMouseEvent * e )
{
+ topLevelWidget()->setCaption( mOrgCap );
int diff = mMouseDownY - e->pos().y();
if ( diff < 10 && diff > -10 )
return;
int tSize = KOPrefs::instance()->mHourSize + (diff/10);
if ( tSize < 4 )
tSize = 4;
if ( tSize > 18 )
tSize = 18;
tSize = (tSize/2)*2;
if ( tSize == KOPrefs::instance()->mHourSize )
return;
KOPrefs::instance()->mHourSize = tSize;
emit scaleChanged();
}
/** This is called in response to repaint() */
void TimeLabels::paintEvent(QPaintEvent*)
{
// kdDebug() << "paintevent..." << endl;
// this is another hack!
// QPainter painter(this);
//QString c
repaintContents(contentsX(), contentsY(), visibleWidth(), visibleHeight());
}
////////////////////////////////////////////////////////////////////////////
EventIndicator::EventIndicator(Location loc,QWidget *parent,const char *name)
: QFrame(parent,name)
{
mColumns = 1;
mTopBox = 0;
mLocation = loc;
mTopLayout = 0;
mPaintWidget = 0;
mXOffset = 0;
if (mLocation == Top) mPixmap = SmallIcon("1uparrow");
else mPixmap = SmallIcon("1downarrow");
mEnabled.resize(mColumns);
if (mLocation == Top)
setMaximumHeight(0);
else
setMinimumHeight(mPixmap.height());
}
EventIndicator::~EventIndicator()
{
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h
index 221b0ea..3cf938f 100644
--- a/korganizer/koagendaview.h
+++ b/korganizer/koagendaview.h
@@ -32,96 +32,97 @@
#include <qsplitter.h>
#endif
#include <qmemarray.h>
#include "koeventview.h"
class QHBox;
class QFrame;
class QLabel;
class QPushButton;
class CalendarView;
class KOAgenda;
class KOAgendaItem;
class KConfig;
class KDGanttMinimizeSplitter;
class TimeLabels : public QScrollView {
Q_OBJECT
public:
TimeLabels(int rows,QWidget *parent=0,const char *name=0,WFlags f=0);
void setCellHeight(int height);
/** Calculates the minimum width */
virtual int minimumWidth() const;
/** updates widget's internal state */
void updateConfig();
/** */
void setAgenda(KOAgenda* agenda);
/** */
virtual void paintEvent(QPaintEvent* e);
void contentsMousePressEvent ( QMouseEvent * ) ;
void contentsMouseReleaseEvent ( QMouseEvent * );
void contentsMouseMoveEvent ( QMouseEvent * );
public slots:
/** update time label positions */
void positionChanged();
signals:
void scaleChanged();
protected:
void drawContents(QPainter *p,int cx, int cy, int cw, int ch);
private:
int mMouseDownY;
+ QString mOrgCap;
int mRows;
int mCellHeight;
/** */
KOAgenda* mAgenda;
};
class EventIndicator : public QFrame {
Q_OBJECT
public:
enum Location { Top, Bottom };
EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0);
virtual ~EventIndicator();
void changeColumns(int columns);
void setPaintWidget( KDGanttMinimizeSplitter* );
void setXOffset( int );
void enableColumn(int column, bool enable);
protected:
void drawContents(QPainter *);
private:
int mXOffset;
KDGanttMinimizeSplitter* mPaintWidget;
int mColumns;
QHBox *mTopBox;
QBoxLayout *mTopLayout;
Location mLocation;
QPixmap mPixmap;
QMemArray<bool> mEnabled;
};
/**
KOAgendaView is the agenda-like view used to display events in an one or
multi-day view.
*/
class KOAgendaView : public KOEventView {
Q_OBJECT
public:
KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 );
virtual ~KOAgendaView();
void setStartHour( int );
void toggleAllDay();
/** Returns maximum number of days supported by the koagendaview */
virtual int maxDatesHint();