| Summary: | ktimetracker filename call does not work | ||
|---|---|---|---|
| Product: | [Applications] ktimetracker | Reporter: | Thorsten Staerk <dev> |
| Component: | general | Assignee: | Thorsten Staerk <dev> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Compiled Sources | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Thorsten Staerk
2009-06-01 13:46:18 UTC
To give a start, here is how to add a task:
svn diff
Index: taskview.cpp
===================================================================
--- taskview.cpp (revision 984143)
+++ taskview.cpp (working copy)
@@ -455,6 +455,7 @@
refresh();
}
for (int i=0; i<=columnCount(); i++) resizeColumnToContents(i);
+ addTask("hi",0,0);
kDebug(5970) << "Leaving function";
}
@@ -868,7 +869,7 @@
setSortingEnabled(true);
return taskuid;
}
-
+
void TaskView::newSubTask()
{
Task* task = currentItem();
The problem seems to be that factory->create(this, "ktimetrackerpart" ) creates the part without telling which file to use The next problem is that ((TimetrackerWidget) (m_part->widget())).openFile(icsfile); must be ((TimetrackerWidget*) (m_part->widget()))->openFile(icsfile); This makes it better, but far from perfect. I need sleep(8*3600) now.
Index: ktimetrackerpart.cpp
===================================================================
--- ktimetrackerpart.cpp (revision 1022777)
+++ ktimetrackerpart.cpp (working copy)
@@ -60,7 +60,7 @@
setWidget( mMainWidget );
setXMLFile( "ktimetrackerui.rc" );
makeMenus();
- mMainWidget->openFile( KStandardDirs::locateLocal( "data",
+ mMainWidget->openFile( KStandardDirs::locateLocal( "data",
QString::fromLatin1( "ktimetracker/ktimetracker.ics" ) ) );
emit setWindowCaption( KStandardDirs::locateLocal( "data", QString::fromLatin1( "ktimetracker/ktimetracker.ics" ) ) );
Index: taskview.cpp
===================================================================
--- taskview.cpp (revision 1022777)
+++ taskview.cpp (working copy)
@@ -408,6 +408,7 @@
void TaskView::load( const QString &fileName )
{
+ kDebug(5970) << "Entering function-filename=" << fileName;
assert( !( fileName.isEmpty() ) );
// if the program is used as an embedded plugin for konqueror, there may be a need
Index: mainwindow.cpp
===================================================================
--- mainwindow.cpp (revision 1022777)
+++ mainwindow.cpp (working copy)
@@ -62,19 +62,24 @@
{
// now that the Part is loaded, we cast it to a Part to get
// our hands on it
+ kDebug(5970) << "calling factory->create";
m_part = static_cast<KParts::ReadWritePart *>
(factory->create(this, "ktimetrackerpart" ));
+ kDebug(5970) << "called factory->create";
+ //((TimetrackerWidget*) (m_part->widget()))->
+
if (m_part)
{
// tell the KParts::MainWindow that this is indeed
// the main widget
setCentralWidget(m_part->widget());
- ((TimetrackerWidget) (m_part->widget())).openFile(icsfile);
+ kDebug(5970) << "icsfile is "<<icsfile;
connect(configureAction, SIGNAL(triggered(bool)),
m_part->widget(), SLOT(showSettingsDialog()));
((TimetrackerWidget *) (m_part->widget()))->setupActions( actionCollection() );
- setupGUI();
+ ((TimetrackerWidget *) (m_part->widget()))->openFile(icsfile);
+ setupGUI();
}
}
else
Index: ktimetrackerpart.h
===================================================================
--- ktimetrackerpart.h (revision 1022777)
+++ ktimetrackerpart.h (working copy)
@@ -53,6 +53,7 @@
public:
ktimetrackerpart(QWidget *parentWidget, QObject *parent, const QVariantList&);
+ QString openfile(QString filename=QString());
TimetrackerWidget* MainWidget() { return mMainWidget; };
virtual ~ktimetrackerpart();
Index: timetrackerwidget.cpp
===================================================================
--- timetrackerwidget.cpp (revision 1022777)
+++ timetrackerwidget.cpp (working copy)
@@ -591,7 +591,7 @@
{
taskView = qobject_cast< TaskView* >( d->mTabWidget->widget( i ) );
- if ( taskView->activeTasks().count() == 0 )
+ if ( taskView && taskView->activeTasks().count() == 0 )
{
d->mTabWidget->setTabTextColor( i, palette().color( QPalette::Foreground ) );
}
Index: karmstorage.cpp
===================================================================
--- karmstorage.cpp (revision 1022777)
+++ karmstorage.cpp (working copy)
@@ -88,7 +88,7 @@
// loads data from filename into view. If no filename is given, filename from preferences is used.
// filename might be of use if this program is run as embedded konqueror plugin.
{
- kDebug(5970) << "Entering function";
+ kDebug(5970) << "Entering function. filename=" << fileName;
QString err;
KEMailSettings settings;
QString lFileName = fileName;
@@ -134,8 +134,8 @@
QObject::connect (d->mCalendar, SIGNAL(resourceChanged(ResourceCalendar *)),
view, SLOT(iCalFileModified(ResourceCalendar *)));
- d->mCalendar->setTimeSpec( KSystemTimeZones::local() );
- d->mCalendar->setResourceName( QString::fromLatin1("KTimeTracker") );
+ //d->mCalendar->setTimeSpec( KSystemTimeZones::local() );
+ //d->mCalendar->setResourceName( QString::fromLatin1("KTimeTracker") );
d->mCalendar->open();
d->mCalendar->load();
Index: timetrackerwidget.h
===================================================================
--- timetrackerwidget.h (revision 1022777)
+++ timetrackerwidget.h (working copy)
@@ -49,10 +49,10 @@
This function checks all (TaskView) mTabWidget->widget() to see if any task is open.
*/
bool allEventsHaveEndTiMe();
-
+ void addTaskView( const QString &fileName = "" );
private:
- void addTaskView( const QString &fileName = "" );
+
/**
Opens a file dialog to save the current taskView.
Now without crashes, but icons are greyed out when starting:
Index: ktimetrackerpart.cpp
===================================================================
--- ktimetrackerpart.cpp (revision 1025934)
+++ ktimetrackerpart.cpp (working copy)
@@ -60,10 +60,8 @@
setWidget( mMainWidget );
setXMLFile( "ktimetrackerui.rc" );
makeMenus();
- mMainWidget->openFile( KStandardDirs::locateLocal( "data",
- QString::fromLatin1( "ktimetracker/ktimetracker.ics" ) ) );
- emit setWindowCaption( KStandardDirs::locateLocal( "data", QString::fromLatin1( "ktimetracker/ktimetracker.ics" ) ) );
+
if ( KTimeTrackerSettings::trayIcon() ) mTray = new TrayIcon( this );
else mTray = new TrayIcon( );
Index: mainwindow.cpp
===================================================================
--- mainwindow.cpp (revision 1025934)
+++ mainwindow.cpp (working copy)
@@ -70,7 +70,7 @@
// tell the KParts::MainWindow that this is indeed
// the main widget
setCentralWidget(m_part->widget());
- ((TimetrackerWidget) (m_part->widget())).openFile(icsfile);
+ ((TimetrackerWidget *) (m_part->widget()))->openFile(icsfile);
connect(configureAction, SIGNAL(triggered(bool)),
m_part->widget(), SLOT(showSettingsDialog()));
((TimetrackerWidget *) (m_part->widget()))->setupActions( actionCollection() );
Index: timetrackerwidget.cpp
===================================================================
--- timetrackerwidget.cpp (revision 1025934)
+++ timetrackerwidget.cpp (working copy)
@@ -434,7 +434,7 @@
bool TimetrackerWidget::closeFile()
{
kDebug(5970) << "Entering TimetrackerWidget::closeFile";
- TaskView *taskView = qobject_cast< TaskView* >( d->mTabWidget->currentWidget() );
+ TaskView *taskView = (TaskView*)( d->mTabWidget->currentWidget() );
// is it an unsaved file?
if ( d->mIsNewVector.contains( taskView ) )
@@ -531,7 +531,7 @@
kDebug(5970) << "Entering TimetrackerWidget::closeAllFiles";
while ( d->mTabWidget->count() > 0 )
{
- TaskView *taskView = qobject_cast< TaskView* >( d->mTabWidget->widget( 0 ) );
+ TaskView *taskView = (TaskView*)( d->mTabWidget->widget( 0 ) );
d->mTabWidget->setCurrentWidget( taskView );
taskView->stopAllTimers();
if ( !( closeFile() ) )
@@ -589,8 +589,7 @@
TaskView *taskView;
for ( int i = 0; i < d->mTabWidget->count(); ++i )
{
- taskView = qobject_cast< TaskView* >( d->mTabWidget->widget( i ) );
-
+ taskView = (TaskView*)( d->mTabWidget->widget( i ) );
if ( taskView->activeTasks().count() == 0 )
{
d->mTabWidget->setTabTextColor( i, palette().color( QPalette::Foreground ) );
@@ -624,7 +623,7 @@
void TimetrackerWidget::slotAddTask( const QString &taskName )
{
- TaskView *taskView = qobject_cast< TaskView* >( d->mTabWidget->currentWidget() );
+ TaskView *taskView = (TaskView*)( d->mTabWidget->currentWidget() );
taskView->addTask( taskName, 0, 0, DesktopList(), 0 );
SVN commit 1026062 by tstaerk: Some code cleanup, e.g. do setCaption next to oPenFile(). CCBUGS:194865 --Thi line, and those below, will be ignored-- M ktimetracker/mainwindow.cpp M ktimetracker/timetrackerwidget.cpp M +2 -2 mainwindow.cpp M +4 -5 timetrackerwidget.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1026062 SVN commit 1026234 by tstaerk: Allow handing over a parameter to work on a specific iCalendar file. This stopped working when mainwindow became a mere KParts::MainWindow. I guess this cost 24 man hours programming time. BUGS:194865 M +29 -26 ktimetrackerpart.cpp M +8 -2 ktimetrackerpart.h M +2 -2 mainwindow.cpp M +2 -2 mainwindow.h WebSVN link: http://websvn.kde.org/?view=rev&revision=1026234 SVN commit 1026315 by tstaerk: Allow handing over a parameter to work on a specific iCalendar file. Backport of 1026234. CCBUGS:194865 M +29 -32 ktimetrackerpart.cpp M +8 -2 ktimetrackerpart.h M +2 -2 mainwindow.cpp M +2 -2 mainwindow.h M +1 -1 version.h WebSVN link: http://websvn.kde.org/?view=rev&revision=1026315 |