Rename a number of classes to enhance compatibility with KDE4

pull/1/head
Timothy Pearson 12 years ago
parent a7a8d7053d
commit 6d33c9774c

@ -71,7 +71,7 @@ v0.85 adds a lot:
type stuff like "3 sin pi" without having to manually add the * in between type stuff like "3 sin pi" without having to manually add the * in between
3 and sin. This also works with numbers and variables, and numbers and 3 and sin. This also works with numbers and variables, and numbers and
parenthesized expressions. parenthesized expressions.
* GUI changes. The main result view now uses KListView, so it gains tooltip * GUI changes. The main result view now uses TDEListView, so it gains tooltip
support for long answers for free, along with a bevy of other improvements. support for long answers for free, along with a bevy of other improvements.
* You can right-click on an answer and copy it to the clipboard. * You can right-click on an answer and copy it to the clipboard.
* Corrected information in the about box. * Corrected information in the about box.

@ -30,7 +30,7 @@
#include "function.h" #include "function.h"
ListView::ListView(TQWidget *parent, const char *name) : ListView::ListView(TQWidget *parent, const char *name) :
KListView(parent, name), m_menu(0), m_usePopup(false), m_removeSingleId(0), TDEListView(parent, name), m_menu(0), m_usePopup(false), m_removeSingleId(0),
m_removeAllId(0) m_removeAllId(0)
{ {
setResizeMode(LastColumn); setResizeMode(LastColumn);
@ -68,7 +68,7 @@ void ListView::enablePopupHandler(bool enable)
if(m_menu) if(m_menu)
kdError() << "ListView menu shouldn't exist here!\n"; kdError() << "ListView menu shouldn't exist here!\n";
m_menu = new KPopupMenu(this); m_menu = new TDEPopupMenu(this);
m_removeSingleId = m_menu->insertItem(removeItemString(), this, TQT_SLOT(removeSelected())); m_removeSingleId = m_menu->insertItem(removeItemString(), this, TQT_SLOT(removeSelected()));
m_removeAllId = m_menu->insertItem("Placeholder", this, TQT_SLOT(removeAllItems())); m_removeAllId = m_menu->insertItem("Placeholder", this, TQT_SLOT(removeAllItems()));
@ -124,7 +124,7 @@ void ListView::removeSelected()
ValueListViewItem::ValueListViewItem(TQListView *listView, const TQString &name, ValueListViewItem::ValueListViewItem(TQListView *listView, const TQString &name,
const Abakus::number_t &value) : const Abakus::number_t &value) :
KListViewItem(listView, name), m_value(value) TDEListViewItem(listView, name), m_value(value)
{ {
valueChanged(); valueChanged();
} }

@ -23,9 +23,9 @@
#include "numerictypes.h" #include "numerictypes.h"
class KPopupMenu; class TDEPopupMenu;
class ListView : public KListView class ListView : public TDEListView
{ {
Q_OBJECT Q_OBJECT
@ -83,14 +83,14 @@ class ListView : public KListView
void removeSelected(); void removeSelected();
private: private:
KPopupMenu *m_menu; TDEPopupMenu *m_menu;
bool m_usePopup; bool m_usePopup;
int m_removeSingleId; int m_removeSingleId;
int m_removeAllId; int m_removeAllId;
}; };
class ValueListViewItem : public KListViewItem class ValueListViewItem : public TDEListViewItem
{ {
public: public:
ValueListViewItem (TQListView *listView, const TQString &name, const Abakus::number_t &value); ValueListViewItem (TQListView *listView, const TQString &name, const Abakus::number_t &value);

@ -50,7 +50,7 @@
#include "abakuslistview.h" #include "abakuslistview.h"
#include "result.h" #include "result.h"
MainWindow::MainWindow() : KMainWindow(0, "abakus-mainwindow"), m_popup(0), m_insert(false) MainWindow::MainWindow() : TDEMainWindow(0, "abakus-mainwindow"), m_popup(0), m_insert(false)
{ {
m_mainSplitter = new TQSplitter(this); m_mainSplitter = new TQSplitter(this);
TQWidget *box = new TQWidget(m_mainSplitter); TQWidget *box = new TQWidget(m_mainSplitter);
@ -156,36 +156,36 @@ MainWindow::MainWindow() : KMainWindow(0, "abakus-mainwindow"), m_popup(0), m_in
bool MainWindow::inRPNMode() const bool MainWindow::inRPNMode() const
{ {
return action<KToggleAction>("toggleExpressionMode")->isChecked(); return action<TDEToggleAction>("toggleExpressionMode")->isChecked();
} }
bool MainWindow::eventFilter(TQObject *o, TQEvent *e) bool MainWindow::eventFilter(TQObject *o, TQEvent *e)
{ {
return KMainWindow::eventFilter(o, e); return TDEMainWindow::eventFilter(o, e);
} }
bool MainWindow::queryExit() bool MainWindow::queryExit()
{ {
saveConfig(); saveConfig();
return KMainWindow::queryExit(); return TDEMainWindow::queryExit();
} }
void MainWindow::contextMenuEvent(TQContextMenuEvent *e) void MainWindow::contextMenuEvent(TQContextMenuEvent *e)
{ {
static KPopupMenu *popup = 0; static TDEPopupMenu *popup = 0;
if(!popup) { if(!popup) {
popup = new KPopupMenu(this); popup = new TDEPopupMenu(this);
action("options_show_menubar")->plug(popup); action("options_show_menubar")->plug(popup);
} }
if(!action<KToggleAction>("options_show_menubar")->isChecked()) if(!action<TDEToggleAction>("options_show_menubar")->isChecked())
popup->popup(e->globalPos()); popup->popup(e->globalPos());
} }
void MainWindow::polish() void MainWindow::polish()
{ {
KMainWindow::polish(); TDEMainWindow::polish();
loadConfig(); loadConfig();
} }
@ -326,7 +326,7 @@ void MainWindow::slotDegrees()
setTrigMode(Abakus::Degrees); setTrigMode(Abakus::Degrees);
m_degrees->setChecked(true); m_degrees->setChecked(true);
if(action("setDegreesMode")) if(action("setDegreesMode"))
action<KToggleAction>("setDegreesMode")->setChecked(true); action<TDEToggleAction>("setDegreesMode")->setChecked(true);
} }
void MainWindow::slotRadians() void MainWindow::slotRadians()
@ -334,7 +334,7 @@ void MainWindow::slotRadians()
setTrigMode(Abakus::Radians); setTrigMode(Abakus::Radians);
m_radians->setChecked(true); m_radians->setChecked(true);
if(action("setRadiansMode")) if(action("setRadiansMode"))
action<KToggleAction>("setRadiansMode")->setChecked(true); action<TDEToggleAction>("setRadiansMode")->setChecked(true);
} }
int MainWindow::getParenthesesLevel(const TQString &str) int MainWindow::getParenthesesLevel(const TQString &str)
@ -366,7 +366,7 @@ void MainWindow::loadConfig()
} }
bool useRPN = config.readBoolEntry("Use RPN Mode", false); bool useRPN = config.readBoolEntry("Use RPN Mode", false);
action<KToggleAction>("toggleExpressionMode")->setChecked(useRPN); action<TDEToggleAction>("toggleExpressionMode")->setChecked(useRPN);
int precision = config.readNumEntry("Decimal Precision", -1); int precision = config.readNumEntry("Decimal Precision", -1);
if(precision < -1 || precision > 75) if(precision < -1 || precision > 75)
@ -395,20 +395,20 @@ void MainWindow::loadConfig()
TDEConfigGroup config(TDEGlobal::config(), "GUI"); TDEConfigGroup config(TDEGlobal::config(), "GUI");
bool showHistory = config.readBoolEntry("ShowHistory", true); bool showHistory = config.readBoolEntry("ShowHistory", true);
action<KToggleAction>("toggleHistoryList")->setChecked(showHistory); action<TDEToggleAction>("toggleHistoryList")->setChecked(showHistory);
m_history->setShown(showHistory); m_history->setShown(showHistory);
bool showFunctions = config.readBoolEntry("ShowFunctions", true); bool showFunctions = config.readBoolEntry("ShowFunctions", true);
action<KToggleAction>("toggleFunctionList")->setChecked(showFunctions); action<TDEToggleAction>("toggleFunctionList")->setChecked(showFunctions);
m_fnList->setShown(showFunctions); m_fnList->setShown(showFunctions);
bool showVariables = config.readBoolEntry("ShowVariables", true); bool showVariables = config.readBoolEntry("ShowVariables", true);
action<KToggleAction>("toggleVariableList")->setChecked(showVariables); action<TDEToggleAction>("toggleVariableList")->setChecked(showVariables);
m_varList->setShown(showVariables); m_varList->setShown(showVariables);
bool compactMode = config.readBoolEntry("InCompactMode", false); bool compactMode = config.readBoolEntry("InCompactMode", false);
compactMode = compactMode || !showHistory; compactMode = compactMode || !showHistory;
action<KToggleAction>("toggleCompactMode")->setChecked(compactMode); action<TDEToggleAction>("toggleCompactMode")->setChecked(compactMode);
if(compactMode) if(compactMode)
TQTimer::singleShot(0, TQT_TQOBJECT(this), TQT_SLOT(slotToggleCompactMode())); TQTimer::singleShot(0, TQT_TQOBJECT(this), TQT_SLOT(slotToggleCompactMode()));
@ -463,7 +463,7 @@ void MainWindow::saveConfig()
{ {
TDEConfigGroup config(TDEGlobal::config(), "GUI"); TDEConfigGroup config(TDEGlobal::config(), "GUI");
bool inCompactMode = action<KToggleAction>("toggleCompactMode")->isChecked(); bool inCompactMode = action<TDEToggleAction>("toggleCompactMode")->isChecked();
config.writeEntry("InCompactMode", inCompactMode); config.writeEntry("InCompactMode", inCompactMode);
@ -501,62 +501,62 @@ void MainWindow::saveConfig()
void MainWindow::setupLayout() void MainWindow::setupLayout()
{ {
KActionCollection *ac = actionCollection(); TDEActionCollection *ac = actionCollection();
KStdAction::quit(TQT_TQOBJECT(kapp), TQT_SLOT(quit()), ac); KStdAction::quit(TQT_TQOBJECT(kapp), TQT_SLOT(quit()), ac);
KStdAction::showMenubar(TQT_TQOBJECT(this), TQT_SLOT(slotToggleMenuBar()), ac); KStdAction::showMenubar(TQT_TQOBJECT(this), TQT_SLOT(slotToggleMenuBar()), ac);
KToggleAction *ta = new KToggleAction(i18n("&Degrees"), SHIFT + ALT + Key_D, TQT_TQOBJECT(this), TQT_SLOT(slotDegrees()), ac, "setDegreesMode"); TDEToggleAction *ta = new TDEToggleAction(i18n("&Degrees"), SHIFT + ALT + Key_D, TQT_TQOBJECT(this), TQT_SLOT(slotDegrees()), ac, "setDegreesMode");
ta->setExclusiveGroup("TrigMode"); ta->setExclusiveGroup("TrigMode");
ta->setChecked(trigMode() == Abakus::Degrees); ta->setChecked(trigMode() == Abakus::Degrees);
ta = new KToggleAction(i18n("&Radians"), SHIFT + ALT + Key_R, TQT_TQOBJECT(this), TQT_SLOT(slotRadians()), ac, "setRadiansMode"); ta = new TDEToggleAction(i18n("&Radians"), SHIFT + ALT + Key_R, TQT_TQOBJECT(this), TQT_SLOT(slotRadians()), ac, "setRadiansMode");
ta->setExclusiveGroup("TrigMode"); ta->setExclusiveGroup("TrigMode");
ta->setChecked(trigMode() == Abakus::Radians); ta->setChecked(trigMode() == Abakus::Radians);
ta = new KToggleAction(i18n("Show &History List"), SHIFT + ALT + Key_H, TQT_TQOBJECT(this), TQT_SLOT(slotToggleHistoryList()), ac, "toggleHistoryList"); ta = new TDEToggleAction(i18n("Show &History List"), SHIFT + ALT + Key_H, TQT_TQOBJECT(this), TQT_SLOT(slotToggleHistoryList()), ac, "toggleHistoryList");
ta->setChecked(true); ta->setChecked(true);
ta = new KToggleAction(i18n("Show &Variables"), SHIFT + ALT + Key_V, TQT_TQOBJECT(this), TQT_SLOT(slotToggleVariableList()), ac, "toggleVariableList"); ta = new TDEToggleAction(i18n("Show &Variables"), SHIFT + ALT + Key_V, TQT_TQOBJECT(this), TQT_SLOT(slotToggleVariableList()), ac, "toggleVariableList");
ta->setChecked(true); ta->setChecked(true);
ta = new KToggleAction(i18n("Show &Functions"), SHIFT + ALT + Key_F, TQT_TQOBJECT(this), TQT_SLOT(slotToggleFunctionList()), ac, "toggleFunctionList"); ta = new TDEToggleAction(i18n("Show &Functions"), SHIFT + ALT + Key_F, TQT_TQOBJECT(this), TQT_SLOT(slotToggleFunctionList()), ac, "toggleFunctionList");
ta->setChecked(true); ta->setChecked(true);
ta = new KToggleAction(i18n("Activate &Compact Mode"), SHIFT + ALT + Key_C, TQT_TQOBJECT(this), TQT_SLOT(slotToggleCompactMode()), ac, "toggleCompactMode"); ta = new TDEToggleAction(i18n("Activate &Compact Mode"), SHIFT + ALT + Key_C, TQT_TQOBJECT(this), TQT_SLOT(slotToggleCompactMode()), ac, "toggleCompactMode");
ta->setChecked(false); ta->setChecked(false);
ta = new KToggleAction(i18n("Use R&PN Mode"), SHIFT + ALT + Key_P, TQT_TQOBJECT(this), TQT_SLOT(slotToggleExpressionMode()), ac, "toggleExpressionMode"); ta = new TDEToggleAction(i18n("Use R&PN Mode"), SHIFT + ALT + Key_P, TQT_TQOBJECT(this), TQT_SLOT(slotToggleExpressionMode()), ac, "toggleExpressionMode");
ta->setChecked(false); ta->setChecked(false);
// Precision actions. // Precision actions.
ta = new KToggleAction(i18n("&Automatic Precision"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecisionAuto()), ac, "precisionAuto"); ta = new TDEToggleAction(i18n("&Automatic Precision"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecisionAuto()), ac, "precisionAuto");
ta->setExclusiveGroup("Precision"); ta->setExclusiveGroup("Precision");
ta->setChecked(true); ta->setChecked(true);
ta = new KToggleAction(i18n("&3 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision3()), ac, "precision3"); ta = new TDEToggleAction(i18n("&3 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision3()), ac, "precision3");
ta->setExclusiveGroup("Precision"); ta->setExclusiveGroup("Precision");
ta->setChecked(false); ta->setChecked(false);
ta = new KToggleAction(i18n("&8 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision8()), ac, "precision8"); ta = new TDEToggleAction(i18n("&8 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision8()), ac, "precision8");
ta->setExclusiveGroup("Precision"); ta->setExclusiveGroup("Precision");
ta->setChecked(false); ta->setChecked(false);
ta = new KToggleAction(i18n("&15 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision15()), ac, "precision15"); ta = new TDEToggleAction(i18n("&15 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision15()), ac, "precision15");
ta->setExclusiveGroup("Precision"); ta->setExclusiveGroup("Precision");
ta->setChecked(false); ta->setChecked(false);
ta = new KToggleAction(i18n("&50 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision50()), ac, "precision50"); ta = new TDEToggleAction(i18n("&50 Decimal Digits"), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecision50()), ac, "precision50");
ta->setExclusiveGroup("Precision"); ta->setExclusiveGroup("Precision");
ta->setChecked(false); ta->setChecked(false);
ta = new KToggleAction(i18n("C&ustom Precision..."), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecisionCustom()), ac, "precisionCustom"); ta = new TDEToggleAction(i18n("C&ustom Precision..."), 0, TQT_TQOBJECT(this), TQT_SLOT(slotPrecisionCustom()), ac, "precisionCustom");
ta->setExclusiveGroup("Precision"); ta->setExclusiveGroup("Precision");
ta->setChecked(false); ta->setChecked(false);
new KAction(i18n("Clear &History"), "editclear", SHIFT + ALT + Key_L, TQT_TQOBJECT(m_result), TQT_SLOT(clear()), ac, "clearHistory"); new TDEAction(i18n("Clear &History"), "editclear", SHIFT + ALT + Key_L, TQT_TQOBJECT(m_result), TQT_SLOT(clear()), ac, "clearHistory");
new KAction(i18n("Select Editor"), "goto", Key_F6, TQT_TQOBJECT(m_edit), TQT_SLOT(setFocus()), ac, "select_edit"); new TDEAction(i18n("Select Editor"), "goto", Key_F6, TQT_TQOBJECT(m_edit), TQT_SLOT(setFocus()), ac, "select_edit");
} }
void MainWindow::populateListViews() void MainWindow::populateListViews()
@ -570,7 +570,7 @@ void MainWindow::populateListViews()
new ValueListViewItem(m_varList, "e", value); new ValueListViewItem(m_varList, "e", value);
} }
KAction *MainWindow::action(const char *key) const TDEAction *MainWindow::action(const char *key) const
{ {
return actionCollection()->action(key); return actionCollection()->action(key);
} }
@ -593,38 +593,38 @@ void MainWindow::slotToggleMenuBar()
void MainWindow::slotToggleFunctionList() void MainWindow::slotToggleFunctionList()
{ {
bool show = action<KToggleAction>("toggleFunctionList")->isChecked(); bool show = action<TDEToggleAction>("toggleFunctionList")->isChecked();
m_fnList->setShown(show); m_fnList->setShown(show);
if(!m_history->isShown()) { if(!m_history->isShown()) {
m_history->setShown(true); m_history->setShown(true);
action<KToggleAction>("toggleHistoryList")->setChecked(true); action<TDEToggleAction>("toggleHistoryList")->setChecked(true);
slotToggleHistoryList(); slotToggleHistoryList();
} }
action<KToggleAction>("toggleCompactMode")->setChecked(false); action<TDEToggleAction>("toggleCompactMode")->setChecked(false);
} }
void MainWindow::slotToggleVariableList() void MainWindow::slotToggleVariableList()
{ {
bool show = action<KToggleAction>("toggleVariableList")->isChecked(); bool show = action<TDEToggleAction>("toggleVariableList")->isChecked();
m_varList->setShown(show); m_varList->setShown(show);
if(!m_history->isShown()) { if(!m_history->isShown()) {
m_history->setShown(true); m_history->setShown(true);
action<KToggleAction>("toggleHistoryList")->setChecked(true); action<TDEToggleAction>("toggleHistoryList")->setChecked(true);
slotToggleHistoryList(); slotToggleHistoryList();
} }
action<KToggleAction>("toggleCompactMode")->setChecked(false); action<TDEToggleAction>("toggleCompactMode")->setChecked(false);
} }
void MainWindow::slotToggleHistoryList() void MainWindow::slotToggleHistoryList()
{ {
bool show = action<KToggleAction>("toggleHistoryList")->isChecked(); bool show = action<TDEToggleAction>("toggleHistoryList")->isChecked();
m_history->setShown(show); m_history->setShown(show);
action<KToggleAction>("toggleCompactMode")->setChecked(false); action<TDEToggleAction>("toggleCompactMode")->setChecked(false);
} }
void MainWindow::slotNewFunction(const TQString &name) void MainWindow::slotNewFunction(const TQString &name)
@ -634,7 +634,7 @@ void MainWindow::slotNewFunction(const TQString &name)
TQString fnName = TQString("%1(%2)").arg(name, userFn->varName); TQString fnName = TQString("%1(%2)").arg(name, userFn->varName);
TQString expr = fn->operand()->infixString(); TQString expr = fn->operand()->infixString();
new KListViewItem(m_fnList, fnName, expr); new TDEListViewItem(m_fnList, fnName, expr);
} }
void MainWindow::slotRemoveFunction(const TQString &name) void MainWindow::slotRemoveFunction(const TQString &name)
@ -667,7 +667,7 @@ void MainWindow::slotRemoveValue(const TQString &name)
void MainWindow::slotToggleCompactMode() void MainWindow::slotToggleCompactMode()
{ {
if(action<KToggleAction>("toggleCompactMode")->isChecked()) { if(action<TDEToggleAction>("toggleCompactMode")->isChecked()) {
m_wasFnShown = m_fnList->isShown(); m_wasFnShown = m_fnList->isShown();
m_wasVarShown = m_varList->isShown(); m_wasVarShown = m_varList->isShown();
m_wasHistoryShown = m_history->isShown(); m_wasHistoryShown = m_history->isShown();
@ -676,9 +676,9 @@ void MainWindow::slotToggleCompactMode()
m_varList->setShown(false); m_varList->setShown(false);
m_history->setShown(false); m_history->setShown(false);
action<KToggleAction>("toggleFunctionList")->setChecked(false); action<TDEToggleAction>("toggleFunctionList")->setChecked(false);
action<KToggleAction>("toggleVariableList")->setChecked(false); action<TDEToggleAction>("toggleVariableList")->setChecked(false);
action<KToggleAction>("toggleHistoryList")->setChecked(false); action<TDEToggleAction>("toggleHistoryList")->setChecked(false);
m_oldSize = size(); m_oldSize = size();
m_newSize = TQSize(0, 0); m_newSize = TQSize(0, 0);
@ -689,9 +689,9 @@ void MainWindow::slotToggleCompactMode()
m_varList->setShown(m_wasVarShown); m_varList->setShown(m_wasVarShown);
m_history->setShown(m_wasHistoryShown); m_history->setShown(m_wasHistoryShown);
action<KToggleAction>("toggleFunctionList")->setChecked(m_wasFnShown); action<TDEToggleAction>("toggleFunctionList")->setChecked(m_wasFnShown);
action<KToggleAction>("toggleVariableList")->setChecked(m_wasVarShown); action<TDEToggleAction>("toggleVariableList")->setChecked(m_wasVarShown);
action<KToggleAction>("toggleHistoryList")->setChecked(m_wasHistoryShown); action<TDEToggleAction>("toggleHistoryList")->setChecked(m_wasHistoryShown);
m_newSize = m_oldSize; m_newSize = m_oldSize;
TQTimer::singleShot(0, TQT_TQOBJECT(this), TQT_SLOT(slotUpdateSize())); TQTimer::singleShot(0, TQT_TQOBJECT(this), TQT_SLOT(slotUpdateSize()));
@ -796,27 +796,27 @@ void MainWindow::selectCorrectPrecisionAction()
{ {
switch(Abakus::m_prec) { switch(Abakus::m_prec) {
case 3: case 3:
action<KToggleAction>("precision3")->setChecked(true); action<TDEToggleAction>("precision3")->setChecked(true);
break; break;
case 8: case 8:
action<KToggleAction>("precision8")->setChecked(true); action<TDEToggleAction>("precision8")->setChecked(true);
break; break;
case 15: case 15:
action<KToggleAction>("precision15")->setChecked(true); action<TDEToggleAction>("precision15")->setChecked(true);
break; break;
case 50: case 50:
action<KToggleAction>("precision50")->setChecked(true); action<TDEToggleAction>("precision50")->setChecked(true);
break; break;
case -1: case -1:
action<KToggleAction>("precisionAuto")->setChecked(true); action<TDEToggleAction>("precisionAuto")->setChecked(true);
break; break;
default: default:
action<KToggleAction>("precisionCustom")->setChecked(true); action<TDEToggleAction>("precisionCustom")->setChecked(true);
} }
} }

@ -34,16 +34,16 @@ class TQTimer;
//class KComboBox; //class KComboBox;
class Editor; class Editor;
class KPopupMenu; class TDEPopupMenu;
class KAction; class TDEAction;
class KListView; class TDEListView;
class ResultListView; class ResultListView;
class ResultListViewText; class ResultListViewText;
class AbakusIface; class AbakusIface;
// Main window class, handles events and layout and stuff // Main window class, handles events and layout and stuff
class MainWindow : public KMainWindow class MainWindow : public TDEMainWindow
{ {
Q_OBJECT Q_OBJECT
@ -105,7 +105,7 @@ class MainWindow : public KMainWindow
TQString interpolateExpression(const TQString &text, ResultListViewText *after); TQString interpolateExpression(const TQString &text, ResultListViewText *after);
// Donated via JuK // Donated via JuK
KAction *action(const char *key) const; TDEAction *action(const char *key) const;
template <class T> T *action(const char *key) const template <class T> T *action(const char *key) const
{ {
@ -117,11 +117,11 @@ class MainWindow : public KMainWindow
TQRadioButton *m_degrees; TQRadioButton *m_degrees;
TQRadioButton *m_radians; TQRadioButton *m_radians;
Editor *m_edit; Editor *m_edit;
KPopupMenu *m_popup; TDEPopupMenu *m_popup;
ResultListView *m_result; ResultListView *m_result;
TQString m_lastError; TQString m_lastError;
TQBoxLayout *m_layout; TQBoxLayout *m_layout;
KListView *m_fnList, *m_varList; TDEListView *m_fnList, *m_varList;
TQSplitter *m_mainSplitter, *m_listSplitter; TQSplitter *m_mainSplitter, *m_listSplitter;
TQSize m_newSize, m_oldSize; TQSize m_newSize, m_oldSize;

@ -35,7 +35,7 @@ using DragSupport::makePixmap;
using namespace ResultList; using namespace ResultList;
ResultListView::ResultListView(TQWidget *parent, const char *name) : ResultListView::ResultListView(TQWidget *parent, const char *name) :
KListView(parent, name), m_itemRightClicked(0) TDEListView(parent, name), m_itemRightClicked(0)
{ {
connect(this, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint &, int)), connect(this, TQT_SIGNAL(doubleClicked(TQListViewItem *, const TQPoint &, int)),
TQT_SLOT(slotDoubleClicked(TQListViewItem *, const TQPoint &, int))); TQT_SLOT(slotDoubleClicked(TQListViewItem *, const TQPoint &, int)));
@ -94,7 +94,7 @@ TQDragObject *ResultListView::dragObject()
void ResultListView::contextMenuEvent(TQContextMenuEvent *e) void ResultListView::contextMenuEvent(TQContextMenuEvent *e)
{ {
m_itemRightClicked = itemUnderCursor(); m_itemRightClicked = itemUnderCursor();
KPopupMenu *menu = constructPopupMenu(m_itemRightClicked); TDEPopupMenu *menu = constructPopupMenu(m_itemRightClicked);
menu->popup(e->globalPos()); menu->popup(e->globalPos());
} }
@ -111,9 +111,9 @@ void ResultListView::slotDoubleClicked(TQListViewItem *item, const TQPoint &, in
emit signalResultSelected(textItem->resultText()); emit signalResultSelected(textItem->resultText());
} }
KPopupMenu *ResultListView::constructPopupMenu(const ResultListViewText *item) TDEPopupMenu *ResultListView::constructPopupMenu(const ResultListViewText *item)
{ {
KPopupMenu *menu = new KPopupMenu(this, "list view context menu"); TDEPopupMenu *menu = new TDEPopupMenu(this, "list view context menu");
menu->insertItem(i18n("Clear &History"), this, TQT_SLOT(clear()), ALT+Key_R); menu->insertItem(i18n("Clear &History"), this, TQT_SLOT(clear()), ALT+Key_R);
@ -136,7 +136,7 @@ void ResultListView::slotCopyResult()
ResultListViewText *ResultListView::lastItem() const ResultListViewText *ResultListView::lastItem() const
{ {
return static_cast<ResultListViewText *>(KListView::lastItem()); return static_cast<ResultListViewText *>(TDEListView::lastItem());
} }
ResultListViewText *ResultListView::itemUnderCursor() const ResultListViewText *ResultListView::itemUnderCursor() const

@ -22,7 +22,7 @@
#include <klistview.h> #include <klistview.h>
#include "numerictypes.h" #include "numerictypes.h"
class KPopupMenu; class TDEPopupMenu;
class TQLabel; class TQLabel;
class TQDragObject; class TQDragObject;
class ResultListViewText; class ResultListViewText;
@ -31,7 +31,7 @@ namespace ResultList {
enum { ExpressionColumn = 0, ResultColumn, ShortcutColumn }; enum { ExpressionColumn = 0, ResultColumn, ShortcutColumn };
} }
class ResultListView : public KListView class ResultListView : public TDEListView
{ {
Q_OBJECT Q_OBJECT
@ -56,7 +56,7 @@ class ResultListView : public KListView
void slotCopyResult(); void slotCopyResult();
private: private:
KPopupMenu *constructPopupMenu(const ResultListViewText *item); TDEPopupMenu *constructPopupMenu(const ResultListViewText *item);
ResultListViewText *itemUnderCursor() const; ResultListViewText *itemUnderCursor() const;
ResultListViewText *m_itemRightClicked; ResultListViewText *m_itemRightClicked;

@ -28,24 +28,24 @@
using namespace ResultList; using namespace ResultList;
ResultListViewText::ResultListViewText(KListView *listView, ResultListViewText::ResultListViewText(TDEListView *listView,
const TQString &text, const TQString &text,
const TQString &result, const TQString &result,
ResultListViewText *after, ResultListViewText *after,
bool isError) bool isError)
: KListViewItem(listView, after, text, result), m_text(text), : TDEListViewItem(listView, after, text, result), m_text(text),
m_result(result), m_wasError(isError), m_stackPosition(0) m_result(result), m_wasError(isError), m_stackPosition(0)
{ {
// This is some kind of non-result answer, don't bother worrying about the // This is some kind of non-result answer, don't bother worrying about the
// stack status, it hasn't changed. // stack status, it hasn't changed.
} }
ResultListViewText::ResultListViewText(KListView *listView, ResultListViewText::ResultListViewText(TDEListView *listView,
const TQString &text, const TQString &text,
const Abakus::number_t &result, const Abakus::number_t &result,
ResultListViewText *after, ResultListViewText *after,
bool isError) bool isError)
: KListViewItem(listView, after, text), m_text(text), : TDEListViewItem(listView, after, text), m_text(text),
m_result(result.toString()), m_wasError(isError), m_stackPosition(0), m_result(result.toString()), m_wasError(isError), m_stackPosition(0),
m_value(result) m_value(result)
{ {
@ -102,7 +102,7 @@ void ResultListViewText::paintCell(TQPainter *p, const TQColorGroup &cg, int col
p->setFont(f); p->setFont(f);
} }
KListViewItem::paintCell(p, group, column, width, align); TDEListViewItem::paintCell(p, group, column, width, align);
} }
int ResultListViewText::width(const TQFontMetrics &fm, const TQListView *lv, int c) const int ResultListViewText::width(const TQFontMetrics &fm, const TQListView *lv, int c) const
@ -111,25 +111,25 @@ int ResultListViewText::width(const TQFontMetrics &fm, const TQListView *lv, int
if(c == ResultColumn) { if(c == ResultColumn) {
TQFont f = lv->font(); TQFont f = lv->font();
f.setBold(true); f.setBold(true);
return KListViewItem::width(TQFontMetrics(f), lv, c); return TDEListViewItem::width(TQFontMetrics(f), lv, c);
} }
if(c == ShortcutColumn) { if(c == ShortcutColumn) {
TQFont f = lv->font(); TQFont f = lv->font();
f.setItalic(true); f.setItalic(true);
f.setPointSize(TQMIN(f.pointSize() * 9 / 11, 10)); f.setPointSize(TQMIN(f.pointSize() * 9 / 11, 10));
return KListViewItem::width(TQFontMetrics(f), lv, c); return TDEListViewItem::width(TQFontMetrics(f), lv, c);
} }
return KListViewItem::width(fm, lv, c); return TDEListViewItem::width(fm, lv, c);
} }
void ResultListViewText::setText(int column, const TQString &text) void ResultListViewText::setText(int column, const TQString &text)
{ {
if(!m_wasError && column == ResultColumn) { if(!m_wasError && column == ResultColumn) {
KListViewItem::setText(column, m_value.toString()); TDEListViewItem::setText(column, m_value.toString());
return; return;
} }
KListViewItem::setText(column, text); TDEListViewItem::setText(column, text);
} }

@ -27,16 +27,16 @@ class TQColorGroup;
class TQFontMetrics; class TQFontMetrics;
// This class shows the results shown in the MainWindow result pane. // This class shows the results shown in the MainWindow result pane.
class ResultListViewText : public KListViewItem class ResultListViewText : public TDEListViewItem
{ {
public: public:
ResultListViewText(KListView *listView, ResultListViewText(TDEListView *listView,
const TQString &text, const TQString &text,
const TQString &result, const TQString &result,
ResultListViewText *after, ResultListViewText *after,
bool isError = false); bool isError = false);
ResultListViewText(KListView *listView, ResultListViewText(TDEListView *listView,
const TQString &text, const TQString &text,
const Abakus::number_t &result, const Abakus::number_t &result,
ResultListViewText *after, ResultListViewText *after,
@ -53,7 +53,7 @@ class ResultListViewText : public KListViewItem
// Redisplays the text by calling value.toString again. // Redisplays the text by calling value.toString again.
void precisionChanged(); void precisionChanged();
// Reimplemented from KListViewItem // Reimplemented from TDEListViewItem
virtual void paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align); virtual void paintCell(TQPainter *p, const TQColorGroup &cg, int column, int width, int align);
virtual int width(const TQFontMetrics &fm, const TQListView *lv, int c) const; virtual int width(const TQFontMetrics &fm, const TQListView *lv, int c) const;

Loading…
Cancel
Save