From 74d0e81facb652eecd9c0684d7fa69a51471f4bc Mon Sep 17 00:00:00 2001 From: cniehaus Date: Sun, 15 Sep 2002 14:24:54 +0000 Subject: hope it works now. Sorry for multi-commits --- (limited to 'noncore') diff --git a/noncore/apps/checkbook/qcheckbook.h b/noncore/apps/checkbook/qcheckbook.h deleted file mode 100644 index 52c0d40..0000000 --- a/noncore/apps/checkbook/qcheckbook.h +++ b/dev/null @@ -1,37 +0,0 @@ -#include "qcheckview.h" -#include "qcheckgraph.h" -#include "qcheckmainmenu.h" - -#include -#include -#include -#include -#include "config.h" -#include - -class QCheckBook : public QMainWindow -{ - Q_OBJECT - public: - QCheckBook(); - private slots: - void newCheck(const QString &filename); - void newGraph(); - void close(); - void initMainMenus(); - private: - QCheckView *m_view; - QCheckGraph *m_view2; - QCheckMainMenu *m_view3; - QToolBar *bar; - QMenuBar *mbar; - int filemenuid; - QString m_filename; - QToolButton *nb1; - QToolButton *nb2; - QToolButton *nb3; - QToolButton *nb4; - bool initCheck; - bool initMM; - QPopupMenu *popup; -}; diff --git a/noncore/apps/checkbook/qcheckentrybase.ui b/noncore/apps/checkbook/qcheckentrybase.ui deleted file mode 100644 index efc35ff..0000000 --- a/noncore/apps/checkbook/qcheckentrybase.ui +++ b/dev/null @@ -1,610 +0,0 @@ - -QCheckEntryBase - - QDialog - - name - QCheckEntryBase - - - geometry - - 0 - 0 - 224 - 291 - - - - caption - Account Transaction - - - layoutMargin - - - layoutSpacing - - - - margin - 5 - - - spacing - 2 - - - - name - Spacer3 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - - name - Spacer5 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - QLabel - - name - TextLabel6 - - - font - - adobe-helvetica - 1 - - - - text - $ - - - - - name - Spacer8 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - QLabel - - name - TextLabel2 - - - text - Category: - - - - - name - Spacer7 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - - name - Spacer4 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - - name - Spacer6 - - - orientation - Horizontal - - - sizeType - Expanding - - - sizeHint - - 20 - 20 - - - - - QRestrictedLine - - name - transAmount - - - - QLabel - - name - TextLabel1 - - - text - Description: - - - - QLabel - - name - TextLabel3 - - - text - Type: - - - - QLabel - - name - TextLabel5 - - - text - Amount: - - - - QComboBox - - - text - Automobile - - - - - text - Bills - - - - - text - CDs - - - - - text - Clothing - - - - - text - Computer - - - - - text - DVDs - - - - - text - Eletronics - - - - - text - Entertainment - - - - - text - Food - - - - - text - Gasoline - - - - - text - Misc - - - - - text - Movies - - - - - text - Rent - - - - - text - Travel - - - - name - cmbCategory - - - editable - true - - - currentItem - 0 - - - autoCompletion - true - - - duplicatesEnabled - false - - - - QLabel - - name - TextLabel4 - - - text - Check Number: - - - - QLabel - - name - TextLabel6_2 - - - font - - adobe-helvetica - 1 - - - - text - $ - - - - QRestrictedLine - - name - transFee - - - - QLabel - - name - TextLabel7 - - - text - Extra Fee: - - - - QLabel - - name - TextLabel8 - - - text - Additional Notes: - - - - QComboBox - - name - descriptionCombo - - - editable - true - - - maxCount - 10 - - - insertionPolicy - BeforeCurrent - - - autoCompletion - true - - - duplicatesEnabled - false - - - - QLabel - - name - TextLabel9 - - - minimumSize - - 0 - 0 - - - - maximumSize - - 32767 - 32767 - - - - caption - - - - text - Date: - - - - QRestrictedLine - - name - dateEdit - - - - QRestrictedLine - - name - checkNumber - - - - QComboBox - - - text - Debit Charge - - - - - text - Written Check - - - - - text - Transfer - - - - - text - Credit Card - - - - name - transType - - - - QMultiLineEdit - - name - additionalNotes - - - - QButtonGroup - - name - ButtonGroup3 - - - sizePolicy - - 7 - 7 - - - - title - - - - layoutMargin - - - layoutSpacing - - - - margin - 4 - - - spacing - 0 - - - QRadioButton - - name - deposit - - - sizePolicy - - 1 - 1 - - - - text - Deposit - - - - QRadioButton - - name - payment - - - sizePolicy - - 1 - 1 - - - - text - Payment - - - checked - true - - - - - - - - - QRestrictedLine -
qrestrictedline.h
- - -1 - -1 - - 0 - - 5 - 5 - - image0 -
-
- - - image0 - 789c6dd23b0ec2300c00d03da7b0e22d42e9476c88232031222186c80c3074813220c4dd214dddd84dac0e759fe2386e1a07a7e3015c639e6318ef04740b0f70d7d730bccf97fdc7d8be87f8406737c62210606869dbb531f531a57f4a299d03a7e06c11cca1055508412c2889acc2ef425423b34840a645f28244936860d2c265d7923bae8b2f05cb35a91739002d2b5727d535cbe954a43ad1e22f700755caf7407cf4799fe286c47dbe3bf303014167a2 - - - - payment - descriptionCombo - cmbCategory - transType - additionalNotes - -
diff --git a/noncore/apps/checkbook/qcheckgraph.cpp b/noncore/apps/checkbook/qcheckgraph.cpp deleted file mode 100644 index 5b21ad8..0000000 --- a/noncore/apps/checkbook/qcheckgraph.cpp +++ b/dev/null @@ -1,258 +0,0 @@ -#include "qcheckgraph.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QCheckGraph::QCheckGraph(const QString filename) - : QCheckGraphBase() -{ - QMenuBar *bar = new QMenuBar(this); - bar->setMargin(0); - QPopupMenu *popup = new QPopupMenu; - popup->insertItem("&Save Graph...", this, SLOT(saveGraphAsPicture())); - bar->insertItem("&File", popup); - - pixmapready = false; - config = new Config(filename, Config::File); - QString forresult = ""; - QString forresult2 = ""; - int i = 1; - for (; forresult != "Not Found"; i++) - { - config->setGroup(QString::number(i)); - forresult = config->readEntry("Description", QString("Not Found")); - forresult2 = config->readEntry("Category", QString("Not Found")); - if (forresult != "Not Found") - { - if (list.contains(forresult2) == 0) - { - config->setGroup("Totals"); - QString larger = config->readEntry("Spent", QString("no")); - QString smaller = config->readEntry(forresult2, QString("no")); - if (larger != "no" && smaller != "no") - { - list << forresult2; - QString percentage = calculator(smaller, larger, true); - - // Here we calculate how many pixels tall it will be by multiplying it by 200. - QString pixels = calculator(percentage, QString("200"), false); - - // This is done because it really doesn't need to have a decimal... just an int, and - // QString rounds doubles up to the nearest whole number in order to convert - // to an int (which is correct). - pixels = pixels.remove(pixels.find('.'), pixels.length()); - - if (pixels.toInt() <= 5) - { - pixels = "6"; - } - - list2 << pixels; - } - } - } else { - continue; - } - // We want to break this loop on the 7th (remember, starts at 0->6 == 7) item. - if (list.count() == 6) - { - break; - } - } - for (QStringList::Iterator it = list.begin(); it != list.end(); it++) - { - if ((*it).length() > 11) - { - (*it).truncate(8); - (*it).append("..."); - } - } - graphPixmap(); -} - -void QCheckGraph::graphPixmap() -{ - pixmapready = false; - graph = QPixmap(240,250); - QPainter p; - p.begin(&graph); - p.fillRect(0, 0, 240, 300, QColor(255,255,255)); - // Draw the graph lines - - // Y - p.drawLine( 40, 50, 40, 252 ); - - // X - p.drawLine( 40, 252, 203, 252 ); - - // Y stepup lines - p.drawLine( 40, 50, 37, 50); - p.drawLine( 40, 70, 37, 70); - p.drawLine( 40, 90, 37, 90); - p.drawLine( 40, 110, 37, 110); - p.drawLine( 40, 130, 37, 130); - p.drawLine( 40, 150, 37, 150); - p.drawLine( 40, 170, 37, 170); - p.drawLine( 40, 190, 37, 190); - p.drawLine( 40, 210, 37, 210); - p.drawLine( 40, 230, 37, 230); - p.drawLine( 40, 245, 37, 245); - - - // Y stepup values - p.drawText((35 - p.fontMetrics().width("100")), (50 + (p.fontMetrics().height() / 2)), "100"); - p.drawText((35 - p.fontMetrics().width("90")), (70 + (p.fontMetrics().height() / 2)), "90"); - p.drawText((35 - p.fontMetrics().width("80")), (90 + (p.fontMetrics().height() / 2)), "80"); - p.drawText((35 - p.fontMetrics().width("70")), (110 + (p.fontMetrics().height() / 2)), "70"); - p.drawText((35 - p.fontMetrics().width("60")), (130 + (p.fontMetrics().height() / 2)), "60"); - p.drawText((35 - p.fontMetrics().width("50")), (150 + (p.fontMetrics().height() / 2)), "50"); - p.drawText((35 - p.fontMetrics().width("40")), (170 + (p.fontMetrics().height() / 2)), "40"); - p.drawText((35 - p.fontMetrics().width("30")), (190 + (p.fontMetrics().height() / 2)), "30"); - p.drawText((35 - p.fontMetrics().width("20")), (210 + (p.fontMetrics().height() / 2)), "20"); - p.drawText((35 - p.fontMetrics().width("10")), (230 + (p.fontMetrics().height() / 2)), "10"); - p.drawText((35 - p.fontMetrics().width("<10")), (245 + (p.fontMetrics().height() / 2)), "<10"); - - // Draw the axis[sic?] labels - QString ylabel = "Percentage"; - int pixel = 100; - for (unsigned int i = 0; i != ylabel.length(); i++) - { - p.setBrush(QColor(0,0,0)); - p.drawText(5,pixel, QString(ylabel[i])); - pixel = pixel + p.fontMetrics().height(); - } - p.drawText(95, 265, "Category"); - - int i = 0; - // Hack: Using if()'s... switch was acting all wierd :{ - QStringList::Iterator it2 = list2.begin(); - for (QStringList::Iterator it = list.begin(); it != list.end(); it++) - { - qWarning(QString::number(i)); - if (i ==0) - { - // For the color code: - p.setBrush(QColor(255,0,0)); - p.drawRect(8,12, 8, 8); - - // Now the text: - p.setBrush(QColor(0,0,0)); - p.drawText(18,20, (*it)); - - // Last, but not least, we have the actual bar graph height. - p.setBrush(QColor(255,0,0)); - p.drawRect(47, ((202 - (*it2).toInt()) + 50), 15, (*it2).toInt()); - } - if (i ==1) - { - p.setBrush(QColor(255,255,0)); - p.drawRect(78,12, 8, 8); - - p.setBrush(QColor(0,0,0)); - p.drawText(88,20, (*it)); - - p.setBrush(QColor(255,255,0)); - p.drawRect(70, ((202 - (*it2).toInt()) + 50), 15, (*it2).toInt()); - } - if (i==2) - { - p.setBrush(QColor(0,255,0)); - p.drawRect(153,12, 8, 8); - p.setBrush(QColor(0,0,0)); - p.drawText(163,20, (*it)); - - p.setBrush(QColor(0,255,0)); - p.drawRect(98, ((202 - (*it2).toInt()) + 50), 15, (*it2).toInt()); - } - if (i==3) - { - p.setBrush(QColor(89,12,54)); - p.drawRect(8,27, 8, 8); - p.setBrush(QColor(0,0,0)); - p.drawText(18,35, (*it)); - - p.setBrush(QColor(89,12,54)); - p.drawRect(126, ((202 - (*it2).toInt()) + 50), 15, (*it2).toInt()); - } - if (i==4) - { - p.setBrush(QColor(0,0,255)); - p.drawRect(78,27, 8, 8); - p.setBrush(QColor(0,0,0)); - p.drawText(88,35, (*it)); - p.setBrush(QColor(0,0,255)); - p.drawRect(154, ((202 - (*it2).toInt()) + 50), 15, (*it2).toInt()); - } - if (i==5) - { - p.setBrush(QColor(100,40,0)); - p.drawRect(153,27, 8, 8); - p.setBrush(QColor(0,0,0)); - p.drawText(163,35, (*it)); - p.setBrush(QColor(100,40,0)); - p.drawRect(182, ((202 - (*it2).toInt()) + 50), 15, (*it2).toInt()); - } - i++; - it2++; - } - - p.end(); - pixmapready = true; - graphWidget->setBackgroundPixmap(graph); -} - -QString QCheckGraph::calculator(QString largervalue, QString smallervalue, bool divide) -{ -// largervalue = largervalue.remove(largervalue.find(".", 0, false), 1); -// smallervalue = smallervalue.remove(smallervalue.find(".", 0, false), 1); - - double largercents = largervalue.toDouble(); - double smallercents = smallervalue.toDouble(); - - double finalammount = 0; - - if (divide == true) - { - finalammount = (largercents / smallercents); - } else { - finalammount = (largercents * smallercents); - } - - qWarning(QString::number(finalammount)); - - return QString::number(finalammount); -} - -/*void QCheckGraph::paintEvent(QPaintEvent *e) -{ - if (pixmapready == true) - { - bitBlt((QPaintDevice *)(graphWidget), 0, 0, graph, 0,0); - QWidget::paintEvent(e); - } -} -*/ -void QCheckGraph::saveGraphAsPicture() -{ - QString homedir = QDir::homeDirPath(); - QDate current = QDate::currentDate(); - QString datestring = QString::number(current.month()); - datestring.append(QString::number(current.day())); - datestring.append(QString::number(current.year())); - QString filename = homedir; - filename.append("/Documents/graph"); - filename.append(datestring); - filename.append(".png"); - graph.save(filename, "PNG", 85); - QString graphmessage = "The graph was saved as graph"; - graphmessage.append(datestring); - graphmessage.append(".png. You may access it by returning to your home screen and clicking on the \"Documents\" tab in the upper right hand screen"); - QMessageBox::information(0, "File Saved", graphmessage); -} diff --git a/noncore/apps/checkbook/qcheckgraph.h b/noncore/apps/checkbook/qcheckgraph.h deleted file mode 100644 index 1cafef8..0000000 --- a/noncore/apps/checkbook/qcheckgraph.h +++ b/dev/null @@ -1,25 +0,0 @@ -#include -#include -#include -#include -#include -#include "config.h" - -#include "qcheckgraphbase.h" - -class QCheckGraph : public QCheckGraphBase -{ - Q_OBJECT - public: - QCheckGraph(const QString); - private: - QStringList list; - QStringList list2; - QString calculator(QString larger, QString smaller, bool divide); - QPixmap graph; - void graphPixmap(); - bool pixmapready; - Config *config; - private slots: - void saveGraphAsPicture(); -}; diff --git a/noncore/apps/checkbook/qcheckgraphbase.ui b/noncore/apps/checkbook/qcheckgraphbase.ui deleted file mode 100644 index 2763839..0000000 --- a/noncore/apps/checkbook/qcheckgraphbase.ui +++ b/dev/null @@ -1,62 +0,0 @@ - -QCheckGraphBase - - QDialog - - name - QCheckGraphBase - - - geometry - - 0 - 0 - 236 - 285 - - - - caption - Account Graph - - - - margin - 0 - - - spacing - 0 - - - QWidget - - name - graphWidget - - - - - - - QWidget -
qwidget.h
- - -1 - -1 - - 0 - - 5 - 5 - - image0 -
-
- - - image0 - 789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753 - - -
diff --git a/noncore/apps/checkbook/qcheckmainmenu.cpp b/noncore/apps/checkbook/qcheckmainmenu.cpp deleted file mode 100644 index 2382513..0000000 --- a/noncore/apps/checkbook/qcheckmainmenu.cpp +++ b/dev/null @@ -1,74 +0,0 @@ -#include "qcheckmainmenu.h" -#include "qcheckname.h" - -QCheckMainMenu::QCheckMainMenu(QWidget *parent) - : QCheckMMBase(parent) -{ - init(); -} - -void QCheckMainMenu::init() -{ - lstCheckBooks->clear(); - QString checkdirname = QDir::homeDirPath(); - checkdirname.append("/.checkbooks"); - QDir checkdir(checkdirname); - if (checkdir.exists() == true) - { - QStringList checkbooks = checkdir.entryList("*.qcb", QDir::Files|QDir::Readable|QDir::Writable, QDir::Time); - for (QStringList::Iterator it = checkbooks.begin(); it != checkbooks.end(); it++) - { - (*it) = (*it).remove((*it).find('.'), (*it).length()); - } - lstCheckBooks->insertStringList(checkbooks); - } - lstCheckBooks->clearSelection(); - connect(lstCheckBooks, SIGNAL(clicked(QListBoxItem *)), this, SLOT(slotSelected(QListBoxItem *))); - lstCheckBooks->clearSelection(); -} - -void QCheckMainMenu::slotSelected(QListBoxItem *item) -{ - if (item != 0) - { - QString text = item->text(); - if (text.isEmpty() == false) - { - text.append(".qcb"); - QString checkdirname = QDir::homeDirPath(); - checkdirname.append("/.checkbooks/"); - text.prepend(checkdirname); - emit itemSelected(text); - } - } -} - -void QCheckMainMenu::newClicked() -{ - QString checkname = QCheckName::getName(); - if (checkname.isEmpty() == false) - { - QString checkdirname = QDir::homeDirPath(); - checkdirname.append("/.checkbooks"); - QDir checkdir(checkdirname); - if (checkdir.exists() == false) - { - checkdir.mkdir(checkdirname); - } - checkdirname.append("/"); - checkdirname.append(checkname); - checkdirname.append(".qcb"); - QFile file(checkdirname); - if (file.exists() == false) - { - file.open(IO_WriteOnly); - QTextStream os(&file); - os << ""; - file.close(); - } - QFileInfo fi(file); - QString noextension = fi.fileName(); - noextension = noextension.remove(noextension.find('.'), noextension.length()); - lstCheckBooks->insertItem(noextension); - } -} diff --git a/noncore/apps/checkbook/qcheckmainmenu.h b/noncore/apps/checkbook/qcheckmainmenu.h deleted file mode 100644 index 456d3df..0000000 --- a/noncore/apps/checkbook/qcheckmainmenu.h +++ b/dev/null @@ -1,27 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "qcheckmmbase.h" - -class QCheckMainMenu : public QCheckMMBase -{ - Q_OBJECT - public: - QCheckMainMenu(QWidget *); - signals: - void itemSelected(const QString &); - private: - void init(); - private slots: - void slotSelected(QListBoxItem *); - public slots: - void newClicked(); -}; - diff --git a/noncore/apps/checkbook/qcheckmmbase.ui b/noncore/apps/checkbook/qcheckmmbase.ui deleted file mode 100644 index efde990..0000000 --- a/noncore/apps/checkbook/qcheckmmbase.ui +++ b/dev/null @@ -1,80 +0,0 @@ - -QCheckMMBase - - QWidget - - name - QCheckMMBase - - - geometry - - 0 - 0 - 256 - 311 - - - - caption - Main Menu - - - - margin - 7 - - - spacing - 3 - - - QLabel - - name - TextLabel2 - - - text - Select from the check books below or click the "New" icon in the toolbar. - - - alignment - WordBreak|AlignVCenter|AlignLeft - - - wordwrap - - - - QListBox - - name - lstCheckBooks - - - - - - - QWidget -
qwidget.h
- - -1 - -1 - - 0 - - 5 - 5 - - image0 -
-
- - - image0 - 789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753 - - -
diff --git a/noncore/apps/checkbook/qcheckname.cpp b/noncore/apps/checkbook/qcheckname.cpp deleted file mode 100644 index 0e4d71c..0000000 --- a/noncore/apps/checkbook/qcheckname.cpp +++ b/dev/null @@ -1,36 +0,0 @@ -#include "qcheckname.h" -#include -#include -#include -#include -#include "qrestrictedline.h" - -QCheckName::QCheckName() - : QCheckNameBase() -{ - connect(cmdDone, SIGNAL(clicked()), this, SLOT(clicked())); -} - -QString QCheckName::getName() -{ - QCheckName qcn; - qcn.setWFlags(Qt::WType_Modal); - qcn.leText->setValidChars("abcdefghijklmnopqrstuvwxyz0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - if (qcn.exec() == QDialog::Accepted) - { - return qcn.leText->text(); - } else { - return QString(""); - } -} - -void QCheckName::clicked() -{ - if (leText->text().isEmpty() == false) - { - hide(); - accept(); - } else { - QMessageBox::critical(this, "Missing Information", "Please enter the name of your Check Book and try again."); - } -} diff --git a/noncore/apps/checkbook/qcheckname.h b/noncore/apps/checkbook/qcheckname.h deleted file mode 100644 index c47c4f9..0000000 --- a/noncore/apps/checkbook/qcheckname.h +++ b/dev/null @@ -1,15 +0,0 @@ -#include "qchecknamebase.h" -#include -#include - -class QCheckName : public QCheckNameBase -{ - Q_OBJECT - public: - QCheckName(); - static QString getName(); - private: - QWidget *m_parent; - private slots: - void clicked(); -}; diff --git a/noncore/apps/checkbook/qcheckview.cpp b/noncore/apps/checkbook/qcheckview.cpp deleted file mode 100644 index ddc3fa9..0000000 --- a/noncore/apps/checkbook/qcheckview.cpp +++ b/dev/null @@ -1,458 +0,0 @@ -#include "qcheckview.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QCheckView::QCheckView(QWidget *parent, QString filename) - : QCheckViewBase(parent) -{ - tblTransactions->setHScrollBarMode( QTable::AlwaysOff ); - tblTransactions->setNumRows( 0 ); - tblTransactions->setNumCols( 4 ); - tblTransactions->setShowGrid( FALSE ); - tblTransactions->horizontalHeader()->setLabel(0, "Num", 29); - tblTransactions->horizontalHeader()->setLabel(1, "Description", 81); - tblTransactions->horizontalHeader()->setLabel(2, "Date", 57); - tblTransactions->horizontalHeader()->setLabel(3, "Amount", 59); - tblTransactions->verticalHeader()->hide(); - tblTransactions->setLeftMargin( 0 ); - tblTransactions->setSelectionMode(QTable::NoSelection); - - m_filename = filename; - load(filename); -} - -void QCheckView::deleteClicked(int row, int col) -{ - QStringList existing; - QString rowText = tblTransactions->text(row, 0); - config->setGroup(rowText); - QString originalamount = config->readEntry("Amount", "0.00"); - - config->setGroup("Data"); - int lastCheck = config->readNumEntry("LastCheck", 0); - - qWarning(rowText); - config->setGroup(rowText); - QString payment = config->readEntry("Payment", "true"); - if ( payment == QString("true") && rowText.toInt() <= lastCheck) - { - for(int i = row; i != (lastCheck); i++) - { - config->setGroup(tblTransactions->text(i, 0)); - QString ibalance = config->readEntry("Balance", "0.00"); - // this adds the old amount on to the transaction and then takes the new amount away - QString newbalance = calculator(ibalance, originalamount, false); - config->writeEntry("Balance", newbalance); - - if (i == (lastCheck - 1)) - { - config->setGroup("Totals"); - config->writeEntry("Balance", newbalance); - break; - } - } - QString category = config->readEntry("Category", "Error"); - if (category != QString("Error")) - { - config->setGroup("Totals"); - config->writeEntry("Spent", calculator(config->readEntry("Spent", QString("0")), originalamount, true)); - QString categorytotal = config->readEntry(category, QString("0")); - categorytotal = calculator(categorytotal, originalamount, true); - config->writeEntry(category, categorytotal); - } - } - if ( payment == QString("false") && rowText.toInt() <= lastCheck) - { - for(int i = row; i != (lastCheck); i++) - { - config->setGroup(tblTransactions->text(i, 0)); - QString ibalance = config->readEntry("Balance", "0.00"); - // this subtracts the old amount on to the transaction and then adds the new amount on - QString newbalance = calculator(ibalance, originalamount, true); - config->writeEntry("Balance", newbalance); - - if (i == lastCheck - 1) - { - config->setGroup("Totals"); - config->writeEntry("Balance", newbalance); - break; - } - } - config->setGroup("Totals"); - config->writeEntry("Deposited", calculator(config->readEntry("Deposited", QString("0")), originalamount, true)); - } - for (int i = rowText.toInt(); i != lastCheck; i++) - { - qWarning(QString::number(i +1)); - config->setGroup(QString::number(i +1)); - QString origamount = config->readEntry("Amount", "0"); - qWarning(origamount); - QString origbalance = config->readEntry("Balance", "0"); - QString origchecknumber = config->readEntry("CheckNumber", "0"); - QString origcomments = config->readEntry("Comments", ""); - QString origdate = config->readEntry("Date", "01/01/2000"); - QString origdescription = config->readEntry("Description", "No Description"); - QString origpayment = config->readEntry("Payment", "true"); - QString origtransactionfee = config->readEntry("TransactionFee", "0"); - QString origtype = config->readEntry("Type", "0"); - - if (config->hasKey("Category")) - { - QString origcategory = config->readEntry("Category", "No Category"); - config->removeGroup(); - config->setGroup(QString::number(i)); - config->clearGroup(); - config->writeEntry("Category", origcategory); - } else { - config->removeGroup(); - config->setGroup(QString::number(i)); - config->clearGroup(); - } - config->writeEntry("Amount", origamount); - config->writeEntry("Balance", origbalance); - config->writeEntry("CheckNumber", origchecknumber); - config->writeEntry("Comments", origcomments); - config->writeEntry("Date", origdate); - config->writeEntry("Description", origdescription); - config->writeEntry("Payment", origpayment); - config->writeEntry("TransactionFee", origtransactionfee); - config->writeEntry("Type", origtype); - } - tblTransactions->clearCell(row, col); - labelBalance->setText(QString("$" + config->readEntry("Balance", QString("0.00")))); - config->setGroup("Data"); - config->writeEntry("LastCheck", QString::number(QString(config->readEntry("LastCheck", 0)).toInt() -1)); - config->write(); - delete qcd; - emit reload(m_filename); - -} - -void QCheckView::load(const QString filename) -{ - config = new Config(filename, Config::File); - - connect(tblTransactions, SIGNAL(clicked(int, int, int, const QPoint &)), this, SLOT(tableClicked(int, int, int, const QPoint &))); - - config->setGroup("Totals"); - labelBalance->setText(QString("$" + config->readEntry("Balance", QString("0.00")))); - - config->setGroup("Data"); - int lastCheck = config->readNumEntry("LastCheck", 1); - for (int i = 1; i != (lastCheck + 1); i++) - { - config->setGroup(QString::number(i)); - QString item = config->readEntry("Description", QString("Not Found")); - if (item != "Not Found") - { - QTableItem *qti = new QTableItem(tblTransactions, QTableItem::Never, QString::number(i)); - QTableItem *qti1 = new QTableItem(tblTransactions, QTableItem::Never, config->readEntry("Description", QString("None"))); - QTableItem *qti2 = new QTableItem(tblTransactions, QTableItem::Never, config->readEntry("Date", QString("None"))); - QTableItem *qti3 = new QTableItem(tblTransactions, QTableItem::Never, QString("$" + config->readEntry("Amount", QString("0.00")))); - int row = tblTransactions->numRows(); - tblTransactions->setNumRows(row + 1); - tblTransactions->setItem(row,0, qti); - tblTransactions->setItem(row,1, qti1); - tblTransactions->setItem(row,2, qti2); - tblTransactions->setItem(row,3, qti3); - tblTransactions->updateCell(row, 0); - tblTransactions->updateCell(row, 1); - tblTransactions->updateCell(row, 2); - tblTransactions->updateCell(row, 3); - } - } -} - -void QCheckView::editClicked(int row, int col) -{ - delete qcd; - QStringList existing; - QString rowText = tblTransactions->text(row, 0); - config->setGroup("Data"); - QString recent = config->readEntry("Recent", ""); - - config->setGroup(rowText); - //We need the original amount to add or subtract to check's blanaces written after this edited check - QString originalamount = config->readEntry("Amount", "0.00"); - QString originalcategory = config->readEntry("Category", "None"); - - existing << config->readEntry("Payment", "true") << config->readEntry("Description", "No Description Found") << config->readEntry("Category", "Misc.") << config->readEntry("Type", "0") << config->readEntry("CheckNumber", "0") << originalamount << config->readEntry("TransactionFee", "") << config->readEntry("Date", "01/01/2001") << config->readEntry("Comments", "") << recent; - QStringList result = QCheckEntry::popupEntry(existing); - if (result.isEmpty() == false) - { - config->setGroup("Data"); - int lastCheck = config->readNumEntry("LastCheck", 0); - config->writeEntry("Recent", result[9]); - - config->setGroup(rowText); - - tblTransactions->setText(row, 1, result[1]); - tblTransactions->updateCell(row, 1); - - tblTransactions->setText(row, 2, result[7]); - tblTransactions->updateCell(row, 2); - - tblTransactions->setText(row, 3, QString("$" + result[5])); - tblTransactions->updateCell(row, 3); - - // This is how the list looks: - // 0: true or false, true == payment, false == deposit - // 1: description of the transaction - // 2: category name - // 3: transaction type (stores the integer value of the index of the combobox) - // 4: check number of the transaction (if any) - // 5: transaction amount - // 6: transaction fee (e.g. service charge, or ATM charge). - // 7: date of the transaction - // 8: additional comments - config->writeEntry("Payment", result[0]); - config->writeEntry("Description", result[1]); - if (result[0] == QString("true")) - { - config->writeEntry("Category", result[2]); - } - config->writeEntry("Type", result[3]); - config->writeEntry("CheckNumber", result[4]); - config->writeEntry("Amount", result[5]); - config->writeEntry("TransactionFee", result[6]); - config->writeEntry("Date", result[7]); - config->writeEntry("Comments", result[8]); - if (result[0] == QString("true")) - { - if (rowText.toInt() <= lastCheck) - { - for(int i = (rowText.toInt() - 1); i != (lastCheck); i++) - { - config->setGroup(tblTransactions->text(i, 0)); - QString ibalance = config->readEntry("Balance", "0.00"); - - // this adds the old amount on to the transaction and then takes the new amount away - QString newbalance = calculator(calculator(ibalance, originalamount, false), result[5], true); - config->writeEntry("Balance", newbalance); - if (i == (lastCheck - 1)) - { - config->setGroup("Totals"); - config->writeEntry("Balance", newbalance); - break; - } - } - } - config->setGroup("Totals"); - config->writeEntry("Spent", calculator(config->readEntry("Spent", QString("0")), originalamount, true)); - config->writeEntry("Spent", calculator(config->readEntry("Spent", QString("0")), result[5], false)); - - if (result[2] == originalcategory) - { - QString categorytotal = config->readEntry(result[2], QString("0")); - categorytotal = calculator(categorytotal, originalamount, true); - categorytotal = calculator(categorytotal, result[5], false); - config->writeEntry(result[2], categorytotal); - } else { - QString origtotal = config->readEntry(originalcategory, QString("0")); - QString origfinal = calculator(origtotal, result[5], true); - if (origfinal == "0" || origfinal == "0.00") - { - config->removeEntry(originalcategory); - } else { - config->writeEntry(originalcategory, origfinal); - } - QString categorytotal = config->readEntry(result[2], QString("0")); - categorytotal = calculator(categorytotal, originalamount, false); - config->writeEntry(result[2],categorytotal); - } - } - if (result[0] == QString("false")) - { - if (rowText.toInt() <= lastCheck) - { - for(int i = (rowText.toInt() - 1 ); i != (lastCheck); i++) - { - config->setGroup(tblTransactions->text(i, 0)); - QString ibalance = config->readEntry("Balance", "0.00"); - - // this subtracts the old amount on to the transaction and then adds the new amount on - QString newbalance = calculator(calculator(ibalance, originalamount, true), result[5], false); - config->writeEntry("Balance", newbalance); - if (i == lastCheck - 1) - { - config->setGroup("Totals"); - config->writeEntry("Balance", newbalance); - break; - } - } - } - config->setGroup("Totals"); - config->writeEntry("Deposited", calculator(config->readEntry("Deposited", QString("0")), originalamount, true)); - config->writeEntry("Deposited", calculator(config->readEntry("Deposited", QString("0")), result[5], false)); - } - labelBalance->setText(QString("$" + config->readEntry("Balance", QString("0.00")))); - config->write(); - } -} -void QCheckView::tableClicked(int row, int col, int mouseButton, const QPoint &mousePos) -{ - if (tblTransactions->text(row, col).isEmpty() == false) - { - QStringList existing; - config->setGroup(tblTransactions->text(row, 0)); - existing << config->readEntry("Payment", "true") << config->readEntry("Description", "No Description Found") << config->readEntry("Category", "Misc.") << config->readEntry("Type", "0") << config->readEntry("CheckNumber", "0") << config->readEntry("Amount", "0.00") << config->readEntry("TransactionFee", "0.00") << config->readEntry("Date", "01/01/2001") << config->readEntry("Comments", "") << config->readEntry("Balance", "0.00"); - qcd = new QCheckDetails(row, col, existing); - qcd->showMaximized(); - connect(qcd, SIGNAL(editClicked(int, int)), this, SLOT(editClicked(int, int))); - connect(qcd, SIGNAL(deleteClicked(int, int)), this, SLOT(deleteClicked(int, int))); - } -} - -void QCheckView::newClicked() -{ - config->setGroup("Data"); - QString recent = config->readEntry("Recent", ""); - QStringList kindablank; - kindablank << recent; - QStringList result = QCheckEntry::popupEntry(kindablank); - if (result.count() > 1) - { - QTableItem *qti = new QTableItem(tblTransactions, QTableItem::Never, result[1]); - int row = tblTransactions->numRows(); - tblTransactions->setNumRows(row + 1); - tblTransactions->setItem(row,1, qti); - tblTransactions->updateCell(row, 1); - config->setGroup("Data"); - config->writeEntry("Recent", result[9]); - int lastCheck = config->readNumEntry("LastCheck", 0); - if (lastCheck == 0) - { - config->writeEntry("LastCheck", 1); - } else { - config->writeEntry("LastCheck", (lastCheck + 1)); - } - QString number = QString::number(lastCheck + 1); - config->setGroup(number); - - QTableItem *qti1 = new QTableItem(tblTransactions, QTableItem::Never, number); - tblTransactions->setItem(row, 0, qti1); - tblTransactions->updateCell(row, 0); - - QTableItem *qti2 = new QTableItem(tblTransactions, QTableItem::Never, result[7]); - tblTransactions->setItem(row, 2, qti2); - tblTransactions->updateCell(row, 2); - - QTableItem *qti3 = new QTableItem(tblTransactions, QTableItem::Never, QString("$" + result[5])); - tblTransactions->setItem(row, 3, qti3); - tblTransactions->updateCell(row, 3); - - // This is how the list looks: - // 0: true or false, true == payment, false == deposit - // 1: description of the transaction - // 2: category name - // 3: transaction type (stores the integer value of the index of the combobox) - // 4: check number of the transaction (if any) - // 5: transaction amount - // 6: transaction fee (e.g. service charge, or ATM charge). - // 7: date of the transaction - config->writeEntry("Payment", result[0]); - config->writeEntry("Description", result[1]); - if (result[0] == QString("true")) - { - config->writeEntry("Category", result[2]); - } - config->writeEntry("Type", result[3]); - config->writeEntry("CheckNumber", result[4]); - config->writeEntry("Amount", result[5]); - config->writeEntry("TransactionFee", result[6]); - config->writeEntry("Date", result[7]); - config->writeEntry("Comments", result[8]); - config->setGroup("Totals"); - if (result[0] == QString("true")) - { - QString totalspent = config->readEntry("Spent", QString("0")); - totalspent = calculator(totalspent, result[5], false); - config->writeEntry("Spent", totalspent); - QString balance = config->readEntry("Balance", QString("0")); - balance = calculator(balance, result[5], true); - - // Make sure to add the fee on, if any - balance = calculator(balance, result[6], true); - - config->writeEntry("Balance", balance); - - config->setGroup(number); - config->writeEntry("Balance", balance); - - config->setGroup("Totals"); - QString categorytotal = config->readEntry(result[2], QString("0")); - categorytotal = calculator(categorytotal, result[5], false); - config->writeEntry(result[2], categorytotal); - } - if (result[0] == QString("false")) - { - QString totaldeposited = config->readEntry("Deposited", QString("0")); - totaldeposited = calculator(totaldeposited, result[5], false); - config->writeEntry("Deposited", totaldeposited); - QString balance = config->readEntry("Balance", QString("0")); - balance = calculator(balance, result[5], false); - - // Make sure to add the fee on, if any - balance = calculator(balance, result[6], true); - - config->writeEntry("Balance", balance); - - config->setGroup(number); - config->writeEntry("Balance", balance); - } - } - config->setGroup("Totals"); - labelBalance->setText(QString("$" + config->readEntry("Balance", QString("0.00")))); - config->write(); -} - -QString QCheckView::calculator(QString largervalue, QString smallervalue, bool subtract) -{ - // This class provides a way to eliminate the ARM processor problem of not being able to handle - // decimals. I just take the two QString'ed numbers and find the decimal point, then I remove the decimal - // point seperating the number into two. Then I convert it to cents (times it times 100) and add/ - // substract the two together. Put the decimals back in, and return. - - largervalue = largervalue.remove(largervalue.find(".", 0, false), 1); - smallervalue = smallervalue.remove(smallervalue.find(".", 0, false), 1); - - int largercents = largervalue.toInt(); - int smallercents = smallervalue.toInt(); - - int finalammount = 0; - - if (subtract == true) - { - finalammount = largercents - smallercents; - } else { - finalammount = largercents + smallercents; - } - - QString returnvalue = QString::number(finalammount); - if (returnvalue.length() >= 2) - { - returnvalue.insert((returnvalue.length() - 2), "."); - } else { - if (returnvalue.length() == 1) - { - returnvalue.prepend("0.0"); - } - } - return returnvalue; -} diff --git a/noncore/apps/checkbook/qcheckviewbase.ui b/noncore/apps/checkbook/qcheckviewbase.ui deleted file mode 100644 index 00ed7dd..0000000 --- a/noncore/apps/checkbook/qcheckviewbase.ui +++ b/dev/null @@ -1,122 +0,0 @@ - -QCheckViewBase - - QWidget - - name - QCheckViewBase - - - geometry - - 0 - 0 - 242 - 312 - - - - caption - Account Transactions - - - - margin - 5 - - - spacing - 1 - - - QLabel - - name - labelBalance - - - frameShape - MShape - - - frameShadow - MShadow - - - text - $0.00 - - - alignment - AlignCenter - - - hAlign - - - - QTable - - name - tblTransactions - - - hScrollBarMode - AlwaysOff - - - numRows - 0 - - - numCols - 4 - - - showGrid - false - - - - QLabel - - name - TextLabel3 - - - text - Balance: - - - alignment - AlignVCenter|AlignRight - - - hAlign - - - - - - - QWidget -
qwidget.h
- - -1 - -1 - - 0 - - 5 - 5 - - image0 -
-
- - - image0 - 789c6dd2c10ac2300c00d07bbf2234b7229d1ddec44f503c0ae2a154410f53d0ed20e2bf6bdb656dd6861dd23d9a66591b0587fd1654235ebded6f0edcd53e419d87ae7b1f4f9b8f906d0bfe012317426a70b07bdc2f3ec77f8ed6b89559061a0343d06a124cc105596482585094bc0ae599b04646c9018926491b2205e140c485cace25755c175d0a967b622ff900b8cc9c7d29af594ea722d589167f813aa852ba07d94b9dce296e883fe7bb163f23896753 - - -
diff --git a/noncore/apps/checkbook/qrestrictedcombo.cpp b/noncore/apps/checkbook/qrestrictedcombo.cpp deleted file mode 100644 index e1533f6..0000000 --- a/noncore/apps/checkbook/qrestrictedcombo.cpp +++ b/dev/null @@ -1,78 +0,0 @@ -/* - * - * $Id$ - * - * Implementation of QRestrictedCombo - * - * Copyright (C) 1997 Michael Wiedmann, - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include - -#include "qrestrictedcombo.h" - -QRestrictedCombo::QRestrictedCombo( QWidget *parent, - const char *name, - const QString& valid ) - : QComboBox( parent, name ) -{ - qsValidChars = valid; -} - -QRestrictedCombo::~QRestrictedCombo() -{ - ; -} - - -void QRestrictedCombo::keyPressEvent( QKeyEvent *e ) -{ - // let QLineEdit process "special" keys and return/enter - // so that we still can use the default key binding - if (e->key() == Key_Enter || e->key() == Key_Return || e->key() == Key_Delete || e->ascii() < 32) - { - QComboBox::keyPressEvent(e); - return; - } - - // do we have a list of valid chars && - // is the pressed key in the list of valid chars? - if (!qsValidChars.isEmpty() && !qsValidChars.contains(e->ascii())) - { - // invalid char, emit signal and return - emit (invalidChar(e->key())); - return; - } - else - // valid char: let QLineEdit process this key as usual - QComboBox::keyPressEvent(e); - - return; -} - - -void QRestrictedCombo::setValidChars( const QString& valid) -{ - qsValidChars = valid; -} - -QString QRestrictedCombo::validChars() const -{ - return qsValidChars; -} - diff --git a/noncore/apps/checkbook/qrestrictedcombo.h b/noncore/apps/checkbook/qrestrictedcombo.h deleted file mode 100644 index 50ea59f..0000000 --- a/noncore/apps/checkbook/qrestrictedcombo.h +++ b/dev/null @@ -1,96 +0,0 @@ -/* - * - * Definition of QRestrictedCombo - * - * Copyright (C) 1997 Michael Wiedmann, - * - * Edited 2001 by Nick Betcher to work - * with Qt-only. Changed class name from LRestrictedLine to - * QRestrictedCombo in order to accomidate Combo Boxes. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef QRESTRICTEDCOMBO_H -#define QRESTRICTEDCOMBO_H - -#include - -/** - * The QRestrictedCombo widget is a variant of @ref QComboBox which - * accepts only a restricted set of characters as input. - * All other characters will be discarded and the signal @ref #invalidChar() - * will be emitted for each of them. - * - * Valid characters can be passed as a QString to the constructor - * or set afterwards via @ref #setValidChars(). - * The default key bindings of @ref QComboBox are still in effect. - * - * @short A line editor for restricted character sets. - * @author Michael Wiedmann - * @version 0.0.1 - */ -class QRestrictedCombo : public QComboBox -{ - Q_OBJECT - Q_PROPERTY( QString validChars READ validChars WRITE setValidChars ) - -public: - - /** - * Constructor: This contructor takes three - optional - arguments. - * The first two parameters are simply passed on to @ref QLineEdit. - * @param parent pointer to the parent widget - * @param name pointer to the name of this widget - * @param valid pointer to set of valid characters - */ - QRestrictedCombo( QWidget *parent=0, const char *name=0, - const QString& valid = QString::null); - - /** - * Destructs the restricted line editor. - */ - ~QRestrictedCombo(); - - /** - * All characters in the string valid are treated as - * acceptable characters. - */ - void setValidChars(const QString& valid); - /** - * @return the string of acceptable characters. - */ - QString validChars() const; - -signals: - - /** - * Emitted when an invalid character was typed. - */ - void invalidChar(int); - -protected: - /** - * @reimplemented - */ - void keyPressEvent( QKeyEvent *e ); - -private: - /// QString of valid characters for this line - QString qsValidChars; -}; - -#endif // QRESTRICTEDCOMBO_H diff --git a/noncore/apps/checkbook/qrestrictedline.cpp b/noncore/apps/checkbook/qrestrictedline.cpp deleted file mode 100644 index 8508c33..0000000 --- a/noncore/apps/checkbook/qrestrictedline.cpp +++ b/dev/null @@ -1,78 +0,0 @@ -/* - * - * $Id$ - * - * Implementation of QRestrictedLine - * - * Copyright (C) 1997 Michael Wiedmann, - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include - -#include "qrestrictedline.h" - -QRestrictedLine::QRestrictedLine( QWidget *parent, - const char *name, - const QString& valid ) - : QLineEdit( parent, name ) -{ - qsValidChars = valid; -} - -QRestrictedLine::~QRestrictedLine() -{ - ; -} - - -void QRestrictedLine::keyPressEvent( QKeyEvent *e ) -{ - // let QLineEdit process "special" keys and return/enter - // so that we still can use the default key binding - if (e->key() == Key_Enter || e->key() == Key_Return || e->key() == Key_Delete || e->ascii() < 32) - { - QLineEdit::keyPressEvent(e); - return; - } - - // do we have a list of valid chars && - // is the pressed key in the list of valid chars? - if (!qsValidChars.isEmpty() && !qsValidChars.contains(e->ascii())) - { - // invalid char, emit signal and return - emit (invalidChar(e->key())); - return; - } - else - // valid char: let QLineEdit process this key as usual - QLineEdit::keyPressEvent(e); - - return; -} - - -void QRestrictedLine::setValidChars( const QString& valid) -{ - qsValidChars = valid; -} - -QString QRestrictedLine::validChars() const -{ - return qsValidChars; -} - diff --git a/noncore/apps/checkbook/qrestrictedline.h b/noncore/apps/checkbook/qrestrictedline.h deleted file mode 100644 index 7e41cd9..0000000 --- a/noncore/apps/checkbook/qrestrictedline.h +++ b/dev/null @@ -1,96 +0,0 @@ -/* - * - * Definition of QRestrictedLine - * - * Copyright (C) 1997 Michael Wiedmann, - * - * Edited 2001 by Nick Betcher to work - * with Qt-only. Changed class name from QRestrictedLine to - * QRestrictedLine. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the Free - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef QRESTRICTEDLINE_H -#define QRESTRICTEDLINE_H - -#include - -/** - * The QRestrictedLine widget is a variant of @ref QLineEdit which - * accepts only a restricted set of characters as input. - * All other characters will be discarded and the signal @ref #invalidChar() - * will be emitted for each of them. - * - * Valid characters can be passed as a QString to the constructor - * or set afterwards via @ref #setValidChars(). - * The default key bindings of @ref QLineEdit are still in effect. - * - * @short A line editor for restricted character sets. - * @author Michael Wiedmann - * @version 0.0.1 - */ -class QRestrictedLine : public QLineEdit -{ - Q_OBJECT - Q_PROPERTY( QString validChars READ validChars WRITE setValidChars ) - -public: - - /** - * Constructor: This contructor takes three - optional - arguments. - * The first two parameters are simply passed on to @ref QLineEdit. - * @param parent pointer to the parent widget - * @param name pointer to the name of this widget - * @param valid pointer to set of valid characters - */ - QRestrictedLine( QWidget *parent=0, const char *name=0, - const QString& valid = QString::null); - - /** - * Destructs the restricted line editor. - */ - ~QRestrictedLine(); - - /** - * All characters in the string valid are treated as - * acceptable characters. - */ - void setValidChars(const QString& valid); - /** - * @return the string of acceptable characters. - */ - QString validChars() const; - -signals: - - /** - * Emitted when an invalid character was typed. - */ - void invalidChar(int); - -protected: - /** - * @reimplemented - */ - void keyPressEvent( QKeyEvent *e ); - -private: - /// QString of valid characters for this line - QString qsValidChars; -}; - -#endif // QRESTRICTEDLINE_H -- cgit v0.9.0.2