summaryrefslogtreecommitdiff
authorthufir <thufir>2002-10-05 17:49:18 (UTC)
committer thufir <thufir>2002-10-05 17:49:18 (UTC)
commit39d6aaa554efe1fbeffa3e3fe966f6d4f446c123 (patch) (unidiff)
tree19924095d125fbda2d881046491b2adc5ad60398
parentfbe0200df248c5b6677483c4f42a801002bb151e (diff)
downloadopie-39d6aaa554efe1fbeffa3e3fe966f6d4f446c123.zip
opie-39d6aaa554efe1fbeffa3e3fe966f6d4f446c123.tar.gz
opie-39d6aaa554efe1fbeffa3e3fe966f6d4f446c123.tar.bz2
fixed bug #252
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/ChangeLog4
-rw-r--r--noncore/apps/opie-sheet/sheet.cpp1
2 files changed, 5 insertions, 0 deletions
diff --git a/noncore/apps/opie-sheet/ChangeLog b/noncore/apps/opie-sheet/ChangeLog
index d3c5c84..c12a6db 100644
--- a/noncore/apps/opie-sheet/ChangeLog
+++ b/noncore/apps/opie-sheet/ChangeLog
@@ -1,21 +1,25 @@
1October 05, 2002
2
3 - Fixed bug #252. (by thufir)
4
1August 31, 2002 5August 31, 2002
2 6
3 - Fixed and updated opie-sheet.pro file. (by cniehaus) 7 - Fixed and updated opie-sheet.pro file. (by cniehaus)
4 8
5August 01, 2002 9August 01, 2002
6 10
7 - Fixed gcc3 compile problems. (by harlekin) 11 - Fixed gcc3 compile problems. (by harlekin)
8 12
9July 06, 2002 13July 06, 2002
10 14
11 - Fixed DocLnk management to save documents correctly. (by leseb) 15 - Fixed DocLnk management to save documents correctly. (by leseb)
12 16
13July 04, 2002 17July 04, 2002
14 18
15 * Release 1.0.1 (by thufir) 19 * Release 1.0.1 (by thufir)
16 - Sheet/Qt is now a part of Opie, so its name is changed to Opie Sheet. (by thufir) 20 - Sheet/Qt is now a part of Opie, so its name is changed to Opie Sheet. (by thufir)
17 - Fixed sorting bug. (by thufir) 21 - Fixed sorting bug. (by thufir)
18 22
19April 14, 2002 23April 14, 2002
20 24
21 * Release 1.0.0 (by thufir) 25 * Release 1.0.0 (by thufir)
diff --git a/noncore/apps/opie-sheet/sheet.cpp b/noncore/apps/opie-sheet/sheet.cpp
index 2279191..be4046b 100644
--- a/noncore/apps/opie-sheet/sheet.cpp
+++ b/noncore/apps/opie-sheet/sheet.cpp
@@ -1,81 +1,82 @@
1/*************************************************************************** 1/***************************************************************************
2 * * 2 * *
3 * This program is free software; you can redistribute it and/or modify * 3 * This program is free software; you can redistribute it and/or modify *
4 * it under the terms of the GNU General Public License as published by * 4 * it under the terms of the GNU General Public License as published by *
5 * the Free Software Foundation; either version 2 of the License, or * 5 * the Free Software Foundation; either version 2 of the License, or *
6 * (at your option) any later version. * 6 * (at your option) any later version. *
7 * * 7 * *
8 ***************************************************************************/ 8 ***************************************************************************/
9 9
10/* 10/*
11 * Opie Sheet (formerly Sheet/Qt) 11 * Opie Sheet (formerly Sheet/Qt)
12 * by Serdar Ozler <sozler@sitebest.com> 12 * by Serdar Ozler <sozler@sitebest.com>
13 */ 13 */
14 14
15#include "sheet.h" 15#include "sheet.h"
16 16
17#include <qmainwindow.h> 17#include <qmainwindow.h>
18#include <qmessagebox.h> 18#include <qmessagebox.h>
19#include <math.h> 19#include <math.h>
20 20
21#define DEFAULT_COL_WIDTH 50 21#define DEFAULT_COL_WIDTH 50
22 22
23Sheet::Sheet(int numRows, int numCols, QWidget *parent) 23Sheet::Sheet(int numRows, int numCols, QWidget *parent)
24 :QTable(numRows, numCols, parent) 24 :QTable(numRows, numCols, parent)
25{ 25{
26 defaultBorders.right=defaultBorders.bottom=QPen(Qt::gray, 1, Qt::SolidLine); 26 defaultBorders.right=defaultBorders.bottom=QPen(Qt::gray, 1, Qt::SolidLine);
27 defaultCellData.data=""; 27 defaultCellData.data="";
28 defaultCellData.background=QBrush(Qt::white, Qt::SolidPattern); 28 defaultCellData.background=QBrush(Qt::white, Qt::SolidPattern);
29 defaultCellData.alignment=(Qt::AlignmentFlags)(Qt::AlignLeft | Qt::AlignTop); 29 defaultCellData.alignment=(Qt::AlignmentFlags)(Qt::AlignLeft | Qt::AlignTop);
30 defaultCellData.fontColor=Qt::black; 30 defaultCellData.fontColor=Qt::black;
31 defaultCellData.font=font(); 31 defaultCellData.font=font();
32 defaultCellData.borders=defaultBorders; 32 defaultCellData.borders=defaultBorders;
33 33
34 clicksLocked=FALSE;
34 selectionNo=-1; 35 selectionNo=-1;
35 setSelectionMode(QTable::Single); 36 setSelectionMode(QTable::Single);
36 37
37 sheetData.setAutoDelete(TRUE); 38 sheetData.setAutoDelete(TRUE);
38 clipboardData.setAutoDelete(TRUE); 39 clipboardData.setAutoDelete(TRUE);
39 for (int i=0; i<numCols; ++i) 40 for (int i=0; i<numCols; ++i)
40 horizontalHeader()->setLabel(i, getHeaderString(i+1), DEFAULT_COL_WIDTH); 41 horizontalHeader()->setLabel(i, getHeaderString(i+1), DEFAULT_COL_WIDTH);
41 42
42 connect(this, SIGNAL(currentChanged(int, int)), this, SLOT(slotCellSelected(int, int))); 43 connect(this, SIGNAL(currentChanged(int, int)), this, SLOT(slotCellSelected(int, int)));
43 connect(this, SIGNAL(valueChanged(int, int)), this, SLOT(slotCellChanged(int, int))); 44 connect(this, SIGNAL(valueChanged(int, int)), this, SLOT(slotCellChanged(int, int)));
44} 45}
45 46
46Sheet::~Sheet() 47Sheet::~Sheet()
47{ 48{
48} 49}
49 50
50typeCellData *Sheet::findCellData(int row, int col) 51typeCellData *Sheet::findCellData(int row, int col)
51{ 52{
52 typeCellData *tempCellData; 53 typeCellData *tempCellData;
53 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next()) 54 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next())
54 if (tempCellData->row==row && tempCellData->col==col) 55 if (tempCellData->row==row && tempCellData->col==col)
55 return tempCellData; 56 return tempCellData;
56 return NULL; 57 return NULL;
57} 58}
58 59
59void Sheet::slotCellSelected(int row, int col) 60void Sheet::slotCellSelected(int row, int col)
60{ 61{
61 typeCellData *cellData=findCellData(row, col); 62 typeCellData *cellData=findCellData(row, col);
62 if (cellData) 63 if (cellData)
63 emit currentDataChanged(cellData->data); 64 emit currentDataChanged(cellData->data);
64 else 65 else
65 emit currentDataChanged(""); 66 emit currentDataChanged("");
66} 67}
67 68
68typeCellData *Sheet::createCellData(int row, int col) 69typeCellData *Sheet::createCellData(int row, int col)
69{ 70{
70 if (row<0 || col<0) return NULL; 71 if (row<0 || col<0) return NULL;
71 typeCellData *cellData=new typeCellData; 72 typeCellData *cellData=new typeCellData;
72 cellData->row=row; 73 cellData->row=row;
73 cellData->col=col; 74 cellData->col=col;
74 cellData->data=defaultCellData.data; 75 cellData->data=defaultCellData.data;
75 cellData->borders=defaultCellData.borders; 76 cellData->borders=defaultCellData.borders;
76 cellData->alignment=defaultCellData.alignment; 77 cellData->alignment=defaultCellData.alignment;
77 cellData->font=defaultCellData.font; 78 cellData->font=defaultCellData.font;
78 cellData->fontColor=defaultCellData.fontColor; 79 cellData->fontColor=defaultCellData.fontColor;
79 cellData->background=defaultCellData.background; 80 cellData->background=defaultCellData.background;
80 sheetData.append(cellData); 81 sheetData.append(cellData);
81 return cellData; 82 return cellData;