26 #include <tqstylesheet.h>
28 #include <tdeactioncollection.h>
30 #include <tdelocale.h>
31 #include <tdeparts/browserextension.h>
32 #include <tdeparts/part.h>
34 #include <libtdepim/progressmanager.h>
40 Frame::Frame(TQObject * parent, KParts::ReadOnlyPart *p, TQWidget *visWidget,
const TQString& tit,
bool watchSignals)
41 :TQObject(parent,
"aKregatorFrame")
43 m_autoDeletePart =
false;
53 connect(m_part, TQ_SIGNAL(setWindowCaption (
const TQString &)),
this, TQ_SLOT(setCaption (
const TQString &)));
54 connect(m_part, TQ_SIGNAL(setStatusBarText (
const TQString &)),
this, TQ_SLOT(setStatusText (
const TQString &)));
56 KParts::BrowserExtension *ext=KParts::BrowserExtension::childObject( p );
58 connect( ext, TQ_SIGNAL(loadingProgress(
int)),
this, TQ_SLOT(setProgress(
int)) );
60 connect(p, TQ_SIGNAL(started(TDEIO::Job*)),
this, TQ_SLOT(setStarted()));
61 connect(p, TQ_SIGNAL(completed()),
this, TQ_SLOT(setCompleted()));
62 connect(p, TQ_SIGNAL(canceled(
const TQString &)),
this, TQ_SLOT(setCanceled(
const TQString&)));
63 connect(p, TQ_SIGNAL(completed(
bool)),
this, TQ_SLOT(setCompleted()));
77 void Frame::setAutoDeletePart(
bool autoDelete)
79 m_autoDeletePart = autoDelete;
86 m_progressItem->setComplete();
89 m_part->deleteLater();
92 int Frame::state()
const
97 KParts::ReadOnlyPart *Frame::part()
const
102 TQWidget *Frame::widget()
const
107 void Frame::setTitle(
const TQString &s)
112 emit titleChanged(
this, s);
116 void Frame::setCaption(
const TQString &s)
118 if(m_progressItem) m_progressItem->setLabel(s);
120 emit captionChanged(s);
123 void Frame::setStatusText(
const TQString &s)
126 m_statusText.replace(TQRegExp(
"<[^>]*>"),
"");
127 emit statusText(m_statusText);
130 void Frame::setProgress(
int a)
133 m_progressItem->setProgress((
int)a);
136 emit loadingProgress(a);
139 void Frame::setState(
int a)
148 case Frame::Canceled:
149 emit canceled(TQString());
152 case Frame::Completed:
159 const TQString& Frame::title()
const
164 const TQString& Frame::caption()
const
169 const TQString& Frame::statusText()
const
174 void Frame::setStarted()
176 if(m_progressId.isNull() || m_progressId.isEmpty()) m_progressId = KPIM::ProgressManager::getUniqueID();
177 m_progressItem = KPIM::ProgressManager::createProgressItem(m_progressId, TQStyleSheet::escape( title() ), TQString(),
false);
178 m_progressItem->setStatus(i18n(
"Loading..."));
184 void Frame::setCanceled(
const TQString &s)
187 m_progressItem->setStatus(i18n(
"Loading canceled"));
188 m_progressItem->setComplete();
195 void Frame::setCompleted()
198 m_progressItem->setStatus(i18n(
"Loading completed"));
199 m_progressItem->setComplete();
206 int Frame::progress()
const