Truncate names of files/folders that are being grep'ed

This commit is contained in:
Humdinger
2014-01-29 12:57:38 +01:00
parent cff5000f79
commit 4c56a102ca
2 changed files with 11 additions and 2 deletions
+9 -2
View File
@@ -144,6 +144,7 @@ GrepWindow::GrepWindow(BMessage* message)
_LoadPrefs(); _LoadPrefs();
_TileIfMultipleWindows(); _TileIfMultipleWindows();
fSearchBoxWidth = fSearchText->Bounds().Width();
Show(); Show();
} }
@@ -157,6 +158,7 @@ GrepWindow::~GrepWindow()
void GrepWindow::FrameResized(float width, float height) void GrepWindow::FrameResized(float width, float height)
{ {
fSearchBoxWidth = fSearchText->Bounds().Width();
BWindow::FrameResized(width, height); BWindow::FrameResized(width, height);
fModel->fFrame = Frame(); fModel->fFrame = Frame();
_SavePrefs(); _SavePrefs();
@@ -1035,8 +1037,13 @@ GrepWindow::_OnNodeMonitorPulse()
void void
GrepWindow::_OnReportFileName(BMessage* message) GrepWindow::_OnReportFileName(BMessage* message)
{ {
if (fModel->fState != STATE_UPDATE) if (fModel->fState != STATE_UPDATE) {
fSearchText->SetText(message->FindString("filename")); BString name = message->FindString("filename");
fSearchText->TruncateString(&name, B_TRUNCATE_MIDDLE,
fSearchBoxWidth - 10);
fSearchText->SetText(name);
}
} }
+2
View File
@@ -141,6 +141,8 @@ private:
bigtime_t fLastNodeMonitorEvent; bigtime_t fLastNodeMonitorEvent;
ChangesIterator* fChangesIterator; ChangesIterator* fChangesIterator;
BMessageRunner* fChangesPulse; BMessageRunner* fChangesPulse;
float fSearchBoxWidth;
BFilePanel* fFilePanel; BFilePanel* fFilePanel;
}; };