author | alwin <alwin> | 2004-03-02 14:00:39 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-03-02 14:00:39 (UTC) |
commit | 12dd57c04b42d4517061ed847b1aa041dd8af841 (patch) (side-by-side diff) | |
tree | afbd18d5b439138256d27aecec7ef993d74a0bd7 | |
parent | ac3e7c0a1ccbb984f06917ebe6156b1681b7de7f (diff) | |
download | opie-12dd57c04b42d4517061ed847b1aa041dd8af841.zip opie-12dd57c04b42d4517061ed847b1aa041dd8af841.tar.gz opie-12dd57c04b42d4517061ed847b1aa041dd8af841.tar.bz2 |
fixed up todlist to work again. The segfault resulted due a real ugly code-style:
Never, realy never, use "using namespace <...>" inside a include file.
Ever use "Opie::<class>" or such inside include files. Think twice, before using
a "use namespace <...>" inside a c++ file. If you're using it just 3,4 times,
write "Opie::<class>::<variable>" or such. If you just simple write a using
namespace all the time it makes the idea of namespaces obsolete. Mostly: just
integrate your OWN namespace (in that case use namespace Todo;) - but try
to use all other namespaces the explicit way - so you will sure that the compiler
inherits the right methods.
ToDo: write this statement into the developer wiki
-rw-r--r-- | core/pim/todo/mainwindow.cpp | 2 | ||||
-rw-r--r-- | core/pim/todo/mainwindow.h | 8 | ||||
-rw-r--r-- | core/pim/todo/quickeditimpl.cpp | 2 |
3 files changed, 5 insertions, 7 deletions
diff --git a/core/pim/todo/mainwindow.cpp b/core/pim/todo/mainwindow.cpp index a244e58..c2f422d 100644 --- a/core/pim/todo/mainwindow.cpp +++ b/core/pim/todo/mainwindow.cpp @@ -35,65 +35,65 @@ #include <qpe/applnk.h> #include <qpe/config.h> #include <qpe/ir.h> #include <qpe/resource.h> #include <qpe/qpemessagebox.h> #include <qpe/alarmserver.h> #include <qpe/qpeapplication.h> #include <qmenubar.h> #include <qmessagebox.h> #include <qpushbutton.h> #include <qaction.h> #include <qtimer.h> #include <qlayout.h> #include <qwhatsthis.h> #include "quickeditimpl.h" #include "todotemplatemanager.h" #include "templateeditor.h" #include "tableview.h" #include "textviewshow.h" #include "todoeditor.h" #include "mainwindow.h" OPIE_EXPORT_APP( OApplicationFactory<Todo::MainWindow> ) using namespace Todo; MainWindow::MainWindow( QWidget* parent, const char* name, WFlags ) - : OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) + : Opie::OPimMainWindow( "Todolist", parent, name, WType_TopLevel | WStyle_ContextHelp ) { if (!name) setName("todo window"); m_syncing = false; m_showing = false; m_counter = 0; m_tempManager = new TemplateManager(); m_tempManager->load(); initUI(); initConfig(); initViews(); initActions(); initEditor(); initShow(); initTemplate(); populateTemplates(); raiseCurrentView(); QTimer::singleShot(0, this, SLOT(populateCategories() ) ); } void MainWindow::initTemplate() { m_curTempEd = new TemplateEditor( this, templateManager() ); } void MainWindow::initActions() { // Data menu m_edit->insertItem(QWidget::tr("New from template"), m_template, -1, 0 ); QAction* a = new QAction( QWidget::tr("New Task" ), Resource::loadPixmap( "new" ), diff --git a/core/pim/todo/mainwindow.h b/core/pim/todo/mainwindow.h index 6a7296b..b35a42b 100644 --- a/core/pim/todo/mainwindow.h +++ b/core/pim/todo/mainwindow.h @@ -20,75 +20,73 @@ -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-=` this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef TODO_MAIN_WINDOW_H #define TODO_MAIN_WINDOW_H #include <qlist.h> #include <opie2/otodoaccess.h> #include <opie2/opimtodo.h> #include <opie2/opimmainwindow.h> #include <opie2/owidgetstack.h> #include "smalltodo.h" #include "todoview.h" #include "quickedit.h" #include "todomanager.h" class QPopupMenu; class QMenuBar; class QToolBar; class QAction; class Ir; class QVBox; class QLineEdit; -using namespace Opie; - namespace Todo { typedef TodoView View; class TemplateManager; class Editor; class TodoShow; class TemplateEditor; struct QuickEditBase; - class MainWindow : public OPimMainWindow { + class MainWindow : public Opie::OPimMainWindow { Q_OBJECT friend class TodoView; // avoid QObject here.... friend class TodoShow; // avoid QObject public: /* OApplicationFactory application Name */ static QString appName() { return QString::fromLatin1("todolist"); } MainWindow( QWidget *parent = 0, const char* name = 0, WFlags fl = 0 ); ~MainWindow(); /** return a context menu for an OPimTodo */ QPopupMenu* contextMenu(int uid, bool doesRecur = FALSE ); QPopupMenu* options(); QPopupMenu* edit(); QToolBar* toolbar(); void updateList(); OPimTodoAccess::List list()const; OPimTodoAccess::List sorted( bool asc, int sortOrder ); OPimTodoAccess::List sorted( bool asc, int sortOrder, int addFilter ); OPimTodo event(int uid ); bool isSyncing()const; bool showCompleted()const; bool showDeadline()const; bool showOverDue()const; bool showQuickTask()const; QString currentCategory()const; int currentCatId(); @@ -115,99 +113,99 @@ private slots: void connectBase( ViewBase* ); void initUI(); void initActions(); void initConfig(); void initViews(); void initEditor(); void initShow(); void initTemplate(); void raiseCurrentView(); ViewBase* currentView(); ViewBase* m_curView; bool m_showing : 1; // used to see if we show a todo in the cases we shouldn't change the table QuickEditBase* m_curQuick; Editor* m_curEdit; TodoShow* currentShow(); TodoShow* m_curShow; TemplateEditor* currentTemplateEditor(); TemplateEditor* m_curTempEd; QMenuBar* m_bar; QToolBar* m_tool; QAction* m_editAction, *m_deleteAction, *m_findAction, *m_completedAction, *m_showDeadLineAction, *m_deleteAllAction, *m_deleteCompleteAction, *m_duplicateAction, *m_showOverDueAction, *m_showQuickTaskAction, *m_effectiveAction; - OWidgetStack *m_stack; + Opie::OWidgetStack *m_stack; QPopupMenu* m_catMenu, *m_edit, *m_options, *m_template; bool m_syncing:1; bool m_deadline:1; bool m_completed:1; bool m_overdue:1; bool m_quicktask:1; TodoManager m_todoMgr; QString m_curCat; QList<ViewBase> m_views; uint m_counter; TemplateManager* m_tempManager; private slots: void slotShow(int); void slotEdit(int); void slotUpdate3( QWidget* ); void slotComplete( int uid ); void slotComplete( const OPimTodo& ev ); void slotNewFromTemplate(int id ); void slotNew(); void slotDuplicate(); void slotDelete(); void slotDelete(int uid ); void slotDeleteAll(); void slotDeleteCompleted(); void slotEdit(); void slotFind(); void setCategory( int ); void slotShowDeadLine( bool ); void slotShowCompleted( bool ); void slotShowQuickTask( bool ); void setDocument( const QString& ); void slotBeam(); void beamDone( Ir* ); void slotShowDetails(); void slotShowNext(); void slotShowPrev(); void slotShowDue( bool ); void slotReturnFromView(); // for TodoShow... /* reimplementation from opimmainwindow */ protected slots: void flush(); void reload(); int create(); bool remove( int uid ); void beam(int uid); void show( int uid ); void edit( int uid ); - void add( const OPimRecord& ); + void add( const Opie::OPimRecord& ); void doAlarm( const QDateTime& dt, int uid ); }; } #endif diff --git a/core/pim/todo/quickeditimpl.cpp b/core/pim/todo/quickeditimpl.cpp index cd0684f..94ae97e 100644 --- a/core/pim/todo/quickeditimpl.cpp +++ b/core/pim/todo/quickeditimpl.cpp @@ -1,56 +1,56 @@ #include <qaction.h> #include <qlineedit.h> #include <qwhatsthis.h> #include <qpe/resource.h> #include <opie2/oclickablelabel.h> #include "mainwindow.h" #include "quickeditimpl.h" QuickEditImpl::QuickEditImpl( QWidget* parent, bool visible ) : QToolBar( (QMainWindow *)parent ), Todo::QuickEdit( (Todo::MainWindow *)parent ) { setHorizontalStretchable( TRUE ); // Load priority icons // TODO - probably should be done globally somewhere else, // see also tableview.cpp/h, taskeditoroverview.cpp/h priority1 = Resource::loadPixmap( "todo/priority1" ); priority3 = Resource::loadPixmap( "todo/priority3" ); priority5 = Resource::loadPixmap( "todo/priority5" ); - m_lbl = new OClickableLabel( this ); + m_lbl = new Opie::OClickableLabel( this ); m_lbl->setMinimumWidth( 15 ); m_lbl->setPixmap( priority3 ); connect(m_lbl, SIGNAL(clicked() ), this, SLOT(slotPrio()) ); QWhatsThis::add( m_lbl, QWidget::tr( "Click here to set the priority of new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); m_edit = new QLineEdit( this ); setStretchableWidget( m_edit ); QWhatsThis::add( m_edit, QWidget::tr( "Enter description of new task here.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); /* * it's not implemented and won't be implemented for 1.0 */ #if 0 QAction *a = new QAction( QWidget::tr( "More" ), Resource::loadPixmap( "todo/more" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotMore() ) ); a->addTo( this ); a->setWhatsThis( QWidget::tr( "Click here to enter additional information for new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); #endif QAction *a = new QAction( QWidget::tr( "Enter" ), Resource::loadPixmap( "enter" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotEnter() ) ); a->addTo( this ); a->setWhatsThis( QWidget::tr( "Click here to add new task.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); a = new QAction( QWidget::tr( "Cancel" ), Resource::loadPixmap( "close" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotCancel() ) ); a->addTo( this ); a->setWhatsThis( QWidget::tr( "Click here to reset new task information.\n\nThis area is called the quick task bar.\n\nIt allows you to quickly add a new task to your list. This area can be shown or hidden by selecting Options->'Show quick task bar' from the menu above." ) ); m_visible = visible; if ( !m_visible ) { hide(); |