Commit 232e2e98 authored by Tomas Mecir's avatar Tomas Mecir

clear some warnings

parent cc7f1910
......@@ -52,8 +52,8 @@ cAlias::cAlias (cList *list) : cListObject (list)
//include prefix/suffix
d->includeprefixsuffix = true;
d->global = false;
d->exp = 0;
d->resolver = 0;
d->exp = nullptr;
d->resolver = nullptr;
}
cAlias::~cAlias ()
......@@ -118,7 +118,7 @@ void cAlias::attribChanged (const QString &name)
// TODO: this is duplicated for every place with conditions
// find out if we could create a common class for this
delete d->exp;
d->exp = 0;
d->exp = nullptr;
// no expression ? nothing to do !
if (d->condition.trimmed().isEmpty()) return;
......@@ -193,7 +193,7 @@ bool cAlias::testCondition ()
queue->fillFromPattern (&d->p);
cValue val = d->exp->evaluate (d->resolver);
delete queue;
d->resolver->setQueue(0);
d->resolver->setQueue(nullptr);
// test passes if the evaluator returns non-zero ...
return (val.asInteger() != 0);
......
......@@ -69,7 +69,7 @@ cAliasEditor::cAliasEditor (QWidget *parent)
: cListEditor (parent)
{
d = new Private;
d->regExpDialog = 0;
d->regExpDialog = nullptr;
}
cAliasEditor::~cAliasEditor ()
......
......@@ -161,7 +161,7 @@ QStringList cCmdParser::parseCommand (const QString &command, bool expandAliases
// perform alias expansion
if (expandAliases) {
cList *al = cListManager::self()->getList (sess(), "aliases");
cAliasList *aliases = al ? dynamic_cast<cAliasList *>(al) : 0;
cAliasList *aliases = al ? dynamic_cast<cAliasList *>(al) : nullptr;
if (aliases && aliases->matchString (cmd))
{
aliasesExpanded = true;
......@@ -425,7 +425,7 @@ unsigned int cCmdParser::repeater (QString &command)
//limit repeat count if needed
cProfileSettings *sett = settings ();
bool limitRepeats = ((sett == 0) ? true : sett->getBool ("limit-repeater"));
bool limitRepeats = sett ? sett->getBool ("limit-repeater") : true;
if ((repc > 100) && limitRepeats)
{
......
......@@ -33,7 +33,7 @@
class KMUDDY_EXPORT cInputLine : public KLineEdit, public cActionBase {
Q_OBJECT
public:
cInputLine (int sess, QString objName="inputline", QWidget *parent=0);
cInputLine (int sess, QString objName="inputline", QWidget *parent=nullptr);
~cInputLine();
/** initialize the input line - must be separated
from the constructor, because it uses cSession, which is not
......
......@@ -61,7 +61,7 @@ class cListModel : public QAbstractItemModel {
QModelIndex indexOf (const cListObject *obj) const
{
if (obj == lst->rootGroup()) return QModelIndex();
if (obj == 0) return QModelIndex();
if (!obj) return QModelIndex();
return createIndex (obj->positionInGroup(), 0, (void *) obj);
}
......@@ -252,7 +252,7 @@ cList::cList (const QString &name)
d->enabled = true;
d->name = name;
d->model = new cListModel (this);
d->rootGroup = 0;
d->rootGroup = nullptr;
d->sess = 0;
d->hasError = false;
}
......@@ -342,7 +342,7 @@ cListGroup *cList::group (const QString &name)
{
if (d->groups.count (name))
return d->groups[name];
return 0;
return nullptr;
}
cListGroup *cList::addGroup (cListGroup *parent, const QString &name)
......@@ -407,7 +407,7 @@ cListObject *cList::getObject (const QString &name)
{
if (d->namedObjects.count (name))
return d->namedObjects[name];
return 0;
return nullptr;
}
void cList::deleteObject (cListObject *obj)
......
......@@ -68,7 +68,7 @@ public:
virtual ~cList ();
/** Create a new instance of this class. */
static cList *newList () { return 0; };
static cList *newList () { return nullptr; };
/** Set session ID of this list. */
void setSession (int sess);
......
......@@ -55,7 +55,7 @@ cListEditor::cListEditor (QWidget *parent)
{
d = new Private;
d->objNum = 0;
d->obj = 0;
d->obj = nullptr;
d->guiCreated = false;
d->saving = false;
......@@ -94,7 +94,7 @@ void cListEditor::setObject (cListObject *obj)
{
if (d->obj) {
disconnect (d->obj, SIGNAL (changed (cListObject *)), this, SLOT (objectChanged (cListObject *)));
d->obj = 0;
d->obj = nullptr;
}
if (!obj) return;
......@@ -146,7 +146,7 @@ void cListEditor::objectChanged (cListObject *obj)
bool cListEditor::objectValid ()
{
if (d->obj == 0) return false;
if (!d->obj) return false;
return (cListManager::self()->objectId (d->obj) != 0);
}
......
......@@ -98,7 +98,7 @@ cListObject *cListGroup::objectAt (int pos)
{
std::list<cListObject *>::iterator it = d->objects.begin();
for (int p = 0; p < pos; ++p) ++it;
if (it == d->objects.end()) return 0; // hit end of list - no such object
if (it == d->objects.end()) return nullptr; // hit end of list - no such object
return *it;
}
......
......@@ -47,7 +47,7 @@ struct cListManager::Private {
int maxObjectID;
};
cListManager *cListManager::_self = 0;
cListManager *cListManager::_self = nullptr;
cListManager *cListManager::self()
{
......@@ -153,8 +153,8 @@ QStandardItemModel *cListManager::typeModel () const
cList *cListManager::getList (int sessId, const QString &name)
{
if (!d->lists.count (sessId)) return 0; // session must exist
if (!d->listTypes.count (name)) return 0; // type must be registered
if (!d->lists.count (sessId)) return nullptr; // session must exist
if (!d->listTypes.count (name)) return nullptr; // type must be registered
if (d->lists[sessId].count (name))
return d->lists[sessId][name]; // list exists - return it
......@@ -224,7 +224,7 @@ cListObject *cListManager::object (int id) const
{
if (d->objects.count (id))
return d->objects[id];
return 0;
return nullptr;
}
void cListManager::loadList (int sessId, cList *list)
......
......@@ -42,7 +42,7 @@ cListObject::cListObject (cList *list)
{
d = new Private;
d->list = list;
d->parent = 0;
d->parent = nullptr;
d->data.enabled = true;
d->groupPos = 0;
d->groupPriorityPos = 0;
......
......@@ -53,9 +53,9 @@ cListViewer::cListViewer (QWidget *parent)
: QTreeView (parent)
{
d = new Private;
d->currentItem = 0;
d->currentItem = nullptr;
d->emptyModel = new QStandardItemModel;
setList (0);
setList (nullptr);
header()->hide(); // no header
d->validator = new QRegExpValidator (QRegExp("^[0-9A-Za-z_ ]+$"), this);
d->col = new KActionCollection (this);
......@@ -115,7 +115,7 @@ cListViewer::~cListViewer ()
void cListViewer::setList (cList *l)
{
d->list = l;
d->currentItem = 0;
d->currentItem = nullptr;
setModel (l ? l->model() : d->emptyModel);
}
......
......@@ -38,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
using namespace std;
cPluginManager *cPluginManager::_self = 0;
cPluginManager *cPluginManager::_self = nullptr;
cPluginManager *cPluginManager::self ()
{
......@@ -52,7 +52,7 @@ cPluginManager::cPluginManager () : cActionBase ("pluginmanager", 0)
findPlugins ();
activeSess = 0;
lastGagged = false;
pluginDialog = 0;
pluginDialog = nullptr;
// global objects receive events from all sessions, hence this will work well
addEventHandler ("send-command", 20, PT_STRING);
......@@ -92,7 +92,7 @@ cPluginManager::~cPluginManager ()
removeEventHandler ("session-created");
removeEventHandler ("session-destroyed");
_self = 0;
_self = nullptr;
}
void cPluginManager::eventIntHandler (QString event, int, int par1, int)
......@@ -189,7 +189,7 @@ bool cPluginManager::loadPlugin (const QString &name)
KService::Ptr service = pluginInfo[name].service();
KPluginFactory *factory = KPluginLoader (*service).factory();
cPlugin *plugin = factory->create<cPlugin> (0);
cPlugin *plugin = factory->create<cPlugin> (nullptr);
if (!plugin) {
kDebug() << "Failed to load plugin: " << name;
......@@ -281,7 +281,7 @@ void cPluginManager::unloadAll ()
void cPluginManager::showPluginsDialog ()
{
pluginDialog = new KDialog (0);
pluginDialog = new KDialog (nullptr);
pluginDialog->setCaption (i18n ("Plugins"));
pluginDialog->setButtons (KDialog::Ok | KDialog::Cancel | KDialog::Apply);
pluginDialog->setInitialSize (QSize (400, 300));
......@@ -302,7 +302,7 @@ void cPluginManager::showPluginsDialog ()
pluginDialog->exec ();
delete pluginDialog;
pluginDialog = 0;
pluginDialog = nullptr;
}
void cPluginManager::applyPluginDialog ()
......
......@@ -150,7 +150,7 @@ chunkItem *cTextChunk::itemAt (int pos)
}
if (it != _entries.end())
return *it;
return 0;
return nullptr;
}
cTextChunk *cTextChunk::splitLine (int idx, bool wordwrap, int indent,
......@@ -158,7 +158,7 @@ cTextChunk *cTextChunk::splitLine (int idx, bool wordwrap, int indent,
{
//look if we need to split the line
if (length() <= idx)
return 0;
return nullptr;
//OKay, we need to split...
QString text = plainText ();
......@@ -183,7 +183,7 @@ cTextChunk *cTextChunk::splitLine (int idx, bool wordwrap, int indent,
//now go, find the item that this splitpos belongs to, and split there!
bool moving = false;
cTextChunk *ch2 = 0;
cTextChunk *ch2 = nullptr;
chunkStart newstartattr = startattr;
newstartattr.startpos = indent; //start at indentation value
list<chunkItem *>::iterator it, moveit;
......@@ -429,7 +429,7 @@ void cTextChunk::replace (int pos, int len, const QString newtext)
int spos, l;
//step 1: prepare replacement chunk
chunkText *chunk = 0;
chunkText *chunk = nullptr;
if (!newtext.isEmpty())
{
chunk = new chunkText;
......@@ -812,7 +812,7 @@ QString chunkText::toHTML (QString &)
chunkItem *chunkText::split (int pos)
{
if ((pos < 0) || (pos >= length()-1))
return 0; //do NOTHING
return nullptr; //do NOTHING
chunkText *cht = new chunkText;
int l1 = pos + 1;
int l2 = _text.length() - l1;
......@@ -825,7 +825,7 @@ chunkItem *chunkText::split (int pos)
chunkItem *chunkLink::split (int pos)
{
if ((pos < 0) || (pos >= length()-1))
return 0; //do NOTHING
return nullptr; //do NOTHING
chunkLink *chl = (chunkLink *) duplicate ();
int l1 = pos + 1;
int l2 = _text.length() - l1;
......
......@@ -49,7 +49,7 @@ class KMUDDY_EXPORT chunkItem {
int startPos () { return startpos; }
void setStartPos (int sp) { startpos = sp; }
virtual int length() = 0;
virtual chunkItem *split (int) { return 0; }
virtual chunkItem *split (int) { return nullptr; }
virtual void trimLeft () {};
virtual chunkItem *duplicate() = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment