Properly apply, and reload when changed, the annotation info in the annotation window (color, modication date, etc).

svn path=/trunk/KDE/kdegraphics/okular/; revision=789344
remotes/origin/KDE/4.1
Pino Toscano 18 years ago
parent 6511086ffc
commit 961b27e99c
  1. 23
      ui/annotwindow.cpp
  2. 4
      ui/annotwindow.h
  3. 8
      ui/pageview.cpp

@ -169,12 +169,6 @@ AnnotWindow::AnnotWindow( QWidget * parent, Okular::Annotation * annot)
connect(textEdit,SIGNAL(textChanged()),
this,SLOT(slotsaveWindowText()));
QColor col = m_annot->style().color().isValid() ? m_annot->style().color() : Qt::yellow;
setPalette( QPalette( col ) );
QPalette pl=textEdit->palette();
pl.setColor( QPalette::Base, col );
textEdit->setPalette(pl);
QVBoxLayout * mainlay = new QVBoxLayout( this );
mainlay->setMargin( 2 );
mainlay->setSpacing( 0 );
@ -188,11 +182,26 @@ AnnotWindow::AnnotWindow( QWidget * parent, Okular::Annotation * annot)
lowerlay->addWidget( sb );
m_title->setTitle( m_annot->window().summary() );
m_title->setDate( m_annot->modificationDate() );
m_title->setAuthor( m_annot->author() );
m_title->connectOptionButton( this, SLOT( slotOptionBtn() ) );
setGeometry(10,10,300,300 );
reloadInfo();
}
void AnnotWindow::reloadInfo()
{
const QColor newcolor = m_annot->style().color().isValid() ? m_annot->style().color() : Qt::yellow;
if ( newcolor != m_color )
{
m_color = newcolor;
setPalette( QPalette( m_color ) );
QPalette pl = textEdit->palette();
pl.setColor( QPalette::Base, m_color );
textEdit->setPalette( pl );
}
m_title->setDate( m_annot->modificationDate() );
}
void AnnotWindow::slotOptionBtn()

@ -11,6 +11,7 @@
#ifndef _ANNOTWINDOW_H_
#define _ANNOTWINDOW_H_
#include <qcolor.h>
#include <qframe.h>
namespace Okular {
@ -25,10 +26,13 @@ class AnnotWindow : public QFrame
Q_OBJECT
public:
AnnotWindow( QWidget * parent, Okular::Annotation * annot);
void reloadInfo();
private:
MovableTitle * m_title;
QTextEdit *textEdit;
QColor m_color;
public:
Okular::Annotation* m_annot;

@ -936,6 +936,14 @@ void PageView::notifyPageChanged( int pageNumber, int changedFlags )
if ( changedFlags & DocumentObserver::Bookmark )
return;
if ( changedFlags & DocumentObserver::Annotations )
{
Q_FOREACH ( AnnotWindow* win, d->m_annowindows )
{
win->reloadInfo();
}
}
// iterate over visible items: if page(pageNumber) is one of them, repaint it
QLinkedList< PageViewItem * >::const_iterator iIt = d->visibleItems.begin(), iEnd = d->visibleItems.end();
for ( ; iIt != iEnd; ++iIt )

Loading…
Cancel
Save