rem: topBorder.m_rgb != botBorder.m_rgb)
add: !kpTool::colorEq (topBorder.m_color, botBorder.m_color))
context: bool kpToolAutoCrop (kpMainWindow *mainWindow){#if DEBUG_KP_TOOL_AUTO_CROP    kdDebug () << "kpToolAutoCrop() CALLED!" << endl;#endif    bool nothingToCrop = false;        if (!mainWindow)    {        kdError () << "kpToolAutoCrop() passed NULL mainWindow" << endl;        return false;    }        kpDocument *doc = mainWindow->document ();    if (!doc)    {        kdError () << "kpToolAutoCrop() passed NULL document" << endl;        return false;    }    QPixmap *pixmap = doc->pixmap ();    if (!pixmap)    {        kdError () << "kptoolAutoCrop() pased NULL pixmap" << endl;        return false;    }        kpViewManager *vm = mainWindow->viewManager ();    if (!vm)    {        kdError () << "kpToolAutoCrop() passed NULL vm" << endl;        return false;    }        kpToolAutoCropBorder leftBorder (pixmap), rightBorder (pixmap),                         topBorder (pixmap), botBorder (pixmap);        // sync: restoreOverrideCursor() for all exit paths    QApplication::setOverrideCursor (Qt::waitCursor);        if (!leftBorder.calculate (true/*x*/, +1/*going right*/))    {        QApplication::restoreOverrideCursor ();        return false;    }    nothingToCrop = leftBorder.fillsEntirePixmap ();#if DEBUG_KP_TOOL_AUTO_CROP    if (nothingToCrop)        kdDebug () << "\tleft border filled entire pixmap - nothing to crop" << endl;#endif        if (!nothingToCrop)    {        if (!rightBorder.calculate (true/*x*/, -1/*going left*/) ||            !topBorder.calculate (false/*y*/, +1/*going down*/) ||            !botBorder.calculate (false/*y*/, -1/*going up*/))        {            QApplication::restoreOverrideCursor ();            return false;        }                int numRegions = leftBorder.exists () +                         rightBorder.exists () +                         topBorder.exists () +                         botBorder.exists ();        nothingToCrop = !numRegions;    #if DEBUG_KP_TOOL_AUTO_CROP        kdDebug () << "\tnumRegions=" << numRegions << endl;        kdDebug () << "\t\tleft=" << leftBorder.m_rect << endl;        kdDebug () << "\t\tright=" << rightBorder.m_rect << endl;        kdDebug () << "\t\ttop=" << topBorder.m_rect << endl;        kdDebug () << "\t\tbot=" << botBorder.m_rect << endl;    #endif                if (numRegions == 2)        {        #if DEBUG_KP_TOOL_AUTO_CROP            kdDebug () << "\t2 regions:" << endl;        #endif                    // in case e.g. the user pastes a solid, coloured-in rectangle,            // we favour killing the bottom and right regions            // (these regions probably contain the unwanted whitespace due            //  to the doc being bigger than the pasted selection to start with)            if (leftBorder.exists () && rightBorder.exists () &&                leftBorder.m_rgb != rightBorder.m_rgb)            {            #if DEBUG_KP_TOOL_AUTO_CROP                kdDebug () << "\t\tignoring left border" << endl;            #endif                leftBorder.invalidate ();            }            else if (topBorder.exists () && botBorder.exists () &&                     topBorder.m_rgb != botBorder.m_rgb)            {            #if DEBUG_KP_TOOL_AUTO_CROP                kdDebug () << "\t\tignoring right border" << endl;            #endif                topBorder.invalidate ();            }        #if DEBUG_KP_TOOL_AUTO_CROP            else            {                kdDebug () << "\t\tok" << endl;            }        #endif        }    }    #if DEBUG_KP_TOOL_AUTO_CROP    kdDebug () << "\tnothingToCrop=" << nothingToCrop << endl;#endif    if (!nothingToCrop)    {        mainWindow->commandHistory ()->addCommand (            new kpToolAutoCropCommand (                leftBorder, rightBorder,                topBorder, botBorder,                mainWindow));    }        QApplication::restoreOverrideCursor ();    if (nothingToCrop)    {        KMessageBox::information (mainWindow,            i18n ("Autocrop could not find any border to remove."),            i18n ("Nothing to Autocrop"),            "DoNotAskAgain_NothingToAutoCrop");    }        return true;}